|
Multi Resolution Molecular Dynamics 0.4.0
Multi Resolution Molecular Dynamics
|
The design of MRMD is heavily influenced by the following three principles: 1) portability, 2) data-oriented programming, and 3) self-documenting code.
To facilitate widespread use with minimal obstacles MRMD uses the Kokkos Performance Portability Library. This enables MRMD to run on various current and future hardware architectures, including modern state-of-the-art GPUs from Nvidia and AMD. At the same time, only a single code base needs to be maintained. We use CI jobs to continuously monitor the building and execution process for different compilers and architectures. Selecting a backend is described in Getting Started.
The software design itself focuses on separating code and data. A few data-only containers are used to hold the simulation state: for example, mrmd::data::Atoms holds the positions, velocities, and other information of all atoms within the simulation, and mrmd::data::Subdomain describes the box they live in. A separate set of functions takes these data containers as inputs and modifies them in place, e.g. mrmd::action::VelocityVerlet.
For performance reasons, the data containers are not treated as immutable objects but are modified by the algorithms directly. All pieces are exposed to the user and can be combined freely to develop new simulation methods. Tutorials shows this in practice: each example is a flat sequence of actions applied to the same containers, and moving from a plain Lennard-Jones fluid to an adaptive resolution simulation is a matter of adding and swapping actions rather than restructuring the program.
A precise naming scheme with a clear folder structure, and the avoidance of abbreviations together with literature references within the source code serve as the main point of documentation. Static code analysis using clang-tidy and automatic source code formatting using clang-format ensure consistency over the whole code base. Detailed examples serve as the main entry point for new users and are tested in the CI at every commit to ensure that everything is working correctly and is up to date.
Every non-trivial method carries the reference it was implemented from, so the documentation of an algorithm is the paper that defines it. These references are written next to the code with @reference{<method>,<doi>} and collected automatically on the Literature References page.
| Namespace | Contents |
|---|---|
| mrmd | Fundamental types (real_t, idx_t, mrmd::Point3D, mrmd::Vector3D), constants, and mrmd::initialize() / mrmd::finalize() |
| mrmd::action | Everything to evolve the simulation physically: integrators, thermostats, barostats, force kernels, constraints |
| mrmd::analysis | Everything to evaluate the current state: energies, pressure, momentum, density profiles |
| mrmd::communication | Ghost particles and periodic boundary conditions, in single and multiple resolution |
| mrmd::data | All fundamental data containers: atoms, molecules, subdomain, histograms |
| mrmd::io | Reading and writing simulation data: CSV, GRO, H5MD, LAMMPS, profiles, thermodynamic forces |
| mrmd::util | Utility functions: angles, interpolation, random numbers, simulation setup helpers |
| mrmd::weighting_function | Weighting functions for different interfaces and region geometries |
| mrmd::toSI | Conversion factors from the internal unit system to SI |
| mrmd::bin_op | GPU compatible binary operators used by the reduction helpers |
Several algorithms are grouped into nested namespaces rather than classes, which is also how they are called: mrmd::action::BerendsenThermostat, mrmd::action::BerendsenBarostat, mrmd::action::UpdateMolecules, mrmd::action::ContributeMoleculeForceToAtoms, mrmd::communication::PeriodicMapping, mrmd::communication::UpdateGhostAtoms and mrmd::communication::AccumulateForce.
Assertions are provided as macros (MRMD_HOST_CHECK_*, MRMD_DEVICE_ASSERT_*, MRMD_NORMAL_CHECK_*) in mrmd/assert/, backed by the assumption namespace when MRMD_VERBOSE_ASSERTS is enabled.
See Theory for the physics these pieces implement, and Tutorials for complete programs that use them.