wright-group / WrightSim

A simulation package for multidimensional spectroscopy.
MIT License
4 stars 0 forks source link

Move zeroing of hamiltonian outside of the matrix function #28

Open ksunden opened 6 years ago

ksunden commented 6 years ago

https://github.com/wright-group/WrightSim/blob/8c23c2431a80f1eb87be6613c69a9db399354be8/WrightSim/hamiltonian/default.py#L288-L289

While nice to not need to remember, the zeroing does nothing for any call other than the first. Elements which already have a value will be overwritten. Elements which are zero don't need to be. This only needs to be done once, not at every time step.

Either move this loop to the calling function (runge-kutta for now), or add a boolean argument to the function, and hide this behind an if statement.