Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Binder

Constraints

Constraint simulations

Constraints2.png

Conformational behavior of a flexible molecule = complex superpositions of different motions

  • Translational motion of the center of mass

  • Rotatiotional motion determined by the torque about the center of mass

  • Conformational changes and vibrations

Usually: High-frequency motions (e.g. bond vibrations) are of less interest, but they dictate the timestep of the simulation.

Constraints3.png

C-H bond stretching of hydrocarbons: 2800-3300 cm1^{-1}

  • Compute frequency: 90THz = 90101290\cdot10^{12} cycles per second

  • Period of one cycle: 110141\cdot10^{-14}s = 10fs

  • Appropriate timestep: 0.5-1~fs to sample a few points per cycle

Constraints4.png

Constraint dynamics enables individual, internal coordinates or combinations thereof to be constrained (= fixed) during the simulation without affecting the other degrees if freedom.

Important: Constraint \neq restraint!

  • Constraint: Bonds or angles are forced to adopt specific values, and the respective degrees of freedom have no energy associated with them.

  • Restraint: Restrained bonds or angles may deviate from the desired value, the restraint is only an additional term in the forcefield. The respective degree of freedom still has an energy associated with it.

Holonomic vs non-holonomic constraints

Holonomic constraints can be expressed in the form

f(q1,q2,q3,...,t)=0f(q_1, q_2, q_3, ... , t) = 0

where qiq_i = coordinates of particle ii

Example:

  • Holonomic: Particle with coordinates rr is constrained to always lie on the surface of a sphere with radius aa, r2a2=0r^2 - a^2=0

  • Non-holonomic Particle with coordinates rr can lie on the surface of a sphere with radius aa or may fall off, r2a20r^2 - a^2\geq0

Constraint6a.jpg

A simple constraint from classical mechanics

constaint7a.jpg

Box is constrained to always remain on the slope, must therefore always satisfy the equation of the slope y=mx+cy = mx+c Without constraint: Box would fall vertically

Gravitational force pulls down along yy dimension, but actual motion is along slope. The total force is the sum of a force due to gravity, and due to a constraint force (perpendicular to the surface, does no work since no motion in this direction, i.e. does not change the energy)

Degrees of freedom, and number of coordinates:

  • Unconstrained system: 3NN degrees of freedom from 3NN independent cartesian coordinates

  • With kk holonomic constraints: 3NkN-k degrees of freedom, which can be described using 3NkN-k generalized coordinates

E.g. for box: 2 degrees of freedom (xx and yy coordinate of box) boils down to a single degree of freedom/generalized coordinate qq under constraint of the slope.

Generalized coordinate qq along the direction of the slope

  • Component of the gravitational force along the slope: MgsinθMg\mathrm{sin}\theta Constraints9.png

  • Acceleration down the slope: gsinθg\mathrm{sin}\theta

  • Equation of motion:

    d2qdt2=gsinθ\frac{\mathrm{d}^2q}{\mathrm{d}t^2} = g\mathrm{sin}\theta
  • Solution:

    q(t)=q(0)+tq˙(0)+t22gsinθq(t) = q(0) + t \dot{q}(0)+\frac{t^2}{2}g\mathrm{sin}\theta

Generalized coordinates can be difficult to find for systems with multiple constraints, it is therefore preferable to work with cartesian coordinates instead:

Md2xdt2=FcxM \frac{\mathrm{d}^2x}{\mathrm{d}t^2} = F_{cx}
Md2ydt2=Mg+FcyM \frac{\mathrm{d}^2y}{\mathrm{d}t^2} = -Mg + F_{cy}

where FcxF_{cx} and FcyF_{cy} are the components of the constraint force.\[0.5cm]

Since the constraint force is perpendicular to the slope, the ratio of the components is given by

FcxFcy=m\frac{F_{cx}}{F_{cy}} = -m

We use this by setting Fcy=λF_{cy}=-\lambda, which yields in turn Fcx=λmF_{cx}=\lambda m.

We thus get the three equations (two for the equations of motion and one for the constraint):

Constraints10.png

which we can solve using the Lagrange multiplier method. Since σ(x,y)=0 \sigma(x,y)=0 for all x,yx,y, we can also infer that dσ=0\mathrm{d}\sigma = 0 and d2σ=0\mathrm{d^2}\sigma = 0 so that we can reformulate the constraint equation to:

Constraints11.png

Solving the three equations gives:

d2xdt2=gm1+m2\frac{\mathrm{d}^2x}{\mathrm{d}t^2} = -g \frac{m}{1+m^2}

d2ydt2=gm21+m2\frac{\mathrm{d}^2y}{\mathrm{d}t^2} = -g \frac{m^2}{1+m^2}

which returns the time dependence for xx and yy:

