From f1965f9d97a2b5a0fcab54529454c884c1081eb7 Mon Sep 17 00:00:00 2001 From: Sander Vandenhaute Date: Fri, 7 Jun 2024 03:58:36 -0400 Subject: [PATCH] bug in metadynamics parsing --- psiflow/sampling/metadynamics.py | 4 ++-- tests/test_sampling.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/psiflow/sampling/metadynamics.py b/psiflow/sampling/metadynamics.py index 5a3a209..3f93d44 100644 --- a/psiflow/sampling/metadynamics.py +++ b/psiflow/sampling/metadynamics.py @@ -26,9 +26,9 @@ def __init__( _plumed_input = remove_comments_printflush(plumed_input) assert "METAD" in _plumed_input if "RESTART" not in _plumed_input: - _plumed_input = "RESTART\n" + _plumed_input + _plumed_input = "\nRESTART\n" + _plumed_input if "FLUSH" not in _plumed_input: # add at the end! - _plumed_input = _plumed_input + "FLUSH STRIDE=1\nPRINT" + _plumed_input = _plumed_input + "\nFLUSH STRIDE=1\nPRINT" # PLUMED + WQ cannot deal with nonexisting hills files! if type(external) in [str, Path]: diff --git a/tests/test_sampling.py b/tests/test_sampling.py index 75e798f..413ea88 100644 --- a/tests/test_sampling.py +++ b/tests/test_sampling.py @@ -448,6 +448,7 @@ def test_order_parameter(dataset): state = simulation_output.state.result() CV = state.order["CV"] assert state.energy is None + assert np.all(np.isnan(state.per_atom.forces)) assert np.allclose(CV, np.linalg.det(dataset[3].result().cell)) # test batch evaluation of order parameter