aiida-mlip

Build Status Coverage Status Docs status PyPI version License DOI

aiida-mlip

logo

machine learning interatomic potentials aiida plugin

Features (in development)

The code relies heavily on janus-core, which handles mlip calculations using ASE.

Getting Started

Installation

We suggest creating a new virtual environment and activating it before running the commands below to install aiida-mlip:

pip install aiida-mlip
verdi plugin list aiida.calculations

The last command should show a list of AiiDA pre-installed calculations and the aiida-mlip plugin calculations:

Registered entry points for aiida.calculations:
* core.arithmetic.add
* core.templatereplacer
* core.transfer
* mlip.opt
* mlip.sp
* mlip.md
* mlip.train
* mlip.descriptors

AiiDA Configuration

Once aiida-mlip is installed, you have to configure AiiDA by creating a profile to store your data:

  1. (Optional) Install RabbitMQ
  2. Run:
    verdi presto #Sets up profile and broker for daemon to run
    
  3. Create a code for janus-core

[!NOTE] Setting up a message broker like RabbitMQ is recommended to enable full functionality, particularly for production use. If detected, verdi presto sets up a complete AiiDA profile, including the computer, database, and broker, but the janus-core code must be set up separately, as described above.

Please refer to our user guide for more details on installation and configuring AiiDA.

Usage

The examples folder provides scripts to submit calculations in the calculations folder, and tutorials in jupyter notebook format in the tutorials folder.

A quick demo of how to submit a calculation using the provided example files:

verdi daemon start     # make sure the daemon is running
cd examples/calculations
verdi run submit_singlepoint.py "janus@localhost" --struct "path/to/structure" --architecture mace --model "/path/to/model"    # run singlepoint calculation
verdi run submit_geomopt.py "janus@localhost" --struct "path/to/structure" --model "path/to/model" --steps 5 --opt_cell_fully True # run geometry optimisation
verdi run submit_md.py "janus@localhost" --struct "path/to/structure" --model "path/to/model" --ensemble "nve" --md_dict_str "{'temp':300,'steps':4,'traj-every':3,'stats-every':1}" # run molecular dynamics

verdi process list -a  # check record of calculation

Models can be trained by using the Train calcjob. In that case the needed inputs are a config file containig the path to train, test and validation xyz file and other optional parameters. Running

verdi run submit_train.py

a model will be trained using the provided example config file and xyz files (can be found in the tests folder)

Development

We recommend installing uv for dependency management when developing for aiida-mlip, and setting up PostgreSQL, as this is currently a requirement for testing:

  1. Install uv
  2. Setup PostgreSQL
  3. Install aiida-mlip with dependencies in a virtual environment:
git clone https://github.com/stfc/aiida-mlip
cd aiida-mlip
uv sync --extra mace # Create a virtual environment and install dependencies with mace for tests
source .venv/bin/activate
pre-commit install  # Install pre-commit hooks
pytest -v  # Discover and run all tests

See the developer guide for more information.

License

BSD 3-Clause License

Funding

Contributors to this project were funded by

PSDI ALC CoSeC