Re: Tcl forces

From: Jérôme Hénin (jerome.henin_at_uhp-nancy.fr)
Date: Thu Jun 16 2005 - 07:19:13 CDT

Dear Manuela,

I think your problem is that loadtotalforces does not return the force for the
current timestep, but for the previous one (for the sake of parallel
efficiency). So the force that you compensate for is slightly outdated, which
unavoidably leads to a diffusion of your atom along z.

What I would do is use positional restraints (so-called "constraints" in NAMD
docs) restricted to the z-direction, with a large force constant. You should
also ensure that the center of mass of the whole system does not move,
otherwise your positional restraint will be meaningless. This has been
discussed on the list before.

Best,
Jerome

On Thursday 16 June 2005 12:51, Manuela Cavallari wrote:
> Dear all,
> my goal is to perform a simulation keeping the z coordinate of
> a particular atom fixed, whilst the x y coordinate are free.
> To this purpose, I've tried to use the Tcl interface and the
> calcforces procedure to set to zero the z component of the force
> acting on the target atom at each timestep, but without success,
> that is, the z coordinate of the target atom changes.
> Here's my tcl script:
>
> # definition of the output file
> set outcoor [open 1594.coor w]
>
> # definition of the id of the target atom
> set aid 1594
> addatom $aid
>
> # calcforces procedure
> proc calcforces {} {
>
> global aid outcoor outforc
>
> # get and print the coordinate of the target atom
> #to check the result of the calculation
> loadcoords p
> set rtarget $p($aid)
> puts $outcoor "$rtarget"
>
> # get force on the atom target
> loadtotalforces f
> if {[array exists f]} {
>
> # define the force to apply to the target atom
> set ftarget $f($aid)
>
> # z component
> set fn [lindex $ftarget 2]
> set fz [expr -$fn]
>
> # x component
> set fx 0
>
> # y component
> set fy 0
>
> lappend fzero $fx $fy $fz
>
> # add the zeroing force fzero to the target atom
> addforce $aid $fzero
> }
> }
>
> Where's the problem?
>
> If someone knows another way to fix the z component of one atom,
> please let me now!
>
> Thank you so much for the attention,
> best regards
> Manuela Cavallari

-- 
Jérôme Hénin
Equipe de Dynamique des Assemblages Membranaires
Université Henri Poincaré / CNRS
Tel : (33) 3 83 68 43 95        Fax : (33) 3 83 68 43 87
http://www.edam.uhp-nancy.fr/

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:40:50 CST