espressomd / espresso

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

Decide api for system-wide propagation setup #4953

Open RudolfWeeber opened 2 months ago

RudolfWeeber commented 2 months ago

Background

Possible API

These are examples for a suggested API for system wide propagation setup, using the same Propagation objects that would be used to control propagation on the particle level.

from espressomd import Propagation

# Langevin for translation and rotation
system.propagation.set_params(
    default=Propagation.TRANS_LANGVEVIN || Propagation.ROT_LANGEVIN,
    kT=1,
    gamma_trans = 1,
    gamma_rot=2)

# LB coupling for translation and Langevin for rotation
system.propagation.set_params(
    default=Propagation.TRANS_LB || Propagation.ROT_LANGEVIN,
    kT=1,
    gamma_trans = 1,
    gamma_rot=2)

# ovverride for an individual particle

system.lb = LBFluidWalberla(...)
lb_tracer = system.part.add(pos=..., propagation=Propagation.LB_TRACER)

system.propagation.run(10)

One drawback is that it is necessary to import the Propagation class in all simulation scripts. On the other hand, then, the API for indidividual particles and the system-default are consistent.