-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
1 changed file
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import os | ||
import shlex | ||
import shutil | ||
import subprocess | ||
import tempfile | ||
|
||
|
||
def test_delta_learning(): | ||
""" | ||
Make sure that the server can run using two backends for the in vacuo | ||
vacuo calculation. The first is the "reference" backend, the second | ||
applies delta learning corrections. | ||
""" | ||
|
||
with tempfile.TemporaryDirectory() as tmpdir: | ||
# Copy files to temporary directory. | ||
shutil.copyfile("tests/input/adp.parm7", tmpdir + "/adp.parm7") | ||
shutil.copyfile("tests/input/adp.rst7", tmpdir + "/adp.rst7") | ||
shutil.copyfile("tests/input/emle_sp.in", tmpdir + "/emle_sp.in") | ||
|
||
# Copy the current environment to a new dictionary. | ||
env = os.environ.copy() | ||
|
||
# Set environment variables. | ||
env["EMLE_BACKEND"] = "torchani,xtb" | ||
env["EMLE_ENERGY_FREQUENCY"] = "1" | ||
|
||
# Create the sander command. | ||
command = "sander -O -i emle_sp.in -p adp.parm7 -c adp.rst7 -o emle.out" | ||
|
||
process = subprocess.run( | ||
shlex.split(command), | ||
cwd=tmpdir, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
env=env, | ||
) | ||
|
||
# Make sure that the process exited successfully. | ||
assert process.returncode == 0 | ||
|
||
# Make sure that an energy file is written. | ||
assert os.path.isfile(tmpdir + "/emle_energy.txt") |