@@ -62,7 +62,7 @@ def split_pdb(pdb: str):
62
62
return "pro.pdb" , "mol.mol2"
63
63
64
64
65
- def run_tleap (protein : str , mol_list : List , charge : List , multiplicity : List , guess_charge : bool ):
65
+ def run_tleap (protein : str , mol_list : List , user_charge : bool , charge : List , multiplicity : List , guess_charge : bool ):
66
66
cmdline = f'pdb4amber -i { protein } -o _{ str (protein )} -y -d -p'
67
67
runCMD (cmdline )
68
68
protein_path = Path (protein ).absolute ()
@@ -72,6 +72,13 @@ def run_tleap(protein: str, mol_list: List, charge: List, multiplicity: List, gu
72
72
cmdline = f'acpype -i { str (Path (mol ).absolute ())} '
73
73
runCMD (cmdline ,
74
74
message = "Perhaps you should check the charge of the ligand and the correctness of the hydrogen atom." )
75
+ elif user_charge :
76
+ for mol in mol_list :
77
+ if Path (mol ).suffix != '.mol2' :
78
+ raise RuntimeError ('must mol2 for user charge!' )
79
+ cmdline = f'acpype -i { str (Path (mol ).absolute ())} -c user'
80
+ runCMD (cmdline ,
81
+ message = "Perhaps you should check the charge of the ligand and the correctness of the hydrogen atom." )
75
82
else :
76
83
for mol , c , spin in zip (mol_list , charge , multiplicity ):
77
84
cmdline = f'acpype -i { str (Path (mol ).absolute ())} -n { c } -m { spin } '
@@ -80,7 +87,11 @@ def run_tleap(protein: str, mol_list: List, charge: List, multiplicity: List, gu
80
87
81
88
mol_frcmod = f"" .join (
82
89
f'loadamberparams { mol_path .stem } .acpype/{ mol_path .stem } _AC.frcmod\n ' for mol_path in mol_list )
83
- mol_load = f"" .join (
90
+ if user_charge :
91
+ mol_load = f"" .join (
92
+ f'{ mol_path .stem } = loadmol2 { mol_path .stem } .acpype/{ mol_path .stem } _user_gaff2.mol2\n ' for mol_path in mol_list )
93
+ else :
94
+ mol_load = f"" .join (
84
95
f'{ mol_path .stem } = loadmol2 { mol_path .stem } .acpype/{ mol_path .stem } _bcc_gaff2.mol2\n ' for mol_path in mol_list )
85
96
combine = f'com = combine{{pro { " " .join (mol_path .stem for mol_path in mol_list )} }}\n '
86
97
leapin = (f"""source leaprc.protein.ff14SB
@@ -173,9 +184,10 @@ def arg_parse():
173
184
help = "time for MD(ns)" , default = 100 )
174
185
parser .add_argument ('-g' , '--guess_charge' ,
175
186
action = 'store_true' , help = 'guess charge' )
187
+ parser .add_argument ('-uc' , '--user_charge' ,
188
+ action = 'store_true' , help = 'user charge' )
176
189
parser .add_argument ('-c' , "--charge" , type = int , nargs = '+' ,
177
190
default = [0 ], help = "charge of mol" )
178
-
179
191
parser .add_argument ("--multiplicity" , type = int , nargs = '+' ,
180
192
default = [1 ], help = "multiplicity of mol" )
181
193
parser .add_argument ("--MIN" , type = str ,
@@ -191,22 +203,22 @@ def mmpbsa():
191
203
protein = args .protein
192
204
mol_list = args .mol2
193
205
temp = args .temp
194
- if not args .guess_charge :
206
+ if not args .guess_charge and not args . user_charge :
195
207
if len (mol_list ) != len (args .charge ) and len (mol_list ) != len (args .multiplicity ):
196
208
raise ValueError (
197
209
"If the charge is not guessed, it is necessary to specify the charge and spin multiplicity for each ligand." )
198
210
199
211
if mol_list is None :
200
212
protein , mol = split_pdb (protein )
201
213
mol_list = [mol ]
202
- parm7 , rst7 = run_tleap (protein , mol_list , args .charge ,
214
+ parm7 , rst7 = run_tleap (protein , mol_list , args .charge , args . user_charge ,
203
215
args .multiplicity , args .guess_charge )
204
216
s = pyamber .SystemInfo (parm7 , rst7 , runMin = args .MIN , runMd = args .MD )
205
217
heavymask = "\" " + s .getHeavyMask () + "\" "
206
218
backbonemask = "\" " + s .getBackBoneMask () + "\" "
207
219
rst7 = prep (rst7 = rst7 , s = s , temp = temp , heavymask = heavymask ,
208
220
backbonemask = backbonemask , loop = 20 )
209
- md = pyamber .NPT ("md" , s , rst7 , rst7 , ntwx = 50000 ,
221
+ md = pyamber .NPT ("md" , s , rst7 , rst7 , ntwx = 50000 ,temp = temp ,
210
222
irest = True , nscm = 1000 , nstlim = args .ns * 500000 )
211
223
md .Run ()
212
224
rst7 = 'final_0.rst7'
0 commit comments