Skip to content

Commit a7822b1

Browse files
committed
Add prev_lambda options
1 parent 3813063 commit a7822b1

File tree

2 files changed

+42
-13
lines changed

2 files changed

+42
-13
lines changed

common/fep.tcl

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Jerome Henin <[email protected]>
44
#
55
# Changes:
6+
# 2020-05-03: added prev_lambda option to runFEP, improved doc
67
# 2018-04-18: added interleaved double-wide sampling (IDWS)
78
# 2010-04-24: added runFEPmin
89
# 2009-11-17: changed for NAMD 2.7 keywords
@@ -12,7 +13,8 @@
1213
##############################################################
1314

1415
##############################################################
15-
# Example NAMD input:
16+
## Example NAMD input: calculation with smaller windows at
17+
## the ends
1618
#
1719
# source fep.tcl
1820
#
@@ -24,7 +26,23 @@
2426
# alchEquilSteps 500
2527
#
2628
# set nSteps 5000
27-
# set init {0 0.05 0.1}
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}
2846
# set end {0.9 0.95 1.0}
2947
#
3048
# runFEPlist $init $nSteps
@@ -38,14 +56,25 @@
3856
##############################################################
3957

4058
##############################################################
41-
# Special usage for Interleaved Double-Wide sampling
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
4265
#
43-
# Example of a piecewise calculation with restarts
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
4473
# and a nonlinear lambda schedule
4574
#
46-
## Run individual points 0, 0.05 then the series from 0.1 to 0.4
75+
## Run individual points 0, 0.05 then the series from 0.1 to 0.5
4776
#
48-
# runFEPlist [concat {0. 0.05} [FEPlist 0.1 0.4 0.1]] $numSteps true
77+
# runFEPlist [concat {0. 0.05} [FEPlist 0.1 0.5 0.1]] $numSteps true
4978
#
5079
## Continue series from 0.5 to 0.9, sampling backward dE from 0.4
5180
#
@@ -82,7 +111,7 @@ proc runFEPlist { lambdaList nSteps { IDWS false } { prev_lambda -1 } } {
82111
firsttimestep 0
83112
alchLambda $l1
84113
alchLambda2 $l2
85-
114+
86115
if { $IDWS && ($prev_lambda >= 0.) } {
87116
alchLambdaIDWS $prev_lambda
88117
}
@@ -110,14 +139,14 @@ proc runFEPlist { lambdaList nSteps { IDWS false } { prev_lambda -1 } } {
110139

111140

112141
##############################################################
113-
# proc runFEP { start stop dLambda nSteps {IDWS} }
142+
# proc runFEP { start stop dLambda nSteps {IDWS} {prev_lambda} }
114143
#
115144
# run FEP windows of width dLambda between values start and stop
116145
##############################################################
117146

118-
proc runFEP { start stop dLambda nSteps { IDWS false }} {
147+
proc runFEP { start stop dLambda nSteps { IDWS false } { prev_lambda -1 } } {
119148

120-
runFEPlist [FEPlist $start $stop $dLambda] $nSteps $IDWS
149+
runFEPlist [FEPlist $start $stop $dLambda] $nSteps $IDWS $prev_lambda
121150
}
122151

123152

@@ -188,7 +217,7 @@ proc runFEPmin { start stop dLambda nSteps nMinSteps temp} {
188217
}
189218
}
190219

191-
if { $nMinSteps > 0 } {
220+
if { $nMinSteps > 0 } {
192221
alchLambda $start
193222
alchLambda2 $start
194223
minimize $nMinSteps

stepB_alchemy_site/inputs/run.namd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,6 @@ if {!$continuing} {
136136
runFEP $lambdaStart $dLambda $dLambda $numSteps $IDWS ;
137137

138138
# 0.5ns per lambda (0.5 ns * 20 lambdas + 1ns * 1 lambda = 11ns total)
139-
set numSteps 250000
140-
runFEP $dLambda $lambdaEnd $dLambda $numSteps $IDWS ;# Invokes the runFEP script. See [Supp-Files]/common/fep.tcl for more details.
139+
set numSteps 250000
140+
runFEP $dLambda $lambdaEnd $dLambda $numSteps $IDWS $lambdaStart ;# Invokes the runFEP script. See [Supp-Files]/common/fep.tcl for more details.
141141

0 commit comments

Comments
 (0)