Constrained molecular dynamics
CP2K can constrain a collective variable during molecular dynamics with
MOTION/CONSTRAINT/COLLECTIVE. The collective variable is
defined in FORCE_EVAL/SUBSYS/COLVAR, and COLVAR in the
constraint section selects it by input order. Use
INTERMOLECULAR for a collective variable
whose atoms are not all in the same molecular object.
A fixed-distance window can be set up as follows:
&FORCE_EVAL
...
&SUBSYS
...
&COLVAR
&DISTANCE
ATOMS 1 2
&END DISTANCE
&END COLVAR
&END SUBSYS
&END FORCE_EVAL
&MOTION
&CONSTRAINT
&COLLECTIVE
COLVAR 1
INTERMOLECULAR TRUE
TARGET [angstrom] 2.0
&END COLLECTIVE
&LAGRANGE_MULTIPLIERS ON
FILENAME constraint_force
COMMON_ITERATION_LEVELS 1
&END LAGRANGE_MULTIPLIERS
&END CONSTRAINT
&MD
...
&END MD
&END MOTION
Lagrange-multiplier output
LAGRANGE_MULTIPLIERS writes two records during a velocity-Verlet step:
Shake Lagrangian Multiplierscontains the position-constraint multipliers. These are the values relevant to a configurational constraint force and constrained thermodynamic integration.Rattle Lagrangian Multiplierscontains the velocity-constraint multipliers. They enforce the time derivative of the constraint and are not a second configurational-force sample.
The values are raw CP2K internal quantities; specifying TARGET in another unit does not convert
the printed multipliers. A distance constraint therefore produces a multiplier in hartree/bohr,
while an angular constraint uses the corresponding internal angular unit. The file contains the
multipliers of all active constraints, first intramolecular constraints and then intermolecular
constraints. The ordering within each group is collective-variable, 3-by-3, and 4-by-6 constraints.
Blue-moon ensemble correction
The printed SHAKE multiplier is not, in general, a complete blue-moon estimator. For one constrained reaction coordinate \(\xi\), define the scalar mass metric
With the CP2K convention that the constraint force is \(-\lambda\nabla\xi\), the free-energy gradient contains a \(Z^{-1/2}\) reweighting and, for a general coordinate, an additional metric-derivative term. CP2K currently writes \(\lambda\) but does not evaluate or print the complete corrected blue-moon estimator. The required metric terms therefore have to be evaluated during postprocessing for the chosen reaction coordinate. See Komeiji, Chem-Bio Informatics Journal 7, 12 (2007) for the general expression and explicit algorithms for two common coordinates.
For the distance between two atoms,
Here \(Z\) is constant and the metric-derivative term is zero. The reweighting cancels, so the free-energy gradient reduces to \(-\langle\lambda\rangle_\xi\) with the sign convention above.
For the three-atom distance difference
the metric-derivative term is also zero, but
depends on the instantaneous angle. Consequently, the free-energy gradient is
This simplification applies to this specific three-atom coordinate. It must not be assumed for an arbitrary COMBINE_COLVAR, coordination number, or multiple simultaneous constraints.
Fixed windows and moving constraints
For equilibrium constrained thermodynamic integration, run independently equilibrated trajectories
at a series of fixed TARGET values, calculate the corrected free-energy gradient in every window,
and integrate it over the reaction coordinate. Check the sampling length, correlation time, window
spacing, integration direction, and unit conversion.
TARGET_GROWTH instead changes TARGET
linearly by TARGET_GROWTH * TIMESTEP at every MD step, optionally stopping at
TARGET_LIMIT. This is a moving-constraint
or slow-growth protocol. CP2K does not integrate the work or turn the resulting trajectory into an
equilibrium free-energy profile automatically. A finite pulling rate can cause lag, dissipation, and
direction-dependent hysteresis, so such a trajectory must be analysed with a method appropriate to
the intended nonequilibrium protocol.