bfee2 3.1.1.post1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. BFEE2/__init__.py +0 -0
  2. BFEE2/commonTools/__init__.py +0 -0
  3. BFEE2/commonTools/commonSlots.py +48 -0
  4. BFEE2/commonTools/fileParser.py +327 -0
  5. BFEE2/commonTools/ploter.py +218 -0
  6. BFEE2/doc/Doc.pdf +0 -0
  7. BFEE2/doc/__init__.py +1 -0
  8. BFEE2/gui.py +2785 -0
  9. BFEE2/inputGenerator.py +2949 -0
  10. BFEE2/postTreatment.py +676 -0
  11. BFEE2/templates_gromacs/000.colvars.template +37 -0
  12. BFEE2/templates_gromacs/000.generate_tpr_sh.template +31 -0
  13. BFEE2/templates_gromacs/000.mdp.template +74 -0
  14. BFEE2/templates_gromacs/001.colvars.template +76 -0
  15. BFEE2/templates_gromacs/001.generate_tpr_sh.template +31 -0
  16. BFEE2/templates_gromacs/001.mdp.template +73 -0
  17. BFEE2/templates_gromacs/001.readme.template +1 -0
  18. BFEE2/templates_gromacs/002.colvars.template +101 -0
  19. BFEE2/templates_gromacs/002.generate_tpr_sh.template +31 -0
  20. BFEE2/templates_gromacs/002.mdp.template +73 -0
  21. BFEE2/templates_gromacs/003.colvars.template +125 -0
  22. BFEE2/templates_gromacs/003.generate_tpr_sh.template +36 -0
  23. BFEE2/templates_gromacs/003.mdp.template +73 -0
  24. BFEE2/templates_gromacs/004.colvars.template +148 -0
  25. BFEE2/templates_gromacs/004.generate_tpr_sh.template +37 -0
  26. BFEE2/templates_gromacs/004.mdp.template +74 -0
  27. BFEE2/templates_gromacs/005.colvars.template +170 -0
  28. BFEE2/templates_gromacs/005.generate_tpr_sh.template +38 -0
  29. BFEE2/templates_gromacs/005.mdp.template +74 -0
  30. BFEE2/templates_gromacs/006.colvars.template +192 -0
  31. BFEE2/templates_gromacs/006.generate_tpr_sh.template +39 -0
  32. BFEE2/templates_gromacs/006.mdp.template +74 -0
  33. BFEE2/templates_gromacs/007.colvars.template +210 -0
  34. BFEE2/templates_gromacs/007.generate_tpr_sh.template +40 -0
  35. BFEE2/templates_gromacs/007.mdp.template +73 -0
  36. BFEE2/templates_gromacs/007_eq.colvars.template +169 -0
  37. BFEE2/templates_gromacs/007_eq.generate_tpr_sh.template +64 -0
  38. BFEE2/templates_gromacs/007_min.mdp.template +62 -0
  39. BFEE2/templates_gromacs/008.colvars.template +42 -0
  40. BFEE2/templates_gromacs/008.generate_tpr_sh.template +31 -0
  41. BFEE2/templates_gromacs/008.mdp.template +74 -0
  42. BFEE2/templates_gromacs/008_eq.colvars.template +14 -0
  43. BFEE2/templates_gromacs/008_eq.generate_tpr_sh.template +31 -0
  44. BFEE2/templates_gromacs/BFEEGromacs.py +1268 -0
  45. BFEE2/templates_gromacs/__init__.py +0 -0
  46. BFEE2/templates_gromacs/find_min_max.awk +27 -0
  47. BFEE2/templates_namd/__init__.py +0 -0
  48. BFEE2/templates_namd/configTemplate.py +1152 -0
  49. BFEE2/templates_namd/fep.tcl +299 -0
  50. BFEE2/templates_namd/fep_lddm.tcl +312 -0
  51. BFEE2/templates_namd/scriptTemplate.py +304 -0
  52. BFEE2/templates_namd/solvate.tcl +9 -0
  53. BFEE2/templates_namd/solvate_mem.tcl +9 -0
  54. BFEE2/templates_namd/updateCenters.py +312 -0
  55. BFEE2/templates_readme/Readme_Gromacs_Geometrical.txt +25 -0
  56. BFEE2/templates_readme/Readme_NAMD_Alchemical.txt +20 -0
  57. BFEE2/templates_readme/Readme_NAMD_Geometrical.txt +34 -0
  58. BFEE2/templates_readme/__init__.py +1 -0
  59. BFEE2/templates_readme/rags.py +187 -0
  60. BFEE2/third_party/__init__.py +0 -0
  61. BFEE2/third_party/py_bar.py +585 -0
  62. BFEE2/version.py +4 -0
  63. bfee2-3.1.1.post1.data/scripts/BFEE2Gui.py +19 -0
  64. bfee2-3.1.1.post1.dist-info/METADATA +86 -0
  65. bfee2-3.1.1.post1.dist-info/RECORD +68 -0
  66. bfee2-3.1.1.post1.dist-info/WHEEL +5 -0
  67. bfee2-3.1.1.post1.dist-info/licenses/LICENSE +677 -0
  68. bfee2-3.1.1.post1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1152 @@
