• No results found

Software to Implement the Ensemble

In document Tear Film Lipid Layers - A Review (Page 55-57)

3. Implementing Mechanics and Statistical Physics into Molecular Dynamics

3.1 Software to Implement the Ensemble

The aim of MD is to simulate molecular systems and their time evolution in a way that it describes sufficiently well the behavior of the same systems in the real world. In Chapter 2 we discussed the mathematical formalism of several of the essential features that underlie molecular dynamics simulations. Next we discuss the machinery needed to apply these ideas to practice, thereby allowing us to carry out simulations and monitor the time development of a system of interest.

While the description of interactions is the core of any simulation model, here we prefer to first discuss some practical aspects and come back to the description of interactions in Section 3.5, where we discuss related themes in greater length.

48

3.1.1 Describing Time in Molecular Dynamics – the Integrator

The heart of MD is the integrator. The integrator creates the time evolution to the system in the form of small and discrete time increments, Δt. The integrator takes the mathematical formulas of the mechanical forces, and applies them to the simulation system, and based on those re-calculates and re-distributes the velocities to the molecules.

The integrator’s action is quite simple. First the algorithm checks the positions and velocities of the atoms and molecules. Then it calculates the forces acting on each particle at a given moment. Then the algorithm moves time by one time step Δt, and calculates a new set of coordinates and velocities based on the forces acting on the particles in the system.

There are several common integrators, which differ from each other by their complexity [102, 128-129]. The most common integrators are the Leap Frog and the velocity-Verlet algorithms [143-144].

Here, as an example of an integrator, is given the pseudocode of the Leap Frog algorithm:

(23)

The algorithm describes the evolution of the system from the time step n to the time step n+1, i.e., it advances the simulation by one time step Δt. In this algorithm the velocities are calculated in the middle of the time steps – half way between time steps n-1 and n, and time steps n and n+1, respectively. This is one of the examples of how the different integrators differ from one another – at which point each of the components, the velocities, the positions, and the forces acting on the particles, are calculated. Other differences include e.g. the number of terms used in the integrator to predict the next positions and velocities. The more terms are used, the more accurate is the integrator, but increasing the number of terms also decreases the integrator’s computational performance.

Each integrator algorithm has its own pitfalls – some are more prone to propagate rounding errors in the calculated values, some do not produce accurate values of the velocities, and others are computationally expensive [128]. One of the requirements that is considered to be crucial in MD simulations is the integrator’s ability to generate time reversible trajectories. Time reversibility (more generally symplecticity) is an

1 1/2 1/2 1/2 n n n n n n

t

t

m

   



'



'

r

r

v

F

v

v

important property since it implies, e.g., conservation of energy during the time integration process.

The leap frog integrator is probably the most commonly used one, as even though it is computationally a little more expensive than some of the others, it can reproduce the velocities correctly, and is not prone to propagate rounding errors in the numerical computations [128].

3.1.2 Simulating with the Integrator

Each MD software package has the integrator as their hard coded “core” of the whole program [131-135]. It is usually just the integrator together with computations of forces, which use the most of the computational resources of the simulation. The simulation programs have highly optimized performance of their integrators, and that is the reason why each program usually provides only one, or perhaps two, different integrators to choose from. When one has selected the software one will be using, the integrator is thus already pre-determined for the user.

The only thing one needs to keep track on when running the simulations with the integrator, is the nature of one's own simulation system – as the properties of the atoms and molecules in the system should be taken into account when the time step Δt is selected in the beginning of the simulation run. The rule of thumb is to use a time step of the size of approximately 1/20 of the fastest oscillatory motion (for example bond vibration) of the system [128]. Usually the by far fastest motion is the hydrogen vibration. If hydrogen bonding is not essential for the system described, it is thus highly recommended to freeze the bond length of hydrogen atoms, or not describe them as separate atoms at all but instead describe for example the methyl group -CH3 as a single entity instead of one carbon and three hydrogens. This speeds up the simulation significantly, as the time step can be set much higher when the hydrogen vibrations need not to be taken into account [128, 138].

In document Tear Film Lipid Layers - A Review (Page 55-57)