Re: Question about applying external force

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

Thanks Giacomo, excuse my ignorance, I'm currently getting " FATAL ERROR:
Setting parameter calc_calc_colvar_forces from script failed!". These are
my files:

.conf:
...
#CONSTRAINTS#

# ABF SECTION

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)}]
}

separation.in:

colvarsTrajFrequency 1
colvarsRestartFrequency 1
scriptedColvarForces on

colvar {
   name d1

   scriptedFunction calc_colvar_forces

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

}

On Mon, Mar 6, 2017 at 4:40 PM, Giacomo Fiorin <giacomo.fiorin_at_gmail.com>
wrote:

> Hello Sebastian, scriptedColvarForces is not a NAMD keyword, and should
> not be included in the main configuration file. It is provided by the
> Colvars module instead.
>
> On Mon, Mar 6, 2017 at 4:32 PM, The Cromicus Productions <
> thecromicusproductions_at_gmail.com> wrote:
>
>> 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
>>>>
>>>
>>>
>>
>
>
> --
> Giacomo Fiorin
> Associate Professor of Research, Temple University, Philadelphia, PA
> Contractor, National Institutes of Health, Bethesda, MD
> http://goo.gl/Q3TBQU
> https://github.com/giacomofiorin
>

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2018 - 23:20:09 CST