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.
- 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 +2785 -0
- BFEE2/inputGenerator.py +2949 -0
- BFEE2/postTreatment.py +676 -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 +74 -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 +73 -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 +73 -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 +73 -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 +74 -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 +74 -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 +74 -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 +73 -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 +62 -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 +74 -0
- BFEE2/templates_gromacs/008_eq.colvars.template +14 -0
- BFEE2/templates_gromacs/008_eq.generate_tpr_sh.template +31 -0
- BFEE2/templates_gromacs/BFEEGromacs.py +1268 -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 +1152 -0
- BFEE2/templates_namd/fep.tcl +299 -0
- BFEE2/templates_namd/fep_lddm.tcl +312 -0
- BFEE2/templates_namd/scriptTemplate.py +304 -0
- BFEE2/templates_namd/solvate.tcl +9 -0
- BFEE2/templates_namd/solvate_mem.tcl +9 -0
- BFEE2/templates_namd/updateCenters.py +312 -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/templates_readme/rags.py +187 -0
- BFEE2/third_party/__init__.py +0 -0
- BFEE2/third_party/py_bar.py +585 -0
- BFEE2/version.py +4 -0
- bfee2-3.1.1.post1.data/scripts/BFEE2Gui.py +19 -0
- bfee2-3.1.1.post1.dist-info/METADATA +86 -0
- bfee2-3.1.1.post1.dist-info/RECORD +68 -0
- bfee2-3.1.1.post1.dist-info/WHEEL +5 -0
- bfee2-3.1.1.post1.dist-info/licenses/LICENSE +677 -0
- bfee2-3.1.1.post1.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,312 @@
|
|
|
1
|
+
##############################################################
|
|
2
|
+
# LDDM variant FEP SCRIPT
|
|
3
|
+
# Haohao Fu <fhh2626@gmail.com>
|
|
4
|
+
# Jerome Henin <henin@ibpc.fr>
|
|
5
|
+
#
|
|
6
|
+
# Important: This version should only be used for the LDDM strategy!
|
|
7
|
+
# Use the NAMD version of fep.tcl for other simulations.
|
|
8
|
+
#
|
|
9
|
+
# Changes:
|
|
10
|
+
# 2020-05-03: added prev_lambda option to runFEP, improved doc
|
|
11
|
+
# 2018-04-18: added interleaved double-wide sampling (IDWS)
|
|
12
|
+
# 2010-04-24: added runFEPmin
|
|
13
|
+
# 2009-11-17: changed for NAMD 2.7 keywords
|
|
14
|
+
# 2008-06-25: added TI routines
|
|
15
|
+
# 2007-11-01: fixed runFEP to handle backwards transformations
|
|
16
|
+
# (i.e. dLambda < 0)
|
|
17
|
+
# 2024-11-04: support LDDM version of runFEP
|
|
18
|
+
##############################################################
|
|
19
|
+
|
|
20
|
+
##############################################################
|
|
21
|
+
## Example NAMD input: calculation with smaller windows at
|
|
22
|
+
## the ends
|
|
23
|
+
#
|
|
24
|
+
# source fep.tcl
|
|
25
|
+
#
|
|
26
|
+
# alch on
|
|
27
|
+
# alchFile system.fep
|
|
28
|
+
# alchCol B
|
|
29
|
+
# alchOutFreq 10
|
|
30
|
+
# alchOutFile system.fepout
|
|
31
|
+
# alchEquilSteps 500
|
|
32
|
+
#
|
|
33
|
+
# set nSteps 5000
|
|
34
|
+
#
|
|
35
|
+
## A) Simple schedule: 20 windows from 0 to 1, in a single run
|
|
36
|
+
#
|
|
37
|
+
# runFEP 0.0 1.0 0.05 $nSteps
|
|
38
|
+
#
|
|
39
|
+
## B) Same thing, in two NAMD separate runs with a restart
|
|
40
|
+
#
|
|
41
|
+
## First run
|
|
42
|
+
# runFEP 0.0 0.5 0.05 $nSteps
|
|
43
|
+
#
|
|
44
|
+
## Restart
|
|
45
|
+
# runFEP 0.5 1.0 0.05 $nSteps
|
|
46
|
+
#
|
|
47
|
+
## C) Lambda schedule with narrower windows at the end points
|
|
48
|
+
## Using two explicit lists of lambda points
|
|
49
|
+
#
|
|
50
|
+
# set init {0.0 0.05 0.1}
|
|
51
|
+
# set end {0.9 0.95 1.0}
|
|
52
|
+
#
|
|
53
|
+
# runFEPlist $init $nSteps
|
|
54
|
+
# runFEP 0.1 0.9 0.1 $nSteps
|
|
55
|
+
# runFEPlist $end $nSteps
|
|
56
|
+
#
|
|
57
|
+
## Alternately, in one step:
|
|
58
|
+
#
|
|
59
|
+
# runFEPlist [concat $init [FEPlist 0.1 0.9 0.1] $end] $nSteps
|
|
60
|
+
#
|
|
61
|
+
##############################################################
|
|
62
|
+
|
|
63
|
+
##############################################################
|
|
64
|
+
## Special usage for Interleaved Double-Wide sampling
|
|
65
|
+
## A) Simple schedule: 20 windows from 0 to 1, in a single run
|
|
66
|
+
#
|
|
67
|
+
# runFEP 0.0 1.0 0.05 $nSteps true
|
|
68
|
+
#
|
|
69
|
+
## B) Same thing, in two NAMD separate runs with a restart
|
|
70
|
+
#
|
|
71
|
+
## First run
|
|
72
|
+
# runFEP 0.0 0.5 0.05 $nSteps true
|
|
73
|
+
#
|
|
74
|
+
## Restart - need to tell the script the previous lambda point: 0.45
|
|
75
|
+
# runFEP 0.5 1.0 0.05 $nSteps true 0.45
|
|
76
|
+
#
|
|
77
|
+
## C) Example of a piecewise calculation with restarts
|
|
78
|
+
# and a nonlinear lambda schedule
|
|
79
|
+
#
|
|
80
|
+
## Run individual points 0, 0.05 then the series from 0.1 to 0.5
|
|
81
|
+
#
|
|
82
|
+
# runFEPlist [concat {0. 0.05} [FEPlist 0.1 0.5 0.1]] $numSteps true
|
|
83
|
+
#
|
|
84
|
+
## Continue series from 0.5 to 0.9, sampling backward dE from 0.4
|
|
85
|
+
#
|
|
86
|
+
# runFEPlist [FEPlist 0.5 0.9 0.1] $numSteps true 0.4
|
|
87
|
+
#
|
|
88
|
+
## Add two values 0.95 and 1, sampling backward dE from 0.9
|
|
89
|
+
## (automatically adds final backward window from 1. to 0.95)
|
|
90
|
+
#
|
|
91
|
+
# runFEPlist {0.95 1.} $numSteps true 0.9
|
|
92
|
+
#
|
|
93
|
+
##############################################################
|
|
94
|
+
|
|
95
|
+
##############################################################
|
|
96
|
+
# proc runFEPlist { lambdaList nSteps {IDWS} {prev_lambda} }
|
|
97
|
+
#
|
|
98
|
+
# Run n FEP windows joining (n + 1) lambda-points
|
|
99
|
+
# Provide prev_lambda value if continuing a sequential
|
|
100
|
+
# transformation and using IDWS
|
|
101
|
+
##############################################################
|
|
102
|
+
|
|
103
|
+
proc runFEPlist { lambdaList nSteps { IDWS false } { prev_lambda -1 } } {
|
|
104
|
+
set epsilon 1e-12
|
|
105
|
+
|
|
106
|
+
# Keep track of window number
|
|
107
|
+
global win
|
|
108
|
+
if {![info exists win]} {
|
|
109
|
+
set win 1
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
set l1 [lindex $lambdaList 0]
|
|
113
|
+
foreach l2 [lrange $lambdaList 1 end] {
|
|
114
|
+
print [format "Running FEP window %3s: Lambda1 %-6s Lambda2 %-6s \[dLambda %-6s\]"\
|
|
115
|
+
$win $l1 $l2 [expr $l2 - $l1]]
|
|
116
|
+
firsttimestep 0
|
|
117
|
+
alchLambda $l1
|
|
118
|
+
alchLambda2 $l2
|
|
119
|
+
|
|
120
|
+
if { $IDWS && ($prev_lambda >= 0.) } {
|
|
121
|
+
alchLambdaIDWS $prev_lambda
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
cv reset
|
|
125
|
+
cv configfile "./colvars_files/colvars_[expr $win - 1].in"
|
|
126
|
+
|
|
127
|
+
run $nSteps
|
|
128
|
+
|
|
129
|
+
# Keep track of previous value to set is as target for backward calculation in IDWS
|
|
130
|
+
set prev_lambda $l1
|
|
131
|
+
set l1 $l2
|
|
132
|
+
incr win
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if { $IDWS && ($l1 > [expr {1. - $epsilon}] || $l1 < $epsilon)} {
|
|
136
|
+
# If the list ends at 1 or zero, we add a final window, which is backward from the end point
|
|
137
|
+
# to complete double-wide sampling
|
|
138
|
+
# this will be look like "forward" sampling in the fepout file ("FepEnergy:" keyword)
|
|
139
|
+
print [format "Running FEP window %3s: Lambda1 %-6s Lambda2 %-6s \[dLambda %-6s\]"\
|
|
140
|
+
$win $l1 $l2 [expr $l2 - $l1]]
|
|
141
|
+
firsttimestep 0
|
|
142
|
+
alchLambda $l1
|
|
143
|
+
alchLambda2 $prev_lambda
|
|
144
|
+
alchLambdaIDWS -1
|
|
145
|
+
|
|
146
|
+
cv reset
|
|
147
|
+
cv configfile "./colvars_files/colvars_[expr $win - 1].in"
|
|
148
|
+
|
|
149
|
+
run $nSteps
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
##############################################################
|
|
155
|
+
# proc runFEP { start stop dLambda nSteps {IDWS} {prev_lambda} }
|
|
156
|
+
#
|
|
157
|
+
# run FEP windows of width dLambda between values start and stop
|
|
158
|
+
##############################################################
|
|
159
|
+
|
|
160
|
+
proc runFEP { start stop dLambda nSteps { IDWS false } { prev_lambda -1 } } {
|
|
161
|
+
|
|
162
|
+
runFEPlist [FEPlist $start $stop $dLambda] $nSteps $IDWS $prev_lambda
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
##############################################################
|
|
167
|
+
# proc FEPlist { start stop dLambda nSteps }
|
|
168
|
+
#
|
|
169
|
+
# Create list of FEP windows
|
|
170
|
+
##############################################################
|
|
171
|
+
|
|
172
|
+
proc FEPlist { start stop dLambda } {
|
|
173
|
+
set epsilon 1e-15
|
|
174
|
+
|
|
175
|
+
if { ($stop < $start) && ($dLambda > 0) } {
|
|
176
|
+
set dLambda [expr {-$dLambda}]
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if { $start == $stop } {
|
|
180
|
+
set ll [list $start $start]
|
|
181
|
+
} else {
|
|
182
|
+
set ll [list $start]
|
|
183
|
+
set l2 [increment $start $dLambda]
|
|
184
|
+
|
|
185
|
+
if { $dLambda > 0} {
|
|
186
|
+
# A small workaround for numerical rounding errors
|
|
187
|
+
while { [expr {$l2 <= ($stop + $epsilon) } ] } {
|
|
188
|
+
lappend ll $l2
|
|
189
|
+
set l2 [increment $l2 $dLambda]
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
while { [expr {$l2 >= ($stop - $epsilon) } ] } {
|
|
193
|
+
lappend ll $l2
|
|
194
|
+
set l2 [increment $l2 $dLambda]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return $ll
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
##############################################################
|
|
204
|
+
##############################################################
|
|
205
|
+
|
|
206
|
+
proc runFEPmin { start stop dLambda nSteps nMinSteps temp} {
|
|
207
|
+
set epsilon 1e-15
|
|
208
|
+
|
|
209
|
+
if { ($stop < $start) && ($dLambda > 0) } {
|
|
210
|
+
set dLambda [expr {-$dLambda}]
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if { $start == $stop } {
|
|
214
|
+
set ll [list $start $start]
|
|
215
|
+
} else {
|
|
216
|
+
set ll [list $start]
|
|
217
|
+
set l2 [increment $start $dLambda]
|
|
218
|
+
|
|
219
|
+
if { $dLambda > 0} {
|
|
220
|
+
# A small workaround for numerical rounding errors
|
|
221
|
+
while { [expr {$l2 <= ($stop + $epsilon) } ] } {
|
|
222
|
+
lappend ll $l2
|
|
223
|
+
set l2 [increment $l2 $dLambda]
|
|
224
|
+
}
|
|
225
|
+
} else {
|
|
226
|
+
while { [expr {$l2 >= ($stop - $epsilon) } ] } {
|
|
227
|
+
lappend ll $l2
|
|
228
|
+
set l2 [increment $l2 $dLambda]
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if { $nMinSteps > 0 } {
|
|
234
|
+
alchLambda $start
|
|
235
|
+
alchLambda2 $start
|
|
236
|
+
minimize $nMinSteps
|
|
237
|
+
reinitvels $temp
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
runFEPlist $ll $nSteps
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
##############################################################
|
|
244
|
+
##############################################################
|
|
245
|
+
|
|
246
|
+
proc runTIlist { lambdaList nSteps } {
|
|
247
|
+
# Keep track of window number
|
|
248
|
+
global win
|
|
249
|
+
if {![info exists win]} {
|
|
250
|
+
set win 1
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
foreach l $lambdaList {
|
|
254
|
+
print [format "Running TI window %3s: Lambda %-6s " $win $l ]
|
|
255
|
+
firsttimestep 0
|
|
256
|
+
alchLambda $l
|
|
257
|
+
run $nSteps
|
|
258
|
+
incr win
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
##############################################################
|
|
264
|
+
##############################################################
|
|
265
|
+
|
|
266
|
+
proc runTI { start stop dLambda nSteps } {
|
|
267
|
+
set epsilon 1e-15
|
|
268
|
+
|
|
269
|
+
if { ($stop < $start) && ($dLambda > 0) } {
|
|
270
|
+
set dLambda [expr {-$dLambda}]
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if { $start == $stop } {
|
|
274
|
+
set ll [list $start $start]
|
|
275
|
+
} else {
|
|
276
|
+
set ll [list $start]
|
|
277
|
+
set l2 [increment $start $dLambda]
|
|
278
|
+
|
|
279
|
+
if { $dLambda > 0} {
|
|
280
|
+
# A small workaround for numerical rounding errors
|
|
281
|
+
while { [expr {$l2 <= ($stop + $epsilon) } ] } {
|
|
282
|
+
lappend ll $l2
|
|
283
|
+
set l2 [increment $l2 $dLambda]
|
|
284
|
+
}
|
|
285
|
+
} else {
|
|
286
|
+
while { [expr {$l2 >= ($stop - $epsilon) } ] } {
|
|
287
|
+
lappend ll $l2
|
|
288
|
+
set l2 [increment $l2 $dLambda]
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
runTIlist $ll $nSteps
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
##############################################################
|
|
297
|
+
# Increment lambda and try to correct truncation errors around
|
|
298
|
+
# 0 and 1
|
|
299
|
+
##############################################################
|
|
300
|
+
|
|
301
|
+
proc increment { lambda dLambda } {
|
|
302
|
+
set epsilon 1e-15
|
|
303
|
+
set new [expr { $lambda + $dLambda }]
|
|
304
|
+
|
|
305
|
+
if { [expr $new > - $epsilon && $new < $epsilon] } {
|
|
306
|
+
return 0.0
|
|
307
|
+
}
|
|
308
|
+
if { [expr ($new - 1) > - $epsilon && ($new - 1) < $epsilon] } {
|
|
309
|
+
return 1.0
|
|
310
|
+
}
|
|
311
|
+
return $new
|
|
312
|
+
}
|