Skip to content

Commit

Permalink
Add calculator test (#6)
Browse files Browse the repository at this point in the history
* add files

* resolve dgl issue

* fix typos; remove poetry

* miss dgl in test

* fix farichem version

* spearate mace from other  dependencies

* use scripts to install pyg and dgl

* fix typo

* fix another typo

* add pynanoflann dependency

* install pynanoflann separately in test workflow

* change alignn downlaod method; update all diatomic curve stats
  • Loading branch information
chiang-yuan authored Sep 20, 2024
1 parent cf512f3 commit 1c7cd6c
Show file tree
Hide file tree
Showing 16 changed files with 8,255 additions and 14,601 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Python Test

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install torch==2.2.0
bash scripts/install-pyg.sh
bash scripts/install-dgl.sh
pip install .[test]
pip install mace-torch
pip install "pynanoflann@git+https://github.com/dwastberg/pynanoflann#egg=af434039ae14bedcbb838a7808924d6689274168"
- name: Run tests
run: |
pytest tests
10 changes: 6 additions & 4 deletions mlip_arena/models/externals.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import matgl
import requests
import torch
from alignn.ff.ff import AlignnAtomwiseCalculator, get_figshare_model_ff
from alignn.ff.ff import AlignnAtomwiseCalculator, get_figshare_model_ff, default_path
from ase import Atoms
from chgnet.model.dynamics import CHGNetCalculator
from chgnet.model.model import CHGNet as CHGNetModel
Expand Down Expand Up @@ -232,11 +232,13 @@ def calculate(self, atoms: Atoms, properties, system_changes) -> None:


class ALIGNN(AlignnAtomwiseCalculator):
def __init__(self, device=None, dir_path: str = "/tmp/alignn/", **kwargs) -> None:
def __init__(self, device=None, **kwargs) -> None:
# TODO: cannot control version
_ = get_figshare_model_ff(dir_path=dir_path)
# _ = get_figshare_model_ff(dir_path=dir_path)
model_path = default_path()

device = device or get_freer_device()
super().__init__(path=dir_path, device=device, **kwargs)
super().__init__(path=model_path, device=device, **kwargs)


class SevenNet(SevenNetCalculator):
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mlip_arena/tasks/diatomics/escn/homonuclear-diatomics.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mlip_arena/tasks/diatomics/orb/homonuclear-diatomics.json

Large diffs are not rendered by default.

Loading

0 comments on commit 1c7cd6c

Please sign in to comment.