Re: extracting force on a single atom

From: Jérôme Hénin (jerome.henin_at_ibpc.fr)
Date: Thu Aug 31 2017 - 08:46:28 CDT

What you need to do is define the script from the beginning, but do nothing
on the first timestep - at least not call loadtotalforces. You can use
[getstep] to keep track of the timestep.

Jerome

On 31 August 2017 at 15:38, Ben Adams <benny.adams1993_at_gmail.com> wrote:

> Thank you. So if I somehow avoid loadTotalForces at the very first
> timestep my problem will be solved? Do you have any suggestions?
> I tried to run for 20 steps and then added my tclForces script but it
> failed:
>
> FATAL ERROR: Setting parameter tclForces from script failed!
>
>
> On Thu, Aug 31, 2017 at 5:37 AM, Jérôme Hénin <jerome.henin_at_ibpc.fr>
> wrote:
>
>> Hi Ben,
>>
>> Two things here. The first one is, you probably want to use
>> loadTotalForces rather than loadForces (loadforces will only collect
>> external forces applied through TclForces). Second, with loadTotalForces,
>> data is collected at the end of one timestep and available on the next. So
>> no data will be available on the very first timestep, and then the forces
>> you'll get will be stale by one timestep.
>>
>> Best,
>> Jerome
>>
>> On 31 August 2017 at 02:18, Ben Adams <benny.adams1993_at_gmail.com> wrote:
>>
>>> Dear NAMD users,
>>>
>>> I've been looking everywhere to find a way to extract forces on a single
>>> atom. It seems the best way is to use "tclforces". Here is that part of my
>>> NAMD configuration file:
>>>
>>> tclForces on
>>> tclForcesScript {
>>> set nter [addgroup {3}]
>>> set cter [addgroup {4}]
>>> proc calcforces {} {
>>> global nter cter
>>> loadcoords coor
>>> loadforces forces
>>> print nter=$forces($nter)
>>> print nter=$coor($nter)
>>>
>>> }
>>> }
>>>
>>>
>>> Unfortunately it doesn't recognize "loadforces" and I get the following
>>> error:
>>>
>>> FATAL ERROR: can't read "forces(g1)": no such variable
>>> while executing
>>> "print nter=$forces($nter)"
>>> (procedure "calcforces" line 5)
>>>
>>> I also tried "$forces(4)" and got the same error.
>>> I search through mailing list. Such a problem is being reported several
>>> times but there are no answers to them.
>>> Can anybody help me with that?
>>> Is there any other way beside "dcdforces" (which outputs all the atoms
>>> together) to get forces for a single atom?
>>>
>>> Regards,
>>>
>>> Ben
>>>
>>>
>>
>

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