While in molecular dynamics, all particles move during a time step, only a single (or small number) particle are changed during a Monte Carlo move.
Thus, while it is OK to recalculate energy/forces for the entire sysem in MD, this is a waste of compute time in MC, where only a small fraciotn of the system has changed.
The project outlined here would significantly improve the performance of MC methods like GHMC, Widdom insertion, the reaction ensemble, and teh Gibbs ensemble.
Steps to improve MC support in ES
[x] Allow calculation of short range energy contribution of a single particle (@jhossbach)
[ ] Re-use some of the results for electrostatics/magnetostatics solvers to calculate energy differences due to a small number of particles changing
[ ] Smarter handling of particle insertion/removeal/modification so that not all caches/Verlet lsits are invalidated
Re-use of informaiton from previous electrostatics/magnetostatics calculations
This concerns P3M. the algorithm consists of the following steps
Interpolating the charges/dipoles onto a grid
Fourier-transform
Solve the Poisson eqn in Fourier space
Back-transform in to real space
back interpolate from the potential onto the particles
the computational effort can be shifted between the interpolation steps and the fourier space steps by favoring higher charge assignment orders or number of grid points, respectively.
In a Monte-Carlo simulation, the real space lattice containing the (interpolated) charfes can be kept. Then, when only one particle is changed, one can skip most of the charge assignment phase of P3M and only substract the particle at its old position and add it at its new position. The same is true for particle insertio/removal MC moves.
Better handling of particle inseriton/remoal/modification
Currently, adding or removing a particel, or changing of any particle property in ES triggers a resort and rebuild of the Verlet lsits and invalidation of all caches. this can probly be avoided in many instances.
[ ] More fine-grained events than on_particel_change() can be introduced. E.g., the change of mass/rotaiontal inrtia, degree of freedom fixes, quaternions, etc. does not require a resort. A ghost update will do, or the ghosts can be updated in parallel with the particle
[ ] Long range solvers need to react to Charge/dipole changes, buy s trdoty id ptobsbly also not necessary. A Verlet lsit update is only necessary if the charge/dipole was/will become 0
[ ] Small position shifts can use the normal mechanism used by the Verlet lists to determine, if an update is needed.
[ ] Further along, the one big Verlet list ES uses per MPI rank could be split into lists per cell (or bunch of cells), so that a particle insertion/removal only affects the Verlet list for that (and the neighboring) regions.
Backgroudn
While in molecular dynamics, all particles move during a time step, only a single (or small number) particle are changed during a Monte Carlo move. Thus, while it is OK to recalculate energy/forces for the entire sysem in MD, this is a waste of compute time in MC, where only a small fraciotn of the system has changed.
The project outlined here would significantly improve the performance of MC methods like GHMC, Widdom insertion, the reaction ensemble, and teh Gibbs ensemble.
Steps to improve MC support in ES
Re-use of informaiton from previous electrostatics/magnetostatics calculations
This concerns P3M. the algorithm consists of the following steps
the computational effort can be shifted between the interpolation steps and the fourier space steps by favoring higher charge assignment orders or number of grid points, respectively.
In a Monte-Carlo simulation, the real space lattice containing the (interpolated) charfes can be kept. Then, when only one particle is changed, one can skip most of the charge assignment phase of P3M and only substract the particle at its old position and add it at its new position. The same is true for particle insertio/removal MC moves.
Better handling of particle inseriton/remoal/modification
on_particel_change()
can be introduced. E.g., the change of mass/rotaiontal inrtia, degree of freedom fixes, quaternions, etc. does not require a resort. A ghost update will do, or the ghosts can be updated in parallel with the particle@pm-blanco, @schlaicha @kosovan @dbeyer @mebrito