Re: On-the-fly modification of tclforces script?

From: Jim Phillips (jim_at_ks.uiuc.edu)
Date: Tue Nov 10 2015 - 09:53:42 CST

Hi Tristan,

In NAMD 2.11b1 you can do the following:

tclForces on
tclForcesScript {
}
startup
while ( 1 ) {
   clearconfig ; # drop previously requested atoms
   source forcescript.tcl
   run 200
}

The main function of the tclForcesScript is to delay tclForces setup until
after startup has progressed far enough to process atom lookup commands.
You can give it /dev/null or an inline script with at least one newline as
above. I could make tclForcesScript optional, but I think keeping it
mandatory results in clearer error messages for new users.

The "startup" command is like "run 0" without the force calculation, so it
won't notice that you haven't defined a calcforces proc. Without the
"startup" command you would need to do this:

tclForces on
tclForcesScript {
   proc calcforces {} { }
}
run 0
..

Note that in 2.11b1 if you want total forces on atoms/groups you need to
explicitly request them. For backwards compatibility use "catch":

tclForces on
tclForcesScript {
   catch { enabletotalforces }
   proc calcforces {} { }
}

Also, since you're hoping to push updates from VMD, you at least need to
use an atomic filesystem operation like rename to update forcescript.tcl
so NAMD doesn't see an incomplete file, or you could use sockets. For an
example see the file lib/replica/namd_replica_server.tcl in NAMD 2.8.

Jim

On Tue, 10 Nov 2015, Tristan Croll wrote:

> Hi all,
>
>
> I'm looking for a way to add some more complex interactions to interactive MD simulations (e.g. to force a defined group of atoms into a particular conformation). Preferably I'd like to be able to do this on-the-fly without having to restart the simulation. Would an approach something like the following in the NAMD configuration file work?
>
>
> tclForces on
>
>
> while {1} {
>
> tclForcesScript forcescript.tcl
>
> run 200
>
> }
>
>
> .. with forcescript.tcl being modified/replaced as necessary from within VMD?
>
>
> Thanks,
>
>
> Tristan
>

This archive was generated by hypermail 2.1.6 : Tue Dec 27 2016 - 23:21:31 CST