problem with colvars: writeTIPMF and writeTISamples give quite different results

Dear LAMMPS users,

I am trying to use colvars to obtain the PMF, and I set the

pnipam.colvars.inp (573 Bytes) (938 Bytes) (2.13 KB) (489 Bytes) (319 Bytes)

HP.3000000.pmf (369 Bytes)

HP.colvars.state (166 KB)

HP.mtd_pot.ti.count (312 Bytes)

HP.mtd_pot.ti.grad (354 Bytes) (299 Bytes)

HP.mtd_pot.ti.grad.est (290 Bytes)

HP.mtd_pot.ti.grad.histo (243 Bytes)

HP.mtd_pot.ti.grad.pmf (281 Bytes)

HP.mtd_pot.ti.pmf (787 Bytes)

It is me again.

I made a simple test. The system contains two particles with LJ 12-6 potential, the distance between the particles is the CV. Thus the PMF should be exactly the LJ 12-6 potential.

The file related to the

LJ.2000000.pmf (3.15 KB) (699 Bytes)

LJ.mtd_pot.ti.count (2.2 KB)

LJ.mtd_pot.ti.grad (3.53 KB) (3.03 KB)

LJ.mtd_pot.ti.grad.est (2.89 KB)

LJ.mtd_pot.ti.grad.histo (2.54 KB)

LJ.mtd_pot.ti.grad.pmf (2.77 KB)

LJ.mtd_pot.ti.pmf (6.5 KB)

pnipam.colvars.inp (465 Bytes) (277 Bytes)

Hello Wei, thanks for being thorough. In many cases (i.e. one-dimensional problems), you would probably want to just use writeTIPMF.

The problem is a difference in the sign of the contents of the .grad file, which contains the mean force when written by writeTISamples, but abf_integrate expects the free-energy gradient (i.e. the negative of the force). The former is consistent with what you would obtain from a trajectory produced with outputTotalForce on, while the latter is consistent with the ABF method, which stores the free-energy gradient internally. Both conventions are documented, but there is no specific warning about the difference, which I’m adding now.

Depending on the shape of the PMF, it may be more difficult to converge the fitting procedure with the opposite sign, because abf_integrate uses a metadynamics-like Gaussian potential, which only has positive signs.

I’d like to change the extension of the file produced by writeTISamples from .grad to .force, to clarify the difference. Feel free to add your thoughts here:

Again, thanks for checking the inconsistency and pointing it out.