bfee2 2.5.0__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.
Potentially problematic release.
This version of bfee2 might be problematic. Click here for more details.
- BFEE2/__init__.py +0 -0
- BFEE2/commonTools/__init__.py +0 -0
- BFEE2/commonTools/commonSlots.py +48 -0
- BFEE2/commonTools/fileParser.py +327 -0
- BFEE2/commonTools/ploter.py +218 -0
- BFEE2/doc/Doc.pdf +0 -0
- BFEE2/doc/__init__.py +1 -0
- BFEE2/gui.py +2136 -0
- BFEE2/inputGenerator.py +2857 -0
- BFEE2/postTreatment.py +502 -0
- BFEE2/templates_gromacs/000.colvars.template +37 -0
- BFEE2/templates_gromacs/000.generate_tpr_sh.template +31 -0
- BFEE2/templates_gromacs/000.mdp.template +70 -0
- BFEE2/templates_gromacs/001.colvars.template +76 -0
- BFEE2/templates_gromacs/001.generate_tpr_sh.template +31 -0
- BFEE2/templates_gromacs/001.mdp.template +70 -0
- BFEE2/templates_gromacs/001.readme.template +1 -0
- BFEE2/templates_gromacs/002.colvars.template +101 -0
- BFEE2/templates_gromacs/002.generate_tpr_sh.template +31 -0
- BFEE2/templates_gromacs/002.mdp.template +70 -0
- BFEE2/templates_gromacs/003.colvars.template +125 -0
- BFEE2/templates_gromacs/003.generate_tpr_sh.template +36 -0
- BFEE2/templates_gromacs/003.mdp.template +70 -0
- BFEE2/templates_gromacs/004.colvars.template +148 -0
- BFEE2/templates_gromacs/004.generate_tpr_sh.template +37 -0
- BFEE2/templates_gromacs/004.mdp.template +70 -0
- BFEE2/templates_gromacs/005.colvars.template +170 -0
- BFEE2/templates_gromacs/005.generate_tpr_sh.template +38 -0
- BFEE2/templates_gromacs/005.mdp.template +70 -0
- BFEE2/templates_gromacs/006.colvars.template +192 -0
- BFEE2/templates_gromacs/006.generate_tpr_sh.template +39 -0
- BFEE2/templates_gromacs/006.mdp.template +70 -0
- BFEE2/templates_gromacs/007.colvars.template +210 -0
- BFEE2/templates_gromacs/007.generate_tpr_sh.template +40 -0
- BFEE2/templates_gromacs/007.mdp.template +69 -0
- BFEE2/templates_gromacs/007_eq.colvars.template +169 -0
- BFEE2/templates_gromacs/007_eq.generate_tpr_sh.template +64 -0
- BFEE2/templates_gromacs/007_min.mdp.template +58 -0
- BFEE2/templates_gromacs/008.colvars.template +42 -0
- BFEE2/templates_gromacs/008.generate_tpr_sh.template +31 -0
- BFEE2/templates_gromacs/008.mdp.template +70 -0
- BFEE2/templates_gromacs/008_eq.generate_tpr_sh.template +31 -0
- BFEE2/templates_gromacs/BFEEGromacs.py +1244 -0
- BFEE2/templates_gromacs/__init__.py +0 -0
- BFEE2/templates_gromacs/find_min_max.awk +27 -0
- BFEE2/templates_namd/__init__.py +0 -0
- BFEE2/templates_namd/configTemplate.py +1094 -0
- BFEE2/templates_namd/fep.tcl +299 -0
- BFEE2/templates_namd/scriptTemplate.py +149 -0
- BFEE2/templates_namd/solvate.tcl +9 -0
- BFEE2/templates_namd/solvate_mem.tcl +9 -0
- BFEE2/templates_namd/updateCenters.py +311 -0
- BFEE2/templates_readme/Readme_Gromacs_Geometrical.txt +25 -0
- BFEE2/templates_readme/Readme_NAMD_Alchemical.txt +20 -0
- BFEE2/templates_readme/Readme_NAMD_Geometrical.txt +34 -0
- BFEE2/templates_readme/__init__.py +1 -0
- BFEE2/third_party/__init__.py +0 -0
- BFEE2/third_party/py_bar.py +335 -0
- BFEE2/version.py +2 -0
- bfee2-2.5.0.data/scripts/BFEE2Gui.py +18 -0
- bfee2-2.5.0.dist-info/LICENSE +677 -0
- bfee2-2.5.0.dist-info/METADATA +76 -0
- bfee2-2.5.0.dist-info/RECORD +65 -0
- bfee2-2.5.0.dist-info/WHEEL +5 -0
- bfee2-2.5.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
##############################################################
|
|
2
|
+
# FEP SCRIPT
|
|
3
|
+
# Jerome Henin <henin@ibpc.fr>
|
|
4
|
+
#
|
|
5
|
+
# Changes:
|
|
6
|
+
# 2020-05-03: added prev_lambda option to runFEP, improved doc
|
|
7
|
+
# 2018-04-18: added interleaved double-wide sampling (IDWS)
|
|
8
|
+
# 2010-04-24: added runFEPmin
|
|
9
|
+
# 2009-11-17: changed for NAMD 2.7 keywords
|
|
10
|
+
# 2008-06-25: added TI routines
|
|
11
|
+
# 2007-11-01: fixed runFEP to handle backwards transformations
|
|
12
|
+
# (i.e. dLambda < 0)
|
|
13
|
+
##############################################################
|
|
14
|
+
|
|
15
|
+
##############################################################
|
|
16
|
+
## Example NAMD input: calculation with smaller windows at
|
|
17
|
+
## the ends
|
|
18
|
+
#
|
|
19
|
+
# source fep.tcl
|
|
20
|
+
#
|
|
21
|
+
# alch on
|
|
22
|
+
# alchFile system.fep
|
|
23
|
+
# alchCol B
|
|
24
|
+
# alchOutFreq 10
|
|
25
|
+
# alchOutFile system.fepout
|
|
26
|
+
# alchEquilSteps 500
|
|
27
|
+
#
|
|
28
|
+
# set nSteps 5000
|
|
29
|
+
#
|
|
30
|
+
## A) Simple schedule: 20 windows from 0 to 1, in a single run
|
|
31
|
+
#
|
|
32
|
+
# runFEP 0.0 1.0 0.05 $nSteps
|
|
33
|
+
#
|
|
34
|
+
## B) Same thing, in two NAMD separate runs with a restart
|
|
35
|
+
#
|
|
36
|
+
## First run
|
|
37
|
+
# runFEP 0.0 0.5 0.05 $nSteps
|
|
38
|
+
#
|
|
39
|
+
## Restart
|
|
40
|
+
# runFEP 0.5 1.0 0.05 $nSteps
|
|
41
|
+
#
|
|
42
|
+
## C) Lambda schedule with narrower windows at the end points
|
|
43
|
+
## Using two explicit lists of lambda points
|
|
44
|
+
#
|
|
45
|
+
# set init {0.0 0.05 0.1}
|
|
46
|
+
# set end {0.9 0.95 1.0}
|
|
47
|
+
#
|
|
48
|
+
# runFEPlist $init $nSteps
|
|
49
|
+
# runFEP 0.1 0.9 0.1 $nSteps
|
|
50
|
+
# runFEPlist $end $nSteps
|
|
51
|
+
#
|
|
52
|
+
## Alternately, in one step:
|
|
53
|
+
#
|
|
54
|
+
# runFEPlist [concat $init [FEPlist 0.1 0.9 0.1] $end] $nSteps
|
|
55
|
+
#
|
|
56
|
+
##############################################################
|
|
57
|
+
|
|
58
|
+
##############################################################
|
|
59
|
+
## Special usage for Interleaved Double-Wide sampling
|
|
60
|
+
## A) Simple schedule: 20 windows from 0 to 1, in a single run
|
|
61
|
+
#
|
|
62
|
+
# runFEP 0.0 1.0 0.05 $nSteps true
|
|
63
|
+
#
|
|
64
|
+
## B) Same thing, in two NAMD separate runs with a restart
|
|
65
|
+
#
|
|
66
|
+
## First run
|
|
67
|
+
# runFEP 0.0 0.5 0.05 $nSteps true
|
|
68
|
+
#
|
|
69
|
+
## Restart - need to tell the script the previous lambda point: 0.45
|
|
70
|
+
# runFEP 0.5 1.0 0.05 $nSteps true 0.45
|
|
71
|
+
#
|
|
72
|
+
## C) Example of a piecewise calculation with restarts
|
|
73
|
+
# and a nonlinear lambda schedule
|
|
74
|
+
#
|
|
75
|
+
## Run individual points 0, 0.05 then the series from 0.1 to 0.5
|
|
76
|
+
#
|
|
77
|
+
# runFEPlist [concat {0. 0.05} [FEPlist 0.1 0.5 0.1]] $numSteps true
|
|
78
|
+
#
|
|
79
|
+
## Continue series from 0.5 to 0.9, sampling backward dE from 0.4
|
|
80
|
+
#
|
|
81
|
+
# runFEPlist [FEPlist 0.5 0.9 0.1] $numSteps true 0.4
|
|
82
|
+
#
|
|
83
|
+
## Add two values 0.95 and 1, sampling backward dE from 0.9
|
|
84
|
+
## (automatically adds final backward window from 1. to 0.95)
|
|
85
|
+
#
|
|
86
|
+
# runFEPlist {0.95 1.} $numSteps true 0.9
|
|
87
|
+
#
|
|
88
|
+
##############################################################
|
|
89
|
+
|
|
90
|
+
##############################################################
|
|
91
|
+
# proc runFEPlist { lambdaList nSteps {IDWS} {prev_lambda} }
|
|
92
|
+
#
|
|
93
|
+
# Run n FEP windows joining (n + 1) lambda-points
|
|
94
|
+
# Provide prev_lambda value if continuing a sequential
|
|
95
|
+
# transformation and using IDWS
|
|
96
|
+
##############################################################
|
|
97
|
+
|
|
98
|
+
proc runFEPlist { lambdaList nSteps { IDWS false } { prev_lambda -1 } } {
|
|
99
|
+
set epsilon 1e-12
|
|
100
|
+
|
|
101
|
+
# Keep track of window number
|
|
102
|
+
global win
|
|
103
|
+
if {![info exists win]} {
|
|
104
|
+
set win 1
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
set l1 [lindex $lambdaList 0]
|
|
108
|
+
foreach l2 [lrange $lambdaList 1 end] {
|
|
109
|
+
print [format "Running FEP window %3s: Lambda1 %-6s Lambda2 %-6s \[dLambda %-6s\]"\
|
|
110
|
+
$win $l1 $l2 [expr $l2 - $l1]]
|
|
111
|
+
firsttimestep 0
|
|
112
|
+
alchLambda $l1
|
|
113
|
+
alchLambda2 $l2
|
|
114
|
+
|
|
115
|
+
if { $IDWS && ($prev_lambda >= 0.) } {
|
|
116
|
+
alchLambdaIDWS $prev_lambda
|
|
117
|
+
}
|
|
118
|
+
run $nSteps
|
|
119
|
+
|
|
120
|
+
# Keep track of previous value to set is as target for backward calculation in IDWS
|
|
121
|
+
set prev_lambda $l1
|
|
122
|
+
set l1 $l2
|
|
123
|
+
incr win
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if { $IDWS && ($l1 > [expr {1. - $epsilon}] || $l1 < $epsilon)} {
|
|
127
|
+
# If the list ends at 1 or zero, we add a final window, which is backward from the end point
|
|
128
|
+
# to complete double-wide sampling
|
|
129
|
+
# this will be look like "forward" sampling in the fepout file ("FepEnergy:" keyword)
|
|
130
|
+
print [format "Running FEP window %3s: Lambda1 %-6s Lambda2 %-6s \[dLambda %-6s\]"\
|
|
131
|
+
$win $l1 $l2 [expr $l2 - $l1]]
|
|
132
|
+
firsttimestep 0
|
|
133
|
+
alchLambda $l1
|
|
134
|
+
alchLambda2 $prev_lambda
|
|
135
|
+
alchLambdaIDWS -1
|
|
136
|
+
run $nSteps
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
##############################################################
|
|
142
|
+
# proc runFEP { start stop dLambda nSteps {IDWS} {prev_lambda} }
|
|
143
|
+
#
|
|
144
|
+
# run FEP windows of width dLambda between values start and stop
|
|
145
|
+
##############################################################
|
|
146
|
+
|
|
147
|
+
proc runFEP { start stop dLambda nSteps { IDWS false } { prev_lambda -1 } } {
|
|
148
|
+
|
|
149
|
+
runFEPlist [FEPlist $start $stop $dLambda] $nSteps $IDWS $prev_lambda
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
##############################################################
|
|
154
|
+
# proc FEPlist { start stop dLambda nSteps }
|
|
155
|
+
#
|
|
156
|
+
# Create list of FEP windows
|
|
157
|
+
##############################################################
|
|
158
|
+
|
|
159
|
+
proc FEPlist { start stop dLambda } {
|
|
160
|
+
set epsilon 1e-15
|
|
161
|
+
|
|
162
|
+
if { ($stop < $start) && ($dLambda > 0) } {
|
|
163
|
+
set dLambda [expr {-$dLambda}]
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if { $start == $stop } {
|
|
167
|
+
set ll [list $start $start]
|
|
168
|
+
} else {
|
|
169
|
+
set ll [list $start]
|
|
170
|
+
set l2 [increment $start $dLambda]
|
|
171
|
+
|
|
172
|
+
if { $dLambda > 0} {
|
|
173
|
+
# A small workaround for numerical rounding errors
|
|
174
|
+
while { [expr {$l2 <= ($stop + $epsilon) } ] } {
|
|
175
|
+
lappend ll $l2
|
|
176
|
+
set l2 [increment $l2 $dLambda]
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
while { [expr {$l2 >= ($stop - $epsilon) } ] } {
|
|
180
|
+
lappend ll $l2
|
|
181
|
+
set l2 [increment $l2 $dLambda]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return $ll
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
##############################################################
|
|
191
|
+
##############################################################
|
|
192
|
+
|
|
193
|
+
proc runFEPmin { start stop dLambda nSteps nMinSteps temp} {
|
|
194
|
+
set epsilon 1e-15
|
|
195
|
+
|
|
196
|
+
if { ($stop < $start) && ($dLambda > 0) } {
|
|
197
|
+
set dLambda [expr {-$dLambda}]
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if { $start == $stop } {
|
|
201
|
+
set ll [list $start $start]
|
|
202
|
+
} else {
|
|
203
|
+
set ll [list $start]
|
|
204
|
+
set l2 [increment $start $dLambda]
|
|
205
|
+
|
|
206
|
+
if { $dLambda > 0} {
|
|
207
|
+
# A small workaround for numerical rounding errors
|
|
208
|
+
while { [expr {$l2 <= ($stop + $epsilon) } ] } {
|
|
209
|
+
lappend ll $l2
|
|
210
|
+
set l2 [increment $l2 $dLambda]
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
while { [expr {$l2 >= ($stop - $epsilon) } ] } {
|
|
214
|
+
lappend ll $l2
|
|
215
|
+
set l2 [increment $l2 $dLambda]
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if { $nMinSteps > 0 } {
|
|
221
|
+
alchLambda $start
|
|
222
|
+
alchLambda2 $start
|
|
223
|
+
minimize $nMinSteps
|
|
224
|
+
reinitvels $temp
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
runFEPlist $ll $nSteps
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
##############################################################
|
|
231
|
+
##############################################################
|
|
232
|
+
|
|
233
|
+
proc runTIlist { lambdaList nSteps } {
|
|
234
|
+
# Keep track of window number
|
|
235
|
+
global win
|
|
236
|
+
if {![info exists win]} {
|
|
237
|
+
set win 1
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
foreach l $lambdaList {
|
|
241
|
+
print [format "Running TI window %3s: Lambda %-6s " $win $l ]
|
|
242
|
+
firsttimestep 0
|
|
243
|
+
alchLambda $l
|
|
244
|
+
run $nSteps
|
|
245
|
+
incr win
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
##############################################################
|
|
251
|
+
##############################################################
|
|
252
|
+
|
|
253
|
+
proc runTI { start stop dLambda nSteps } {
|
|
254
|
+
set epsilon 1e-15
|
|
255
|
+
|
|
256
|
+
if { ($stop < $start) && ($dLambda > 0) } {
|
|
257
|
+
set dLambda [expr {-$dLambda}]
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if { $start == $stop } {
|
|
261
|
+
set ll [list $start $start]
|
|
262
|
+
} else {
|
|
263
|
+
set ll [list $start]
|
|
264
|
+
set l2 [increment $start $dLambda]
|
|
265
|
+
|
|
266
|
+
if { $dLambda > 0} {
|
|
267
|
+
# A small workaround for numerical rounding errors
|
|
268
|
+
while { [expr {$l2 <= ($stop + $epsilon) } ] } {
|
|
269
|
+
lappend ll $l2
|
|
270
|
+
set l2 [increment $l2 $dLambda]
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
while { [expr {$l2 >= ($stop - $epsilon) } ] } {
|
|
274
|
+
lappend ll $l2
|
|
275
|
+
set l2 [increment $l2 $dLambda]
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
runTIlist $ll $nSteps
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
##############################################################
|
|
284
|
+
# Increment lambda and try to correct truncation errors around
|
|
285
|
+
# 0 and 1
|
|
286
|
+
##############################################################
|
|
287
|
+
|
|
288
|
+
proc increment { lambda dLambda } {
|
|
289
|
+
set epsilon 1e-15
|
|
290
|
+
set new [expr { $lambda + $dLambda }]
|
|
291
|
+
|
|
292
|
+
if { [expr $new > - $epsilon && $new < $epsilon] } {
|
|
293
|
+
return 0.0
|
|
294
|
+
}
|
|
295
|
+
if { [expr ($new - 1) > - $epsilon && ($new - 1) < $epsilon] } {
|
|
296
|
+
return 1.0
|
|
297
|
+
}
|
|
298
|
+
return $new
|
|
299
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import string
|
|
2
|
+
|
|
3
|
+
removeProteinTemplate = string.Template('''
|
|
4
|
+
mol new ${path}.psf
|
|
5
|
+
mol addfile ${path}.pdb
|
|
6
|
+
set aa [atomselect top "not $selectionPro"]
|
|
7
|
+
$$aa writepsf ${outputPath}.psf
|
|
8
|
+
$$aa writepdb ${outputPath}.pdb
|
|
9
|
+
exit
|
|
10
|
+
''')
|
|
11
|
+
|
|
12
|
+
removeMemProteinTemplate = string.Template('''
|
|
13
|
+
mol new ${path}.psf
|
|
14
|
+
mol addfile ${path}.pdb
|
|
15
|
+
set aa [atomselect top "$selectionLig"]
|
|
16
|
+
$$aa writepsf ${outputPath}_base.psf
|
|
17
|
+
$$aa writepdb ${outputPath}_base.pdb
|
|
18
|
+
mol delete top
|
|
19
|
+
package require solvate
|
|
20
|
+
solvate ${outputPath}_base.psf ${outputPath}_base.pdb -x 20 -y 20 -z 20 +x 20 +y 20 +z 20 -o ${outputPath} -s WT -b 2.2
|
|
21
|
+
mol delete top
|
|
22
|
+
mol new ${outputPath}.psf
|
|
23
|
+
mol addfile ${outputPath}.pdb
|
|
24
|
+
set aa [atomselect top all]
|
|
25
|
+
$$aa writexyz ${outputPath}.xyz
|
|
26
|
+
exit
|
|
27
|
+
''')
|
|
28
|
+
|
|
29
|
+
removeMemProteinFepTemplate = string.Template('''
|
|
30
|
+
package require autoionize
|
|
31
|
+
mol new ${path}.psf
|
|
32
|
+
mol addfile ${path}.pdb
|
|
33
|
+
set aa [atomselect top "$selectionLig"]
|
|
34
|
+
$$aa writepsf ${outputPath}_base.psf
|
|
35
|
+
$$aa writepdb ${outputPath}_base.pdb
|
|
36
|
+
mol delete top
|
|
37
|
+
package require solvate
|
|
38
|
+
solvate ${outputPath}_base.psf ${outputPath}_base.pdb -x 20 -y 20 -z 20 +x 20 +y 20 +z 20 -o ${outputPath} -s WT -b 2.2
|
|
39
|
+
mol delete top
|
|
40
|
+
mol new ${outputPath}.psf
|
|
41
|
+
mol addfile ${outputPath}.pdb
|
|
42
|
+
set aa [atomselect top all]
|
|
43
|
+
$$aa writexyz ${outputPath}.xyz
|
|
44
|
+
$$aa set beta 0
|
|
45
|
+
set solute [atomselect top "not water"]
|
|
46
|
+
$$solute set beta 1
|
|
47
|
+
$$aa writepdb ${outputFepPath}.pdb
|
|
48
|
+
exit
|
|
49
|
+
''')
|
|
50
|
+
|
|
51
|
+
removeProteinAmberTemplate = string.Template('''
|
|
52
|
+
parm ${path}.parm7
|
|
53
|
+
trajin ${path}.pdb
|
|
54
|
+
strip :$residueNum parmout ${outputPath}.parm7
|
|
55
|
+
trajout ${outputPath}.pdb
|
|
56
|
+
go
|
|
57
|
+
''')
|
|
58
|
+
|
|
59
|
+
neutralizeSystempTemplate = string.Template('''
|
|
60
|
+
package require autoionize
|
|
61
|
+
autoionize -psf ${path}.psf -pdb ${path}.pdb -neutralize -cation ${cationName} -anion ${anionName} -seg IO2 -o ${path}
|
|
62
|
+
mol new ${path}.psf
|
|
63
|
+
mol addfile ${path}.pdb
|
|
64
|
+
set aa [atomselect top all]
|
|
65
|
+
$$aa set beta 0
|
|
66
|
+
set solute [atomselect top "not water and not ion"]
|
|
67
|
+
$$solute set beta 1
|
|
68
|
+
$$aa writexyz ${path}.xyz
|
|
69
|
+
${extraCommand}
|
|
70
|
+
exit
|
|
71
|
+
''')
|
|
72
|
+
|
|
73
|
+
def charmmToGromacsTemplate(inputPrefix, forceFieldList):
|
|
74
|
+
return f'''
|
|
75
|
+
import numpy as np
|
|
76
|
+
import parmed, MDAnalysis
|
|
77
|
+
from MDAnalysis import transformations
|
|
78
|
+
def measurePBC(uObject):
|
|
79
|
+
atoms = uObject.select_atoms('all')
|
|
80
|
+
atomPositions = atoms.positions
|
|
81
|
+
xyz_array = np.transpose(atomPositions)
|
|
82
|
+
min_x = np.min(xyz_array[0])
|
|
83
|
+
max_x = np.max(xyz_array[0])
|
|
84
|
+
min_y = np.min(xyz_array[1])
|
|
85
|
+
max_y = np.max(xyz_array[1])
|
|
86
|
+
min_z = np.min(xyz_array[2])
|
|
87
|
+
max_z = np.max(xyz_array[2])
|
|
88
|
+
return [
|
|
89
|
+
np.array([max_x, max_y, max_z]) - np.array([min_x, min_y, min_z]),
|
|
90
|
+
(np.array([min_x, min_y, min_z]) + np.array([max_x, max_y, max_z])) / 2
|
|
91
|
+
]
|
|
92
|
+
def charmmToGromacs(psfFile, pdbFile, prmFiles, PBC, outputPrefix):
|
|
93
|
+
struct = parmed.load_file(psfFile)
|
|
94
|
+
struct.load_parameters(
|
|
95
|
+
parmed.charmm.CharmmParameterSet(*prmFiles)
|
|
96
|
+
)
|
|
97
|
+
struct.coordinates = parmed.load_file(pdbFile).coordinates
|
|
98
|
+
struct.box = [PBC[0], PBC[1], PBC[2], 90, 90, 90]
|
|
99
|
+
struct.save(f'{{outputPrefix}}.top', format='gromacs')
|
|
100
|
+
struct.save(f'{{outputPrefix}}.gro')
|
|
101
|
+
uObject = MDAnalysis.Universe('{inputPrefix}.psf', '{inputPrefix}.pdb')
|
|
102
|
+
pbcVector = measurePBC(uObject)
|
|
103
|
+
allAtoms = uObject.select_atoms('all')
|
|
104
|
+
transformations.translate((-pbcVector[1] + pbcVector[0] / 2))(allAtoms)
|
|
105
|
+
allAtoms.write('{inputPrefix}.pdb', 'pdb', bonds=None)
|
|
106
|
+
charmmToGromacs(
|
|
107
|
+
'{inputPrefix}.psf',
|
|
108
|
+
'{inputPrefix}.pdb',
|
|
109
|
+
{forceFieldList},
|
|
110
|
+
pbcVector[0],
|
|
111
|
+
'{inputPrefix}_gmx'
|
|
112
|
+
)'''
|
|
113
|
+
|
|
114
|
+
amberToGromacsTemplate = string.Template('''
|
|
115
|
+
import numpy as np
|
|
116
|
+
import parmed, MDAnalysis
|
|
117
|
+
from MDAnalysis import transformations
|
|
118
|
+
def measurePBC(uObject):
|
|
119
|
+
atoms = uObject.select_atoms('all')
|
|
120
|
+
atomPositions = atoms.positions
|
|
121
|
+
xyz_array = np.transpose(atomPositions)
|
|
122
|
+
min_x = np.min(xyz_array[0])
|
|
123
|
+
max_x = np.max(xyz_array[0])
|
|
124
|
+
min_y = np.min(xyz_array[1])
|
|
125
|
+
max_y = np.max(xyz_array[1])
|
|
126
|
+
min_z = np.min(xyz_array[2])
|
|
127
|
+
max_z = np.max(xyz_array[2])
|
|
128
|
+
return [
|
|
129
|
+
np.array([max_x, max_y, max_z]) - np.array([min_x, min_y, min_z]),
|
|
130
|
+
(np.array([min_x, min_y, min_z]) + np.array([max_x, max_y, max_z])) / 2
|
|
131
|
+
]
|
|
132
|
+
def amberToGromacs(parmFile, rstFile, PBC, outputPrefix):
|
|
133
|
+
struct = parmed.load_file(parmFile, xyz=rstFile)
|
|
134
|
+
struct.coordinates = parmed.load_file(rstFile).coordinates
|
|
135
|
+
struct.box = [PBC[0], PBC[1], PBC[2], 90, 90, 90]
|
|
136
|
+
struct.save(f'{outputPrefix}.top', format='gromacs')
|
|
137
|
+
struct.save(f'{outputPrefix}.gro')
|
|
138
|
+
uObject = MDAnalysis.Universe('${inputPrefix}.parm7', '${inputPrefix}.pdb')
|
|
139
|
+
pbcVector = measurePBC(uObject)
|
|
140
|
+
allAtoms = uObject.select_atoms('all')
|
|
141
|
+
transformations.translate((-pbcVector[1] + pbcVector[0] / 2))(allAtoms)
|
|
142
|
+
allAtoms.write('${inputPrefix}.pdb', 'pdb', bonds=None)
|
|
143
|
+
amberToGromacs(
|
|
144
|
+
'${inputPrefix}.parm7',
|
|
145
|
+
'${inputPrefix}.pdb',
|
|
146
|
+
pbcVector[0],
|
|
147
|
+
'${inputPrefix}_gmx',
|
|
148
|
+
)
|
|
149
|
+
''')
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
package require solvate
|
|
2
|
+
solvate ../complex.psf ../complex.pdb -x 12 -y 12 -z 12 +x 12 +y 12 +z 12 -o complex_largeBox -s W2 -b 2.2
|
|
3
|
+
mol addfile complex_largeBox.psf
|
|
4
|
+
mol addfile complex_largeBox.pdb
|
|
5
|
+
set all [atomselect top "all"]
|
|
6
|
+
$all writexyz complex_largeBox.xyz
|
|
7
|
+
$all delete
|
|
8
|
+
mol delete top
|
|
9
|
+
exit
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
package require solvate
|
|
2
|
+
solvate ../complex.psf ../complex.pdb -x 0 -y 0 -z 16 +x 0 +y 0 +z 16 -o complex_largeBox -s W2 -b 2.2
|
|
3
|
+
mol addfile complex_largeBox.psf
|
|
4
|
+
mol addfile complex_largeBox.pdb
|
|
5
|
+
set all [atomselect top "all"]
|
|
6
|
+
$all writexyz complex_largeBox.xyz
|
|
7
|
+
$all delete
|
|
8
|
+
mol delete top
|
|
9
|
+
exit
|