libAtoms / workflow

python workflow toolkit
GNU General Public License v2.0
24 stars 17 forks source link

Clean up rng #285

Closed bernstei closed 5 months ago

bernstei commented 6 months ago

Replace all calls to np.random.<some sampling function> with passing an explicit np.random.Generator, so the user can keep better track of the random number state to make scripts reproducible. In particular, the random numbers for each op are generated from a generator that's spawned from the main one, so it's easy for things to be the same whether an op is actually done or skipped because the output file is already present.

Changes to pretty much every function that uses random numbers, because they all require a generator as a function argument. Since it's bad practice for reproducible scripts, wfl will not make it easy by defaulting to a random unknown rng state.

At least one test of this reproducibility, but maybe not comprehensive enough.

closes #284 closes #286