ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/oopsePaper/Mechanics.tex
Revision: 1077
Committed: Tue Mar 2 03:15:35 2004 UTC (21 years, 4 months ago) by gezelter
Content type: application/x-tex
File size: 20070 byte(s)
Log Message:
More DLM changes

File Contents

# User Rev Content
1 mmeineke 899
2     \section{\label{sec:mechanics}Mechanics}
3    
4 gezelter 1069 \subsection{\label{integrate}Integrating the Equations of Motion: the
5     DLM method}
6 mmeineke 899
7 gezelter 1069 The default method for integrating the equations of motion in {\sc
8 gezelter 1076 oopse} is a velocity-Verlet version of the symplectic splitting method
9     proposed by Dullweber, Leimkuhler and McLachlan
10     (DLM).\cite{Dullweber1997} When there are no directional atoms or
11     rigid bodies present in the simulation, this integrator becomes the
12     standard velocity-Verlet integrator which is known to sample the
13     microcanonical (NVE) ensemble.\cite{}
14 mmeineke 899
15 gezelter 1069 Previous integration methods for orientational motion have problems
16     that are avoided in the DLM method. Direct propagation of the Euler
17     angles has a known $1/\sin\theta$ divergence in the equations of
18     motion for $\phi$ and $\psi$,\cite{AllenTildesley} leading to
19     numerical instabilities any time one of the directional atoms or rigid
20     bodies has an orientation near $\theta=0$ or $\theta=\pi$. More
21     modern quaternion-based integration methods have relatively poor
22     energy conservation. While quaternions work well for orientational
23 gezelter 1076 motion in other ensembles, the microcanonical ensemble has a
24 gezelter 1069 constant energy requirement that is quite sensitive to errors in the
25     equations of motion. An earlier implementation of {\sc oopse}
26     utilized quaternions for propagation of rotational motion; however, a
27     detailed investigation showed that they resulted in a steady drift in
28     the total energy, something that has been observed by
29     others.\cite{Laird97}
30    
31 mmeineke 899 The key difference in the integration method proposed by Dullweber
32     \emph{et al.} is that the entire rotation matrix is propagated from
33 gezelter 1076 one time step to the next. In the past, this would not have been
34     feasible, since that the rotation matrix for a single body has nine
35     elements compared to 3 or 4 elements for Euler angles and quaternions
36     respectively. System memory has become less costly in recent times,
37     and this can be translated into substantial benefits in energy
38     conservation.
39 mmeineke 899
40 gezelter 1069 The basic equations of motion being integrated are derived from the
41     Hamiltonian for conservative systems containing rigid bodies,
42     \begin{equation}
43 gezelter 1077 H = \sum_{i} \left( \frac{1}{2} m_i {\bf v}_i^T \cdot {\bf v}_i +
44     \frac{1}{2} {\bf j}_i^T \cdot \overleftrightarrow{\mathsf{I}}_i^{-1} \cdot
45     {\bf j}_i \right) +
46 gezelter 1076 V\left(\left\{{\bf r}\right\}, \left\{\mathsf{A}\right\}\right)
47 gezelter 1069 \end{equation}
48 gezelter 1076 where ${\bf r}_i$ and ${\bf v}_i$ are the cartesian position vector
49     and velocity of the center of mass of particle $i$, and ${\bf j}_i$
50     and $\overleftrightarrow{\mathsf{I}}_i$ are the body-fixed angular
51     momentum and moment of inertia tensor, respectively. $\mathsf{A}_i$
52     is the $3 \times 3$ rotation matrix describing the instantaneous
53     orientation of the particle. $V$ is the potential energy function
54     which may depend on both the positions $\left\{{\bf r}\right\}$ and
55     orientations $\left\{\mathsf{A}\right\}$ of all particles. The
56     equations of motion for the particle centers of mass are derived from
57     Hamilton's equations and are quite simple,
58 gezelter 1069 \begin{eqnarray}
59 gezelter 1076 \dot{{\bf r}} & = & {\bf v} \\
60     \dot{{\bf v}} & = & \frac{{\bf f}}{m}
61 gezelter 1069 \end{eqnarray}
62 gezelter 1076 where ${\bf f}$ is the instantaneous force on the center of mass
63     of the particle,
64 gezelter 1069 \begin{equation}
65 gezelter 1077 {\bf f} = - \frac{\partial}{\partial
66 gezelter 1076 {\bf r}} V(\left\{{\bf r}(t)\right\}, \left\{\mathsf{A}(t)\right\}).
67 gezelter 1069 \end{equation}
68    
69 gezelter 1076 The equations of motion for the orientational degrees of freedom are
70 gezelter 1069 \begin{eqnarray}
71 gezelter 1077 \dot{\mathsf{A}} & = & \mathsf{A} \cdot
72 gezelter 1076 \mbox{ skew}\left(\overleftrightarrow{I}^{-1} \cdot {\bf j}\right) \\
73     \dot{{\bf j}} & = & {\bf j} \times \left( \overleftrightarrow{I}^{-1}
74 gezelter 1077 \cdot {\bf j} \right) - \mbox{ rot}\left(\mathsf{A}^{T} \cdot \frac{\partial
75 gezelter 1076 V}{\partial \mathsf{A}} \right)
76 gezelter 1069 \end{eqnarray}
77 gezelter 1076 In these equations of motion, the $\mbox{skew}$ matrix of a vector
78     ${\bf v} = \left( v_1, v_2, v_3 \right)$ is defined:
79     \begin{equation}
80     \mbox{skew}\left( {\bf v} \right) := \left(
81     \begin{array}{ccc}
82     0 & v_3 & - v_2 \\
83     -v_3 & 0 & v_1 \\
84     v_2 & -v_1 & 0
85     \end{array}
86     \right)
87     \end{equation}
88     The $\mbox{rot}$ notation refers to the mapping of the $3 \times 3$
89     rotation matrix to a vector of orientations by first computing the
90     skew-symmetric part $\left(\mathsf{A} - \mathsf{A}^{T}\right)$ and
91     then associating this with a length 3 vector by inverting the
92     $\mbox{skew}$ function above:
93     \begin{equation}
94     \mbox{rot}\left(\mathsf{A}\right) := \mbox{ skew}^{-1}\left(\mathsf{A}
95     - \mathsf{A}^{T} \right)
96     \end{equation}
97 gezelter 1077 Written this way, the $\mbox{rot}$ operation creates a set of
98     conjugate angle coordinates to the body-fixed angular momenta
99     represented by ${\bf j}$. This equation of motion for angular momenta
100     is equivalent to the more familiar body-fixed form:
101     \begin{eqnarray}
102     \dot{j_{x}} & = & \tau^b_x(t) +
103     \left(\overleftrightarrow{\mathsf{I}}_{yy} - \overleftrightarrow{\mathsf{I}}_{zz} \right) j_y j_z \\
104     \dot{j_{y}} & = & \tau^b_y(t) +
105     \left(\overleftrightarrow{\mathsf{I}}_{zz} - \overleftrightarrow{\mathsf{I}}_{xx} \right) j_z j_x \\
106     \dot{j_{z}} & = & \tau^b_z(t) +
107     \left(\overleftrightarrow{\mathsf{I}}_{xx} - \overleftrightarrow{\mathsf{I}}_{yy} \right) j_x j_y
108     \end{eqnarray}
109     which utilize the body-fixed torques, ${\bf \tau}^b$. Torques are
110     most easily derived in the space-fixed frame,
111     \begin{equation}
112     {\bf \tau}^b(t) = \mathsf{A}(t) \cdot {\bf \tau}^s(t)
113     \end{equation}
114     where
115     \begin{equation}
116     {\bf \tau}^s(t) = - \hat{\bf u}(t) \times \left( \frac{\partial}
117     {\partial \hat{\bf u}} V\left(\left\{ {\bf r}(t) \right\}, \left\{
118     \mathsf{A}(t) \right\}\right) \right)
119     \end{equation}
120     where $\hat{\bf u}$ is a unit vector pointing along the principal axis
121     of the particle in the space-fixed frame.
122 gezelter 1069
123 gezelter 1077 The DLM method uses a Trotter factorization of the orientational
124     propagator. This has three effects:
125     \begin{enumerate}
126     \item the integrator is area preserving in phase space (i.e. it is
127     {\it symplectic}),
128     \item the integrator is time-{\it reversible}, making it suitable for Hybrid
129     Monte Carlo applications, and
130     \item the error for a single time step is of order $O\left(h^3\right)$
131     for timesteps of length $h$.
132     \end{enumerate}
133 gezelter 1069
134     In the integration method, the
135     orientational propagation involves a sequence of matrix evaluations to
136     update the rotation matrix.\cite{Dullweber1997} These matrix rotations
137     end up being more costly computationally than the simpler arithmetic
138     quaternion propagation. With the same time step, a 1000 SSD particle
139     simulation shows an average 7\% increase in computation time using the
140     symplectic step method in place of quaternions. This cost is more than
141     justified when comparing the energy conservation of the two methods as
142     illustrated in figure
143 mmeineke 899 \ref{timestep}.
144    
145     \begin{figure}
146     \epsfxsize=6in
147     \epsfbox{timeStep.epsi}
148     \caption{Energy conservation using quaternion based integration versus
149     the symplectic step method proposed by Dullweber \emph{et al.} with
150     increasing time step. For each time step, the dotted line is total
151     energy using the symplectic step integrator, and the solid line comes
152     from the quaternion integrator. The larger time step plots are shifted
153     up from the true energy baseline for clarity.}
154     \label{timestep}
155     \end{figure}
156    
157     In figure \ref{timestep}, the resulting energy drift at various time
158     steps for both the symplectic step and quaternion integration schemes
159     is compared. All of the 1000 SSD particle simulations started with the
160     same configuration, and the only difference was the method for
161     handling rotational motion. At time steps of 0.1 and 0.5 fs, both
162     methods for propagating particle rotation conserve energy fairly well,
163     with the quaternion method showing a slight energy drift over time in
164     the 0.5 fs time step simulation. At time steps of 1 and 2 fs, the
165     energy conservation benefits of the symplectic step method are clearly
166     demonstrated. Thus, while maintaining the same degree of energy
167     conservation, one can take considerably longer time steps, leading to
168     an overall reduction in computation time.
169    
170     Energy drift in these SSD particle simulations was unnoticeable for
171     time steps up to three femtoseconds. A slight energy drift on the
172     order of 0.012 kcal/mol per nanosecond was observed at a time step of
173     four femtoseconds, and as expected, this drift increases dramatically
174     with increasing time step. To insure accuracy in the constant energy
175     simulations, time steps were set at 2 fs and kept at this value for
176     constant pressure simulations as well.
177    
178    
179     \subsection{\label{sec:extended}Extended Systems for other Ensembles}
180    
181 gezelter 1076 {\sc oopse} implements a number of extended system integrators for
182     sampling from other ensembles relevant to chemical physics. The
183     integrator can selected with the {\tt ensemble} keyword in the
184     {\tt .bass} file:
185 mmeineke 899
186 gezelter 1076 \begin{center}
187     \begin{tabular}{lll}
188     {\bf Integrator} & {\bf Ensemble} & {\bf {\tt .bass} line} \\
189     NVE & microcanonical & {\tt ensemble = ``NVE''; } \\
190     NVT & canonical & {\tt ensemble = ``NVT''; } \\
191     NPTi & isobaric-isothermal (with isotropic volume changes) & {\tt
192     ensemble = ``NPTi'';} \\
193     NPTf & isobaric-isothermal (with changes to box shape) & {\tt
194     ensemble = ``NPTf'';} \\
195     NPTxyz & approximate isobaric-isothermal & {\tt ensemble =
196     ``NPTxyz'';} \\
197     & (with separate barostats on each box dimension) &
198     \end{tabular}
199     \end{center}
200 gezelter 1069
201 gezelter 1076 The relatively well-known Nos\'e-Hoover thermostat is implemented in
202     {\sc oopse}'s NVT integrator. This method couples an extra degree of
203     freedom (the thermostat) to the kinetic energy of the system, and has
204     been shown to sample the canonical distribution in the system degrees
205     of freedom while conserving a quantity that is, to within a constant,
206     the Helmholtz free energy.
207 gezelter 1069
208 gezelter 1076 NPT algorithms attempt to maintain constant pressure in the system by
209     coupling the volume of the system to a barostat. {\sc oopse} contains
210     three different constant pressure algorithms. The first two, NPTi and
211     NPTf have been shown to conserve a quantity that is, to within a
212     constant, the Gibbs free energy. The Melchionna modification to the
213     Hoover barostat is implemented in both NPTi and NPTf. NPTi allows
214     only isotropic changes in the simulation box, while box {\it shape}
215     variations are allowed in NPTf. The NPTxyz integrator has {\it not}
216     been shown to sample from the isobaric-isothermal ensemble. It is
217     useful, however, in that it maintains orthogonality for the axes of
218     the simulation box while attempting to equalize pressure along the
219     three perpendicular directions in the box.
220 mmeineke 899
221 gezelter 1076 Each of the extended system integrators requires additional keywords
222     to set target values for the thermodynamic state variables that are
223     being held constant. Keywords are also required to set the
224     characteristic decay times for the dynamics of the extended
225     variables.
226 mmeineke 899
227 gezelter 1076 \begin{tabular}{llll}
228     {\bf variable} & {\bf {\tt .bass} keyword} & {\bf units} & {\bf
229     default value} \\
230     $T_{\mathrm{target}}$ & {\tt targetTemperature = 300;} & K & none \\
231     $P_{\mathrm{target}}$ & {\tt targetPressure = 1;} & atm & none \\
232     $\tau_T$ & {\tt tauThermostat = 1e3;} & fs & none \\
233     $\tau_B$ & {\tt tauBarostat = 5e3;} & fs & none \\
234     & {\tt resetTime = 200;} & fs & none \\
235     & {\tt useInitialExtendedSystemState = ``true'';} & logical &
236     false
237     \end{tabular}
238 mmeineke 899
239 gezelter 1076 Two additional keywords can be used to either clear the extended
240     system variables periodically ({\tt resetTime}), or to maintain the
241     state of the extended system variables between simulations ({\tt
242     useInitialExtendedSystemState}). More details on these variables
243     and their use in the integrators follows below.
244    
245     \subsubsection{\label{sec:noseHooverThermo}Nos\'{e}-Hoover Thermostatting}
246    
247     The Nos\'e-Hoover equations of motion are given by\cite{Hoover85}
248 mmeineke 899 \begin{eqnarray}
249     \dot{{\bf r}} & = & {\bf v} \\
250 gezelter 1076 \dot{{\bf v}} & = & \frac{{\bf f}}{m} - \chi {\bf v} \\
251     \dot{\mathsf{A}} & = & \\
252     \dot{{\bf j}} & = & - \chi {\bf j}
253 mmeineke 899 \label{eq:nosehoovereom}
254     \end{eqnarray}
255    
256     $\chi$ is an ``extra'' variable included in the extended system, and
257     it is propagated using the first order equation of motion
258     \begin{equation}
259 gezelter 1076 \dot{\chi} = \frac{1}{\tau_{T}^2} \left( \frac{T}{T_{\mathrm{target}}} - 1 \right).
260 mmeineke 899 \label{eq:nosehooverext}
261     \end{equation}
262    
263 gezelter 1076 The instantaneous temperature $T$ is proportional to the total kinetic
264     energy (both translational and orientational) and is given by
265     \begin{equation}
266     T = \frac{2 K}{f k_B}
267     \end{equation}
268     Here, $f$ is the total number of degrees of freedom in the system,
269     \begin{equation}
270     f = 3 N + 3 N_{\mathrm{orient}} - N_{\mathrm{constraints}}
271     \end{equation}
272     and $K$ is the total kinetic energy,
273     \begin{equation}
274     K = \sum_{i=1}^{N} \frac{1}{2} m_i {\bf v}_i^T \cdot {\bf v}_i +
275     \sum_{i=1}^{N_{\mathrm{orient}}} \sum_{\alpha=x,y,z} \frac{{\bf
276     j}_{i\alpha}^T \cdot {\bf j}_{i\alpha}}{2
277     \overleftrightarrow{\mathsf{I}}_{i,\alpha \alpha}}
278     \end{equation}
279 mmeineke 899
280 gezelter 1076 In eq.(\ref{eq:nosehooverext}), $\tau_T$ is the time constant for
281     relaxation of the temperature to the target value. To set values for
282     $\tau_T$ or $T_{\mathrm{target}}$ in a simulation, one would use the
283     {\tt tauThermostat} and {\tt targetTemperature} keywords in the {\tt
284     .bass} file. The units for {\tt tauThermostat} are fs, and the units
285     for the {\tt targetTemperature} are degrees K. The integration of
286     the equations of motion is carried out in a velocity-Verlet style 2
287     part algorithm:
288 mmeineke 899
289 gezelter 1076 {\tt moveA:}
290     \begin{eqnarray}
291     T(t) & \leftarrow & \left\{{\bf v}(t)\right\}, \left\{{\bf j}(t)\right\} \\
292     {\bf v}\left(t + \delta t / 2\right) & \leftarrow & {\bf
293     v}(t) + \frac{\delta t}{2} \left( \frac{{\bf f}(t)}{m} - {\bf v}(t)
294     \chi(t)\right) \\
295     {\bf r}(t + \delta t) & \leftarrow & {\bf r}(t) + \delta t {\bf
296     v}\left(t + \delta t / 2 \right) \\
297     {\bf j}\left(t + \delta t / 2 \right) & \leftarrow & {\bf
298     j}(t) + \frac{\delta t}{2} \left( {\bf \tau}^b(t) - {\bf j}(t)
299     \chi(t) \right) \\
300     \mathsf{A}(t + \delta t) & \leftarrow & \mathrm{rot}({\bf j}(t +
301     \delta t / 2) \overleftrightarrow{\mathsf{I}}^{b},
302     \delta t) \\
303     \chi\left(t + \delta t / 2 \right) & \leftarrow & \chi(t) +
304     \frac{\delta t}{2 \tau_T^2} \left( \frac{T(t)}{T_{\mathrm{target}}} - 1
305     \right)
306     \end{eqnarray}
307    
308     Here $\mathrm{rot}( {\bf j} / {\bf I} )$ is the same symplectic Trotter
309     factorization of the three rotation operations that was discussed in
310     the section on the DLM integrator. Note that this operation modifies
311     both the rotation matrix $\mathsf{A}$ and the angular momentum ${\bf
312     j}$. {\tt moveA} propagates velocities by a half time step, and
313     positional degrees of freedom by a full time step. The new positions
314     (and orientations) are then used to calculate a new set of forces and
315     torques.
316    
317     {\tt doForces:}
318     \begin{eqnarray}
319     {\bf f}(t + \delta t) & \leftarrow & - \frac{\partial V}{\partial {\bf
320     r}(t + \delta t)} \\
321     {\bf \tau}^{s}(t + \delta t) & \leftarrow & {\bf u}(t + \delta t)
322     \times \frac{\partial V}{\partial {\bf u}} \\
323     {\bf \tau}^{b}(t + \delta t) & \leftarrow & \mathsf{A}(t + \delta t)
324     \cdot {\bf \tau}^s(t + \delta t)
325     \end{eqnarray}
326    
327     Here ${\bf u}$ is a unit vector pointing along the principal axis of
328     the rigid body being propagated, ${\bf \tau}^s$ is the torque in the
329     space-fixed (laboratory) frame, and ${\bf \tau}^b$ is the torque in
330     the body-fixed frame. ${\bf u}$ is automatically calculated when the
331     rotation matrix $\mathsf{A}$ is calculated in {\tt moveA}.
332    
333     Once the forces and torques have been obtained at the new time step,
334     the velocities can be advanced to the same time value.
335    
336     {\tt moveB:}
337     \begin{eqnarray}
338     T(t + \delta t) & \leftarrow & \left\{{\bf v}(t + \delta t)\right\},
339     \left\{{\bf j}(t + \delta t)\right\} \\
340     \chi\left(t + \delta t \right) & \leftarrow & \chi\left(t + \delta t /
341     2 \right) + \frac{\delta t}{2 \tau_T^2} \left( \frac{T(t+\delta
342     t)}{T_{\mathrm{target}}} - 1 \right) \\
343     {\bf v}\left(t + \delta t \right) & \leftarrow & {\bf
344     v}\left(t + \delta t / 2 \right) + \frac{\delta t}{2} \left(
345     \frac{{\bf f}(t + \delta t)}{m} - {\bf v}(t + \delta t)
346     \chi(t \delta t)\right) \\
347     {\bf j}\left(t + \delta t \right) & \leftarrow & {\bf
348     j}\left(t + \delta t / 2 \right) + \frac{\delta t}{2} \left( {\bf
349     \tau}^b(t + \delta t) - {\bf j}(t + \delta t)
350     \chi(t + \delta t) \right)
351     \end{eqnarray}
352    
353     Since ${\bf v}(t + \delta t)$ and ${\bf j}(t + \delta t)$ are required
354     to caclculate $T(t + \delta t)$ as well as $\chi(t + \delta t)$, the
355     indirectly depend on their own values at time $t + \delta t$. {\tt
356     moveB} is therefore done in an iterative fashion until $\chi(t +
357     \delta t)$ becomes self-consistent. The relative tolerance for the
358     self-consistency check defaults to a value of $\mbox{10}^{-6}$, but
359     {\sc oopse} will terminate the iteration after 4 loops even if the
360     consistency check has not been satisfied.
361    
362     The Nos\'e-Hoover algorithm is known to conserve a Hamiltonian for the
363     extended system that is, to within a constant, identical to the
364     Helmholtz free energy,
365     \begin{equation}
366     H_{\mathrm{NVT}} = V + K + f k_B T_{\mathrm{target}} \left(
367     \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t\prime) dt\prime
368     \right)
369     \end{equation}
370     Poor choices of $\delta t$ or $\tau_T$ can result in non-conservation
371     of $H_{\mathrm{NVT}}$, so the conserved quantity is maintained in the
372     last column of the {\tt .stat} file to allow checks on the quality of
373     the integration.
374    
375     Bond constraints are applied at the end of both the {\tt moveA} and
376     {\tt moveB} portions of the algorithm. Details on the constraint
377     algorithms are given in section \ref{sec:rattle}.
378    
379     \subsubsection{\label{sec:NPTi}Constant-pressure integration (isotropic box)}
380    
381    
382 mmeineke 899 \subsection{\label{Sec:zcons}Z-Constraint Method}
383    
384     Based on fluctuatin-dissipation theorem,\bigskip\ force auto-correlation
385     method was developed to investigate the dynamics of ions inside the ion
386     channels.\cite{Roux91} Time-dependent friction coefficient can be calculated
387     from the deviation of the instaneous force from its mean force.
388    
389     %
390    
391     \begin{equation}
392     \xi(z,t)=\langle\delta F(z,t)\delta F(z,0)\rangle/k_{B}T
393     \end{equation}
394    
395    
396     where%
397     \begin{equation}
398     \delta F(z,t)=F(z,t)-\langle F(z,t)\rangle
399     \end{equation}
400    
401    
402     If the time-dependent friction decay rapidly, static friction coefficient can
403     be approximated by%
404    
405     \begin{equation}
406     \xi^{static}(z)=\int_{0}^{\infty}\langle\delta F(z,t)\delta F(z,0)\rangle dt
407     \end{equation}
408    
409    
410     Hence, diffusion constant can be estimated by
411     \begin{equation}
412     D(z)=\frac{k_{B}T}{\xi^{static}(z)}=\frac{(k_{B}T)^{2}}{\int_{0}^{\infty
413     }\langle\delta F(z,t)\delta F(z,0)\rangle dt}%
414     \end{equation}
415    
416    
417     \bigskip Z-Constraint method, which fixed the z coordinates of the molecules
418     with respect to the center of the mass of the system, was proposed to obtain
419     the forces required in force auto-correlation method.\cite{Marrink94} However,
420     simply resetting the coordinate will move the center of the mass of the whole
421     system. To avoid this problem, a new method was used at {\sc oopse}. Instead of
422     resetting the coordinate, we reset the forces of z-constraint molecules as
423     well as subtract the total constraint forces from the rest of the system after
424     force calculation at each time step.
425     \begin{verbatim}
426     $F_{\alpha i}=0$
427     $V_{\alpha i}=V_{\alpha i}-\frac{\sum\limits_{i}M_{_{\alpha i}}V_{\alpha i}}{\sum\limits_{i}M_{_{\alpha i}}}$
428     $F_{\alpha i}=F_{\alpha i}-\frac{M_{_{\alpha i}}}{\sum\limits_{\alpha}\sum\limits_{i}M_{_{\alpha i}}}\sum\limits_{\beta}F_{\beta}$
429     $V_{\alpha i}=V_{\alpha i}-\frac{\sum\limits_{\alpha}\sum\limits_{i}M_{_{\alpha i}}V_{\alpha i}}{\sum\limits_{\alpha}\sum\limits_{i}M_{_{\alpha i}}}$
430     \end{verbatim}
431    
432     At the very beginning of the simulation, the molecules may not be at its
433     constraint position. To move the z-constraint molecule to the specified
434     position, a simple harmonic potential is used%
435    
436     \begin{equation}
437     U(t)=\frac{1}{2}k_{Harmonic}(z(t)-z_{cons})^{2}%
438     \end{equation}
439     where $k_{Harmonic}$\bigskip\ is the harmonic force constant, $z(t)$ is
440     current z coordinate of the center of mass of the z-constraint molecule, and
441     $z_{cons}$ is the restraint position. Therefore, the harmonic force operated
442     on the z-constraint molecule at time $t$ can be calculated by%
443     \begin{equation}
444     F_{z_{Harmonic}}(t)=-\frac{\partial U(t)}{\partial z(t)}=-k_{Harmonic}%
445     (z(t)-z_{cons})
446     \end{equation}
447     Worthy of mention, other kinds of potential functions can also be used to
448     drive the z-constraint molecule.