forked from aspuru-guzik-group/iacta
-
Notifications
You must be signed in to change notification settings - Fork 1
/
read_reactions.py
executable file
·48 lines (43 loc) · 2.14 KB
/
read_reactions.py
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
import io_utils
import analysis
from analysis import *
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(
description="Read reaction products."
)
parser.add_argument("folder", help="Folder containing the react*** files.")
parser.add_argument("-c", "--resolve-chiral",
help="Resolve chiral compounds. Defaults to no.",
action="store_true")
parser.add_argument("--all", help="Do not limit reaction network to reactant"
+" and connected products. Defaults to false.",
action="store_true")
parser.add_argument("--ts", help="Sort products by TS energy as opposed"
+" to enthalpy. (the default).",
action="store_true")
parser.add_argument("--local", help="Use reaction-local barrier instead of TS energy.",
action="store_true")
args = parser.parse_args()
folder =args.folder
pathways = read_all_reactions(folder)
species = get_species_table(pathways, resolve_chiral=args.resolve_chiral)
reactant, E = io_utils.traj2smiles(folder + "/init_opt.xyz", index=0,chiral=args.resolve_chiral)
if args.all:
final = analyse_reaction_network(pathways,species,list(species.index)[::-1],
sort_by_barrier=args.ts,
reaction_local=args.local,
resolve_chiral=args.resolve_chiral)
else:
print("Reactant: %s" % reactant)
if reactant in species.index:
final = analyse_reaction_network(pathways,species,[reactant],
sort_by_barrier=args.ts,
reaction_local=args.local,
resolve_chiral=args.resolve_chiral)
else:
print("Error! Reactant not in found species")
raise SystemExit(-1)
# Finally, save parsed reaction network
final.to_csv(folder + "/parsed_reactions.csv")
species.to_csv(folder + "/parsed_species.csv")