An implementation of several variants of dissipative particle dynamics, a coarse-grained molecular dynamics method to simulate mesoscale structures.
Available methods:
- Standard dissipative particle dynamics (DPD), source: Groot and Warren, JCP, 1997
- Many-body dissipative particle dynamics (MDPD), source: Warren, PRE, 2003
- A generalised many-body DPD with freedom in defining local density and wrapping function (GMDPD) presented in Vanya and Elliott, PRE, 2020
This implementation of DPD/MDPD allows non-bonded particles only. For more complex simulations of polymers, we recommend DL_MESO or LAMMPS.
Project is mainly written in Python. Key bottlenecks involving force and energy computation are optimised as follows:
- Enhancement by Numba library (experimental)
- A Fortran module linked via f2py (about 10x faster)
Post-processing tools to compute density profiles and radial distribution functions are in utils.py
.
(NB: There are also ad hoc versions in pure Fortran and Julia not developed anymore.)
Standard DPD with Fortran-optimised code:
from dpdsim import DPDSim
sim = DPDSim(implementation="fortran", steps=1000, thermo=100)
sim.create_particle_inputs(kind="pure") # alternative is 'binary'
sim.run()
Other force fields (MDPD, EMDPD, GMDPD) are handled in the same way, eg:
from dpdsim import GMDPDSim
sim = GMDPDSim(implementation="fortran", steps=1000, thermo=100)
...
Access to key physics-computing functions:
sim.compute_pe() # returns potential energy
sim.compute_ke() # returns kinetic energy
sim.compute_local_density() # computes MDPD local density stored in "sim.rho2"
sim.compute_force() # computes force, virial and the stress tensor diagonal
Post-processing from within Python works as follows:
from dpdsim.utils import compute_profile, compute_rdf
# run with DPDSim object "sim"
r_pr, pr = compute_profile(sim, 0, 1, N_bins=50) # 0 for x-coord, 1 for particle type
r_rdf, rdf = compute_rdf(sim, 1, N_bins=50) # 1 for particle type
In case of questions, bugs or ideas for improvement, please contact me at peter.vanya~gmail
.