Skip to content

Commit

Permalink
Merge branch 'main' into hanwen/PBC_AL
Browse files Browse the repository at this point in the history
  • Loading branch information
juraskov authored Nov 25, 2024
2 parents 37bf174 + 4bd5c1f commit e23f8ef
Show file tree
Hide file tree
Showing 104 changed files with 6,282 additions and 4,556 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a5e89e407dd5b4ac988138af6870262d3a9e43fa # apply ruff formatter
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
groups:
gha-dependencies:
patterns:
- '*'
5 changes: 4 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
pull_request:

env:
FORCE_COLOR: 1

jobs:
pre-commit:
env:
Expand All @@ -15,4 +18,4 @@ jobs:
uses: actions/checkout@v4

- name: Run pre-commit
uses: pre-commit/[email protected].0
uses: pre-commit/[email protected].1
86 changes: 72 additions & 14 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@ on:
branches: [main]
pull_request:

env:
FORCE_COLOR: 1

jobs:
test:
name: GAP (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"]
os: ["ubuntu-22.04"]
python-version: ["3.9"]

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1

- uses: mamba-org/setup-micromamba@v2
with:
# the create command looks like this:
# `micromamba create -n test-env python=3.9 -f environment.yml`
Expand All @@ -38,27 +41,75 @@ jobs:
run: ./install_gap.sh

- name: Test basic install
run: pytest
run: pytest --cov=mlptrain -k "not test_openmm"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
flags: python-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
slug: duartegroup/mlp-train

test-ace:
name: ACE (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: ["ubuntu-22.04"]
python-version: ["3.9"]

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4

- uses: julia-actions/setup-julia@v2
with:
version: '1.6'

- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment_ace.yml
environment-name: gha-test-env
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
- name: ACE install
run: ./install_ace.sh

- name: Test ACE
run: pytest --cov=mlptrain -k "not test_openmm"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
flags: python-${{ matrix.python-version }}-ace
token: ${{ secrets.CODECOV_TOKEN }}
slug: duartegroup/mlp-train

test-mace:
name: MACE (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"]
os: ["ubuntu-22.04"]
python-version: ["3.9"]

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1

- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment_mace.yml
environment-name: gha-test-env
Expand All @@ -70,4 +121,11 @@ jobs:
run: ./install_mace.sh

- name: Test MACE install
run: pytest
run: pytest --cov=mlptrain

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
flags: python-${{ matrix.python-version }}-mace
token: ${{ secrets.CODECOV_TOKEN }}
slug: duartegroup/mlp-train
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ dist/
*DS_store
**/__pycache__/
**/__MACOSX/
.coverage
.pytest_cache
.coverage*
.pytest_cache
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ repos:
- id: check-shebang-scripts-are-executable
- id: check-added-large-files
args: ['--maxkb=500', '--enforce-all']
exclude: mlptrain/sampling/tests/data.zip
exclude: tests/data/data.zip
- id: check-yaml
- id: check-toml

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.3
rev: v0.2.1
hooks:
- id: ruff
args: [--show-source, --fix]
- id: ruff-format
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[![Test with pytest](https://github.com/duartegroup/mlp-train/actions/workflows/pytest.yml/badge.svg?event=push)](https://github.com/duartegroup/mlp-train/actions/workflows/pytest.yml)
[![DOI](https://img.shields.io/badge/doi-10.6084/m9.figshare.25816864.v1-blue.svg?style=flat&labelColor=whitesmoke&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAB8AAAAfCAYAAAAfrhY5AAAJsklEQVR42qWXd1DTaRrHf%2BiB2Hdt5zhrAUKz4IKEYu9IGiGFFJJQ0gkJCAKiWFDWBRdFhCQUF3UVdeVcRQEBxUI3yY9iEnQHb3bdW1fPubnyz%2F11M7lvEHfOQee2ZOYzPyDv%2B3yf9%2Fk95YX4fx%2BltfUt08GcFEuPR4U9hDDZ%2FVngIlhb%2FSiI6InkTgLzgDcgfvtnovhH4BzoVlrbwr55QnhCtBW4QHXnFrZbPBaQoBh4%2FSYH2EnpBEtqcDMVzB93wA%2F8AFwa23XFGcc8CkT3mxz%2BfXWtq9T9IQlLIXYEuHojudb%2BCM7Hgdq8ydi%2FAHiBXyY%2BLjwFlAEnS6Jnar%2FvnQVhvdzasad0eKvWZKe8hvDB2ofLZ%2FZEcWsh%2BhyIuyO5Bxs2iZIE4nRv7NWAb0EO8AC%2FWPxjYAWuOEX2MSXZVgPxzmRL3xKz3ScGpx6p6QnOx4mDIFqO0w6Q4fEhO5IzwxlSwyD2FYHzwAW%2BAZ4fEsf74gCumykwNHskLM7taQxLYjjIyy8MU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VbxIqrm0VL76zlH3gQzWP3R3Bv9oXxclrlO7VVtgBRpSP4hMFWJ8BrUSBCJXC07l40X4jWuvtc42ofNCxtlX2JH6bdeojXgTh5TxOBKEyY5wvBE%2BACh8BtOPNPkApjoxi5h%2B%2FFMQQNpWvZaMH7MKFu5Ax8HoCQdmGkJrtnOiLHwD3uS5y8%2F2xTSDrE%2F4PT1yqtt6vGe8ldMBVMEPd6KwqiYECHDlfbvzphcWP%2BJiZuL5swoWQYlS%2Br7Yu5mNUiGD2retxBi9fl6RDGn4Ti9B1oyYy%2BMP5G87D%2FCpRlvdnuy0PY6RC8BzTA40NXqckQ9TaOUDywkYsudxJzPgyDoAWn%2BB6nEFbaVxxC6UXjJiuDkW9TWq7uRBOJocky9iMfUhGpv%2FdQuVVIuGjYqACbXf8aa%2BPeYNIHZsM7l4s5gAQuUAzRUoT51hnH3EWofXf2vkD5HJJ33vwE%2FaEWp36GHr6GpMaH4AAPuqM5eabH%2FhfG9zcCz4nN6cPinuAw6IHwtvyB%2FdO1toZciBaPh25U0ducR2PI3Zl7mokyLWKkSnEDOg1x5fCsJE9EKhH7HwFNhWMGMS7%2BqxyYsbHHRUDUH4I%2FAheQY7wujJNnFUH4KdCju83riuQeHU9WEqNzjsJFuF%2FdTDAZ%2FK7%2F1WaAU%2BAWymT59pVMT4g2AxcwNa0XEBDdBDpAPvgDIH73R25teeuAF5ime2Ul0OUIiG4GpSAEJeYW9wDTf43wfwHgHLKJoPznkwAAAABJRU5ErkJggg%3D%3D)](https://doi.org/10.6084/m9.figshare.25816864.v1)
[![pytest CI](https://github.com/duartegroup/mlp-train/actions/workflows/pytest.yml/badge.svg?event=push)](https://github.com/duartegroup/mlp-train/actions/workflows/pytest.yml)
[![codecov](https://codecov.io/gh/duartegroup/mlp-train/branch/main/graph/badge.svg)](https://codecov.io/gh/duartegroup/mlp-train)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![License](https://img.shields.io/badge/License-MIT%202.0-blue.svg)](https://opensource.org/licenses/mit)
[![GitHub issues](https://img.shields.io/github/issues/duartegroup/mlp-train.svg)](https://github.com/duartegroup/mlp-train/issues)

# mlp-train
General machine learning potentials (MLP) training for molecular systems in gas phase and solution
Expand All @@ -15,7 +16,7 @@ Available models:

## Install

Each model is installed into individual conda environment:
Each model is installed into an individual conda environment:

```
# Install GAP
Expand All @@ -32,14 +33,19 @@ Each model is installed into individual conda environment:

- Units are: distance (Å), energy (eV), force (eV Å$`^{-1}`$), time (fs)

## Using with OpenMM (Experimental!)
## Using with OpenMM

The OpenMM backend only works with MACE at the moment. The necessary dependencies are installed automatically via conda:

```console
```
./install_mace.sh
```

Depending on your machine, you might need to prefix the command above with something like `CONDA_OVERRIDE_CUDA="11.2"` in two scenarios:

- To ensure an environment that is compatible with your CUDA driver.
- To force CUDA builds to be installed, even if the installation is being done from a CPU-only machine. This is typical in a situation where you are installing from a head node without GPUs but intend to run on GPUs and want to install the CUDA builds.

You should now be able to run `water_openmm.py` in `./examples` or run the jupyter notebook on Google Colab [`water_openmm_colab.ipynb`](./examples/water_openmm_colab.ipynb).

You can use OpenMM during active learning by passing the keyword argument `md_program="OpenMM"` to the `al_train` method.
Expand Down
6 changes: 4 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ dependencies:
- cython
- dscribe=2.0
- matplotlib-base
- numpy
- pytest
- numpy<2
- pytest=8
- pytest-cov=5
- py-plumed
- scipy
- xtb
- scikit-learn
- pip:
- quippy-ase # GAP
- ase@git+https://gitlab.com/ase/ase.git@f2615a6e9a # For PLUMED
6 changes: 4 additions & 2 deletions environment_ace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ dependencies:
- cython
- dscribe=2.0
- matplotlib-base
- numpy
- pytest
- numpy<2
- pytest=8
- pytest-cov=5
- py-plumed
- scipy
- xtb
- scikit-learn
- pip:
- julia # Python-Julia integration (this will not install Julia itself!)
- pyjulip@git+https://github.com/casv2/pyjulip.git@72280a6ac3 # Integration with ACE
Expand Down
28 changes: 10 additions & 18 deletions environment_mace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,18 @@ dependencies:
- dscribe=2.0
- matplotlib-base
- numpy
- pytest
- pytest=8
- pytest-cov=5
- py-plumed
- scipy
- xtb
# MACE dependencies
- pytorch=2.0
- openmm-torch=1.1
- torchvision
- torchaudio
- torch-ema
# TODO: You might also need CUDA-specific libraries,
# but that depends on CUDA version
# https://pytorch.org/get-started/locally/
# - pytorch-cuda=11.8
# - pytorch-cuda=12.1
- scikit-learn
- openmm
- openmm-torch
- nnpops
- openmm-ml
- git
- openmm-ml
- pip:
# e3nn is available on conda as well, but it is a dependency of mace
# so needs to be installed together.
- e3nn
- mace@git+https://github.com/ACEsuit/[email protected]
# The upstream PR to openmm-ml has not been merged yet: https://github.com/openmm/openmm-ml/pull/61)
- openmmml@git+https://github.com/sef43/openmm-ml.git@mace
- ase@git+https://gitlab.com/ase/ase.git@f2615a6e9a # For PLUMED
- mace-torch
Loading

0 comments on commit e23f8ef

Please sign in to comment.