Setting `abstol` and `reltol` when solving the Schrödinger equation with OrdinaryDiffEq

Firstly, both abstol and reltol are stepwise, not global. They bound the acceptable error for a single time step, but larger errors may accumulate over the course of the simulation.

For each step, abstol is a tolerance on the next value of norm(Ψ - Ψ_exact) conditional on the current Ψ being exact, while reltol is a tolerance on norm(Ψ - Ψ_exact) / norm(Ψ). Of course, you don’t actually know Ψ_exact, but if anything the error estimates lean toward the pessimistic side, so this is usually quite robust. (Specifically, for an order n algorithm the error is estimated by comparing the proposed step to one computed using an order n - 1 algorithm. This can really be thought of as a heuristic error estimate for the order n - 1 algorithm, and should thus be an overestimate for the order n algorithm unless something pathological is going on.)

abstol specifies what zero means to you in absolute terms, while reltol specifies the number of accurate digits you demand. If you know the typical magnitude of your state—say, the typical or maximum value of norm(Ψ) during the simulation—it’s natural to set abstol = scale * reltol. I think matlab ode solvers can even do this automatically: you specify a reltol, and the integrator keeps track of the largest state encountered and updates abstol accordingly. However, if the norm of your states is fairly constant, at least in order of magnitude terms, you might as well only specify reltol while keeping abstol = 0.

For quantum states where norm(Ψ) = 1, the distinction doesn’t really matter and abstol and reltol are interchangeable. In this case, I’d set abstol to zero and experiment with reltol.

1 Like