[CP2K:3126] Re: Metadynamics Bug report in colvar: DISTANCE
Teodoro Laino
teodor... at gmail.com
Wed Mar 2 21:10:25 CET 2011
Dear Ata,
> 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)
sorry this is not the case, since the PBC are applied to the difference xi-xj and not
to xi and xj independently. See:
> ss=MATMUL(cell%h_inv,xpi-xpj)
anyway.. I try to follow your thoughts:
[..]
>
> 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
This is wrong - In fact
NINT(0.5+\epsilon) = 1
NINT(0.5-\epsilon)=0
NINT rounds its argument to the nearest whole number.
(see for definition of NINT: http://fortranwiki.org/fortran/show/nint )
Where did you find the behavior of NINT you reported above?
======
Let's make a simple 1D example using the equations you have posted. Let's assume you have a 1D cell of 10.
Your atom (j) is fixed to position 2.
Your atom (i) is in position 6.
The difference ss is equal to 4.
After a short time atom (i) continuously moves to position 7.2 -> we know that the distance is now 5.2 if you do not consider periodic boundary conditions.
Instead, if you consider PBC the real distance is a bit different - In fact, using your notation:
2266 ss=MATMUL(cell%h_inv,xpi-xpj)
ss = (1/10.)*(7.2-2) = 0.52
2267 ss=ss-NINT(ss)
ss = 0.52 - NINT(0.52) = 0.52 - 1 = -0.48
2268 xij=MATMUL(cell%hmat,ss)
xij = 10*(-0.48) = -4.8
the colvar is equal to:
ss=SQRT((-4.8)**2)=4.8
the colvar is continuously going from 4 to 4.8 passing by the maximum which is 5 (for the xi in position 7).
You have no jumps.
======
Sorry but I still cannot see any problem.
The only problem I can see is that you would have a value of 0 when the atoms would be at a distance of 10. But again in PBC the value of 10 is equal to 0. They overlap.
Regards,
Teo
>
> 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
>
> --
> You received this message because you are subscribed to the Google Groups "cp2k" group.
> To post to this group, send email to cp... at googlegroups.com.
> To unsubscribe from this group, send email to cp2k+uns... at googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cp2k?hl=en.
>
More information about the CP2K-user
mailing list