1
$\begingroup$

Consider a general set of Hamilton's equations $$ \begin{align} \dot{q}(q, p) &= \partial_p H(q, p) \\ \dot{p}(q, p) &= -\partial_q H(q, p) \end{align} $$ A first-order integrator one could use is the sympletic-Euler. There are two second-order methods I know of that can be used to numerically integrate these equations: Leapfrog and position-Verlet.

Is there any difference at all between using Leapfrog or position-Verlet?

Leapfrog (second order, sympletic, reversible)

This is like a sympletic Euler but sandwiched between a half-momentum step at the beginning and at the end. $$ \begin{align} p_{t+\delta/2} &= p_t + \frac{\delta}{2}\dot{p}(q_t, p_t) \\ q_{t+\delta} &= q_t + \delta \dot{q}(q_t, p_{t+\delta/2}) \\ p_{t+\delta} &= p_{t+\delta/2} + \frac{\delta}{2}\dot{p}(q_{t+\delta}, p_{t+\delta/2}) \end{align} $$

Position-Verlet (second order, sympletic)

Similar to the Leapfrog method but starts with a half-position update rather than half-momentum update. \begin{align} q_{t+\delta/2} &= q_t + \frac{\delta}{2}\dot{q}(q_t, p_t) \\ p_{t + \delta} &= p_t + \delta \dot{p}(q_{t+\delta}, p_t) \\ q_{t+\delta} &= q_{+\delta/2} + \frac{\delta}{2}\dot{q}(q_{t+\delta/2}, p_{t+\delta}) \end{align}

Is there any difference between using Leapfrog or position-Verlet? Either numerically or theoretically.

$\endgroup$
7
  • 1
    $\begingroup$ The leapfrog you've written is velocity Verlet method as far as I can tell. My experience with leapfrog is quite different (cf this post of mine). $\endgroup$
    – Kyle Kanos
    Feb 23, 2022 at 16:52
  • 2
    $\begingroup$ Also, it looks like you forgot to swap the p's and q's between the two methods you've written. $\endgroup$
    – Kyle Kanos
    Feb 23, 2022 at 16:53
  • 1
    $\begingroup$ There is no difference in numerical solutions with leapfrog method and Verlet algorithm as it has been testified on a large system of 500-5000 equations discussed on mathematica.stackexchange.com/questions/208590/… $\endgroup$ Feb 23, 2022 at 16:59
  • $\begingroup$ @KyleKanos yes I did forget, just edited! $\endgroup$ Feb 23, 2022 at 17:41
  • 1
    $\begingroup$ @Euler_Salter I think it is more fantasy then reality about accuracy of velocity Verlet compare to regular Verlet. Also leapfrog and Verlet look same on a large system numerical solution. Nevertheless could you compare 3 algorithms on your problem and report here about accuracy compare to exact solution? $\endgroup$ Feb 24, 2022 at 5:30

1 Answer 1

1
$\begingroup$

The two methods are mathematically and numerically equivalent. The easiest way to see this is to consider the update as, \begin{align} p &= p + \delta t \cdot \dot{p}(p,\,q) / 2 \\ q &= q + \delta t \cdot \dot{q}(p,\,q) \\ p &= p + \delta t \cdot \dot{p}(p,\,q) / 2 \end{align} This kind of update is done $n$ times in a sequential manner: \begin{align} p &= p + \delta t \cdot \dot{p}(p,\,q) / 2 \\ q &= q + \delta t \cdot \dot{q}(p,\,q) \\ p &= p + \delta t \cdot \dot{p}(p,\,q) / 2 \\ p &= p + \delta t \cdot \dot{p}(p,\,q) / 2 \\ q &= q + \delta t \cdot \dot{q}(p,\,q) \\ p &= p + \delta t \cdot \dot{p}(p,\,q) / 2 \\ &\cdots \\ p &= p + \delta t \cdot \dot{p}(p,\,q) / 2 \\ q &= q + \delta t \cdot \dot{q}(p,\,q) \\ p &= p + \delta t \cdot \dot{p}(p,\,q) / 2 \end{align} You can then combine the pairs of half-steps with each other while also breaking the individual $q$ updates into two halves. To rectify the fact that Leapfrog updates on a half-cycle offset from the position Verlet, we can add or subtract terms at the beginning & end as needed, which then would yield, \begin{align} q &= q + \delta t \cdot \dot{q}(p,\,q) / 2 \\ p &= p + \delta t \cdot \dot{p}(p,\,q) \\ q &= q + \delta t \cdot \dot{q}(p,\,q) / 2 \end{align} Hence, the two methods are mathematically equivalent. For a programmatic viewpoint, see this blog post.

The only difference is that in one case, the force is computed once while in the second case it is computed twice. It likely would be preferable, for computation efficiency reasons, to compute the more expensive function just once per step. If it happens that $\dot{p}$ is more expensive than $\dot{q}$, use position Verlet; if not, use Leapfrog/velocity Verlet.


In the comments, you indicated that "a few papers [...] show that the velocity-Verlet is numerically more accurate". Note that the thesis in question is discussing the original Verlet integrator, $$ q(t + \Delta t) = 2q(t) − q(t − \Delta t) + \Delta t^2\frac{F\left(q(t)\right)}{M}+\mathcal{O}\left(\Delta t^4\right) $$ with Leapfrog/velocity Verlet method, \begin{align} q\left(t+\Delta t\right) &= q(t)+\Delta tv(t)+\frac{\Delta t^2}{2}\frac{F\left(q(t)\right)}{M} \\ v\left(t+\Delta t\right) &= v(t) + \frac{\Delta t}{2}\frac{F\left(q(t+\Delta t)\right)+F\left(q(t)\right)}{M} \end{align} The reference Swope et al 1982, for instance, indicates that it is due to the rounding errors in finite precision on a computer that the velocity Verlet method is superior. Their appendix doesn't seem to cover examples. Tuckerman, Berne and Martyna 1992 doesn't actually seem to discuss numerical accuracy between the two methods.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.