# Constrained molecular dynamics

Constrained molecular dynamics is performed using the SHAKE algorithm.^{[1]}.
In this algorithm, the Lagrangian for the system is extended as follows:

where the summation is over *r* geometric constraints, is the Lagrangian for the extended system, and λ_{i} is a Lagrange multiplier associated with a geometric constraint σ_{i}:

with ξ_{i}(*q*) being a geometric parameter and ξ_{i} is the value of ξ_{i}(*q*) fixed during the simulation.

In the SHAKE algorithm, the Lagrange multipliers λ_{i} are determined in the iterative procedure:

- Perform a standard MD step (leap-frog algorithm):
- Use the new positions
*q*(*t*+Δ*t*) to compute Lagrange multipliers for all constraints: - Update the velocities and positions by adding a contribution due to restoring forces (proportional to λ
_{k}): - repeat steps 2-4 until either |σ
_{i}(*q*)| are smaller than a predefined tolerance (determined by SHAKETOL), or the number of iterations exceeds SHAKEMAXITER.

## How to

Geometric constraints are introduced by defining one or more entries with the STATUS parameter set to 0 in the ICONST-file. Constraints can be used within a standard NVT or NpT MD setting introduced by MDALGO=1|2|3. Note that fixing geometric parameters related to lattice vectors is not allowed within an NVT simulation (VASP would terminate with an error message). Constraints can be combined with restraints, time-dependent bias potentials (Metadynamics), monitored coordinates and other elements available within the context of MD.