3. Implementing Mechanics and Statistical Physics into Molecular Dynamics
3.3 Simulating Molecules
We have now seen how the thermodynamic ensembles can be reproduced in simulations as additions to the integrator. However, even assigning the new velocities to the atoms in the integrator is not a straightforward process. Often a completed integrator step leads to violations of bond lengths or angle bending, or brings molecules too close to each other. All this imposes large forces to the atoms and molecules of the system, but the MD algorithm is usually capable of dealing with these forces. And if not – the system crashes, and the simulation needs to be restarted.
All simulations can crash due to excessive forces, but the probability of such an event can be lowered by a pre-minimized starting configuration, to get reasonably close to energy minimum configurations for all molecules of the system, before starting the simulation run. Sometimes that is not enough, however. It is sometimes a good idea to use bond and angle constraints to calm the system down before releasing all restraints and starting an unconstrained simulation run [138]. Constraints can be needed in the beginning of the simulation also for simply speeding up the system – for example constraining all bonds of hydrogen atoms speeds up simulations significantly, as mentioned already in the previous Section [128, 138].
Thus, to keep the simulations stable and fast, we need two new algorithms. One to energy minimize the starting structure to be able to start the simulation from as stable conformation as possible, and another to implement the constraints to the system during the integrator protocol, to speed up the simulations and prevent systems from crashing.
3.3.1 Steepest Descent Algorithm for Setting up the Starting Configuration
For minimizing the system configuration and molecular configurations before the simulation run, one can use specific algorithms, which simply calculate all the forces that the bonds, angles, rotation barriers and molecule-molecule contacts cause to the system. The algorithm relaxes the system by moving the atoms step by step towards the steepest crescent of their potential energy, hopefully finally reaching a configuration near the global configuration minimum for the whole system. This is for example how the STEEP algorithm implemented in GROMACS works [138].
As a result of the energy minimization process, the molecules can of course get stuck in a local minimum. If that happens, one can reconstruct the structure to be minimized to avoid that, and run the algorithm again and hope for better outcome. Another option is to use some more elaborate configuration minimization protocols, such as simulated annealing [127- 128]. In simulated annealing the system is heated to a high temperature to allow considerable conformational freedom, and then slowly cooled down afterwards. Doing this provides a better chance that no molecules get stuck to the local minima in the conformational space. When using this kind of approach one needs to be careful, though, as some molecular isomerizations not possible in room temperature can take place in the high temperature phase of the simulated annealing protocol. One thus needs to protect the stereochemistry of the molecules by for example adding angle constraints to the system when running the annealing.
3.3.2 Implementing Holonomic Constraints for Molecules
In cases where there are bond or angle constraints in the MD system, one needs a way to set the constrained bonds and angles back to their equilibrium values, after the MD integrator has updated the positions of the atoms in the simulation system, possibly violating these constraints. Specific algorithms have been developed for this.
In GROMACS there are three different algorithms – the SHAKE, SETTLE and LINCS algorithms [152-155].
SHAKE is an iterative protocol, which solves equations of motion in the Lagrangian formalism, taking into account the holonomic constraints in the molecules (the constrained bonds and angles). The protocol is iterative, and stops only when a satisfactory solution for all atoms has been found, or a pre-set maximum number of iterations is reached [152].
Another possibility to set the constrained bonds and angles back to their right values is an algorithm called LINCS (LINear Constraint Solver) [154- 155]. LINCS does not use iterations, but rather stores all the force gradients the constraints impose to the system in a single matrix, and moves all the atoms towards the gradient of the matrix in one step. In most cases the procedure leads to satisfactory results such that no iterations are needed. But if one wishes, one can also do up to four iterations of LINCS, to make it absolutely sure that the constraints are well taken care of. To speed up simulations even more, many software packages also provide a fast constraint solver for water molecules only. Very often most of the simulation box is full of water, and most of the simulation resources are
56
used to simulate water molecules. To accelerate the simulation up, one often imposes bond and angle constraints for the water molecules to reduce the time one spends simulating ”only water”. To get full advantage of this, for example the GROMACS software provides a fast and efficient version of SHAKE to take care of the iterative solving of constraints of water molecules. That program is called SETTLE, and it indeed speeds up the simulation significantly [153].