Re: if{} statements

From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Mar 05 2013 - 07:54:53 CST

On Tue, Mar 5, 2013 at 2:46 PM, Thomas C. Bishop <bishop_at_latech.edu> wrote:
> Can someone explain how IF statements work in NAMD config files.
> See the code snippet below that was originally posted as
> "Re: namd-l: Very long simulation"
>
> There is a section in namd manual on tcl interface but in version 2.9 there
> is no information on if statements.
>
> A short explanation of "if-then-else" usage would be appreciated.
>
> (along w/ word "if-then-else" b/c searching for "if" in the manual does not
> help:-)

the if command is part of the Tcl language, so you'd have to look up
the syntax in the Tcl docs.
the Tcl tutorial is a good starting point for figuring these things
out. check out:

http://www.tcl.tk/man/tcl8.5/tutorial/Tcl7.html

for example.

axel.

> Thanks in advance
> TOm
>
>
>>>
>>> #############################################################
>>> ## ADJUSTABLE PARAMETERS ##
>>> #############################################################
>>>
>>> structure ../DMPC/dmpc_autopsf.psf
>>> coordinates ../DMPC/dmpc.pdb
>>> outputName dmpcout
>>>
>>> set temperature 300
>>>
>>>
>>> #############################################################
>>> ## SIMULATION PARAMETERS ##
>>> #############################################################
>>>
>>> # Input
>>> paraTypeCharmm on
>>> parameters par_all36_lipid.prm
>>> parameters par_all27_prot_lipid.inp
>>>
>>>
>>> # NOTE: Do not set the initial velocity temperature if you
>>> # have also specified a .vel restart file!
>>> temperature $temperature
>>>
>>>
>>> # Periodic Boundary Conditions
>>> # NOTE: Do not set the periodic cell basis if you have also
>>> # specified an .xsc restart file!
>>> if {1} {
>>> cellBasisVector1 46.2735 0. 0.
>>> cellBasisVector2 0. 46.2735 0.
>>> cellBasisVector3 0. 0. 62.3748
>>> cellOrigin 0. 0. 0.
>>> }
>>> wrapWater on
>>> wrapAll on
>>>
>>>
>>> # Force-Field Parameters
>>> exclude scaled1-4
>>> 1-4scaling 1.0
>>> cutoff 12.
>>> switching on
>>> switchdist 10.
>>> pairlistdist 13.5
>>> vdwForceSwitching on
>>>
>>>
>>>
>>> # Integrator Parameters
>>> timestep 2.0 ;# 2fs/step
>>> rigidBonds all ;# needed for 2fs steps
>>> nonbondedFreq 1
>>> fullElectFrequency 2
>>> stepspercycle 20
>>>
>>>
>>> #PME (for full-system periodic electrostatics)
>>> if {1} {
>>> PME yes
>>> PMEGridSizeX 50
>>> PMEGridSizeY 50
>>> PMEGridSizeZ 65
>>> }
>>>
>>>
>>> # Constant Temperature Control
>>> langevin on ;# do langevin dynamics
>>> langevinDamping 1 ;# damping coefficient (gamma) of 5/ps
>>> langevinTemp $temperature
>>>
>>> # Constant Pressure Control (variable volume)
>>> if {0} {
>>> useGroupPressure yes ;# needed for 2fs steps
>>> useFlexibleCell yes ;# no for water box, yes for membrane
>>> useConstantArea no ;# no for water box, yes for membrane
>>>
>>> langevinPiston on
>>> langevinPistonTarget 1.01325 ;# in bar -> 1 atm
>>> langevinPistonPeriod 200.
>>> langevinPistonDecay 50.
>>> langevinPistonTemp $temperature
>>> }
>>>
>>>
>>> restartfreq 1000 ;# 1000steps = every 2ps
>>> dcdfreq 1000
>>> xstFreq 1000
>>> outputEnergies 50
>>> outputPressure 50
>>>
>>>
>>> # Fixed Atoms Constraint (set PDB beta-column to 1)
>>> if {1} {
>>> fixedAtoms on
>>> fixedAtomsFile dmpcf.pdb
>>> fixedAtomsCol B
>>> fixedAtomsForces on
>>> }
>>>
>>> #############################################################
>>> ## EXTRA PARAMETERS ##
>>> #############################################################
>>>
>>> # Put here any custom parameters that are specific to
>>> # this job (e.g., SMD, TclForces, etc...)
>>>
>>> #############################################################
>>> ## EXECUTION SCRIPT ##
>>> #############################################################
>>>
>>> # Minimization
>>> if {1} {
>>> minimize 1000
>>> reinitvels $temperature
>>> }
>>>
>>> run 250000 ;# 0.5 ns
>>>
>>
>

--
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
International Centre for Theoretical Physics, Trieste. Italy.

This archive was generated by hypermail 2.1.6 : Wed Dec 31 2014 - 23:21:00 CST