Metadynamics Bug report in colvar: DISTANCE

Ata Roudgar rou... at yahoo.com
Wed Mar 2 19:11:10 UTC 2011



> thanks for being so responsive, but I would like to make it clear that the DISTANCE cv (as is implemented in CP2K, with the name &DISTANCE) between

> two atoms (i and j) is defined as :
>
> sqrt( (xi-xj)**2 + (yi-yj)**2 + (zi-zj)**2)
>
> that  IS equal to
>
> sqrt ((-(xi-xj)*2 + (yi-yj)**2 + (zi-zj)**2)
>


No Teo, my xj is a fixed point and never change its sign and therefore
only xi when it goes far enough it becomes xi --> -xi and therefore
(xi-xj) --> (-x1-xj)

Beside, It is not that simple. There is transformation involved. ok,
let me be more precise

File   colvar_methods.F

line 2265 - 2269

2265    CALL get_coordinates(colvar, i, xpi, my_particles)
2266    CALL get_coordinates(colvar, j, xpj, my_particles)
2266    ss=MATMUL(cell%h_inv,xpi-xpj)
2267    ss=ss-NINT(ss)
2268    xij=MATMUL(cell%hmat,ss)

Line 2265 and 2266 get the cartesian coordinate of the two atoms,
xpi=(xi,yi,zi) and xpj=(xj,yj,zj)
Line 2266 there is transformation from cartesian to direct coordinate
where
   x --> A
   y --> B
   z --> C
and A, B and C are unitcell vectors therefore

first element of ss =  Ax(xi-xj)+Ay(yi-yj)+Az(zi-zj)
second element of ss = Bx(xi-xj)+By(yi-yj)+Bz(zi-zj)
third element of ss = Cx(xi-xj)+Cy(yi-yj)+Cz(zi-zj)

now, ss is the transformed version of (Ri-Rj) where Ri=(xi,yi,xi) and
Rj=(xj,yj,zj). This is needed because now all ss elements  varied from
0 to 1
Now after line 2267
ss = ss- NINT (ss)

the ss remains unchanged if its value changes between 0 to 0.5 that
means if the distance between two atoms in x direction does not go
betound of half of the length of the unitcell in x direction
everything is still fine. The smae for y and z direction. The problem
occours when the distance between two atoms (in any direction) goes
beyond the half of the length of unit cell (in that direction) in that
case

fist, second or third  element of ss lets say ss = 0.5+\epsilon  after
line 2267 the value of ss jump from 0.5+\epsilon to \epsilon because
NINT(0.5+x)=x

In line 2268 there is back transformation from direct to the cartesian
coordinate and if there is a jump on ss due to line 2267, this jump
will bring a discountinuety on the distance. This can be fixed by
removing line 2267

Cheers,
Ata




More information about the CP2K-user mailing list