forked from openkim-hackathons/NPTCrystalStructure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunner
More file actions
executable file
·65 lines (61 loc) · 2 KB
/
Copy pathrunner
File metadata and controls
executable file
·65 lines (61 loc) · 2 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3
"""
Universal runner for Crystal Genome Tests.
"""
import json
from ast import literal_eval
from shutil import copy
from test_driver.test_driver import TestDriver
model_name = input("Model name?\n")
print(model_name)
temperature_K = input("Temperature (K)?\n")
if temperature_K != "":
temperature_K = float(temperature_K)
print(temperature_K)
else:
print("No temperature given")
temperature_K = 0
cell_cauchy_stress_eV_angstrom3 = input(
"Cauchy stress (literal list of floats, Voigt order xx,yy,zz,yz,xz,xy, eV/A^3)?\n"
).split()
if cell_cauchy_stress_eV_angstrom3 != []:
cell_cauchy_stress_eV_angstrom3 = [
float(component) for component in cell_cauchy_stress_eV_angstrom3
]
print(cell_cauchy_stress_eV_angstrom3)
else:
print("No stress given")
cell_cauchy_stress_eV_angstrom3 = [0, 0, 0, 0, 0, 0]
runtime_args_text = input("Runtime arguments (literal dictonary)?\n")
if runtime_args_text != "":
runtime_args = literal_eval(runtime_args_text)
print(runtime_args)
else:
runtime_args = {}
print("No runtime arguments given")
query_result = literal_eval(
input("Initial parameters from query or test_generator (literal list of dicts)?\n")
)
print(json.dumps(query_result, indent=2))
test = TestDriver(model_name)
for structure in query_result:
species_match = (
structure["stoichiometric-species"]["source-value"]
== query_result[0]["stoichiometric-species"]["source-value"]
)
prototype_match = (
structure["prototype-label"]["source-value"]
== query_result[0]["prototype-label"]["source-value"]
)
assert species_match and prototype_match, (
"The input structures must have identical "
"prototype-label and stoichiometric-species"
)
test(
structure,
temperature_K=temperature_K,
cell_cauchy_stress_eV_angstrom3=cell_cauchy_stress_eV_angstrom3,
**runtime_args
)
test.write_property_instances_to_file()
copy("kim-tools.log", "output/kim-tools.log")