Hello CP2K developers and users,
I am running a constrained MD simulation in CP2K and trying to keep the O–H coordination number (CN) of hydroxyl groups constrained during the trajectory. However, the constraint does not seem to hold as expected.
My setup is:
&COLVAR
&COORDINATION
KINDS_FROM Oh
KINDS_TO H
R_0 [angstrom] 1.25
NN 8
ND 16
&END COORDINATION
&END COLVAR
&CONSTRAINT
&COLLECTIVE
COLVAR 1
INTERMOLECULAR
TARGET 0.88
&END COLLECTIVE
&LAGRANGE_MULTIPLIERS
COMMON_ITERATION_LEVELS 1
&END
&END CONSTRAINT
My intention is to constrain the O–H CN so that each hydroxyl oxygen keeps its single bonded H during the MD run.
However, after about 15 ps of simulation, I found from the trajectory analysis that the CN is not actually maintained. Around ~8 ps, some O atoms in OH groups lose their only H, so their O–H CN effectively becomes 0.
To diagnose this, I checked:
the O–H distances in the OH groups
the number of H atoms around each hydroxyl O as a function of time
Both analyses suggest that some hydroxyl O atoms indeed lose their bonded H during the simulation, even though the collective variable is supposed to be constrained.
My questions are:
Is this the correct way to constrain an intramolecular O–H coordination number in CP2K?
Could the use of INTERMOLECULAR here be incorrect for this purpose?
What should I do to correctly constrain the O–H coordination number to 1?
I will attach the figures and the input file showing:
O–H bond distances vs time
the number of H atoms around each hydroxyl O vs time
Any suggestions would be greatly appreciated. Thank you very much for your help.
Best regards


Hi Marcella,
Thank you very much for your helpful reply. Your explanation was very insightful and gave me a much clearer understanding of the issue.
I now realize that I was focusing too much on the distance between one specific O and one specific H, while the constrained variable in my input is actually the global coordination number defined over all Oh and all H atoms. This was a very important point, and your comment helped me see the problem from the correct perspective.
Thank you again for your clarification. It was very helpful for me.
Best regards,
Qi Zhang