-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathorca_example.py
More file actions
65 lines (53 loc) · 1.57 KB
/
orca_example.py
File metadata and controls
65 lines (53 loc) · 1.57 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
# ruff: noqa: T201
import sys
from pathlib import Path
import stk
import stko
def main() -> None:
"""Run the example."""
if len(sys.argv) > 1:
orca_path = sys.argv[1]
else:
print("usage: orca_example.py orca_path")
sys.exit()
bb1 = stk.BuildingBlock("NCCN", [stk.PrimaryAminoFactory()])
bb2 = stk.BuildingBlock("O=CC=O", [stk.AldehydeFactory()])
polymer = stk.ConstructedMolecule(
stk.polymer.Linear(
building_blocks=(bb1, bb2),
repeating_unit="AB",
orientations=(0, 0),
num_repeating_units=1,
)
)
examples_output = Path("orca_output_directory")
examples_output.mkdir(parents=True, exist_ok=True)
# Run optimisations.
etkdg = stko.ETKDG()
polymer = etkdg.optimize(polymer)
orca_ey_1 = stko.OrcaEnergy(
orca_path=orca_path,
topline="! SP B97-3c",
basename="example1",
output_dir=f"{examples_output}/orca_e1_dir",
)
print(orca_ey_1.get_energy(polymer))
uff = stko.UFF()
polymer = uff.optimize(polymer)
orca_ey_2 = stko.OrcaEnergy(
orca_path=orca_path,
topline="! SP B97-3c",
basename="example2",
output_dir=f"{examples_output}/orca_e2_dir",
)
print(orca_ey_2.get_energy(polymer))
orca_ey_3 = stko.OrcaEnergy(
orca_path=orca_path,
topline="! SP B97-3c",
basename="example3",
output_dir=f"{examples_output}/orca_e3_dir",
write_input_only=True,
)
orca_ey_3.get_results(polymer)
if __name__ == "__main__":
main()