MD tutorial script fails randomly

Summary

The MD tutorial script that is part of the temperature-dependent phonon example (3a_run_fcp_md.py) is run as part of the weekly tests. Sometimes it passes (example), sometimes it doesn't (example). The underlying issue is related to FCP stability (#256 (closed), #412 (closed)) and hence of much broader concern. For the more narrow purpose of testing, an irregularly failing test is of course not helpful/acceptable.

Steps to reproduce

As discussed below the test fails "randomly". Hence run test and hope that conditions are perfect.

What is the current bug behavior?

The last three failures (1, 2, 3) each produced a slightly different error message:

[1] ValueError: Displacement 3.10284 larger than maximum allowed displacement 3.00000
[2] ValueError: Displacement 3.03632 larger than maximum allowed displacement 3.00000
[3] ValueError: Displacement 3.01153 larger than maximum allowed displacement 3.00000

What is the expected correct behavior?

Test passes every time.

Possible fixes

I suspect that the random initialization (flashback?) of the MD is the culprit. Simply the test should be run in exactly the same way every time.

It might be enough to set numpy.random.seed since both from MaxwellBoltzmannDistribution and Langevin use numpy.random by default.

Edited by Paul Erhart