Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
13fc591
feat: add MACE potential support with MPI interface
FelyCZ Feb 22, 2026
547d35f
fix: add test for MACE potential with MPI interface
FelyCZ Feb 22, 2026
d37987d
chore: cleanup
FelyCZ Feb 22, 2026
b78376a
fix: add MACE install script
FelyCZ Feb 22, 2026
02bd2dc
fix: add option for custom Python interpretter
FelyCZ Feb 22, 2026
dd59254
fix: MACE model loading
FelyCZ Feb 22, 2026
789cdb7
fix: default MACE model path
FelyCZ Feb 22, 2026
8ca192a
fix: default MACE model path
FelyCZ Feb 22, 2026
5f5828a
docs: add information about MACE to README
FelyCZ Feb 22, 2026
1f8ee25
docs: add quick guide for MACE interface
FelyCZ Feb 22, 2026
c8dfc47
docs: add MACE licensing
FelyCZ Mar 7, 2026
683d2ae
chore: cleanup
FelyCZ Mar 7, 2026
d829cfc
style: reformat & comment cleanup
FelyCZ Mar 7, 2026
9c7bc19
style: autoformat
FelyCZ Mar 17, 2026
b01d25d
fix: mace unit test default model path
FelyCZ Mar 17, 2026
7e5266e
Merge branch 'master' into feat/add-mace
danielhollas Apr 28, 2026
07f1fd5
CI: Install MACE for MPI builds
danielhollas Apr 28, 2026
d11c195
Remove oversubsribe parameter in MACE test
danielhollas Apr 28, 2026
ac63c4d
Try adding LD_LIBRARY_PATH
danielhollas Apr 28, 2026
f23559e
Build shared mpich libraries
danielhollas May 1, 2026
1efe09b
Merge branch 'master' into feat/add-mace
danielhollas May 1, 2026
cccdc9e
MACE: Don't sleep by default
danielhollas May 1, 2026
105021d
Fix mace_server.py for float32 precision inference
danielhollas May 21, 2026
8aad1b9
Cleanup imports
danielhollas May 29, 2026
978a014
Use MACECalculator
danielhollas May 29, 2026
f0b0610
Fix coordinates receive
danielhollas May 30, 2026
0fd213c
Add inline dependencies to mace_server.py
danielhollas May 30, 2026
0c52124
Remove MACE-OFF23 model, remove install_mace.sh
danielhollas May 30, 2026
3caba04
Ruff check
danielhollas May 30, 2026
1ec47a1
Remove MACE unit test
danielhollas May 30, 2026
ae0c895
Merge branch 'master' into dh-mace
danielhollas May 30, 2026
022ad76
idebug=2 in mace test
danielhollas May 30, 2026
37543f2
Remove MACE config from ABIN input file
danielhollas Jun 20, 2026
27d5e71
Parse cmdline args in mace_server.py
danielhollas Jun 28, 2026
78dd175
Remove OpenMP parallelization from force_mace.F90
danielhollas Jun 28, 2026
0250271
Register exception_hook that shuts down MPI communication
danielhollas Jun 28, 2026
c5fd929
Test the actual interface
danielhollas Jun 29, 2026
d141132
Add failing test, add ERROR_TAG=13
danielhollas Jun 29, 2026
0a70500
Simplify
danielhollas Jun 29, 2026
0f6409b
Fix
danielhollas Jun 29, 2026
9438ee0
Send error tag upon ABIN error
danielhollas Jun 29, 2026
4737748
Temporarily skip unit tests on macos runner
danielhollas Jun 29, 2026
26ebf63
Add MACE_ERROR test
danielhollas Jun 29, 2026
5340640
More coverage
danielhollas Jun 29, 2026
af7f468
Fixes and cleanup for utils/run.mace_mpi_abin.sh
danielhollas Jun 30, 2026
c51854f
Tweaks
danielhollas Jul 3, 2026
083deb4
Don't send extra message to MACE server if we got error tag from it
danielhollas Jul 3, 2026
65df2d9
Better error handling in ABIN
danielhollas Jul 3, 2026
9709ee3
Add special diff handling for ERROR output file
danielhollas Jul 4, 2026
baff923
More robust test.sh
danielhollas Jul 4, 2026
19ce7b3
Tweaks to run.mace_mpi_abin.sh
danielhollas Jul 4, 2026
86b15dc
Run ruff on mace_server.py
danielhollas Jul 4, 2026
c667f24
Add WITHOUT_MACE test
danielhollas Jul 4, 2026
93b6f8d
Fail if mace_port.txt does not exist
danielhollas Jul 4, 2026
2cdf047
Fix OpenMPI test
danielhollas Jul 4, 2026
1c7f0c5
Handle ERROR tag from ABIN in MACE server
danielhollas Jul 4, 2026
3bf1694
Merge branch 'master' into dh-mace
danielhollas Jul 5, 2026
39b5844
Fix prek
danielhollas Jul 5, 2026
e3997cc
Actually add MACE_ERROR2 test
danielhollas Jul 5, 2026
10abf04
Run ruff format, add assertions about size of data sent
danielhollas Jul 5, 2026
a446c6a
Cleanup input.ins
danielhollas Jul 5, 2026
35130d9
Fix mace_server EXIT tag handling, add perf_counter
danielhollas Jul 5, 2026
13e253d
Tweaks
danielhollas Jul 5, 2026
9f6b41a
Update README
danielhollas Jul 6, 2026
19c0e75
More README
danielhollas Jul 6, 2026
179c2d1
Add more details about MPICH installation
danielhollas Jul 6, 2026
4427a94
Skip MACE tests when python deps are not available
danielhollas Jul 6, 2026
9fa194f
Fix unbound variable
danielhollas Jul 6, 2026
12799ec
Merge branch 'master' into dh-mace
danielhollas Jul 6, 2026
b88b1de
Tweak README files
danielhollas Jul 6, 2026
fe817c6
Fix make -j in install_mpich
danielhollas Jul 6, 2026
b5b283d
Remove LD_LIBRARY_PATH hack
danielhollas Jul 6, 2026
6f1c328
README tweaks
danielhollas Jul 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/gfortran.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,15 @@ jobs:
if [ $GCC_V -ge 10 ];then export FFLAGS="-fallow-argument-mismatch";export FCFLAGS="-fallow-argument-mismatch";fi && \
./dev_scripts/install_mpich.sh ${HOME}/mpich ${MPICH_V}

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: 3.12
activate-environment: true

