Conservation of total energy of the system¶
Energies are basic values in MD. If you perform NVE simulation in which no damping, temperature control, nor external forces, the total energy has to be conserved whereas kinetic and potential energies fluctuate. This is often used to check the validity of forces on atoms when programming new potentials.
When one performs structure relaxation by damping velocities of atoms, as MD steps increase the kinetic energy has to decrease to zero.
When one performs constant temperture simulation, kinetic energy should be almost constant during the simulation.
Since total, kinetic, and potential energies are written in out.erg
file, users can plot energy evolution using gnuplot command as,
$ gnuplot
gnuplot> plot 'out.erg' us 2:3 w l t 'total', 'out.erg' us 2:4 w l t 'kinetic', 'out.erg' us 2:5 w l t 'potential'
The gnuplot command above will show the total and potential energies directory.
But the absolute values of total and potential ennergies and kinetic energy are much different.
And thus it will not be easy to look at the fluctuation of energies.
The fluctuation of each energy becomes more apparent by shifting the origin of total and potential energies.
The initial potential energy is written in the header of out.erg
, so one can subtract the initial potential energy from total and potential energies as,
gnuplot> e0 = -9.3648308E+002
gnuplot> p 'out.erg' us 2:($3-e0) w l t 'total', '' us 2:4 w l t 'kinetic', '' us 2:($5-e0) w l t 'potential'
where e0 = -9.3648308E+002
is the initial potential energy.
The energy evolution is something like the figure below. As shown in the figure, for a NVE simulation, the total energy is conserved during simulation.