Skip to content

Commit

Permalink
Switch to CPU platform for single point energy test, shortened length…
Browse files Browse the repository at this point in the history
… of simulations run in process tests
  • Loading branch information
mb2055 committed Aug 8, 2024
1 parent 2643b30 commit 993c825
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 12 deletions.
7 changes: 4 additions & 3 deletions tests/FreeEnergy/test_atm.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,15 @@ def test_single_point_energies(TEMOA_host, TEMOA_lig1, TEMOA_lig2):
production = BSS.Process.OpenMM(
system,
production_atm,
platform="CUDA",
platform="CPU",
setup_only=True,
work_dir=tmpdirname,
**{"_is_testing": True},
)
production.start()
production.wait()

assert not production.isError()
# now get the file containing single points
df = pd.read_csv(os.path.join(tmpdirname, "energies_singlepoint.csv"))
ens = df.to_dict()
Expand Down Expand Up @@ -477,10 +479,9 @@ def test_single_point_energies(TEMOA_host, TEMOA_lig1, TEMOA_lig2):
"com": 0.0,
"distance": 0.02983,
"angle": 0.0072010,
"dihedral": 6.234e-07,
"dihedral": 3.55355e-13,
"position_restraint": 0.0,
}
print(ens_nonlam)
for key, en in ens_GL_nolam.items():
assert pytest.approx(ens_nonlam[key][0], rel=1e-3) == en

Expand Down
47 changes: 38 additions & 9 deletions tests/Process/test_atm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def test_ATM_min(TEMOA_hostguest):
# First get a system with data
system, data = TEMOA_hostguest
# Generate a minimisation protocol
prot_min = BSS.Protocol.AToMMinimisation(data=data, steps=100)
prot_min = BSS.Protocol.AToMMinimisation(data=data, steps=1)

run_process(system, prot_min)
del system, data
Expand All @@ -18,7 +18,11 @@ def test_ATM_equil_noATMForce(TEMOA_hostguest):
system, data = TEMOA_hostguest
# Generate an equilibration protocol
prot_equil = BSS.Protocol.AToMEquilibration(
data=data, runtime="0.2 ps", use_atm_force=False
data=data,
runtime="4 fs",
use_atm_force=False,
report_interval=1,
restart_interval=1,
)

run_process(system, prot_equil)
Expand All @@ -30,7 +34,11 @@ def test_ATM_equil_withATMForce(TEMOA_hostguest):
system, data = TEMOA_hostguest
# Generate an equilibration protocol
prot_equil = BSS.Protocol.AToMEquilibration(
data=data, runtime="0.2 ps", use_atm_force=True
data=data,
runtime="4 fs",
use_atm_force=True,
report_interval=1,
restart_interval=1,
)

run_process(system, prot_equil)
Expand All @@ -41,7 +49,13 @@ def test_ATM_anneal(TEMOA_hostguest):
# First get a system with data
system, data = TEMOA_hostguest
# Generate an annealing protocol
prot_anneal = BSS.Protocol.AToMAnnealing(data=data, runtime="0.2 ps")
prot_anneal = BSS.Protocol.AToMAnnealing(
data=data,
runtime="4 fs",
report_interval=1,
restart_interval=1,
anneal_numcycles=1,
)

run_process(system, prot_anneal)
del system, data
Expand All @@ -66,8 +80,10 @@ def test_custom_ATM_anneal(TEMOA_hostguest):
protocol = BSS.Protocol.AToMAnnealing(
data=data,
anneal_values=annealing_dict,
anneal_numcycles=10,
runtime="0.2 ps",
anneal_numcycles=1,
runtime="2 fs",
report_interval=1,
restart_interval=1,
)
run_process(system, protocol)

Expand All @@ -76,19 +92,32 @@ def test_ATM_production(TEMOA_hostguest):
# First get a system with data
system, data = TEMOA_hostguest
# Generate a production protocol
prot_prod = BSS.Protocol.AToMProduction(data=data, runtime="0.2 ps")
prot_prod = BSS.Protocol.AToMProduction(
data=data,
runtime="2 fs",
report_interval=1,
restart_interval=1,
)

run_process(system, prot_prod)

# now test "MBAR" analysis method
prot_prod = BSS.Protocol.AToMProduction(
data=data, runtime="0.2 ps", analysis_method="MBAR"
data=data,
runtime="2 fs",
analysis_method="MBAR",
report_interval=1,
restart_interval=1,
)
run_process(system, prot_prod)

# finally, test the "both" analysis method
prot_prod = BSS.Protocol.AToMProduction(
data=data, runtime="0.2 ps", analysis_method="both"
data=data,
runtime="2 fs",
analysis_method="both",
report_interval=1,
restart_interval=1,
)
run_process(system, prot_prod)

Expand Down

0 comments on commit 993c825

Please sign in to comment.