-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18339b6
commit 0532585
Showing
2 changed files
with
44 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import copy | ||
|
||
import hoomd | ||
|
||
from hoomd_organics.tests import BaseTest | ||
from hoomd_organics.utils import ScaleEpsilon, ScaleSigma | ||
|
||
|
||
class TestActions(BaseTest): | ||
def test_scale_epsilon(self, benzene_simulation): | ||
sim = benzene_simulation | ||
epsilon_scale = ScaleEpsilon(sim=sim, scale_factor=0.5) | ||
energy_operation = hoomd.update.CustomUpdater( | ||
action=epsilon_scale, trigger=10 | ||
) | ||
sim.operations.updaters.append(energy_operation) | ||
old_lj_force = copy.deepcopy(sim._lj_force().params) | ||
sim.run_NVT(n_steps=10, kT=1.0, tau_kt=1.0) | ||
new_lj_force = sim._lj_force().params | ||
for k in old_lj_force.keys(): | ||
assert ( | ||
new_lj_force[k]["epsilon"] == old_lj_force[k]["epsilon"] + 0.5 | ||
) | ||
|
||
def test_scale_sigma(self, benzene_simulation): | ||
sim = benzene_simulation | ||
sigma_scale = ScaleSigma(sim=sim, scale_factor=0.5) | ||
energy_operation = hoomd.update.CustomUpdater( | ||
action=sigma_scale, trigger=10 | ||
) | ||
sim.operations.updaters.append(energy_operation) | ||
old_lj_force = copy.deepcopy(sim._lj_force().params) | ||
sim.run_NVT(n_steps=10, kT=1.0, tau_kt=1.0) | ||
new_lj_force = sim._lj_force().params | ||
for k in old_lj_force.keys(): | ||
assert new_lj_force[k]["sigma"] == old_lj_force[k]["sigma"] + 0.5 |