Re: Question about applying external force

From: The Cromicus Productions (thecromicusproductions_at_gmail.com)
Date: Mon Mar 06 2017 - 15:32:36 CST

Thanks for your reply, Jerome! I'm getting issues with this command (ERROR:
The following variables were set in the
configuration file but are NOT VALID:scriptedColvarForces).
This is what I wrote:

#CONSTRAINTS#
scriptedColvarForces on
colvars on
colvarsConfig separation.in

#SCRIPT
numsteps 20000

proc calc_colvar_forces { ts } {
  set omega 42.
  set A 42.
  cv colvar d1 addforce [expr {$A * cos($omega * $ts)}]
}

and I defined d1 in separation.in:

colvarsTrajFrequency 1
colvarsRestartFrequency 1
colvar {
   name d1

   distance {
      group1 {
         atomNumbersRange 1-28
      }
      group2 {
          atomNumbersRange 411-444
      }
   }
}

Any idea of what am I doing wrong? Also, can I do this procedure for two
molecules simultaneously?

On Mon, Mar 6, 2017 at 3:23 PM, Jérôme Hénin <jerome.henin_at_ibpc.fr> wrote:

> Hi Sebastian,
>
> This sounds like a job for a scripted collective variable restraint.
> <http://colvars.github.io/colvars-refman-namd/colvars-refman-namd.html#x1-810006.10>
>
> Define a variable named d made of a distance component between the two
> molecules, enable scriptedColvarForces, and then this Tcl procedure
> should do the trick:
>
> proc calc_colvar_forces { ts } {
> set omega 42.
> set A 42.
> cv colvar d addforce [expr {$A * cos($omega * $ts)}]
> }
>
>
> Best,
> Jerome
>
>
> On 6 March 2017 at 20:56, The Cromicus Productions <
> thecromicusproductions_at_gmail.com> wrote:
>
>> Hi everyone,
>>
>> I would like to consider the center of mass of two molecules and apply a
>> force F=Acos(wt) in the direction between the CMs to separate and get them
>> back. Is this possible in NAMD? Any suggestion about how to do it?
>> Thank you very much,
>>
>> Sebastian
>>
>
>

This archive was generated by hypermail 2.1.6 : Sun Dec 31 2017 - 23:21:07 CST