HTMPC17
A template library for Multi-Particle Collision Dynamics
All Classes Functions Variables Typedefs Friends Pages
HTMPC17 - a Heavily Templated library for simulating hydrodynamic interactions using Multi-Particle Collision dynamics in c++17

Welcome to the project page for HTMPC17.

About HTMPC and its Features

HTMPC is a plugin-based template library implementing the Multi-Particle Collision Dynamics algorithm that uses discrete particles to simulate hydrodynamic interactions. It supports the following (optional) extensions to the original algorithm and technical features:

  • Thermostat to regulate system energy
  • Cell-based conservation of local angular momentum
  • Gravity along one of the system axes
  • A variety of boundary conditions in many useful combinations:
    • Periodic, optionally with shear
    • No-slip, optionally with shear
    • Slip
    • Cylindrical with slip or no-slip surfaces (experimental)
  • Particle IDs
  • CUDA-based GPU acceleration
    • Support for all architectures since Kepler
  • MPI-support for distributing simulations over an arbitrary number of ranks
    • Also supported on CUDA-aware MPI-implementations, tested and decently scaling on thousands of GPUs simulating more than a trillion particles
  • Bit-perfect reproducibilty of particle trajectories independent of the number of MPI-ranks or the domain decomposition of distributed systems
  • Writing (and reading) snapshots of the simulation system, manually or at given intervals
  • Configuration of run-time parameters using command line parameters or parameter files
  • Plugin-based approach allowing to define custom
    • Objects in solution
    • Boundary conditions
    • Data processing
    • Whatever you can think of
  • Compile-time configuration using a single DSL-like configuration class
    • Extendable using custom, plugin-provided interpreters

Source Code and Documentation

The source code can be found here.

For details on how to use and extend HTMPC, see the Programmer's Manual and/or the API documentation (work in progress) provided on this page.

The source code also contains a sample folder, showing how to implement an actual simulation using a force-loop plugin, that in turn utilizes a Lennard-Jones-force plugin to simulate solute particle interacions.

In case of problems, please also check the Changelog at the end of this page and check if you are using the latest release.

Acknowledgements

The technical implementation, based on code for the scientific details provided by a number of contributors, was written by Elmar Westphal at Forschungszentrum Juelich, who wishes to thank the following people without whose support HTMPC would not exist:

  • Roland Winkler for initiating the project of a GPU-accelerated MPC-code many years ago, supporting it and many projects based on it over all this time and never getting tired of my countless questions
  • Chien-Cheng Huang and Sunil Pratab Singh for providing many of the scientific code samples the code is based on
  • Kai Qi and Segun Goh whose large-scale projects were the driving force that lead to a truly distributed implementation
  • Gerhard Gompper whose institute is this project's home

Citations

If you find this code or portions of it useful for your work, please cite: Westphal, E., Goh, S., Winkler, R. G., & Gompper, G. (2025). HTMPC꞉ A heavily templated C++ library for large scale particle‐based mesoscale hydrodynamics simulations using multiparticle collision dynamics. Computer Physics Communications, 309, 109494.

Changelog

  • 20250123 fixed an issue that could lead to artifacts based on insufficient precision of floating point random numbers
  • 20250126 fixed an issue with bit_perfect ab initio reproducility in certain setups