[gmx-developers] fshift

Erik Lindahl lindahl at stanford.edu
Fri Jun 6 20:51:14 CEST 2003


On Friday, June 6, 2003, at 08:28  AM, David wrote:

> On Fri, 2003-06-06 at 20:30, Daniele Bemporad wrote:
>> Hi all, hi David
>> In the previous e-mail I forgot to also ask about "fshift[is3]" in
>> innerc.c and its arguments is3, is3+1, is3+2.
>> The problem is that if I change the calculation of the force and I 
>> update
>> the variable "f [atom number] [x, y or z axis]" , I get NO effect on 
>> the
>> atomic positions, unless I also update this (still mysterious to me)
>> variable "fshift". What is this about ? Can please anybody tell me 
>> what
>> exactly the 2 elements of the array are in bonded and non-bonded
>> interactions: fr->fshift[1st_element][2nd_element] ?
> If your modification has no effect, then you may be using another
> routine than you think you are (there are > 70 different innerloop
> routines). Bonded forces are somewhat more straightforward.

I think this was for bondfree.c, so it's only bonded interactions.

One subtle detail is that we often reference the array as 
one-dimensional in the core routines for performance reasons. Thus, 
instead of doing

fr->fshift[is][YY] = ....

we often cast the array to a float pointer and do

fr->fshift[is3+YY]= ...

This avoids a pointer dereference, and saves multiplications when 
updating both X,Y,Z dimensions.



More information about the gromacs.org_gmx-developers mailing list