Skip to content
lukaswittmannPublic

About

The Modular and Open-source Implicit Solvation Toolkit (MOIST): smooth, differentiable molecular cavities, efficient PCMs, pressure (GOSTSHYP) and statistical (RISM) solvation models in modern Fortran with C and Python APIs

Topics

Resources

Contributing

Stars

27 stars

Watchers

1 watching

Forks

Repository files navigation

MOIST - The Modular and Open-source Implicit Solvation Toolkit

License Version DOI Build Documentation Coverage


MOIST is a modular library for modern implicit solvation in molecular quantum chemistry, usable from Fortran, C, and Python, and implemented with performance and differentiability in mind.

Note

MOIST is in pre-release: the Fortran, C, and Python APIs may still change between releases. Feedback, feature requests and contributions are very welcome; please open an issue.

Short Feature List

Installation

To build this project from the source code in this repository you need to have

  • a Fortran compiler supporting Fortran 2018
  • a C11 compiler and a C++17 compiler (e.g. gcc/g++ with gfortran, icx/icpx with ifx or ifort, or clang/clang++ with gfortran)
  • one of the supported build systems:
    • meson version 0.57 or newer, with a build-system backend, i.e. ninja version 1.8.2 or newer
    • cmake version 3.25 or newer, with a build-system backend, i.e. ninja version 1.10 or newer
  • a LAPACK / BLAS provider, like MKL, OpenBLAS, or Accelerate on macOS

See Tested platforms for the compilers and platforms covered by CI.

Building with meson

Optional dependencies are

Setup a default build with

meson setup build

You can select the Fortran compiler by the FC environment variable. To compile and run the projects testsuite use

meson test -C build --print-errorlogs

If the testsuite passes you can install with

meson configure build --prefix=/path/to/install
meson install -C build
Build options

The build is configured through meson options passed to meson setup:

Option Default Effect
-Dlapack=... auto BLAS/LAPACK backend: auto, mkl, mkl-rt, openblas, netlib, accelerate, custom
-Dcustom_libraries=... [] Libraries for the custom backend: paths, names, or a leading -L<dir>
-Dilp64=true false Use 64-bit-integer (ILP64) BLAS/LAPACK; needs an ILP64 BLAS/LAPACK
-Dopenmp=false true OpenMP parallelisation
-Dapi=false true C API (include/moist.h)
-Dpython=true false Python extension module, see Python API
-Ddocs=true false Man page (needs asciidoctor)
-Ddev_tests=false true The dev_tester binary with long-running diagnostic tests

The cmake build exposes the same toggles as -DMOIST_* options, see below.

Building with cmake

Configure and compile a default build with

cmake -B build -G Ninja
cmake --build build

The Fortran compiler is selected through the FC environment variable. To install, set the prefix at configure time and install the built tree

cmake -B build -G Ninja -DCMAKE_INSTALL_PREFIX=/path/to/install
cmake --build build
cmake --install build

The unit-test suite is built by default (the moist-tester target; disable with -DMOIST_TESTS=OFF). Run it with

ctest --test-dir build --output-on-failure
Build options

The optional numerical features map onto -DMOIST_<FEATURE> cache variables, with defaults matching the meson options:

cmake option meson equivalent Default
-DMOIST_ILP64=ON -Dilp64=true OFF
-DMOIST_OPENMP=OFF -Dopenmp=false ON
-DMOIST_API=OFF -Dapi=false ON
-DMOIST_LAPACK=... -Dlapack=... auto
-DMOIST_TESTS=OFF — ON

-DMOIST_LAPACK accepts the same backends as meson (auto, mkl, mkl-rt, openblas, netlib, accelerate, custom); custom takes its libraries from -DMOIST_CUSTOM_LIBRARIES=.... For example, a build against ILP64 BLAS/LAPACK:

cmake -B build -G Ninja -DMOIST_ILP64=ON
cmake --build build

Usage

The moist command line tool is organised into subcommands. The general form is

moist <subcommand> [options] <input>

Run moist --help to list all subcommands, or moist <subcommand> --help (for example moist cavity drop svdw --help) for the options of a specific command. moist --version, moist --citation, and moist --license print the version, the relevant literature references, and the license notice.

Constructing a cavity

To build a molecular cavity with the SvdW-DROP scheme from an XYZ coordinate file:

moist cavity drop svdw coord.xyz

Here cavity selects the cavity-only workflow, drop the DROP cavity construction, and svdw the smooth van der Waals level set (the alternative level set is cfc). Common options for this command are --radii {cpcm,smd,d3,cosmo,bondi} to choose the atomic radii set, --nleb <N> to set the Lebedev points per atom. The other cavity constructors, NumSA and iSwiG, are available as moist cavity {numsa,iswig} <coord>, and moist cavity mc {svdw,cfc} <coord> integrates the level-set isosurface with marching cubes.

Other subcommands

  • moist solvent <name> reports the tabulated properties of a solvent by name or alias.

