espressomd / espresso

The ESPResSo package
https://espressomd.org
GNU General Public License v3.0
226 stars 183 forks source link

Investigate switching integrator per particle #4015

Open RudolfWeeber opened 3 years ago

RudolfWeeber commented 3 years ago

Right now, the integrator is chosen globally (via integ_switch). Specific intregrators contain their own loop over all particles.

This has two weaknesses:

Using definitions:

We should investigate, whether

In a second step (or in one go), integrator parameters can be put into classes. This would be time step for velocity verlet, pre-factor and cap for steepest descent, etc.

@fweik, this is how I understood our discussions on the topic. Is there something missing?

fweik commented 3 years ago

Yes that sounds reasonable. If you want to coerce the virtual sites into that abstraction (they are really not per particle), than they will always need special treatment. Also it has to be considered if rattle can be integrated into this framework.

For the virtual sites I think abstractly what you want to do is in the first sweep defer some particles for later integration. You could e.g. have integrators return either new positions for a particle or a defer tag, in which the particle is noted for later propagation. Then, if there are deferred particles, you do the next loop only with the left ones and so on until there are none left. Potentially rattle also fits into this construction e.g. rattle could defer particles until it is happy with the tolerance.

jngrad commented 3 years ago

Equations of motion for integrators and thermostats

Used notation:

Velocity Verlet

Velocity Verlet NpT

Stokesian Dynamics

Brownian Dynamics

Steepest descent

Langevin

LB

RudolfWeeber commented 3 years ago

@jngrad, thanks for collecting the status quo.

In the future, there should be

There will likely be the following propagation schemes:

RudolfWeeber commented 3 years ago
RudolfWeeber commented 3 years ago

Single particle propagators without pre/post tasks

Below propagators have kernels of the form

new_pos, new_vel = kernel(particle)

force is optional in some cases. Analogous for rotation. There is (to my understanding) no task which has to run before they can be applied

Single particle propagators with pre/post tasks

The following propagators have single particle kernels + a pre- and/or a post-task

Collective propagators

Not sure how rattle fits in. Probably only as an addon to Velocity Verlet

RudolfWeeber commented 3 years ago

So, if we only had single particle kernels which work independently, we'd have

for prop in active_propagatros:
    prop.pre(filter(particles,prop))
for part in particles:
    select_propagator(part).propagate(part) 
for prop in propagatros:
    prop.post(filter(particles,prop))

Here, filter() would filter the particles that qualify for a specific propagator. select_propagatro() will either reutrn the default (system-wide) propagator or the one specified on the single particle.

Alternatively, one can have one traversal of particles per propagator

for prop in all_propagators:
    prop.propagate(filter(particles,prop))

The latter approach works also with collective particles and would allow us to specify an order (e.g., virtual sites last) The single particle propagators could then share (part of) the propagate() implementation.

The first approach would allow to combine the vve rlet list update check into the propagation traversal. Otherwise, an independent pass is needed. (Currently, verlet list checks are copied into all propagatros, which I don't think, we want to keep).

We also need to decide, how functional we want this to be. I.e., which of the following should the propagator change "in-place"and which whoudl be returned as some state-change datastructure, which is acted upon later?