Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make installable #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aimnet2/_version.py export-subst
47 changes: 47 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

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

jobs:
test:
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macOS-latest
- ubuntu-latest
python-version:
- "3.10"

steps:
- uses: actions/checkout@v4

- name: Install conda environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/test_env.yaml
create-args: >-
python=${{ matrix.python-version }}

- name: Install package
run: |
python -m pip install .

- name: Run tests
run: |
pytest -v --color=yes pyaimnet2/tests/
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include pyaimnet2 *
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,47 @@ Output is a dictionary with the following keys:
energy: shape (m, ) - energy in eV
charges: shape (m, n) - partial atomic charges
```

## Installation
To make accessing the models simpler this package can be installed into a python environment. It is recommended that you
create a new conda environment with the required dependencies to run the AIMNET2 model and provided calculator interfaces.
You can create the environment using the following command
```bash
mamba create -n aimnet2 -c conda-forge 'pytorch=2' numpy ase
```
you should then activate the environment using
```bash
conda activate aimnet2
```
to use the `pysisyphus` calculator you will need to install the package from PyPI using pip
```bash
pip install pysisyphus
```
you should then clone this package and install from source via
```bash
git clone https://github.com/isayevlab/AIMNet2.git
cd AIMNet2
pip install .
```

## Loading models via python
The aimnet2 package provides a convenience function to load the ensemble models

```python
from pyaimnet2 import load_model

model = load_model("wb97m-d3") # can also load b973c
```
the model can then be used by providing the inputs as described in [Models](#models) or used with one of the provided
calculators like ASE

```python
from pyaimnet2.calculators.aimnet2ase import AIMNet2Calculator

calculator = AIMNet2Calculator(model=model)
```


## Calculators

We provide example code for AIMNet2 calculators for [ASE](https://wiki.fysik.dtu.dk/ase) and [pysisyphus](https://pysisyphus.readthedocs.io/) Python libraries. The code shows an example use of the AIMNet2 models.
Expand Down
70 changes: 0 additions & 70 deletions calculators/aimnet2ase.py

This file was deleted.

12 changes: 12 additions & 0 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: pyaminet2
channels:
- conda-forge
dependencies:
- python
- pip
- ase
- numpy
- pytorch==2.0.0

# testing
- pytest
Binary file removed models/aimnet2_b973c_0.jpt
Binary file not shown.
Binary file removed models/aimnet2_b973c_1.jpt
Binary file not shown.
Binary file removed models/aimnet2_b973c_2.jpt
Binary file not shown.
Binary file removed models/aimnet2_b973c_3.jpt
Binary file not shown.
Binary file removed models/aimnet2_wb97m-d3_0.jpt
Binary file not shown.
Binary file removed models/aimnet2_wb97m-d3_1.jpt
Binary file not shown.
Binary file removed models/aimnet2_wb97m-d3_2.jpt
Binary file not shown.
Binary file removed models/aimnet2_wb97m-d3_3.jpt
Binary file not shown.
7 changes: 7 additions & 0 deletions pyaimnet2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from . import _version
from pyaimnet2.utils import load_model


__all__ = ["load_model"]

__version__ = _version.get_versions()["version"]
Loading