API access

moist provides first class API support for Fortran, C and Python; see the API reference for an overview. Other programming languages should try to interface with moist via one of those three APIs. To provide first class API support for a new language the interface specification should be available as meson build files.

Fortran API

The recommended way to access the Fortran module API is by using moist as a meson subproject.

The complete API is available from moist module, the individual modules are available to the user as well but are not part of the public API and therefore not guaranteed to remain stable. ABI compatibility is only guaranteed for the same minor version.

The communication with the Fortran API uses the error_type and structure_type of the modular computation tool chain library (mctc-lib) to handle errors and represent geometries, respectively.

Python API

The Python API is disabled by default and can be built in-tree or out-of-tree. The in-tree build is mainly meant for end users and packages. To build the Python API with the normal project set the python option in the configuration step with

meson setup build -Dpython=true -Dpython_version=$(which python3)

The Python version can be used to select a different Python version, it defaults to 'python3'. Python 2 is not supported with this project, the Python version key is meant to select between several local Python 3 versions.

Proceed with the build as described before. The package can be used directly from the build tree with PYTHONPATH=build/python, or installed to make it available in the selected prefix. With -Dpython=true the test suite also runs the Python tests and requires numpy, pytest, and PySCF.

For the out-of-tree build see the instructions in the python directory.

Tested platforms

Every combination below builds and passes the full test suite in CI. The oldest tested compilers are GCC 14, Intel ifx 2025.1 and classic Intel ifort 2021.12; older versions may work but are not tested.

Platform and compiler matrix
Platform GCC 15 conda-forge GCC 15 Intel ifx 2025.1 Intel ifort 2021.12 Python
Linux x86_64 (Ubuntu 24.04) meson, CMake meson, CMake meson, CMake meson, CMake 3.10, 3.13
Linux arm64 (Ubuntu 24.04) meson, CMake meson, CMake – – 3.13
macOS arm64 (macOS 15) meson, CMake meson, CMake1 – – 3.13
Windows x86_64 meson, CMake2 – meson, CMake3 – –

1) With clang 19 and libc++ as the C/C++ compilers. 2) MSYS2 UCRT64, which ships only its current GCC, at present 16.x. 3) Native toolchain with icx and Visual Studio 2022; static library only, meson with -Ddefault_library=static.

  • BLAS/LAPACK: reference LAPACK (Linux, GCC), MKL (ifx, ifort), OpenBLAS (conda-forge, MSYS2), Accelerate (macOS)
  • ILP64: 64-bit integer BLAS/LAPACK with GCC 15 and OpenBLAS on Linux x86_64
  • Debug: GCC 14 debug build with runtime checks (-fcheck=bounds,do,mem,pointer, _GLIBCXX_ASSERTIONS) on Linux x86_64
  • Python: the bindings are tested against PySCF, both from a meson build and as a pip-installed package

Contributing

Contributions are welcome; see CONTRIBUTING.md for the code style, linting, testing, and documentation guidelines.

Citation

If you use moist, please cite the software itself (see CITATION.cff; the DOI badge above links to the latest release):

together with the references for the cavities, models, and solvers you used. For the DROP cavities, these include

For the isodensity cavity (ρ-DROP), please also cite

At the end of a run, moist prints the citations for the cavities, models, and solvers it used; the full list is printed by

moist --citation

License

moist is free software released under the MPL-2.0 license (see LICENSE).

It also bundles third-party code under separate licenses. The full inventory, with origins and license texts, is in THIRD_PARTY_NOTICES.md.

Acknowledgements

We gratefully acknowledge the people and projects moist builds on:

  • Jaś Kachnowicz for help with the initial version of the solvent properties and geometries.
  • Jacob Williams for modern Fortran implementations of the SLSQP, L-BFGS-B, nlesolver, fmin, LSQR, LSMR, and LUSOL solvers.
  • The FINUFFT developers at the Flatiron Institute, Martin Reinecke for ducc0, and the xsimd developers for the FFT and SIMD code.
  • The authors of the force-field parameter sources: Peter Boyd for lammps_interface; the openmmforcefields developers; Leela S. Dodda and the Jorgensen Lab for OPLSAA-DB; Gajanan Kanagalingam, Sebastian Schmitt, Florian Fleckenstein, and Simon Stephan for TUK-FFDat; and the VeloxChem developers.
  • The developers of the mctc-lib, mstore, toml-f, jonquil, test-drive, and fclap projects.

These components retain their original copyright notices and licenses; the full texts accompany each component in the source tree and are catalogued in THIRD_PARTY_NOTICES.md.

About

The Modular and Open-source Implicit Solvation Toolkit (MOIST): smooth, differentiable molecular cavities, efficient PCMs, pressure (GOSTSHYP) and statistical (RISM) solvation models in modern Fortran with C and Python APIs

Topics

Resources

Contributing

Stars

27 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages