-
Notifications
You must be signed in to change notification settings - Fork 7
/
amber_md.svl
407 lines (317 loc) · 10.3 KB
/
amber_md.svl
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
//==== write amber input section =====
// 1 : perform a minimization 1000 steps
// 2 : a restraint equilibration while heating the system
// 3 : restraint equilibration to sequentially heat the system
// 4 : just a npt equilibration
// 5 : production md
// 6 : smd specificications
// 7 : smd restraints
// 1 :
local function writeMinimisationInput[path, nRes]
local currentDir= cd [];
cd path;
local fh=fopenw '1_min.in';
fwrite[fh,'&cntrl\n'];
fwrite[fh,'imin=1, maxcyc=1000,\n'];
fwrite[fh,'ntpr=100,\n'];
fwrite[fh,'ntr=1,\n'];
fwrite[fh,'restraintmask=\':1-{} & !@H=\',\n', nRes];
fwrite[fh,'restraint_wt=1.0,\n'];
fwrite[fh,'/\n'];
fclose fh;
cd currentDir;
return 0;
endfunction
// 2 :
local function writeFirstEquilibration[path,nRes]
local currentDir= cd [];
cd path;
local fh=fopenw '2_eq.in';
fwrite[fh,'&cntrl\n'];
fwrite[fh,'imin=0,\n'];
fwrite[fh,'ntx=1, \n'];
fwrite[fh,'ntxo=1, ntpr=2000, ntwx=0, ntwv=0, ntwe=0, ntwr=0, ioutfm=1,\n'];
fwrite[fh,'ntp=0, ntc=2,\n'];
fwrite[fh,'ntb=1, ntf=2, cut=9.0,\n'];
fwrite[fh,'ntt=3, temp0=150, tempi=100, ig=-1, gamma_ln=4.0,\n'];
fwrite[fh,'nstlim= 50000, dt=0.002,\n'];
fwrite[fh,'iwrap=1,\n'];
fwrite[fh,'ntr=1,\n'];
fwrite[fh,'restraintmask=\':1-{} & !@H=\', \n', nRes];
fwrite[fh,'restraint_wt=1.0,\n'];
fwrite[fh,'nmropt=1,\n'];
fwrite[fh,'&end\n'];
fwrite[fh,'&wt type=\'END\' /\n'];
fwrite[fh,'DISANG=dist_md.rst\n'];
fclose fh;
cd currentDir;
return 0;
endfunction;
// 3 :
local function writeSecondEquilibration[path,nRes,temperature]
local currentDir= cd [];
cd path;
local fh=fopenw tok_cat['3_eq_',totok temperature,'.in'];
fwrite[fh,'&cntrl\n'];
fwrite[fh,'imin=0,\n'];
fwrite[fh,'ntx=5, irest=1,\n'];
fwrite[fh,'ntxo=1, ntpr=2000, ntwx=0, ntwv=0, ntwe=0, ntwr=0, ioutfm=1,\n'];
fwrite[fh,'ntp=0, ntc=2,\n'];
fwrite[fh,'ntb=1, ntf=2, cut=9.0, \n'];
fwrite[fh,'ntt=3, temp0={}, ig=-1, gamma_ln=4.0,\n',temperature];
fwrite[fh,'nstlim= 50000, dt=0.002,\n'];
fwrite[fh,'iwrap=1,\n'];
fwrite[fh,'ntr=1,\n'];
fwrite[fh,'restraintmask=\':1-{} & !@H=\', \n',nRes];
fwrite[fh,'restraint_wt=1.0,\n'];
fwrite[fh,'nmropt=1,\n'];
fwrite[fh,'&end\n'];
fwrite[fh,'&wt type=\'END\' /\n'];
fwrite[fh,'DISANG=dist_md.rst\n'];
fclose fh;
cd currentDir;
return 0;
endfunction;
// 4 :
//TODO: change back to 500000
local function writeThirdEquilibration[path,nRes,simlength]
local currentDir= cd [];
cd path;
local fhA=fopenw tok_cat['4a_eq.in'];
fwrite[fhA,'&cntrl\n'];
fwrite[fhA,'imin=0,\n'];
fwrite[fhA,'ntx=5, irest=1,\n'];
fwrite[fhA,'iwrap=1,\n'];
fwrite[fhA,'ntxo=1, ntpr=2000, ntwx=0, ntwv=0, ntwe=0, ntwr=0, ioutfm=1,\n'];
fwrite[fhA,'ntp=1, ntc=2, taup=2.0, \n'];
fwrite[fhA,'ntb=2, ntf=2, cut=9.0,\n'];
fwrite[fhA,'ntt=3, temp0=300.0, ig=-1, gamma_ln=4.0,\n'];
fwrite[fhA,'nstlim=10000, dt=0.002,\n'];
fwrite[fhA,'ntr=1,\n'];
fwrite[fhA,'restraintmask=\':1-{} & !@H=\', \n',nRes];
fwrite[fhA,'restraint_wt=1.0,\n'];
fwrite[fhA,'nmropt=1,\n'];
fwrite[fhA,'&end\n'];
fwrite[fhA,'&wt type=\'END\' /\n'];
fwrite[fhA,'DISANG=dist_md.rst\n'];
fclose fhA;
local fh=fopenw tok_cat['4b_eq.in'];
fwrite[fh,'&cntrl\n'];
fwrite[fh,'imin=0,\n'];
fwrite[fh,'ntx=5, irest=1,\n'];
fwrite[fh,'iwrap=1,\n'];
fwrite[fh,'ntxo=1, ntpr=2000, ntwx=0, ntwv=0, ntwe=0, ntwr=0, ioutfm=1,\n'];
fwrite[fh,'ntp=1, ntc=2, taup=2.0, \n'];
fwrite[fh,'ntb=2, ntf=2, cut=9.0,\n'];
fwrite[fh,'ntt=3, temp0=300.0, ig=-1, gamma_ln=4.0,\n'];
fwrite[fh,'nstlim={}, dt=0.002,\n',round(simlength/2*1000000)-10000];
fwrite[fh,'ntr=1,\n'];
fwrite[fh,'restraintmask=\':1-{} & !@H=\', \n',nRes];
fwrite[fh,'restraint_wt=1.0,\n'];
fwrite[fh,'nmropt=1,\n'];
fwrite[fh,'&end\n'];
fwrite[fh,'&wt type=\'END\' /\n'];
fwrite[fh,'DISANG=dist_md.rst\n'];
fclose fh;
cd currentDir;
return 0;
endfunction;
// 5:
local function writeMD[path,nRes,temperature,simlength]
local currentDir= cd [];
cd path;
local fh=fopenw tok_cat['md.in'];
fwrite[fh,'&cntrl\n'];
fwrite[fh,'ntx=5, irest=1,\n'];
fwrite[fh,'iwrap=1,\n'];
fwrite[fh,'ntxo=1, ntpr=2000, ntwx=0, ntwv=0, ntwe=0, ntwr=0, ioutfm=1,\n'];
fwrite[fh,'ntc=2, ntf=2,\n'];
fwrite[fh,'ntb=1, cut=9.0,\n'];
fwrite[fh,'ntt=3, temp0=300.0, gamma_ln=4.0, ig=-1,\n'];
fwrite[fh,'nstlim={}, dt=0.002,\n',round(simlength/2*1000000)];
fwrite[fh,'ntr=1,\n'];
fwrite[fh,'restraintmask=\':1-{} & !@H=\', \n',nRes];
fwrite[fh,'restraint_wt=1.0,\n'];
fwrite[fh,'nmropt=1,\n'];
fwrite[fh,'&end\n'];
fwrite[fh,'&wt type=\'END\' /\n'];
fwrite[fh,'DISANG=dist_md.rst\n'];
fclose fh;
cd currentDir;
return 0;
endfunction;
// 6 :
local function writeJarz[path,nRes,options]
local currentDir= cd [];
cd path;
local fh=fopenw tok_cat['duck.in'];
fwrite[fh,' &cntrl\n'];
fwrite[fh,'ntx = 5, irest=1,\n'];
fwrite[fh,'iwrap=1,\n'];
fwrite[fh,'ntb=1,\n'];
fwrite[fh,'ntt=3, temp0=300.0, gamma_ln=4.0,\n'];
fwrite[fh,'nstlim={}, dt=0.002,\n',round(options.smd_length/2*1000000)];
fwrite[fh,'ntc=2, ntf=2, cut=9.0,\n'];
fwrite[fh,'ntxo=1, ntpr=2000, ntwx=0, ntwe=1000, ntwr={}, ioutfm=1,\n',round(options.smd_length/2)*1000000];
fwrite[fh,'jar=1,\n'];
fwrite[fh,'ntr=1, restraintmask=\':1-{} & !@H=\', restraint_wt=1.0,\n',nRes];
fwrite[fh,'/\n'];
fwrite[fh,'&wt type=\'DUMPFREQ\', istep1=50 /\n'];
fwrite[fh,'&wt type=\'END\' /\n'];
fwrite[fh,'DISANG=../dist_duck.rst\n'];
fwrite[fh,'DUMPAVE=duck.dat\n'];
fwrite[fh,'LISTIN=POUT\n'];
fwrite[fh,'LISTOUT=POUT\n'];
fclose fh;
fh=fopenw tok_cat['duck_325K.in'];
fwrite[fh,' &cntrl\n'];
fwrite[fh,'ntx = 5, irest=1,\n'];
fwrite[fh,'iwrap=1,\n'];
fwrite[fh,'ntb=1,\n'];
fwrite[fh,'ntt=3, temp0=325.0, gamma_ln=4.0,\n'];
fwrite[fh,'nstlim={}, dt=0.002,\n',round(options.smd_length/2*1000000)];
fwrite[fh,'ntc=2, ntf=2, cut=9.0,\n'];
fwrite[fh,'ntxo=1, ntpr=2000, ntwx=0, ntwe=1000, ntwr={}, ioutfm=1,\n',round(options.smd_length/2)*1000000];
fwrite[fh,'jar=1,\n'];
fwrite[fh,'ntr=1, restraintmask=\':1-{} & !@H=\', restraint_wt=1.0,\n',nRes];
fwrite[fh,'/\n'];
fwrite[fh,'&wt type=\'DUMPFREQ\', istep1=50 /\n'];
fwrite[fh,'&wt type=\'END\' /\n'];
fwrite[fh,'DISANG=../dist_duck.rst\n'];
fwrite[fh,'DUMPAVE=duck.dat\n'];
fwrite[fh,'LISTIN=POUT\n'];
fwrite[fh,'LISTOUT=POUT\n'];
fclose fh;
cd currentDir;
return 0;
endfunction;
local function printUserOutput[options]
print "Finished MD output";
endfunction
// define actual smd restraints between two atoms or center of masses
local function writeMDRestraints[path,atomIndices,options]
local currentDir= cd [];
cd path;
local ligand_indices=first atomIndices;
local receptor_indices=second atomIndices;
local starting_dist=third atomIndices;
local aid;
local useCom=0;
local fh=fopenw tok_cat['dist_md.rst'];
print atomIndices;
fwrite[fh,'#Prevent dissociation by penalizing interaction break (>3.0A)\n'];
if useCom ===0 then
//by default we use a vector between the two interacting atoms
fwrite[fh,'&rst iat={},{}, r2=2.00, r3=3.00, r4=4.00, rk2=1.0, rk3=10.0, /\n',receptor_indices[1],ligand_indices[1]];
else
fwrite[fh,'&rst iat=-1,-1, r2=2.00, r3=3.00, r4=4.00, rk2=1.0, rk3=10.0, /\n'];
fwrite[fh,'igr1= '];
local i=0;
for aid in receptor_indices loop
fwrite[fh,'{}, ',aid];
endloop
fwrite[fh,'0, \n'];
fwrite[fh,'igr2= '];
for aid in ligand_indices loop
fwrite[fh,'{}, ',aid];
endloop
fwrite[fh,'0, /\n '];
endif
fclose fh;
cd currentDir;
return 0;
endfunction
// write restraints file for the smd simulation
local function writeJarzRestraints[path,atomIndices,options]
local currentDir= cd [];
cd path;
local useCom=0;
local ligand_indices=first atomIndices;
local receptor_indices=second atomIndices;
local starting_dist=third atomIndices;
local aid;
local fh=fopenw tok_cat['dist_duck.rst'];
// sample format of the dist_duck.rst to be produced
// =================================================
//&rst iat=-1,-1,
// r2=2.50, rk2=50.0, r2a=5.50,
// igr1= 539, 588, 602, 636, 1259, 1285, 1292, 1311, 1318, 1891, 2121, 2576, 2612, 0,
// igr2= 3283, 3284, 3286, 3287, 3288, 3290, 3291, 3292, 3294, 3295, 3296, 0, /
// =================================================
if useCom===0 then
// always start pulling at 2.50 A distance, till 2.50 + smd_displ
fwrite[fh,'#change distance from (2.50) to unbound ({.2f})\n',2.5+options.smd_displ];
fwrite[fh,'&rst iat={},{}, r2={.2f}, rk2={.2f}, r2a={.2f}, /\n',receptor_indices[1],ligand_indices[1],2.50,options.smd_fc,2.50+options.smd_displ];
else
//// version using the currently measured reaction coordinate distance instead
fwrite[fh,'&rst iat=-1,-1, r2={.2f}, rk2={.2f}, r2a={.2f}, /\n',starting_dist,options.smd_fc,starting_dist+options.smd_displ];
fwrite[fh,'igr1= '];
local i=0;
for aid in receptor_indices loop
fwrite[fh,'{}, ',aid];
endloop
fwrite[fh,'0, \n'];
fwrite[fh,'igr2= '];
for aid in ligand_indices loop
fwrite[fh,'{}, ',aid];
endloop
fwrite[fh,'0, /\n '];
endif
fclose fh;
cd currentDir;
return 0;
endfunction
//SRC COMMENT NEXT LINES MOVED TO QUEUE.SVL
//
//global function writeAmberLaunchScripts options
// writeEquilibrationQueue[options];
//
// local ns=1;
// while (ns <=50) loop
// writeMDQueue[ns];
// ns=ns+1;
// endloop
//
//endfunction
//global function launchAmber[options]
// writeAmberLaunchScripts[options];
// writeAmberLaunchScripts_Workstation[];
//endfunction
//////
global function writeAmberInputs [path,options,ligand,nRes,selectedAtomIds]
local ret=writeMinimisationInput[path,nRes];
if ret > 0 then
return ret;
endif
ret = writeFirstEquilibration[path,nRes];
if ret > 0 then
return ret;
endif
ret = writeSecondEquilibration[path,nRes,200];
if ret > 0 then
return ret;
endif
ret = writeSecondEquilibration[path,nRes,250];
if ret > 0 then
return ret;
endif
ret = writeSecondEquilibration[path,nRes,300];
if ret > 0 then
return ret;
endif
ret = writeThirdEquilibration[path,nRes,options.equilibration_length];
if ret > 0 then
return ret;
endif
ret = writeMD[path,nRes,300,options.md_length];
if ret > 0 then
return ret;
endif
ret = writeJarz[path,nRes,options];
if ret > 0 then
return ret;
endif
ret = writeMDRestraints[path,selectedAtomIds,options];
ret= writeJarzRestraints[path,selectedAtomIds,options];
return 0;
endfunction