- name: Install MACE
run: uv pip install --torch-backend=cpu -r interfaces/MACE/mace_server.py

- name: build ABIN
run: |
if [ $GCC_V -ge 10 ];then export FFLAGS="-fallow-argument-mismatch $FFLAGS";fi && \
Expand All @@ -341,6 +350,7 @@ jobs:
LDLIBS: ${{ env.ABIN_LDLIBS }}
- name: test ABIN
run: make test

- name: Codecov upload
uses: codecov/codecov-action@v7
with:
Expand Down Expand Up @@ -374,6 +384,15 @@ jobs:
if: steps.openmpi-cache.outputs.cache-hit != 'true'
run: ./dev_scripts/install_openmpi.sh ${HOME}/openmpi ${OPENMPI_V} ${OPENMPI_PATCH}

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: 3.12
activate-environment: true

- name: Install MACE
run: uv pip install --torch-backend=cpu -r interfaces/MACE/mace_server.py

- name: build ABIN
run: ./configure --mpi "${HOME}/openmpi/${OPENMPI_V}/install" && make
env:
Expand Down
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
ABIN is a program for performing ab initio molecular dynamics.
It is a general purpose program that was initially designed to model nuclear quantum effects (NQE).
NQE can be most rigirously captured with path integral MD (PIMD), but also within the Quantum Thermostat based on General Langevin Equation framework developed by Michele Cerriotti.
ABIN can also simulate non-adiabatic events using Surface-hoping algorithm, using either the classical fewest-switches algorithm (FSSH) or simpler Landau-Zener approach which does not require non-adiabatic couplings. The LZ approach can also capture singlet-triplet transitions.
ABIN can also simulate non-adiabatic events using Surface-hoping algorithm, using either the classical fewest-switches algorithm (FSSH) or simpler Landau-Zener (LZ) approach which does not require non-adiabatic couplings. The LZ approach can also capture singlet-triplet transitions.

