+ real buffer_temp;
+
+ if (EI_MD(ir->eI) && ir->etc == etcNO)
+ {
+ if (bGenVel)
+ {
+ buffer_temp = opts->tempi;
+ }
+ else
+ {
+ buffer_temp = calc_temp(sys, ir, state.v);
+ }
+ if (buffer_temp > 0)
+ {
+ sprintf(warn_buf, "NVE simulation: will use the initial temperature of %.3f K for determining the Verlet buffer size", buffer_temp);
+ warning_note(wi, warn_buf);
+ }
+ else
+ {
+ sprintf(warn_buf, "NVE simulation with an initial temperature of zero: will use a Verlet buffer of %d%%. Check your energy drift!",
+ (int)(verlet_buffer_ratio_NVE_T0*100 + 0.5));
+ warning_note(wi, warn_buf);
+ }
+ }
+ else
+ {
+ buffer_temp = get_max_reference_temp(ir, wi);
+ }
+
+ if (EI_MD(ir->eI) && ir->etc == etcNO && buffer_temp == 0)
+ {
+ /* NVE with initial T=0: we add a fixed ratio to rlist.
+ * Since we don't actually use verletbuf_tol, we set it to -1
+ * so it can't be misused later.
+ */
+ ir->rlist *= 1.0 + verlet_buffer_ratio_NVE_T0;
+ ir->verletbuf_tol = -1;
+ }
+ else
+ {
+ /* We warn for NVE simulations with >1(.1)% drift tolerance */
+ const real drift_tol = 0.01;
+ real ener_runtime;
+
+ /* We use 2 DOF per atom = 2kT pot+kin energy, to be on
+ * the safe side with constraints (without constraints: 3 DOF).
+ */
+ ener_runtime = 2*BOLTZ*buffer_temp/(ir->nsteps*ir->delta_t);
+
+ if (EI_MD(ir->eI) && ir->etc == etcNO && ir->nstlist > 1 &&
+ ir->nsteps > 0 &&
+ ir->verletbuf_tol > 1.1*drift_tol*ener_runtime)
+ {
+ sprintf(warn_buf, "You are using a Verlet buffer tolerance of %g kJ/mol/ps for an NVE simulation of length %g ps, which can give a final drift of %d%%. For conserving energy to %d%%, you might need to set verlet-buffer-tolerance to %.1e.",
+ ir->verletbuf_tol, ir->nsteps*ir->delta_t,
+ (int)(ir->verletbuf_tol/ener_runtime*100 + 0.5),
+ (int)(100*drift_tol + 0.5),
+ drift_tol*ener_runtime);
+ warning_note(wi, warn_buf);
+ }
+
+ set_verlet_buffer(sys, ir, buffer_temp, state.box, wi);
+ }