-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathold_meze.py
137 lines (112 loc) · 5.49 KB
/
old_meze.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import functions
import argparse
import os
import sofra
import logging
import meze.meze as meze
logger = logging.getLogger()
logger.setLevel(logging.CRITICAL)
def clean_arguments(arguments):
"""
Check arguments and clean them
Parameters:
-----------
arguments: Namespace
command-line arguments
Return:
-------
cleaned Namespace of arguments
"""
check_integers = lambda arg: functions.check_positive(functions.check_int(arg))
check_integers(arguments.min_steps)
check_floats = lambda arg: functions.check_positive(functions.check_float(arg))
check_floats(arguments.short_nvt)
check_floats(arguments.nvt)
check_floats(arguments.npt)
return arguments
def character(string):
if len(string) > 1:
message = f"Input must be a single character, not {string}"
raise argparse.ArgumentTypeError(message)
if string == "_":
message = "The character _ is not an allowed separator"
raise argparse.ArgumentTypeError(message)
def main():
parser = argparse.ArgumentParser(description="MEZE: MetalloEnZymE FF-builder for alchemistry")
parser.add_argument("protocol_file",
help="protocol file containing equilibration options",
type=str,
default=os.getcwd() + "/afe/protocol.dat")
parser.add_argument("transformation",
help="the pair of ligands undergoing AFE transformation, e.g. ligand_1~ligand_2",
type=str)
parser.add_argument("-s",
"--separator",
help="character separating the two ligand names",
default="~",
type=character)
arguments = parser.parse_args()
protocol = functions.input_to_dict(arguments.protocol_file)
keys = list(protocol.keys())
if "metal" in keys:
metal = True
else:
metal = False
if metal:
meze = meze.Meze(prepared=True,
protein_file=protocol["protein input file"],
cut_off=protocol["cutoff"],
force_constant_0=protocol["force constant"],
workdir=protocol["project directory"],
ligand_path=protocol["ligand directory"],
ligand_charge=protocol["ligand charge"],
ligand_ff=protocol["ligand forcefield"],
group_name=protocol["group name"],
protein_path=protocol["protein directory"],
water_model=protocol["water model"],
protein_ff=protocol["protein forcefield"],
engine=protocol["engine"],
sampling_time=protocol["engine"],
box_edges=protocol["box edges"],
box_shape=protocol["box shape"],
min_steps=protocol["minimisation steps"],
short_nvt=protocol["short nvt"],
nvt=protocol["nvt"],
npt=protocol["npt"],
min_dt=protocol["minimisation stepsize"],
min_tol=protocol["minimisation tolerance"],
repeats=protocol["repeats"],
temperature=protocol["temperature"],
pressure=protocol["pressure"])
meze.write_restraints_file_0(engine="somd")
elif not metal:
meze = sofra.Sofra(prepared=True,
equilibration_path=protocol["equilibration directory"],
outputs=protocol["outputs"],
workdir=protocol["project directory"],
ligand_path=protocol["ligand directory"],
group_name=protocol["group name"],
protein_file=protocol["prepared protein file"],
protein_path=protocol["protein directory"],
water_model=protocol["water model"],
ligand_ff=protocol["ligand forcefield"],
protein_ff=protocol["protein forcefield"],
ligand_charge=protocol["ligand charge"],
engine=protocol["engine"],
sampling_time=protocol["sampling time"],
box_edges=protocol["box edges"],
box_shape=protocol["box shape"],
min_steps=protocol["minimisation steps"],
short_nvt=protocol["short nvt"],
nvt=protocol["nvt"],
npt=protocol["npt"],
min_dt=protocol["minimisation stepsize"],
min_tol=protocol["minimisation tolerance"],
repeats=protocol["repeats"],
temperature=protocol["temperature"],
pressure=protocol["pressure"])
ligand_a, ligand_b = functions.separate(arguments.transformation)
equilibrated_network = meze.get_equilibrated(ligand_a, ligand_b)
equilibrated_network.prepare_afe(ligand_a, ligand_b)
if __name__ == "__main__":
main()