espressomd/espresso

Velocity Verlet step in documentation has a typo

Closed this issue · 3 comments

In the documentation (https://espressomd.github.io/doc/integration.html#velocity-verlet-algorithm) the force used for the first half step is $F(x(t), v(t-\Delta t/2), t)$ but in the code it uses the force at time $t$ instead:

inline void velocity_verlet_propagator_1(Particle &p, double time_step) {
for (unsigned int j = 0; j < 3; j++) {
if (!p.is_fixed_along(j)) {
/* Propagate velocities: v(t+0.5*dt) = v(t) + 0.5 * dt * a(t) */
p.v()[j] += 0.5 * time_step * p.force()[j] / p.mass();
/* Propagate positions (only NVT): p(t + dt) = p(t) + dt *
* v(t+0.5*dt) */
p.pos()[j] += time_step * p.v()[j];
}
}
}

Used in

int System::System::integrate(int n_steps, int reuse_forces) {

(Note the calculate_forces before it calls integrator_step_1

the code does what the doc says.
whether that is correct, is not obvious for velocity dependent forces (cited literature makes no statement about such forces)
in step 4, the velocity argument to the force is missing (same as in step 3)

Unless I'm overlooking something, at step 4 we have forces calculated based on $F(x(t+\Delta t), v(t+\Delta t/2), t+\Delta t)$, then at the next integration step, step 1 becomes $F(x(t+\Delta t), v(t+\Delta t/2+\Delta t), t+\Delta t)$ i.e. $F(x(t'), v(t'-\Delta t/2), t')$. Regarding velocity-dependent forces (thermostat friction and LB particle coupling), we have tests to make sure they are properly set at the correct place w.r.t the two half-time integration steps.

Offline discussion: the user guide is consistent with the C++ code. There is only one typo to fix.