The basic philosophy of ABIN program is simple —
The basic philosophy of ABIN program is simple —
while the program itself handles the propagation of the system according to the equations of motion,
the forces and energies are taken from an external electronic structure program such as ORCA or TeraChem.
The call to the chosen external program is handled via a simple shell script interface.
Expand Down Expand Up @@ -72,11 +72,41 @@ To install the libraries, you can use the install scripts in `dev_scripts/`.
We use these in our Continuous Integration testing suite on Github using the Ubuntu 18.04 image.

The optional libraries are:
- [MPICH](https://www.mpich.org/): An MPI implementation used for Replica Exchange MD and MPI interface with TeraChem.
- [MPICH](https://www.mpich.org/): An MPI implementation used for Replica Exchange MD and MPI interface with TeraChem and MACE.
- If you just need REMD you can also use other MPI libraries such as OpenMPI or IntelMPI.
- [FFTW](http://www.fftw.org/): Fast Fourier Transform library used for normal mode transformation in Path Integral MD.
- [PLUMED](https://www.plumed.org/): A collection of very useful tools for free energy calculations (MetaDynamics, Umbrella Sampling etc).
- [TCPB-CPP](https://github.com/mtzgroup/tcpb-cpp): [EXPERIMENTAL] TCPB interface to TeraChem
- [MACE](https://github.com/ACEsuit/mace): Machine Learning Atomic Cluster Expansion potential.
- The interface to MACE requires an MPICH installation (see below) and MACE python environment.
See `interfaces/MACE/README.md` for details


### Installing with MPICH

1. Install MPICH (adjust MPICH_PATH as needed)

```bash
MPICH_PATH=/home/$USER/software/mpich
./dev_scripts/install_mpich.sh $MPICH_PATH
```

2. Compile ABIN and run tests

(Substitute the `<mpich_version>` for the actual version that was installed)
```bash
MPICH_PATH=$MPICH_PATH/<mpich_version>/install
./configure --mpi $MPICH_PATH
make clean && make
make test
```

Before running ABIN, you might need to adjust your PATH and LD_LIBRARY_PATH

```bash
export LD_LIBRARY_PATH=$MPICH_PATH/lib:$LD_LIBRARY_PATH
export PATH=$MPICH_PATH/bin:$PATH
```


## Structure of the repository
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ done

# Set to default if FFLAGS is not defined yet, see
# https://stackoverflow.com/questions/11362250/in-bash-how-do-i-test-if-a-variable-is-defined-in-u-mode
: ${FFLAGS:="-O2 -fopenmp -fimplicit-none $warning_flags"}
: ${FFLAGS:="-O2 -g -fopenmp -fimplicit-none $warning_flags"}

if [[ -z ${FC-} ]];then
if [[ $MPI = "TRUE" ]];then
Expand Down
22 changes: 15 additions & 7 deletions dev_scripts/install_mpich.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,26 @@
# Exit script immediately upon error
set -euo pipefail

CC=${CC:-gcc}
FC=${FC:-gfortran}

if [[ -z ${1-} ]]; then
echo "ERROR: Provide prefix path where install MPICH as first parameter"
exit 1
fi
# Path as an optional first parameter
MPICH_DIR="${1-$HOME/mpich}"
MPICH_DIR="$(realpath "$1")"
# We take current stable version as default
# (as of 06 Nov 2020).
MPICH_VERSION="${2-"4.0.2"}"
MPICH_VERSION="${2-"4.3.2"}"

# Detect number of CPUs
NCPUS=$(nproc)

TAR_FILE="mpich-${MPICH_VERSION}.tar.gz"
DOWNLOAD_URL="https://www.mpich.org/static/downloads/${MPICH_VERSION}/${TAR_FILE}"
INSTALL_DIR="$MPICH_DIR/$MPICH_VERSION/install"

# Github Actions machines have two CPUs, per:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources
NCPUS=2

if [[ -d "$INSTALL_DIR" ]];then
echo "Found existing MPICH installation in $INSTALL_DIR"
Expand Down Expand Up @@ -56,9 +63,10 @@ cd "$MPICH_DIR/$MPICH_VERSION/src" && tar -xzf "../pkg/${TAR_FILE}" && cd "mpich
# export FCFLAGS=-fallow-argument-mismatch
./configure FC=gfortran CC=gcc \
--enable-fortran=all \
--with-pm=hydra --with-device=ch3:nemesis \
--with-pm=hydra \
--with-device=ch3:nemesis \
--with-namepublisher=pmi \
--enable-static --disable-shared \
--enable-static \
--prefix="${INSTALL_DIR}" 2>&1 |\
tee configure.log
make -j $NCPUS 2>&1 | tee make.log
Expand Down
64 changes: 64 additions & 0 deletions interfaces/MACE/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# MACE MPI Interface for ABIN

This directory contains the Python-based server for the MACE (Machine Learning Atomic Cluster Expansion) potential.

## Requirements

- Python >= 3.8
- PyTorch >= 1.12
- mace-torch
- ase
- mpi4py
- numpy

The exact dependencies are specified as inline metadata in `mace_server.py`.
We highly recommend installing the dependencies in a fresh virtual environment
using the [uv package manager](https://github.com/astral-sh/uv):

```console
# Install uv first, https://github.com/astral-sh/uv#installation
uv venv # Creates a new virtual environment in .venv/ folder
uv pip install -r interfaces/MACE/mace_server.py --torch-backend=auto
source .venv/bin/activate # Activates the environment
```

> [!IMPORTANT]
> The tricky part is to install the correct binary version of PyTorch, as it needs to match your CUDA version.
> The `--torch-backend=auto` should autodetect your environment and install the correct version.
> In HPE clusters, make sure you load your CUDA environment before running the installation.
> Please read the [uv PyTorch documentation](https://docs.astral.sh/uv/guides/integration/pytorch/#automatic-backend-selection) for more information.
> If your machine doesn't have a GPU accelerator, the installation will automatically pick up the CPU-only build.

ABIN itself must be compiled using the MPICH compiler, see top-level [README.md](../../README.md#installing-with-mpich) for instructions.

After installation, run the MACE tests to make sure the basic communication works.
```console
$ make test TEST="MACE MACE_ERROR MACE_ERROR2"
Running tests in directories:
MACE MACE_ERROR MACE_ERROR2
MACE PASSED
=======================
MACE_ERROR PASSED
=======================
MACE_ERROR2 PASSED
=======================

3 tests PASSED.
```

These tests use a fake potential, not the actual MACE implementation.
Make sure you test the energy conservation using a short NVE dynamics
before running production calculations!

## Usage

The MACE server must be launched alongside ABIN using mpirun.
It is recommended to use the provided launch script `utils/run.mace_mpi_abin.sh`.

Rough steps:

1. Specify `pot='_mace_'` in the ABIN input file, everything else is the same.
2. Copy `interfaces/MACE/mace_server.py` and `utils/run.mace_mpi_abin.sh` into your working directory.
3. In the launch script, specify the ABIN input files, and paths to MPICH and Python installation.
4. In the launch script, specify path to your MACE model file, and whether to evaluate the model on CPU or CUDA GPU.
5. Profit!
Loading
Loading