Re: Feature request for the colvars module -- TCL syntax

From: Ajasja Ljubetič (ajasja.ljubetic_at_gmail.com)
Date: Tue Jan 18 2011 - 11:44:54 CST

Dear Axel,

thank you for the warning. Currently I set all the environment variable in
the same script that runs the simulations.
The purpose of this being, that I can edit all the parameters in one place.
Up to now I had no problems with mixing up the results of runs. As an added
security measure I suppose I can print the values of the environment vars to
the log file.
But of course I'll try to overdue it with the scripting stuff:)

Best regards,
Ajasja

On Tue, Jan 18, 2011 at 16:09, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:

> dear ajasja,
>
> while i can understand your excitement about using
> scripting abilities in, there is one issue that i recommend
> to take seriously before going too far with this.
>
> first off, i would advise strongly against making your
> input depend on environment variables. this adds an
> "external" element to your input and makes reproducing
> a run depend on _two_ factors: your input and the current
> environment (which may or may not be set from a script).
> this can very easily to confusion or scenarios, where you
> don't know for certain how to reproduce a given result.
> not exactly what you want to have.
>
> secondly, scripting is most valuable when you can use
> it to handle repetitive tasks and thus avoid typos or to
> guarantee that certain parts of an input are consistent.
> however, as it was already mentioned, you can do most,
> if not all, of it by simply using a preprocessor and templates
> then generating a single full input file. again, the benefit
> is that it is much easier to reproduce calculations and
> to verify that certain settings have been made exactly
> as you expect them to be.
>
> the fact that something can technically be done, does
> not always mean that it is a good idea to do it.
>
> cheers,
> axel.
>
>
> On Tue, Jan 18, 2011 at 8:17 AM, Ajasja Ljubetič
> <ajasja.ljubetic_at_gmail.com> wrote:
> > Dear Jérôme and Chris,
> >
> > In general I think that this templating system I linked to could be used
> > directly from the NAMD conf file. It would take the input template and
> > output a substituted conf file. I think something like this could be
> > implemented in pure TCL
> > #NAMD.conf
> > colvarsConfig [substify template.name out.name]
> >
> > This would then create a filled out template out.name and return the
> correct
> > file name.
> >
> > All my "problems" are basically just minor inconveniences, result from
> the
> > fact that I'm spoiled by NAMD's TCL syntax.
> > Here are some concrete examples:
> >
> > 0) I use TCL variables extensivaly in NAMD conf files here's an example:
> > #NAMD.conf
> > set strucname $env(STRUCTNAME)
> > structure $strucname.psf
> > coordinates $strucname.pdb
> > ..
> > #set length $env(LENGTH_NS) ;#ns
> > set timestep 1 ;#femtosecond
> > ..
> > #set numsteps [expr round(($length * 1000000)/ $timestep)]
> >
> > 1) Lets say I would like to change the number of samples for each bin.
> But
> > then I have to edit the number of steps to run in the NAMD conf file as
> well
> > (and I always kept forgetting this). Using TCl I could just do:
> >
> > #NAMD.conf
> > set fullsamples 500
> > set numbins 10 ;#
> >
> > ..
> > set numsteps [expr $fullsamples*($numbins+1)]
> > run $numsteps
> >
> > #colvars.in
> > colvar {
> > name chi1
> >
> > width [expr 360/$numbins]
> > lowerboundary -180
> > upperboundary 180
> > ...
> > }
> >
> > abf {
> > colvars chi1
> > fullSamples $fullsamples
> > }
> >
> > 2) Let's say I have 5 colvars and I would like to run the simulations on
> the
> > pairs of colvars. Using TCl I could have just one pair of configurations
> > files instead of 10 pairs.
> > #namd.conf
> >
> > set colvar1 chi1
> > set colvar2 chi2
> >
> > #colvar.in
> > if {[string compare "chi1" $colvar1 ] || [string compare "chi1" $colvar2
> ] }
> > {
> > .define chi1..
> > }
> >
> > if {[string compare "chi2" $colvar1 ] || [string compare "chi2" $colvar2]
> }
> > {
> > .define chi2..
> > }
> > ..
> > abf {
> > colvars $colvar1 $colvar2
> > fullSamples $fullsamples
> > }
> >
> >
> > 3) Let's say I have some similar systems (a protein labeled at different
> > positions). Using enviorment variables I could use the same pair of conf
> > files and pass the different atom ID’s like this:
> > #colvar.in
> > …
> > dihedral {
> > group1 { $env(ATOM1) }
> > group2 { $env(ATOM2)}
> > group3 { $env(ATOM3)}
> > group4 { $env(ATOM4)}
> > }
> > …
> >
> >
> >
> > Best regards,
> > Ajasja
> >
> >
>
>
>
> --
> Dr. Axel Kohlmeyer
> akohlmey_at_gmail.com http://goo.gl/1wk0
>
> Institute for Computational Molecular Science
> Temple University, Philadelphia PA, USA.
>

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2012 - 23:19:43 CST