# Metadynamics Bug report in colvar: DISTANCE

Ata Roudgar rou... at yahoo.com
Wed Mar 2 01:47:26 CET 2011

```Hi,
I have so much fun with CP2K and really appreciate everyone who
contributes to this software. I am performing metadynamics on a system
of Triflic acids and the purpose of this metadynamics is to calculate
the activation energy or so called reconstruction free energy of
lateral proton transfer. The proton which is in form of hydronium
should overcome a hydrogen bond and travel along y direction (around
7bohr) and reach to  transition state and then provide a final state.

There is a inconsistency which introduce a bug to my metadynmics:
File   colvar_methods.F

line 2265 - 2269

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

For my system  line 2272: ss=ss-NINT(ss) is totally inappropriate.
Here is the explanation about what these lines do.

The first two lines get the coordination of two atoms which are listed
in DISTANCE colvar. ss in third line calculate the coordination
difference between these two atoms in direct coordinate (not in
Cartesian). The forth line consider periodic boundary condition which
means if the distance between two atoms during the metadynamics become
more than half of the unitcell, this line will consider the atoms of
the next unitcell to calculate the distance. Thus there will be huge
jump in my real CV (S(r)) from x to -x or from y to -y or z to -z.
This brings a huge difference between k(s-S(x)) and consequently a
huge jump in total energy. So, it might a be good idea to implement a
keyword (like the one in angle) to tell the user if he need a periodic
boundary condition or not during metadynamics. I hope it help to
improve the next version of CP2K

Regards,
Ata

```