# Total energy can not conserve when using extremely small time step in NVE simulation

**URL:** <https://gromacs.bioexcel.eu/t/total-energy-can-not-conserve-when-using-extremely-small-time-step-in-nve-simulation/3803>\
**Category:** User discussions\
**Tags:** mdrun\
**Created:** [March 8, 2022, 2:47pm UTC](https://gromacs.bioexcel.eu/t/total-energy-can-not-conserve-when-using-extremely-small-time-step-in-nve-simulation/3803 "2022-03-08T14:47:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zwyolo](https://avatars.discourse-cdn.com/v4/letter/z/e8c25b/32.png) [@zwyolo](https://gromacs.bioexcel.eu/u/zwyolo)\
**Post date:** [March 8, 2022, 2:47pm UTC](https://gromacs.bioexcel.eu/t/total-energy-can-not-conserve-when-using-extremely-small-time-step-in-nve-simulation/3803/1 "2022-03-08T14:47:28Z")

</div>

GROMACS version: 2020  
GROMACS modification: No

Hi guys,

Recent I ran several NVE simulations using different time steps (dt). And I found that when using extremely small time steps (like 0.1 fs), the total energy cannot conserve, however the larger time steps (like 0.5fs or 1fs) can generate a total energy that conserve at the beginning of the simulation. Here is my mdp options, which is very simple, is there anything wrong with my simulation setup?

Thanks!

total energy:

 ![Screen Shot 2022-03-08 at 8.46.11 AM](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/3/32546595451f8485834b6b1faa51fad192bfef44.png)

mdp options:

title = Define here  
cpp = /lib/cpp  
constraints = h-bonds  
constraint-algorithm = LINCS  
integrator = md  
dt = 0.0001  
nsteps = 100000  
nstenergy = 10  
nstxout = 10  
nstvout = 10  
nstfout = 10  
nstlog = 10  
nstxtcout = 0  
cutoff-scheme = Verlet  
nstlist = 10

coulombtype = PME  
rvdw = 1.2  
rlist = 1.2  
rcoulomb = 1.2  
fourierspacing = 0.1  
pme\_order = 4  
ewald\_rtol = 1e-5

Tcoupl = no

Pcoupl = no

gen\_vel = no  
gen\_temp = 300  
gen\_seed = -1

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [March 9, 2022, 1:57pm UTC](https://gromacs.bioexcel.eu/t/total-energy-can-not-conserve-when-using-extremely-small-time-step-in-nve-simulation/3803/2 "2022-03-09T13:57:59Z")

</div>

I assume you are using single precision. You then get too small increments in coordinates to represent accurately in single precision, in particular when using constraints. You need to switch to double precision when using small time steps.

---

<div class="post-metadata">

**Author:** ![zwyolo](https://avatars.discourse-cdn.com/v4/letter/z/e8c25b/32.png) [@zwyolo](https://gromacs.bioexcel.eu/u/zwyolo)\
**Post date:** [March 30, 2022, 4:07pm UTC](https://gromacs.bioexcel.eu/t/total-energy-can-not-conserve-when-using-extremely-small-time-step-in-nve-simulation/3803/3 "2022-03-30T16:07:02Z")

</div>

Thank you, Prof. Hess. That works. When using double precision, the total energy conserves.
