forked from openkim-hackathons/NPTCrystalStructure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
37 lines (32 loc) · 1.69 KB
/
run.py
File metadata and controls
37 lines (32 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import argparse
import subprocess
from kim_tools.test_driver.core import query_crystal_structures
from test_driver.test_driver import TestDriver
if __name__ == '__main__':
# Argument parsing
parser = argparse.ArgumentParser(description='Pass arguments to the KIM test driver')
parser.add_argument('-m', '--model', help='Pass model for test driver to run', required=True)
parser.add_argument('-s', '--stoichiometry', help='Stoichiometry of structure to test', nargs='+',
required=True)
parser.add_argument('-p', '--prototype', help='Prototype ASE label', required=True)
parser.add_argument('-t', '--temperature', help='Temperature in K', required=False)
args = parser.parse_args()
# Get arguments
model_name = args.model
stoich = args.stoichiometry
prot = args.prototype
temperature_K = 293.15 if args.temperature is None else float(args.temperature)
# Run test
subprocess.run(f"kim-api-collections-management install user {model_name}", shell=True)
test_driver = TestDriver(model_name)
list_of_queried_structures = query_crystal_structures(kim_model_name=model_name,
stoichiometric_species=stoich,
prototype_label=prot)
for i, queried_structure in enumerate(list_of_queried_structures):
try:
test_driver(queried_structure, temperature_K=temperature_K,
repeat=(0, 0, 0),
lammps_command="mpirun -np 20 --bind-to none lmp_mpi")
except Exception as e:
print(f"Got exception {repr(e)}")
test_driver.write_property_instances_to_file()