Print forces for flat-bottom position restraint during MD at every step

GROMACS version: Any version
GROMACS modification: Yes
Here post your question

Dear All,

I would like to calculate the osmotic pressure from the MD simulation by applying the flat bottom potential. For this, I need to print the corresponding forces at every MD step, which can only be done by modifying the source code (as far as I know).

I need to modify the following part of the code src/gromacs/pulling/pull.cpp to print the forces,

if ((pcrd->params.eType == epullFLATBOTTOM && dev < 0)
|| (pcrd->params.eType == epullFLATBOTTOMHIGH && dev > 0))
{
dev = 0;
}

        pcrd->scalarForce = -k * dev;
        *V += 0.5 * k * gmx::square(dev);
        *dVdl += 0.5 * dkdl * gmx::square(dev);

But, it is not working for me. Could you please help me with the source code? Thanks.

Regards,
Sandeep

What doesn’t work?
There is no print statement in the code above.