1
+ # generate NAMD/Gromacs/Colvars config files
2
+
3
+ import numpy as np
4
+
5
+ class configTemplate:
6
+ ''' generate NAMD/Gromacs/Colvars config files
7
+ In the Colvars config file, ndx and xyz files are used to indicate the group of atoms
8
+ The non-hydrogen atoms of protein are labeled as 'protein' in complex.ndx
9
+ The non-hydrogen atoms of ligand are labeled as 'ligand' in complex.ndx
10
+ The non-hydrogen atoms of user-defined reference are labeled as 'reference' in complex.ndx '''
11
+
12
+ def __init__(self):
13
+ pass
14
+
15
+ def namdConfigTemplate(
16
+ self,
17
+ forceFieldType,
18
+ forceFieldFiles,
19
+ topFile,
20
+ coorFile,
21
+ NAMDRestartCoor,
22
+ NAMDRestartVel,
23
+ NAMDRestartXsc,
24
+ PBCCondition,
25
+ outputPrefix,
26
+ temperature,
27
+ numSteps,
28
+ cvFile = '',
29
+ cvDefinitionFile = '',
30
+ CVRestartFile = '',
31
+ fepFile = '',
32
+ fepWindowNum = 20,
33
+ fepForward = True,
34
+ fepDoubleWide = False,
35
+ fepMinBeforeSample = False,
36
+ membraneProtein = False,
37
+ OPLSMixingRule = False,
38
+ GaWTM = False,
39
+ CUDASOAIntegrator = False,
40
+ timestep = 2.0,
41
+ LDDMStep1 = False,
42
+ lambdaABF = False
43
+ ):
44
+ """the namd config file template
45
+
46
+ Args:
47
+ forceFieldType (str): 'charmm' or 'amber'
48
+ forceFieldFiles (list of str): name of charmm force field files
49
+ topFile (str): name of the topology file (psf, parm)
50
+ coorFile (str): name of the coordinate file (pdb, rst)
51
+ NAMDRestartCoor (str): name of namd binary restart coor file (if restart from a previous simulation)
52
+ NAMDRestartVel (str): name of namd binary restart vel file
53
+ NAMDRestartXsc (str): name of namd restart xsc file
54
+ PBCCondition (np.array, 2*3): PBC vector, ((lengthX, lengthY, lengthZ),(centerX, centerY, centerZ))
55
+ outputPrefix (str): prefix of output file
56
+ temperature (float): temperature of the simulation
57
+ numSteps (int): number of steps of the simulation
58
+ cvFile (str): name of Colvars file. Defaults to ''.
59
+ cvDefinitionFile (str, optional): name of a TCL file defining new CVs. Defaults to ''.
60
+ CVRestartFile (str, optional): name of Colvars restart file. Defaults to ''.
61
+ fepFile (str, optional): name of fep file, indicating which atoms will be generated/removed
62
+ (if run alchemical simulation). Defaults to ''.
63
+ fepWindowNum (int, optional): number of fep windows. Defaults to 20.
64
+ fepForward (bool, optional): whether this is a forward fep simulation. Defaults to True.
65
+ fepDoubleWide (bool, optional): whether this is a double-wide fep simulation. Defaults to False.
66
+ fepMinBeforeSample (bool, optional): whether do minimization before sampling in each FEP window.
67
+ Defaults to False.
68
+ membraneProtein (bool, optional): whether simulating a membrame protein. Defaults to False.
69
+ OPLSMixingRule (bool, optional): whether use the OPLS mixing rules. Defaults to False.
70
+ GaWTM (bool, optional): Whether this is an GaWTM-eABF simulation. Default to False
71
+ CUDASOAIntegrator (bool, optional): Whether CUDASOA integrator is used. Default to False
72
+ timestep (float, optional): timestep of the simulation. Default to 2.0
73
+ LDDMStep1 (bool, optional): whether this is the 1st step of a LDDM simulation. Default to False.
74
+ lambdaABF (bool, optional): whether use WTM-lambdaABF. This option is incompatible with FEP. Default to False.
75
+
76
+ Returns:
77
+ str: a NAMD config string if succeed, and empty string otherwise
78
+ """
79
+
80
+ assert(forceFieldType == 'charmm' or forceFieldType == 'amber')
81
+ assert(not lambdaABF or cvFile != '')
82
+ assert(not lambdaABF or fepFile != '')
83
+
84
+ configString = f'\
85
+ coordinates {coorFile} \n'
86
+
87
+ # force field files
88
+ if forceFieldType == 'charmm':
89
+ configString += f'\
90
+ structure {topFile} \n\
91
+ paraTypeCharmm on \n'
92
+ for ff in forceFieldFiles:
93
+ configString += f'\
94
+ parameters {ff} \n'
95
+ elif forceFieldType == 'amber':
96
+ configString += f'\
97
+ parmFile {topFile} \n\
98
+ amber on \n'
99
+ else:
100
+ # error
101
+ return ''
102
+
103
+ # structure
104
+ if forceFieldType == 'charmm':
105
+ configString += f'\
106
+ exclude scaled1-4 \n\
107
+ 1-4scaling 1.0 \n\
108
+ switching on \n\
109
+ switchdist 10.0 \n\
110
+ cutoff 12.0 \n\
111
+ pairlistdist 14.0 \n'
112
+ elif forceFieldType == 'amber':
113
+ configString += f'\
114
+ exclude scaled1-4 \n\
115
+ 1-4scaling 0.83333333 \n\
116
+ switching on \n\
117
+ switchdist 9.0 \n\
118
+ cutoff 10.0 \n\
119
+ pairlistdist 12.0 \n'
120
+ else:
121
+ # error
122
+ return ''
123
+
124
+ # OPLS mixing rule
125
+ if OPLSMixingRule:
126
+ configString += f'\
127
+ vdwGeometricSigma yes \n'
128
+
129
+ if NAMDRestartCoor == '' and NAMDRestartVel == '' and NAMDRestartXsc == '' and isinstance(PBCCondition, np.ndarray):
130
+ # set temperature
131
+ configString += f'\
132
+ temperature {temperature} \n\
133
+ cellBasisVector1 {PBCCondition[0][0]} 0 0 \n\
134
+ cellBasisVector2 0 {PBCCondition[0][1]} 0 \n\
135
+ cellBasisVector3 0 0 {PBCCondition[0][2]} \n\
136
+ cellOrigin {PBCCondition[1][0]} {PBCCondition[1][1]} {PBCCondition[1][2]} \n'
137
+ elif NAMDRestartCoor != '' and NAMDRestartVel != '' and NAMDRestartXsc != '' and PBCCondition == '':
138
+ # restart from files
139
+ configString += f'\
140
+ bincoordinates {NAMDRestartCoor} \n\
141
+ binvelocities {NAMDRestartVel} \n\
142
+ ExtendedSystem {NAMDRestartXsc} \n'
143
+ else:
144
+ # error
145
+ return ''
146
+
147
+ if lambdaABF:
148
+ configString += f'\
149
+ computeEnergies 1 \n' # required by WTM-lambda ABF
150
+
151
+ # other parameters
152
+ configString += f'\
153
+ binaryoutput yes \n\
154
+ binaryrestart yes \n\
155
+ outputname {outputPrefix} \n\
156
+ dcdUnitCell yes \n\
157
+ outputenergies 5000 \n\
158
+ outputtiming 5000 \n\
159
+ outputpressure 5000 \n\
160
+ restartfreq 5000 \n\
161
+ XSTFreq 5000 \n\
162
+ dcdFreq 5000 \n\
163
+ hgroupcutoff 2.8 \n\
164
+ wrapAll off \n\
165
+ wrapWater on \n\
166
+ langevin on \n\
167
+ langevinDamping 1 \n\
168
+ langevinTemp {temperature} \n\
169
+ langevinHydrogen no \n\
170
+ langevinpiston on \n\
171
+ langevinpistontarget 1.01325 \n\
172
+ langevinpistonperiod 200 \n\
173
+ langevinpistondecay 100 \n\
174
+ langevinpistontemp {temperature} \n\
175
+ usegrouppressure yes \n\
176
+ PME yes \n\
177
+ PMETolerance 10e-6 \n\
178
+ PMEInterpOrder 4 \n\
179
+ PMEGridSpacing 1.0 \n\
180
+ timestep {timestep} \n\
181
+ fullelectfrequency 2 \n\
182
+ nonbondedfreq 1 \n\
183
+ rigidbonds all \n\
184
+ rigidtolerance 0.00001 \n\
185
+ rigiditerations 400 \n\
186
+ stepspercycle 10 \n\
187
+ splitpatch hydrogen \n\
188
+ margin 2 \n'
189
+
190
+ # membrane protein
191
+ if membraneProtein:
192
+ configString += f'\
193
+ useflexiblecell yes \n\
194
+ useConstantRatio yes \n'
195
+ else:
196
+ configString += f'\
197
+ useflexiblecell no \n\
198
+ useConstantRatio no \n'
199
+
200
+ # CUDASOA integrator
201
+ if CUDASOAIntegrator:
202
+ configString += f'\
203
+ CUDASOAIntegrate on \n'
204
+
205
+ # colvars definition
206
+ if cvFile != '':
207
+ configString += f'\
208
+ colvars on \n'
209
+ if not GaWTM:
210
+ configString += f'\
211
+ colvarsConfig {cvFile} \n'
212
+
213
+ if CVRestartFile != '':
214
+ configString += f'\
215
+ colvarsInput {CVRestartFile} \n'
216
+
217
+
218
+ if cvDefinitionFile != '':
219
+ configString += f'\
220
+ source {cvDefinitionFile} \n'
221
+
222
+ # fep
223
+ if fepFile == '' and (not lambdaABF):
224
+ if NAMDRestartCoor == '' and NAMDRestartVel == '' and NAMDRestartXsc == '':
225
+ configString += f'\
226
+ minimize 500 \n\
227
+ reinitvels {temperature} \n'
228
+ if not GaWTM:
229
+ configString += f'\
230
+ run {numSteps} \n'
231
+ else:
232
+ configString += f'\
233
+ accelMD on \n\
234
+ accelMDG on \n\
235
+ accelMDdihe on \n\
236
+ accelMDOutFreq 1000 \n\
237
+ accelMDGSigma0D 6.0 \n'
238
+ if CVRestartFile == '':
239
+ # new GaMD-WTM-eABF simulation
240
+ configString += f'\
241
+ accelMDGcMDSteps 500000 \n\
242
+ accelMDGcMDPrepSteps 100000 \n\
243
+ accelMDGEquiPrepSteps 100000 \n\
244
+ accelMDGEquiSteps 500000 \n\
245
+ for {{set stage 0}} {{$stage < 2}} {{incr stage}} {{ \n\
246
+ if {{$stage == 0}} {{ \n\
247
+ puts "Probing the GaMD parameters..." \n\
248
+ cv configfile {cvFile} \n\
249
+ run norepeat 1000000 \n\
250
+ }} elseif {{$stage == 1}} {{ \n\
251
+ puts "Starting eABF + GaMD..." \n\
252
+ cv reset \n\
253
+ cv configfile {cvFile + ".amd"} \n\
254
+ run norepeat {numSteps} \n\
255
+ }} \n\
256
+ }} \n'
257
+ else:
258
+ configString += f'\
259
+ accelMDGcMDSteps 0 \n\
260
+ accelMDGcMDPrepSteps 0 \n\
261
+ accelMDGEquiPrepSteps 0 \n\
262
+ accelMDGEquiSteps 0 \n\
263
+ accelMDGRestart on \n\
264
+ accelMDGRestartFile {CVRestartFile}.gamd \n\
265
+ colvarsConfig {cvFile + ".amd"} \n\
266
+ colvarsInput {CVRestartFile} \n\
267
+ run norepeat {numSteps} \n'
268
+
269
+ elif fepFile != '' and (not lambdaABF):
270
+ # currently the alchemical route is somewhat hard-coded
271
+ # this will be improved in the future
272
+ if LDDMStep1:
273
+ configString += f'\
274
+ source ./fep_lddm.tcl \n'
275
+ else:
276
+ configString += f'\
277
+ source ../fep.tcl \n'
278
+ configString += f'\
279
+ alch on \n\
280
+ alchType FEP \n\
281
+ alchFile {fepFile} \n\
282
+ alchCol B \n\
283
+ alchOutFile {outputPrefix}.fepout \n\
284
+ alchOutFreq 50 \n\
285
+ alchVdwLambdaEnd 0.7 \n\
286
+ alchElecLambdaStart 0.5 \n\
287
+ alchDecouple on \n\
288
+ alchEquilSteps 100000 \n'
289
+
290
+ if fepForward:
291
+ if not fepDoubleWide:
292
+ if fepMinBeforeSample:
293
+ # minimize before sampling
294
+ configString += f'\
295
+ runFEPmin 0.0 1.0 {1.0/fepWindowNum} 500000 1000 {temperature}\n'
296
+ else:
297
+ configString += f'\
298
+ runFEP 0.0 1.0 {1.0/fepWindowNum} 500000\n'
299
+
300
+ else:
301
+ # double wide simulation
302
+ configString += f'\
303
+ runFEP 0.0 1.0 {1.0/fepWindowNum} 500000 true\n'
304
+
305
+ else:
306
+ # backward
307
+ if not fepDoubleWide:
308
+ if fepMinBeforeSample:
309
+ # minimize before sampling
310
+ configString += f'\
311
+ runFEPmin 1.0 0.0 {-1.0/fepWindowNum} 500000 1000 {temperature}\n'
312
+ else:
313
+ configString += f'\
314
+ runFEP 1.0 0.0 {-1.0/fepWindowNum} 500000\n'
315
+
316
+ else:
317
+ # double wide simulation
318
+ configString += f'\
319
+ runFEP 1.0 0.0 {-1.0/fepWindowNum} 500000 true\n'
320
+
321
+ else:
322
+ # lambda ABF instead of FEP
323
+ configString += f'\
324
+ alch on \n\
325
+ alchType TI \n\
326
+ alchFile {fepFile} \n\
327
+ alchCol B \n\
328
+ alchOutFile {outputPrefix}.fepout \n\
329
+ alchOutFreq 5000 \n\
330
+ alchVdwLambdaEnd 0.7 \n\
331
+ alchElecLambdaStart 0.5 \n\
332
+ alchDecouple on \n\
333
+ alchlambda 0 \n\
334
+ run {numSteps} \n'
335
+
336
+ return configString
337
+
338
+ def gromacsMinimizeConfigTemplate(self):
339
+ """the gromacs config file template for minimization
340
+
341
+ Returns:
342
+ str: a Gromacs config string if succeed, and empty string otherwise
343
+ """
344
+ configString = f'\
345
+ integrator = steep \n\
346
+ emtol = 418.4 \n\
347
+ emstep = 0.01 \n\
348
+ nsteps = 20000 \n\
349
+ nstlist = 1 \n\
350
+ cutoff-scheme = Verlet \n\
351
+ ns_type = \n\
352
+ coulombtype = PME \n\
353
+ rcoulomb = 1.2 \n\
354
+ rvdw = 1.2 \n\
355
+ pbc = xyz \n'
356
+ return configString
357
+
358
+ def gromacsConfigTemplate(
359
+ self,
360
+ forceFieldType,
361
+ temperature,
362
+ numSteps,
363
+ membraneProtein = False,
364
+ generateVelocities = True
365
+ ):
366
+ """the gromacs config file template
367
+
368
+ Args:
369
+ forceFieldType (str): 'charmm' or 'amber'
370
+ temperature (float): temperature of the simulation
371
+ numSteps (int): number of steps of the simulation
372
+ membraneProtein (bool, optional): whether simulating a membrame protein. Defaults to False.
373
+ generateVelocities (bool, optional): whether generate velocities. Defaults to True.
374
+
375
+ Returns:
376
+ str: a Gromacs config string if succeed, and empty string otherwise
377
+ """
378
+
379
+ configString = f'\
380
+ integrator = md \n\
381
+ nsteps = {numSteps} \n\
382
+ dt = 0.002 \n\
383
+ nstxout = 5000 \n\
384
+ nstvout = 5000 \n\
385
+ nstenergy = 5000 \n\
386
+ nstlog = 5000 \n\
387
+ continuation = no \n\
388
+ constraint_algorithm = lincs \n\
389
+ constraints = h-bonds \n\
390
+ cutoff-scheme = Verlet \n\
391
+ nstlist = 10 \n\
392
+ coulombtype = PME \n'
393
+
394
+ if forceFieldType == 'charmm':
395
+ configString += f'\
396
+ rcoulomb = 1.2 \n\
397
+ rvdw = 1.2 \n\
398
+ rvdw-switch = 1.0 \n'
399
+
400
+ elif forceFieldType == 'amber':
401
+ configString += f'\
402
+ rcoulomb = 0.9 \n\
403
+ rvdw = 0.9 \n\
404
+ rvdw-switch = 0.8 \n'
405
+
406
+ configString += f'\
407
+ vdwtype = Cut-off \n\
408
+ vdw-modifier = force-switch \n\
409
+ DispCorr = EnerPres \n\
410
+ tcoupl = V-rescale \n\
411
+ tc-grps = System \n\
412
+ tau_t = 1 \n\
413
+ ref_t = {temperature} \n\
414
+ pbc = xyz \n\
415
+ pcoupl = C-rescale \n\
416
+ tau-p = 1 \n'
417
+
418
+ if not membraneProtein:
419
+ configString += f'\
420
+ ref-p = 1.01325 \n\
421
+ compressibility = 4.5e-5 \n\
422
+ refcoord-scaling = com \n\
423
+ pcoupltype = isotropic \n'
424
+
425
+ elif membraneProtein:
426
+ configString += f'\
427
+ ref-p = 1.01325 1.01325 \n\
428
+ compressibility = 4.5e-5 4.5e-5 \n\
429
+ refcoord-scaling = com \n\
430
+ pcoupltype = semiisotropic \n'
431
+
432
+ if generateVelocities:
433
+ configString += f'\
434
+ gen_vel = yes \n\
435
+ gen_temp = {temperature} \n\
436
+ gen_seed = -1 \n'
437
+
438
+ return configString
439
+
440
+ def cvLambdaTemplate(self, bins):
441
+ """lambda CV template for WTM-lambdaABF
442
+
443
+ Args:
444
+ bins (int): number of bins for the CV
445
+
446
+ Returns:
447
+ str: string of lambda definition
448
+ """
449
+ string = f'\
450
+ colvar {{ \n\
451
+ name l \n\
452
+ extendedLagrangian on \n\
453
+ extendedMass 150000 \n\
454
+ extendedLangevinDamping 1000 \n\
455
+ lowerBoundary 0 \n\
456
+ upperBoundary 1 \n\
457
+ reflectingLowerBoundary \n\
458
+ reflectingUpperBoundary \n\
459
+ width {1/float(bins)} \n\
460
+ subtractAppliedForce \n\
461
+ expandboundaries \n\
462
+ alchLambda {{ \n\
463
+ }} \n\
464
+ outputTotalForce \n\
465
+ outputAppliedforce \n\
466
+ }} \n'
467
+ return string
468
+
469
+ def cvRMSDTemplate(
470
+ self, setBoundary, lowerBoundary, upperBoundary, refFile,
471
+ extendedLagrangian = True, reflectingBoundary = False,
472
+ unit = 'namd'
473
+ ):
474
+ """RMSD CV template
475
+
476
+ Args:
477
+ setBoundary (bool): whether set boundary (for free-energy calculation)
478
+ lowerBoundary (float): lower boundary of free-energy calculaton
479
+ upperboundary (float): upper boundary of free-energy calculation
480
+ refFile (str): path to the reference file
481
+ extendedLagrangian (bool, optional): Whether extended Lagrangian is added. Default to True
482
+ reflectingBoundary (bool, optional): Whether use reflecting boundaries, requires setBoundary on. Default to False
483
+ unit (str, optional): unit, 'namd' or 'gromacs'. Default to namd.
484
+
485
+ Returns:
486
+ str: string of RMSD definition
487
+ """
488
+
489
+ if unit == 'namd':
490
+ scaleFactor = 1
491
+ elif unit == 'gromacs':
492
+ scaleFactor = 0.1
493
+
494
+ string = f'\
495
+ colvar {{ \n\
496
+ name RMSD \n'
497
+
498
+ if setBoundary:
499
+ string += f'\
500
+ width {0.05 * scaleFactor:.2f} \n\
501
+ lowerboundary {lowerBoundary * scaleFactor:.2f} \n\
502
+ upperboundary {upperBoundary * scaleFactor:.2f} \n'
503
+
504
+ if setBoundary and reflectingBoundary:
505
+ string += f'\
506
+ reflectingLowerboundary on \n\
507
+ reflectingUpperboundary on \n'
508
+
509
+ if extendedLagrangian:
510
+ string += f'\
511
+ subtractAppliedForce on \n\
512
+ expandboundaries on \n\
513
+ extendedLagrangian on \n\
514
+ extendedFluctuation {0.05 * scaleFactor:.2f} \n'
515
+
516
+ string += f'\
517
+ rmsd {{ \n\
518
+ atoms {{ \n\
519
+ indexGroup ligand \n\
520
+ }} \n\
521
+ refpositionsfile {refFile} \n\
522
+ }} \n\
523
+ }} \n'
524
+ return string
525
+
526
+ def cvAngleTemplate(
527
+ self, setBoundary, lowerBoundary, upperBoundary, angle,
528
+ refFile, oldDefinition = True, extendedLagrangian = True, reflectingBoundary = False
529
+ ):
530
+ """Eulaer and polar angle template
531
+
532
+ Args:
533
+ setBoundary (bool): whether set boundary (for free-energy calculation)
534
+ lowerBoundary (float): lower boundary of free-energy calculaton
535
+ upperBoundary (float): upper boundary of free-energy calculation
536
+ angle (str): 'eulerTheta', 'eulerPhi', 'eulerPsi', 'polarTheta' or 'polarPhi'
537
+ refFile (str): path to the reference file
538
+ oldDefinition (bool, optional): Whether use old definition of angles
539
+ for compatibility. Defaults to True
540
+ extendedLagrangian (bool, optional): Whether extended Lagrangian is added. Default to True
541
+ reflectingBoundary (bool, optional): Whether use reflecting boundaries, requires setBoundary on. Default to False
542
+ """
543
+
544
+ assert(
545
+ angle == 'eulerTheta' or angle == 'eulerPhi' or angle == 'eulerPsi' or \
546
+ angle == 'polarTheta' or angle == 'polarPhi'
547
+ )
548
+
549
+ if angle == 'eulerTheta' or angle == 'eulerPhi' or angle == 'eulerPsi':
550
+ if oldDefinition:
551
+ return self.cvEulerAngleTemplate(
552
+ setBoundary, lowerBoundary, upperBoundary, angle, refFile, extendedLagrangian, reflectingBoundary
553
+ )
554
+ else:
555
+ return self.newCvEulerAngleTemplate(
556
+ setBoundary, lowerBoundary, upperBoundary, angle, refFile, extendedLagrangian, reflectingBoundary
557
+ )
558
+ elif angle == 'polarTheta' or angle == 'polarPhi':
559
+ if oldDefinition:
560
+ return self.cvPolarAngleTemplate(
561
+ setBoundary, lowerBoundary, upperBoundary, angle, refFile, extendedLagrangian, reflectingBoundary
562
+ )
563
+ else:
564
+ return self.newCvPolarAngleTemplate(
565
+ setBoundary, lowerBoundary, upperBoundary, angle, refFile, extendedLagrangian, reflectingBoundary
566
+ )
567
+
568
+ def cvEulerAngleTemplate(
569
+ self, setBoundary, lowerBoundary, upperBoundary, angle,
570
+ refFile, extendedLagrangian = True, reflectingBoundary = False
571
+ ):
572
+ """Euler angle template
573
+
574
+ Args:
575
+ setBoundary (bool): whether set boundary (for free-energy calculation)
576
+ lowerBoundary (float): lower boundary of free-energy calculaton
577
+ upperboundary (float): upper boundary of free-energy calculation
578
+ angle (str): 'eulerTheta', 'eulerPhi' or 'eulerPsi'
579
+ refFile (str): path to the reference file
580
+ extendedLagrangian (bool, optional): Whether extended Lagrangian is added. Default to True
581
+ reflectingBoundary (bool, optional): Whether use reflecting boundaries, requires setBoundary on. Default to False
582
+
583
+ Returns:
584
+ string: string of Euler angle definition
585
+ """
586
+
587
+ assert(angle == 'eulerTheta' or angle == 'eulerPhi' or angle == 'eulerPsi')
588
+
589
+ string = f'\
590
+ colvar {{ \n\
591
+ name {angle} \n'
592
+
593
+ if angle == 'eulerTheta':
594
+ string += f'\
595
+ customFunction asin(2 * (q1*q3-q4*q2)) * 180 / 3.1415926\n'
596
+ elif angle == 'eulerPhi':
597
+ string += f'\
598
+ customFunction atan2(2*(q1*q2+q3*q4), 1-2*(q2*q2+q3*q3)) * 180 / 3.1415926\n'
599
+ elif angle == 'eulerPsi':
600
+ string += f'\
601
+ customFunction atan2(2*(q1*q4+q2*q3), 1-2*(q3*q3+q4*q4)) * 180 / 3.1415926\n'
602
+
603
+ if setBoundary:
604
+ string += f'\
605
+ width 1 \n\
606
+ lowerboundary {lowerBoundary:.1f} \n\
607
+ upperboundary {upperBoundary:.1f} \n'
608
+
609
+ if setBoundary and reflectingBoundary:
610
+ string += f'\
611
+ reflectingLowerboundary on \n\
612
+ reflectingUpperboundary on \n'
613
+
614
+ if extendedLagrangian:
615
+ string += f'\
616
+ subtractAppliedForce on \n\
617
+ expandboundaries on \n\
618
+ extendedLagrangian on \n\
619
+ extendedFluctuation 1 \n'
620
+
621
+ string += f'\
622
+ Orientation {{ \n\
623
+ name q \n\
624
+ atoms {{ \n\
625
+ indexGroup ligand \n\
626
+ centerReference on \n\
627
+ rotateReference on \n\
628
+ fittingGroup {{ \n\
629
+ indexGroup protein \n\
630
+ }} \n\
631
+ refpositionsfile {refFile} \n\
632
+ }} \n\
633
+ refpositionsfile {refFile} \n\
634
+ }} \n\
635
+ }} \n'
636
+
637
+ return string
638
+
639
+ def cvPolarAngleTemplate(
640
+ self, setBoundary, lowerBoundary, upperBoundary, angle,
641
+ refFile, extendedLagrangian = True, reflectingBoundary = False
642
+ ):
643
+ """Polar angle template
644
+
645
+ Args:
646
+ setBoundary (bool): whether set boundary (for free-energy calculation)
647
+ lowerBoundary (float): lower boundary of free-energy calculaton
648
+ upperboundary (float): upper boundary of free-energy calculation
649
+ angle (str): 'polarTheta' or 'polarPhi'
650
+ refFile (str): path to the reference file
651
+ extendedLagrangian (bool, optional): Whether extended Lagrangian is added. Default to True
652
+ reflectingBoundary (bool, optional): Whether use reflecting boundaries, requires setBoundary on. Default to False
653
+
654
+ Return:
655
+ str: string of polar angle definition
656
+ """
657
+
658
+ assert(angle == 'polarTheta' or angle == 'polarPhi')
659
+
660
+ string = f'\
661
+ colvar {{ \n\
662
+ name {angle} \n'
663
+
664
+ if angle == 'polarTheta':
665
+ string += f'\
666
+ customFunction acos(-i2) * 180 / 3.1415926\n'
667
+ elif angle == 'polarPhi':
668
+ string += f'\
669
+ customFunction atan2(i3, i1) * 180 / 3.1415926\n\
670
+ period 360 \n\
671
+ wrapAround 0.0 \n'
672
+
673
+ if setBoundary:
674
+ string += f'\
675
+ width 1 \n\
676
+ lowerboundary {lowerBoundary:.1f} \n\
677
+ upperboundary {upperBoundary:.1f} \n'
678
+
679
+ if setBoundary and reflectingBoundary:
680
+ string += f'\
681
+ reflectingLowerboundary on \n\
682
+ reflectingUpperboundary on \n'
683
+
684
+ if extendedLagrangian:
685
+ string += f'\
686
+ subtractAppliedForce on \n\
687
+ expandboundaries on \n\
688
+ extendedLagrangian on \n\
689
+ extendedFluctuation 1 \n'
690
+
691
+ string += f'\
692
+ distanceDir {{ \n\
693
+ name i \n\
694
+ group1 {{ \n\
695
+ indexGroup reference \n\
696
+ centerReference on \n\
697
+ rotateReference on \n\
698
+ fittingGroup {{ \n\
699
+ indexGroup reference \n\
700
+ }} \n\
701
+ refpositionsfile {refFile} \n\
702
+ }} \n\
703
+ group2 {{ \n\
704
+ indexGroup ligand \n\
705
+ centerReference on \n\
706
+ rotateReference on \n\
707
+ fittingGroup {{ \n\
708
+ indexGroup reference \n\
709
+ }} \n\
710
+ refpositionsfile {refFile} \n\
711
+ }} \n\
712
+ }} \n\
713
+ }} \n'
714
+ return string
715
+
716
+ def newCvEulerAngleTemplate(
717
+ self, setBoundary, lowerBoundary, upperBoundary, angle,
718
+ refFile, extendedLagrangian = True, reflectingBoundary = False
719
+ ):
720
+ """new definition Euler angle template, probably the pinning down the protein is not required
721
+
722
+ Args:
723
+ setBoundary (bool): whether set boundary (for free-energy calculation)
724
+ lowerBoundary (float): lower boundary of free-energy calculaton
725
+ upperboundary (float): upper boundary of free-energy calculation
726
+ angle (str): 'eulerTheta', 'eulerPhi' of 'eulerPsi'
727
+ refFile (str): path to the reference file
728
+ extendedLagrangian (bool, optional): Whether extended Lagrangian is added. Default to True
729
+ reflectingBoundary (bool, optional): Whether use reflecting boundaries, requires setBoundary on. Default to False
730
+
731
+ Returns:
732
+ string: string of Euler angle definition
733
+ """
734
+
735
+ assert(angle == 'eulerTheta' or angle == 'eulerPhi' or angle == 'eulerPsi')
736
+
737
+ string = f'\
738
+ colvar {{ \n\
739
+ name {angle} \n'
740
+
741
+ if setBoundary:
742
+ string += f'\
743
+ width 1 \n\
744
+ lowerboundary {lowerBoundary:.1f} \n\
745
+ upperboundary {upperBoundary:.1f} \n'
746
+
747
+ if setBoundary and reflectingBoundary:
748
+ string += f'\
749
+ reflectingLowerboundary on \n\
750
+ reflectingUpperboundary on \n'
751
+
752
+ if extendedLagrangian:
753
+ string += f'\
754
+ subtractAppliedForce on \n\
755
+ expandboundaries on \n\
756
+ extendedLagrangian on \n\
757
+ extendedFluctuation 1 \n'
758
+
759
+ string += f'\
760
+ {angle} {{ \n\
761
+ atoms {{ \n\
762
+ indexGroup ligand \n\
763
+ centerReference on \n\
764
+ rotateReference on \n\
765
+ centerToOrigin on \n\
766
+ fittingGroup {{ \n\
767
+ indexGroup protein \n\
768
+ }} \n\
769
+ refpositionsfile {refFile} \n\
770
+ }} \n\
771
+ refpositionsfile {refFile} \n\
772
+ }} \n\
773
+ }} \n'
774
+
775
+ return string
776
+
777
+ def newCvPolarAngleTemplate(
778
+ self, setBoundary, lowerBoundary, upperBoundary, angle,
779
+ refFile, extendedLagrangian = True, reflectingBoundary = False
780
+ ):
781
+ """new definition of Polar angle template, probably the pinning down the protein is not required
782
+
783
+ Args:
784
+ setBoundary (bool): whether set boundary (for free-energy calculation)
785
+ lowerBoundary (float): lower boundary of free-energy calculaton
786
+ upperboundary (float): upper boundary of free-energy calculation
787
+ angle (str): 'polarTheta' or 'polarPhi'
788
+ refFile (str): path to the reference file
789
+ extendedLagrangian (bool, optional): Whether extended Lagrangian is added. Default to True
790
+ reflectingBoundary (bool, optional): Whether use reflecting boundaries, requires setBoundary on. Default to False
791
+
792
+ Return:
793
+ str: string of polar angle definition
794
+ """
795
+
796
+ assert(angle == 'polarTheta' or angle == 'polarPhi')
797
+
798
+ string = f'\
799
+ colvar {{ \n\
800
+ name {angle} \n'
801
+
802
+ if angle == 'polarTheta':
803
+ string += f'\
804
+ customFunction acos(-sin(t / 180 * 3.1415926) * sin(p / 180 * 3.1415926)) * 180 / 3.1415926\n'
805
+ elif angle == 'polarPhi':
806
+ string += f'\
807
+ customFunction atan2(cos(t / 180 * 3.1415926), cos(p / 180 * 3.1415926) * sin(t / 180 * 3.1415926)) * 180 / 3.1415926\n\
808
+ period 360 \n\
809
+ wrapAround 0.0 \n'
810
+
811
+ if setBoundary:
812
+ string += f'\
813
+ width 1 \n\
814
+ lowerboundary {lowerBoundary:.1f} \n\
815
+ upperboundary {upperBoundary:.1f} \n'
816
+
817
+ if setBoundary and reflectingBoundary:
818
+ string += f'\
819
+ reflectingLowerboundary on \n\
820
+ reflectingUpperboundary on \n'
821
+
822
+ if extendedLagrangian:
823
+ string += f'\
824
+ subtractAppliedForce on \n\
825
+ expandboundaries on \n\
826
+ extendedLagrangian on \n\
827
+ extendedFluctuation 1 \n'
828
+
829
+ string += f'\
830
+ polarTheta {{ \n\
831
+ name t \n\
832
+ atoms {{ \n\
833
+ indexGroup ligand \n\
834
+ centerReference on \n\
835
+ rotateReference on \n\
836
+ centerToOrigin on \n\
837
+ fittingGroup {{ \n\
838
+ indexGroup reference \n\
839
+ }} \n\
840
+ refpositionsfile {refFile} \n\
841
+ }} \n\
842
+ }} \n\
843
+ polarPhi {{ \n\
844
+ name p \n\
845
+ atoms {{ \n\
846
+ indexGroup ligand \n\
847
+ centerReference on \n\
848
+ rotateReference on \n\
849
+ centerToOrigin on \n\
850
+ fittingGroup {{ \n\
851
+ indexGroup reference \n\
852
+ }} \n\
853
+ refpositionsfile {refFile} \n\
854
+ }} \n\
855
+ }} \n\
856
+ }} \n'
857
+ return string
858
+
859
+ def cvRTemplate(
860
+ self, setBoundary, lowerBoundary, upperBoundary,
861
+ extendedLagrangian = True, reflectingBoundary = False,
862
+ unit = 'namd'
863
+ ):
864
+ """r distance template
865
+
866
+ Args:
867
+ setBoundary (bool): whether set boundary (for free-energy calculation)
868
+ lowerBoundary (float): lower boundary of free-energy calculaton
869
+ upperboundary (float): upper boundary of free-energy
870
+ extendedLagrangian (bool, optional): Whether extended Lagrangian is added. Default to True
871
+ reflectingBoundary (bool, optional): Whether use reflecting boundaries, requires setBoundary on. Default to False
872
+ unit (str, optional): unit, 'namd' or 'gromacs'. Default to namd.
873
+
874
+ Returns:
875
+ str: string of distance r definition
876
+ """
877
+
878
+ if unit == 'namd':
879
+ scaleFactor = 1
880
+ elif unit == 'gromacs':
881
+ scaleFactor = 0.1
882
+
883
+ string = f'\
884
+ colvar {{ \n\
885
+ name r \n'
886
+ if setBoundary:
887
+ string += f'\
888
+ width {0.1 * scaleFactor:.2f} \n\
889
+ lowerboundary {lowerBoundary * scaleFactor:.2f} \n\
890
+ upperboundary {upperBoundary * scaleFactor:.2f} \n'
891
+
892
+ if setBoundary and reflectingBoundary:
893
+ string += f'\
894
+ reflectingLowerboundary on \n\
895
+ reflectingUpperboundary on \n'
896
+
897
+ if extendedLagrangian:
898
+ string += f'\
899
+ subtractAppliedForce on \n\
900
+ expandboundaries on \n\
901
+ extendedLagrangian on \n\
902
+ extendedFluctuation {0.1 * scaleFactor:.2f} \n'
903
+
904
+ string += f'\
905
+ distance {{ \n\
906
+ forceNoPBC yes \n\
907
+ group1 {{ \n\
908
+ indexGroup reference \n\
909
+ }} \n\
910
+ group2 {{ \n\
911
+ indexGroup ligand \n\
912
+ }} \n\
913
+ }} \n\
914
+ }} \n'
915
+
916
+ return string
917
+
918
+ def cvHeadTemplate(self, indexFile, reweightAMD=False):
919
+ """return the head of colvars file
920
+
921
+ Args:
922
+ indexFile (str): name of ndx file
923
+ reweightAMD (bool, optional): if reweightAMD, there should be "smp off" in the
924
+ head. Default to False.
925
+
926
+ Returns:
927
+ str: head of colvars file
928
+ """
929
+
930
+ string = f'\
931
+ colvarsTrajFrequency 5000 \n\
932
+ colvarsRestartFrequency 5000 \n\
933
+ indexFile {indexFile} \n'
934
+ # if reweightAMD:
935
+ # string += f'\
936
+ #smp off \n'
937
+ return string
938
+
939
+ def cvHarmonicWallsTemplate(self, cv, lowerWall, upperWall, unit = 'namd'):
940
+ ''' template of harmonic wall bias
941
+
942
+ Args:
943
+ cv (str): name of the colvars
944
+ lowerWall (float): lower wall of the bias
945
+ upperWall (float): upper wall of the bias
946
+ unit (str, optional): unit, 'namd' or 'gromacs'. Default to namd.
947
+
948
+ Returns:
949
+ str: string of the harmonic wall bias definition '''
950
+
951
+ if cv == 'RMSD' or cv == 'r':
952
+ distanceCV = True
953
+ else:
954
+ distanceCV = False
955
+
956
+ if unit == 'gromacs' and distanceCV:
957
+ scaleFactor = 0.1
958
+ else:
959
+ scaleFactor = 1
960
+
961
+ string = f'\
962
+ harmonicWalls {{ \n\
963
+ colvars {cv} \n\
964
+ lowerWalls {lowerWall * scaleFactor:.1f} \n\
965
+ upperWalls {upperWall * scaleFactor:.1f} \n\
966
+ lowerWallConstant 0.2 \n\
967
+ upperWallConstant 0.2 \n\
968
+ }} \n'
969
+ return string
970
+
971
+ def cvHarmonicTemplate(
972
+ self, cv, constant, center, tiWindows=0, tiForward=True, targetForceConstant = 0,
973
+ unit = 'namd'
974
+ ):
975
+ """template for a harmonic restraint
976
+
977
+ Args:
978
+ cv (str): name of the colvars
979
+ constant (float): force constant of the restraint
980
+ center (float): center of the restraint
981
+ tiWindows (int): number of windows of the TI simulation (if runs a TI simulation). Defaults to 0.
982
+ tiForward (bool, optional): whether the TI simulation is forward (if runs a TI simulation). Defaults to True.
983
+ targetForceConstant (int, optional): targeted force constant of the restraint in TI simulation (if runs a TI simulation).
984
+ Defaults to 0.
985
+ unit (str, optional): unit, 'namd' or 'gromacs'. Default to namd.
986
+
987
+ Returns:
988
+ str: string of the harmonic restraint definition
989
+ """
990
+
991
+ if cv == 'RMSD' or cv == 'r':
992
+ distanceCV = True
993
+ else:
994
+ distanceCV = False
995
+
996
+ if unit == 'gromacs' and distanceCV:
997
+ forceConstantScaleFactor = 418.4
998
+ centerScaleFactor = 0.1
999
+ elif unit == 'gromacs' and not distanceCV:
1000
+ forceConstantScaleFactor = 4.164
1001
+ centerScaleFactor = 1
1002
+ else:
1003
+ forceConstantScaleFactor = 1
1004
+ centerScaleFactor = 1
1005
+
1006
+
1007
+ string = f'\
1008
+ harmonic {{ \n\
1009
+ colvars {cv} \n\
1010
+ forceConstant {constant * forceConstantScaleFactor:.1f} \n\
1011
+ centers {center * centerScaleFactor:.1f} \n'
1012
+
1013
+ if tiWindows != 0:
1014
+ string += f'\
1015
+ targetNumSteps 500000 \n\
1016
+ targetEquilSteps 100000 \n\
1017
+ targetForceConstant {targetForceConstant * forceConstantScaleFactor:.1f} \n\
1018
+ targetForceExponent 4 \n'
1019
+
1020
+ schedule = ''
1021
+ if tiForward:
1022
+ schedule += ' '.join([str(float(i) / float(tiWindows)) for i in range(tiWindows+1)])
1023
+ else:
1024
+ schedule += ' '.join([str(float(i) / float(tiWindows)) for i in range(tiWindows, -1, -1)])
1025
+
1026
+ string += f' lambdaSchedule {schedule}\n'
1027
+
1028
+ string += '}\n'
1029
+ return string
1030
+
1031
+ def cvABFTemplate(self, cv, unit='namd', czar=True):
1032
+ ''' template for WTM-eABF bias
1033
+
1034
+ Args:
1035
+ cv (str): name of the colvars
1036
+ unit (str, optional): unit, 'namd' or 'gromacs'. Default to namd.
1037
+ czar (bool, optional): whether call the czar estimator. Default to True.
1038
+
1039
+ Returns:
1040
+ str: string of the WTM-eABF definition '''
1041
+
1042
+ if unit == 'namd':
1043
+ scaleFactor = 1
1044
+ elif unit == 'gromacs':
1045
+ scaleFactor = 4.184
1046
+
1047
+ czar_line = ' writeCZARwindowFile \n' if czar else ''
1048
+
1049
+ string = f'\
1050
+ abf {{ \n\
1051
+ colvars {cv} \n\
1052
+ FullSamples 10000 \n\
1053
+ historyfreq 50000 \n\
1054
+ {czar_line}\
1055
+ }} \n\
1056
+ metadynamics {{ \n\
1057
+ colvars {cv} \n\
1058
+ hillWidth 3.0 \n\
1059
+ hillWeight {0.05 * scaleFactor:.2f} \n\
1060
+ wellTempered on \n\
1061
+ biasTemperature 4000 \n\
1062
+ }} \n'
1063
+ return string
1064
+
1065
+ def cvHistogramTemplate(self, cv):
1066
+ """ template for outputting the histogram of the CV
1067
+
1068
+ Args:
1069
+ cv (str): name of the colvars
1070
+
1071
+ Returns:
1072
+ str: string of the histogram definition
1073
+ """
1074
+
1075
+ string = f'\
1076
+ histogram {{ \n\
1077
+ colvars {cv} \n\
1078
+ outputFileDX none \n\
1079
+ outputFreq 10000 \n\
1080
+ }} \n'
1081
+ return string
1082
+
1083
+ def cvReweightAMDTemplate(self, cv):
1084
+ """ template for reweight aMD results
1085
+
1086
+ Args:
1087
+ cv (str): name of the colvars
1088
+
1089
+ Returns:
1090
+ str: string of the reweightamd definition
1091
+ """
1092
+
1093
+ string = f'\
1094
+ reweightamd {{ \n\
1095
+ colvars {cv} \n\
1096
+ }} \n'
1097
+ return string
1098
+
1099
+ def cvProteinTemplate(self, centerCoor, refFile, unit = 'namd'):
1100
+ """the template of restraining the protein
1101
+
1102
+ Args:
1103
+ centerCoor (np.array, 3): (x,y,z), center of the protein
1104
+ refFile (str): path of the reference file
1105
+ unit (str, optional): unit, 'namd' or 'gromacs'. Default to namd.
1106
+
1107
+ Returns:
1108
+ str: string of the restraining the protein
1109
+ """
1110
+
1111
+ if unit == 'namd':
1112
+ translationCoorScaleFactor = 1
1113
+ translationForceScaleFactor = 1
1114
+ orientationForceScaleFactor = 1
1115
+ elif unit == 'gromacs':
1116
+ translationCoorScaleFactor = 0.1
1117
+ translationForceScaleFactor = 418.4
1118
+ orientationForceScaleFactor = 4.184
1119
+
1120
+ string = f'\
1121
+ colvar {{ \n\
1122
+ name translation \n\
1123
+ distance {{ \n\
1124
+ group1 {{ \n\
1125
+ indexGroup protein \n\
1126
+ }} \n\
1127
+ group2 {{ \n\
1128
+ dummyAtom ({centerCoor[0] * translationCoorScaleFactor}, {centerCoor[1] * translationCoorScaleFactor}, {centerCoor[2] * translationCoorScaleFactor}) \n\
1129
+ }} \n\
1130
+ }} \n\
1131
+ }} \n\
1132
+ harmonic {{ \n\
1133
+ colvars translation \n\
1134
+ centers 0.0 \n\
1135
+ forceConstant {100.0 * translationForceScaleFactor:.1f} \n\
1136
+ }} \n\
1137
+ \n\
1138
+ colvar {{ \n\
1139
+ name orientation \n\
1140
+ orientation {{ \n\
1141
+ atoms {{ \n\
1142
+ indexGroup protein \n\
1143
+ }} \n\
1144
+ refPositionsFile {refFile} \n\
1145
+ }} \n\
1146
+ }} \n\
1147
+ harmonic {{ \n\
1148
+ colvars orientation \n\
1149
+ centers (1.0, 0.0, 0.0, 0.0) \n\
1150
+ forceConstant {2000.0 * orientationForceScaleFactor:.1f} \n\
1151
+ }} \n'
1152
+ return string