Simulation Algorithm That Conserves Energy and Momentum for Molecular Dynamics of Systems Driven by Switching Potentials
Whenever there exists a crossover from one potential to another, computational problems are introduced in Molecular Dynamics (MD) simulation. These problem are overcome here by an algorithm, described in detail. The algorithm is applied to a 2-body particle potential for a hysteresis loop reaction model. Extreme temperature conditions were applied to test for algorithm effectiveness by monitoring global energy, pressure and temperature discrepancies in an equilibrium system. No net rate of energy and other flows within experimental error should be observed, in addition to invariance of temperature and pressure along the MD cell for the said system. It is found that all these conditions are met only when the algorithm is applied. It is concluded that the method can easily be extended to Nonequilibrium MD (NEMD) simulations and to reactive systems with reversible, non-hysteresis loops.
The packages used extensively for biophysical simulations include CHARMM, GROMACS, DL_POLY, IMD, and AMBER [1–5] where routine model reactions are not included. This is a significant limitation at attempting to model processes. One of the many reasons is that in the space of potential interactions, it is not so easy to specify when a species comes into existence, and when it ceases to exist; these criteria at the molecular level seems to be arbitrary or subjective, and macroscopic level designations are not always applicable. Another reason is that the complex potentials are not single-valued and would require costly 3 body interaction calculations. Probably newer phenomena—from the simulation point of view—might be uncovered if cost-effective reactive potentials could be used. The current algorithm is primitive enough to provide first steps in this direction for very large molecular assemblies encountered in Biophysical simulation where -body () potentials would be currently prohibitive in terms of computational time. This work presents a simple dimeric single bond reaction as an example of how reactions can be included. From these tests, it is concluded that the method can easily be extended to reversible chemical systems. The theory is general and works for -body interactions for the coordinates involved in any cross-over trajectory irrespective of the degree of interaction. Recently, a 3-body potential modeled after the method of Stillinger  was used to study a chemical reaction at relatively low temperatures where by assumption, no precautions were taken into account for changes due to the steep gradients in the potential. While such methods might obtain for non-synthetic MD when the temperature and other thermodynamical variables are relatively small in magnitude, implying low velocities of the particles, more care must be taken at extremely high temperatures. Synthetic MD methods—meaning those techniques where the equations of motion are solved so as to replicate the ensemble probability distribution of the specified Hamiltonian and where the temperature, pressure, and other thermodynamical variables are introduced into a pseudo-Hamiltonian directly so that the successive trajectory coordinates can be computed at any time, with fixed temperature or pressure variables, [7–10]—unlike non synthetic methods where thermostats and barostats are placed in possibly localized regions by perturbing the system, are probably more immune to energy violations due to the artificial nature of computing the particle trajectories. We note that the gerund forms such as "thermostatting” for thermostat has been used routinely to refer to the application of a method to a simulation to control temperature [11, pages 143–144, 535]. The same applies for the gerund forms of barostats [11, pages 158–160] which refer to a method for controlling the pressure of a system under simulation. However, even for synthetic simulations, conservation of energy, and momentum at crossovers could lead to less fluctuation of the quantities or variables which appear and are set in the apparent or synthetic Hamiltonian. Thus various dispersion and variance relationships, from which quantities like the Specific Heat are derived, would differ from those described by a nonsynthetic Hamiltonian. Elementary statistical mechanics and the Boltzmann theorem all indicate that in systems with a conservative Hamiltonian, the equilibrium state would be that in which equipartition of energy and the Maxwell distribution of velocities would obtain, and this would always be the case as the system relaxes to equilibrium; hence the temperature too, as determined by the equipartition result . For large enough systems in terms of number of free coordinates, these results imply that once a system has reached equilibrium, it would persist in that state indefinitely. If, therefore, the simulation algorithm were perfect, it would evolve about an equilibrium trajectory indefinitely. There would, therefore, be no need to "thermostat” any closed system. For canonical and other ensembles, on the other hand, where energy exchange is investigated, then thermostatting would be required even for perfect algorithms that produce for each discrete time step the exact trajectory as would be produced in principle by integrating exactly the equations of motion. For the majority of cases however, thermostats are used just to maintain a particular temperature for a system at either local or global equilibrium. Hence, one can conclude for these cases that thermostats are implemented as a corrective to imperfect trajectory algorithms that does not constantly place the system on an equilibrium trajectory, as required by the theorem; that is, it would appear that in the majority of instances, thermostatting in equilibrium systems is related to the fact that one's algorithm is imperfect in the sense that it cannot compute a bona fide equilibrium state. This can only be the case if accumulated machine and computational errors create a trajectory not corresponding to a microcanonical or canonical ensemble of states. Hence, for these situations, thermostatting refers to the implementation of algorithms that forces the system to adopt on average a canonical or microcanonical distribution of energies among the principle components within the system. In synthetic methods, the "actual” trajectory is not traced, but one that reproduces a canonical trajectory, but even here, opinions differ as to how accurately these trajectories are traced. Indeed, recent work seems to show that external perturbations can modify the "noise” spectrum of a natural system. For instance, the presence of an external random contribution to a high-frequency periodic electric field can reduce the total noise power . This suggests that some natural properties connected to time correlation functions is a function of external perturbations and so one may conclude that basic synthetic methods may not include such elements of stochasticity. Another interesting observation of [12, 13] is the use of Monte Carlo techniques to model the system. In this case, Monte Carlo is used to simulate the dynamics of electrons in the semiconductor lattice by taking into account stochastic averaging. This is to be contrasted with the method here of attempting direct (and approximate) integration of the equations of motion, moderated by probabilistic inputs of energy at the ends of the box to simulate a "thermostat.” One guess is that such Monte Carlo methods might be suitable if the details of molecular motion are not being investigated, and that given that a particular form of behavior is accepted, then one might superimpose stochasticity upon it through a Monte Carlo algorithm to simulate scattering phenomena, which includes temperature control. One possible problem with synthetic methods is that if a phenomenon is due to the system being in a particular phase space of a particular fixed Hamiltonian, then such events may not be detected or may be underrepresented in these synthetic methods. An overview of some of the above is in order. In the Nosé-Hoover method, one defines a Lagrangian for the system coordinates as where is the temperature parameter. This so-called Lagrangian defines the conjugate momenta to and as, respectively, and . Then for this system, there results ultimately a pseudo-Hamiltonian: whose trajectory is determined by the coupled equations that must be solved: where the last equation in superfluous. Equation (1.3) is solved by special and time consuming techniques that are not typical of those used for the standard Hamiltonian, such as the well-known Verlet and Gear algorithms. An analogous set of equations can be derived for constant pressure studies . Another algorithm to correct for machine errors in following a PES is temperature-coupling method of Berendsen et al.  which has been widely used in many systems but it is claimed [11, page 161] that the canonical distribution is not produced "exactly.” In this method, the velocities are scaled every time step by factor given by The upshot of the above is that these algorithms can be viewed as some sort of corrective procedure used to overcome problems of trajectory calculation accuracy for the rather simplistic, single-valued potential that are used for nonreactive systems due to the nonperfect integration of the equations of motion . Paradoxically perhaps, the theories that were developed never allude to the machine error basis behind equilibrium thermostatting, which is not required by the theorem when the system relaxes to equilibrium, and thus hardly any reference is made to the error in the computations of their new equations of motion that incorporates fixed thermodynamical variables like the pressure or temperature. It may be argued that they were referring to the canonical ensemble, but a careful examination of the Nosé justification of the method refers to a microcanonical phase space trajectory with the delta function having a component form . This might imply that machine error was not the foremost reason for the invention of the algorithms together with the accompanying theory. To date however, there has been little—if any—development in providing corrective measures to trajectory calculations for multivalued and other potentials which require switches to transfer trajectories from one PES to another for various molecular species which involve the variables pertaining to the surfaces. This particular review refers to one such attempt, which will be described in detail in what follows.
For both synthetic and nonsynthetic methods using -body potentials, various switches and lists would have to be created to keep track of which potential energy surface a particle can transit to, and exit from, in order to define when a molecule is formed or destroyed in a reaction. Nonsynthetic Nonequilibrium Molecular Dynamics (NEMD) does not presuppose a theory concerning molecular interactions and therefore if new phenomena and relationships are sought in simulation studies, making use of quantitative values for the mechanical variables, conservation algorithms would have to be employed for systems with multipotential surfaces. In such studies, especially under extreme conditions, algorithms that can control energy and momentum variations so that larger time steps could be utilized seem essential; for nonsynthetic methods, they would be essential because gradients of energy flow could be artificially induced by violation of energy and momentum conservation due to the extreme potential gradients, thereby compromising any quantitative studies in nonequilibrium energy flows in NEMD simulations where gradients of thermodynamical variables exists by imposed boundary conditions. To initiate such studies, especially at extreme conditions, an algorithm was devised to correct for such momentum and energy conservation violations at crossover points in the potential curves due to reactions. The method is applicable to any -body interaction system; in our case, we use a 2-body interaction system with switches that can turn on the potentials at prescribed distances.
The model reaction simulated may be written as where and are the forward and backward rate constant, respectively. The reaction simulation was conducted at high temperatures not used ordinarily in simulations of (Lennard-Jones) fluids where the reduced temperatures (all units used are reduced ones ) ranges 0.3–1.2,  whereas here, , well above the supercritical regime of the fluid. At these temperatures, the normal choices for time step increments do not obtain without also taking into account energy-momentum conservation algorithms in regions where there are abrupt changes of gradient [11, 17, 18]. The global literature does not seem to cover such extreme conditions of simulation with these precautions. The simulation was at density with atomic particles. The potentials used are as given in Figure 1 where for the vicinity where the bond of the dimer is broken (2 free particles emerge) and is the point along the hysteresis potential curve where the dimer is defined to exist for two previously free particles. The reaction proceeds as follows: all particles interact with the splined pair potential except for the dimeric pair formed from particles and which interact with a harmonic-like intermolecular potential modified by a switch given by where is the vibrational potential given by (1.7) The switching function is defined as where The switching function becomes effective when the distance between the atoms approach the value (see Figure 1). Some of the other parameters used in the equations that follow include (exact value is determined by the other input parameters), . Switches are commonly encountered in theoretical accounts of complex interactions, such as found in polymer interactions and in chemical reactions. There are many flavors of switch categories, and some are more effective than others in forcing the merging of one potential type to another for a given distance defined by a metric [19–23]. The ideal switch would resemble a Heaviside step function but such functions cannot be so easily incorporated into the dynamical equations of motion which feature continuous variables because the various orders of differentials must be defined and computable over the discrete time steps. For instance, a switching function with several known applications, including those from statistical mechanics is given by the form : where and are defined constants and the s represent distances. For various optimization schemes to check for global minima, such as claimed in the Hunjan-Ramaswamy global optimization method, switches such as the function of the following form has been used : where is a time-dependent variable. On the other hand, for cluster dynamics, a switch of the form [21, equation 7], is used, where the parameters and are adjusted to minimum energy of sub-clusters according to their species partitioning scheme. Switches without explicit details have been mentioned in other complex molecular structural studies to define topologies . Similarly, switching functions to demarcate potential boundaries [23, equations 5, 6] about bonding angles and bond distances having the forms below have been used:
The above all refer to clearly defined spatial boundaries where there is a change of potential interaction type. In stochastic analysis [24, page 4] of response functions to a symmetric dichotomous switch variable having values , analytical values may be derived for the flow variables. The situation here, on the other hand, is not stochastic where the particle trajectories are concerned, and the rate laws can only be determined through simulation and integration of the system Hamiltonian with the system potential given by (1.6). Coming back to our description of the particle dynamics and the switch function, our particles and above also interact with all other particles not bonded to it via . Details of these potentials and their interactions are given elsewhere ; here we note the high activation energy at of approximately . At , the molecular potential is turned on where at this point there is actually a crossing of the potential curves although the gradients of the molecular and free potentials are "very close." On the other hand, at , the switch forces the two curves to coalesce, but detailed examination shows that there is an energy gap of about the same magnitude as the cut-off point in a normal nonsplined potential (0.04 energy units), meaning there is no crossing of the potentials. It might be argued that there might be improvements of the results due to a choice of another type of switching potential, involving, for example, exponentials or the hyperbolic function. The problem however, is not the smoothness of the curves and the degree of continuity (with ever smaller energy gaps between states but the fact that finite time steps are used, and that the cross-over trajectory between different states of the particles (from dimer to free particle and vice versa—is calculated according to potential before the bifurcation, so that an a posteriori calculation or algorithm must be invented to scale the velocites in such a way as to be consistent with the new potentials that are operating after the switch and transition. The current algorithm is applied for both these types of cross-over regions. The MD cell is rectangular, with unit distance along the axis ( direction) of the cell length, whereas the breadth and height was both , implying a thin pencil-like system where the thermostats were placed at the ends of the MD cell, and the energy supplied per unit time step at both ends of the cell (orthogonal to the axis) in the vicinity of and maintained at temperatures and could be monitored, where this energy per unit step time is, respectively, and . At equilibrium (when ) the net energy supplied within statistical error (meaning 1–3 units of the standard error of the distributions) is zero, that is, . The cell is divided up uniformly into 64 rectangular regions along the axis and its thermodynamical properties of temperature and pressure are probed. The resulting values of the 's and the relative invariance of the pressure and temperature profiles would be a measure of the accuracy of the algorithm from a thermodynamical point of view at the steady state. For systems with a large number of particles such thermodynamical criteria are appropriate. The synthetic thermostats now frequently used in conjunction with "non-Hamiltonian" MD  cannot be employed for this type of study. The runs were for 4 million time steps, with averages taken over 100 dumps, where each variable is sampled every 20 time steps. The final averages were over the 20–100 dump values of averaged quantities.
The temperature and pressure are computed by the equipartition and Virial expression given, respectively, by where and the intermolecular pair Virial is given by with being the potential.
2. Algorithm and Analysis of Numerical Results
The velocity Verlet algorithm [25, page 81] used here  and allied types generate a trajectory at time from that at with step increment through a mapping , where which does not scale linearly with . This follows from the form used here consisting of 3 steps in computing the trajectory at time from the data at time :
For a Hamiltonian whose potential is dependent only on position having momentum components , the system without external perturbation has constant energy , and the normal assumption in MD (NEMD) is that for the th step, and also for the specified . In the simulation under NEMD, the force fields are constant and do not change for any one time step. In these cases, the energy is a constant of the motion for any time interval when no external perturbations (e.g., due to thermostat interference) are impressed. When there is a crossing of potentials at such a time interval from to at an interparticle distance (icd) (such as points and of Figure 1) of general particle and (the particle pair) due to a reactive process (such as occurs in either direction of (1.5), a bifurcation occurs where the MD program computes the next step coordinates as for the unreacted system (potential ), which needs to be corrected. Let the icd at time step be (with potential) and at step after interval be where . Due to this crossover, a different Hamiltonian is operative after point is crossed, where under NEMD, the other coordinates not undergoing crossover are not affected. For what follows, subscripts refer to the particle concerned. Let the interparticle potential at be for and for , where . Then if be the final coordinate due to the potential and force field, two questions may be asked: (i) can the velocities of be scaled, so that there is no energy or momentum violation during the crossover based on the trajectory calculation? and (ii) can a pseudostochastic potential be imposed from coordinates (at virtual time ) to such that (i) above is true? For (ii) we have the following.
Theorem 2.1. A virtual potential which scales velocities to preserve momentum and energy can be constructed about region
Proof. The external work done on particles 1 and 2 over the time step is proportional to the distance traveled since these forces are constant and so for each of these particles , where is the distance increment during at least part of the time step from to . For the nonreacting trajectory over time ( (virtual because it is not the correct path due to the crossover at ), where is the change of kinetic energy for the pair from the First Law between the end points . Now over time interval to , for the reactive trajectory, we introduce a "virtual potential" that will lead to the same positional coordinates for the pair at the end of the time step with different velocities than for the nonreactive transition leading to the transition where is the change of kinetic energy for the pair with turned on and along this trajectory, the change of potential for is equated to the change in the K.E. of the pair as given in the results of Theorem 2.2 for all three orthogonal coordinates, that is, with momentum conservation, that is, for the variation along the coordinate, but along internuclear coordinate whereas (scaled about all three axes). Continuity of potential implies Subtracting (2.2) from (2.3) and applying b.c.'s (2.5) leads to The above shows that a conservative virtual potential could be said to be operating in the vicinity of the transition (from ).
Question (i) above leads to the following.
Theorem 2.2. Relative to the velocities at any due to the potential, the rescaled velocities due to the potential difference leading to these final velocities due to the virtual potential can have a form given by (where ) for a vector .
Proof. From the velocities at due to , we compute the velocities at due to the virtual potential. Since net change of momentum is due to the external forces only, which is invariant for the pair, conservation of total momentum relating and in (2.7) yields a definition of (summation from 1 to 2 for what follows, where the mass of particle is ) Defining for any vector , , where then the rescaled velocities become from (2.7) With , energy conservation implies The coupling of (2.10) and (2.11) leads, after several steps of algebra to Defining , , (, then the above is equivalent to the quadratic equation: and in simulations, only is unknown and can be determined from (2.13) where real solutions exist for .
The above Inequality leads to a certain asymmetry concerning forward and backward reactions, even for reversible reactions where the regions of formation and breakdown of molecules are located in the same region with the reversal of the sign of approximate . For this simulation, a reaction in either direction (formation or breakdown of dimer) proceeds if (2.12) is true for real ; if not, then the trajectory follows the one for the initial trajectory without any reaction (i.e., no potential crossover). We would like to suggest that the real reasons for shifted potentials showing "instability in the numerical solution of the differential equations” [25, page 146, line 5] has nothing to do with the forces being discontinuous. It will be recalled that this potential has the form for , and otherwise with . This is because the potentials are continuous and by Newton's Third Law there can be no net change in the momentum due to intermolecular forces implying momentum conservation. Further, the energies (both kinetic and that for the continuous potential) cannot change over an instantaneous change of the forces over zero distance. Thus there is also energy conservation. The reason for the instabilities is due to the fact that the change of position is calculated from the forces of the previous step before the sudden change in force, that puts the particle position away from the PES where there is no mechanical algorithm to correct for the violation in energy conservation with respect to the PES and the kinetic energy. Hence, the problem has nothing to do with the mechanical or dynamical setup of the potential and the forces, but with the MD move algorithm that cannot handle effectively discontinuities of the forces.
Interpretation of Results
Figure 1 shows a rapidly changing potential curve with several inflexion points used in the simulation at very high temperature (as far as I know such ranges have not been reported in the literature for nonsynthetic methods) warranting smaller time steps; larger ones would introduce errors due to the rapidly changing potential and high K.E.; thus, even with the application of the algorithm about coordinates and , curves and have too large value to achieve equilibrium—meaning flat or invariant—temperature (see Figure 2) or pressure (see Figure 3) or unit step thermostat heat supply (see Table 1). ( and ) profiles where for these curves, the values show net heat absorption.
The curve at with shows flat profiles (within statistical fluctuations and 2 standard errors of variation) for temperature, pressure, and net zero heat supply; and this choice of time step interval was found adequate for runs at much higher temperatures ( and ) which was used to determine thermodynamical properties . For this value and all others, no reasonable stationary equilibrium conditions could be obtained without the application of the algorithm (curves , , , and ). The algorithm is seen to be effective over a wide temperature range for this complex dimer reaction simulated under extreme values of thermodynamical variables and the results here do not vary for longer runs and greater sampling statistics (e.g., 6 or 10 million time steps). The thin, pencil-like geometry of the rectangular cell with thermostats located at the ends would highlight the energy nonconservation leading to a nonflat temperature distribution, as observed and which was used to determine the regime of validity of the algorithm.
Without difficulty, one can easily construct a reversible system where and coincide, and this will be investigated next. Such systems would typically have most of the particles in the molecular or dimer state, and accumulated machine computational errors would be one factor to consider which this algorithm should effectively address. The two body potentials considered here saves time but the methodology is general and applies to all interactions, because the essential kinetics and dynamics of all physical phenomena are governed by the principle of conservation of energy and momentum without exception. This element has often been bypassed or has received little emphasis in non-Hamiltonian and other synthetic methodologies used currently.
The author is grateful to University of Malaya for a Conference grant to present this algorithm as an Invited Speaker at the Fifth ICDSA (2007, Atlanta) which this communication briefly reviews.
J. Xu, S. Kjelstrup, and D. Bedeaux, “Molecular dynamics simulations of a chemical reaction; conditions for local equilibrium in a temperature gradient,” Physical Chemistry Chemical Physics, vol. 8, pp. 2017–2027, 2006.View at: Google Scholar
S. Nosé, “A unified formulation of the constant temperature molecular dynamics methods,” The Journal of Chemical Physics, vol. 81, no. 1, pp. 511–519, 1984.View at: Google Scholar
S. Nosé, “A molecular dynamics method for simulation in the canonical ensemble,” Molecular Physics, vol. 52, pp. 255–268, 1984.View at: Google Scholar
D. Frenkel and B. Smit, Understanding Molecular Simulations: From Algorithms to Applications, vol. 1 of Computational Science Series, Academic Press, San Diego, Calif, USA, 2nd edition, 2002.
D. Persano Adorno, N. Pizzolato, and B. Spagnolo, “The influence of noise on electron dynamics in semiconductors driven by a periodic electric field,” Journal of Statistical Mechanics: Theory and Experiment, vol. 2009, no. 1, Article ID P01039, 10 pages, 2009.View at: Publisher Site | Google Scholar
D. Persano Adorno, M. Zarcone, and G. Ferrante, “Far-infrared harmonic generation in semiconductors: a Monte Carlo simulation,” Laser Physics, vol. 10, no. 1, pp. 310–315, 2000.View at: Google Scholar
G. J. Martyna, D. J. Tobias, and M. L. Klein, “Constant pressure molecular dynamics algorithms,” The Journal of Chemical Physics, vol. 101, no. 5, pp. 4177–4189, 1994.View at: Google Scholar
H. J. C. Berendsen, J. P. M. Postma, W. F. Van Gunsteren, A. DiNola, and J. R. Haak, “Molecular dynamics with coupling to an external bath,” The Journal of Chemical Physics, vol. 81, no. 8, pp. 3684–3690, 1984.View at: Google Scholar
M. E. Tuckerman and G. J. Martyna, “Understanding modern molecular dynamics: techniques and applications,” Journal of Physical Chemistry B, vol. 104, no. 2, pp. 159–178, 2000.View at: Google Scholar
J. M. Haile, Molecular Dynamics Simulation, John Wiley & Sons, New York, NY, USA, 1992.
T. Baer and W. L. Hase, Unimolecular Reaction Dynamics, Oxford University Press, Oxford, UK, 1996.
G. S. Fanourgakis and S. C. Farantos, “Potential functions and static and dynamic properties of (; ) clusters,” Journal of Physical Chemistry, vol. 100, pp. 3900–3909, 1996.View at: Google Scholar
D. R. Bevan, L. Li, L. G. Pedersen, and T. A. Darden, “Molecular dynamics simulations of the decamer: influence of the crystal environment,” Biophysical Journal, vol. 78, no. 2, pp. 668–682, 2000.View at: Google Scholar
M. P. Allen and D. J. Tildesley, Computer Simulation of Liquids, Oxford University Press, Oxford, UK, 1992.