quantum-exeter / SpiDy.jl

:spider: Non-Markovian stochastic SPIn (and harmonic oscillator) DYnamics.
GNU General Public License v3.0
11 stars 2 forks source link

Changes to speed up the simulations #3

Closed cerisola closed 1 year ago

cerisola commented 1 year ago

This pull request introduces changes to speed up the simulations.

The main (and breaking) change is that now the diffeqsolver family of methods return directly the solution from the DifferentialEquations.jl library, instead of manipulating the result. This surpassingly results in a major speed-up, frequently of 2x or more. However, care should be taken since this change is breaking, mainly since now the order of the time and spin components indices are swapped in the results returned by diffeqsolver. Furthermore, the way to access the interpolator is now also different. The example code in the run folder has been updated to work with the new conventions, but users of previous versions should change their custom scripts.

There are also some other minor changes, such as pre-allocating some variables repeatedly used in the differential equation to minimise the number of allocations when solving the ODE.