Skip to content

Commit

Permalink
Add test for per-config T in MD
Browse files Browse the repository at this point in the history
  • Loading branch information
bernstei committed Oct 24, 2024
1 parent 064a6b7 commit f89eaf0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,29 @@ def test_NVT_Langevin_const_T(cu_slab):
assert all([at.info['MD_temperature_K'] == 500.0 for at in atoms_traj])


def test_NVT_Langevin_const_T_per_config(cu_slab):

calc = EMT()

inputs = ConfigSet([cu_slab.copy(), cu_slab.copy()])
outputs = OutputSpec()

for at_i, at in enumerate(inputs):
at.info["WFL_MD_TEMPERATURE"] = 500 + at_i * 100

n_steps = 30

atoms_traj = md.md(inputs, outputs, calculator=calc, integrator="Langevin", steps=n_steps, dt=1.0,
temperature=200.0, temperature_tau=100/fs, rng=np.random.default_rng(1))

atoms_traj = list(atoms_traj)
atoms_final = atoms_traj[-1]

assert len(atoms_traj) == (n_steps + 1) * 2
assert all([at.info['MD_temperature_K'] == 500.0 for at in list(atoms_traj)[:n_steps + 1]])
assert all([at.info['MD_temperature_K'] == 600.0 for at in list(atoms_traj)[n_steps + 1:]])


def test_NVT_const_T_mult_configs_distinct_seeds(cu_slab):

calc = EMT()
Expand Down

0 comments on commit f89eaf0

Please sign in to comment.