test_disordered fails randomly

Issue #156 resolved
Bradley Dice created an issue

The cubatic order parameter test_disordered appears to be non-deterministic. A particular set of values chosen at random made the test fail. The test design should not pass/fail based on the set of random values drawn. We need to either seed the random number generator, or ensure that the lower bound is chosen to work for any set of random values.

Comments (6)

  1. Bradley Dice reporter

    @harperic Could you help us understand what this test is meant to do? We think it failed due to an inconvenient choice of random values, but your insight on the physics of this tests would be valuable.

  2. Eric Harper

    Sorry, somehow just saw this. We should seed the RNG since it's technically stochastic and a unit test should not be.

    The disordered test is supposed to take a completely disordered set of orientations and ensure the value of the COP is near zero. This is done be randomly generating the orientations, so it's certainly possible to randomly generate a set of orientations with enough order to fail the test.

    I believe we've done this for other tests, but one way to avoid this is to generate the orientations from a simulation of a fluid and read the orientations. Depends on how "self-contained" you want it to be.

  3. Vyas Ramasubramani

    I see, that makes sense. Currently I've gone through and changed all the existing tests that use random numbers to just use a seed to at least make them deterministic. For cases like this I think it may make sense to do something more sophisticated like what you suggest, though.

    @bdice for now I think we can resolve this issue, I'm going to open a new one with some proposals on how we should upgrade our testing framework that we can update and work through separately.

  4. Log in to comment