x(t)=x(0)+tdx(0)dtgt22m1+m2x(t) = x(0) + t\frac{\mathrm{d}x(0)}{\mathrm{d}t}-g\frac{t^2}{2} \frac{m}{1+m^2}

y(t)=y(0)+tdy(0)dtgt22m21+m2y(t) = y(0) + t\frac{\mathrm{d}y(0)}{\mathrm{d}t}-g\frac{t^2}{2} \frac{m^2}{1+m^2}

Constraints in MD

Forces from intra- and intermolecular interactions + forces from constraints

Constraint σk\sigma_k requires a fixed bond length between atoms ii and jj:

Fckx=λkσkxF_{ckx} = \lambda_k \frac{\partial\sigma_k}{\partial x}

where λk\lambda_kis the Lagrange multiplier, xx is one of the Cartesian coordinates of the two atoms. The constraint is then

σij=(rirj)2dij2=0\sigma_{ij} = (\overrightarrow{r}_i-\overrightarrow{r}_j)^2-d_{ij}^2 = 0

which gives

σkri=2(rirj)\frac{\partial\sigma_k}{\partial \overrightarrow{r}_i} = 2(\overrightarrow{r}_i-\overrightarrow{r}_j)

σkrj=2(rirj)\frac{\partial\sigma_k}{\partial \overrightarrow{r}_j} = -2(\overrightarrow{r}_i-\overrightarrow{r}_j)

We can therefore rewrite the forces as (incorporating the factor 2 into λ\lambda):

Fci=λ(rirj)F_{ci} = \lambda (\overrightarrow{r}_i-\overrightarrow{r}_j)

Fcj=λ(rirj)F_{cj} = -\lambda (\overrightarrow{r}_i-\overrightarrow{r}_j)

This can be incorporated into the Verlet algorithm:

ri(t+Δt)=2ri(t)ri(tΔt)+Δt2miFi(t)+kΔt2miλkrij(t)\overrightarrow{r}_i(t+\Delta t) = 2\overrightarrow{r}_i(t) - \overrightarrow{r}_i(t-\Delta t) + \frac{\Delta t^2}{m_i}\overrightarrow{F}_i(t) + \sum_k\frac{\Delta t^2}{m_i}\lambda_k\overrightarrow{r}_{ij}(t)

where the summation is over all constraints kk that affect atom ii. The last term thus perturbs the positions that would have been obtained without constraints.

ri(t+Δt)=ri(t+Δt)+kΔt2miλkrij(t)\overrightarrow{r}_i(t+\Delta t) = \overrightarrow{r}'_i(t+\Delta t) + \sum_k\frac{\Delta t^2}{m_i}\lambda_k\overrightarrow{r}_{ij}(t)

Determine multipliers λ\lambda. E.g. for a diatomic molecule:

r1(t+Δt)=r1(t+Δt)+Δt2m1λ12(r1(t)r2(t))\overrightarrow{r}_1(t+\Delta t) = \overrightarrow{r}'_1(t+\Delta t) + \frac{\Delta t^2}{m_1}\lambda_{12}(\overrightarrow{r}_{1}(t)-\overrightarrow{r}_{2}(t))

r2(t+Δt)=r2(t+Δt)Δt2m2λ12(r1(t)r2(t))\overrightarrow{r}_2(t+\Delta t) = \overrightarrow{r}'_2(t+\Delta t) - \frac{\Delta t^2}{m_2}\lambda_{12}(\overrightarrow{r}_{1}(t)-\overrightarrow{r}_{2}(t))

r1(t+Δt)r2(t+Δt)2=r1(t)r2(t)2=d122|\overrightarrow{r}_{1}(t+\Delta t)-\overrightarrow{r}_{2}(t + \Delta t)|^2 = |\overrightarrow{r}_{1}(t)-\overrightarrow{r}_{2}(t)|^2 = d_{12}^2

Which gives us three equations with three unknown r1(t+Δt)\overrightarrow{r}_{1}(t+\Delta t), r2(t+Δt)\overrightarrow{r}_{2}(t+\Delta t), and λ12\lambda_{12}, which can be solved easily.

For many constraints: Solving for Lagrange multipliers becomes equivalent to inverting a k×kk \times k matrix even when we ignore quadratic terms in λ\lambda

Commonly used algorithms are: SHAKE (Ryckaert, Cicotti and Berendsen 1977) Use the above scheme (with the Verlet integrator). Solve each constraint in turn. Since satisfying one constraint might cause the violation of another, it is necessary to iterate around the constraints until they are all satisfied within some tolerance

SHAKE_algorithm.png By Pedro Gonnet - Own work, CC BY 3.0, https://commons.wikimedia.org/w/index.php?curid=117923908

RATTLE (Andersen 1983) Implementation using Velocity Verlet integrator. This also requires the velocities to be corrected (not only the positions)\[0.5cm]

Many others all differing in how they solve for λ\lambda