Skip to content

Commit

Permalink
single point calcjob (#84)
Browse files Browse the repository at this point in the history
add singlepoint calcuations for aiida and model management
---------

Co-authored-by: Alin Marin Elena <alin@elena.re>
Co-authored-by: ElliottKasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Jacob Wilkins <46597752+oerc0122@users.noreply.github.com>
  • Loading branch information
4 people authored Mar 15, 2024
1 parent 6334e0d commit c9700ee
Show file tree
Hide file tree
Showing 34 changed files with 1,089 additions and 661 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ jobs:
run: |
poetry env use ${{ matrix.python-version }}
poetry install --with dev
echo "JANUS_PATH=$(poetry run which janus)" >> $GITHUB_ENV
- name: Run test suite

env:
# show timings of tests
# show timings of test
PYTEST_ADDOPTS: "--durations=0"
JANUS_PATH: ${{ env.JANUS_PATH }}
run: poetry run pytest --cov aiida_mlip --cov-append .

- name: Report coverage to Coveralls
Expand Down
100 changes: 43 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,67 +18,59 @@ intended to help developers get started with their AiiDA plugins.
* [`.github/`](.github/): [Github Actions](https://github.com/features/actions) configuration
* [`ci.yml`](.github/workflows/ci.yml): runs tests, checks test coverage and builds documentation at every new commit
* [`publish-on-pypi.yml`](.github/workflows/publish-on-pypi.yml): automatically deploy git tags to PyPI - just generate a [PyPI API token](https://pypi.org/help/#apitoken) for your PyPI account and add it to the `pypi_token` secret of your github repository
* [`docs.yml`](.github/workflows/docs.yml): builds and deploys the documentation
* [`aiida_mlip/`](aiida_mlip/): The main source code of the plugin package
* [`data/`](aiida_mlip/data/): A new `DiffParameters` data class, used as input to the `DiffCalculation` `CalcJob` class
* [`calculations.py`](aiida_mlip/calculations.py): A new `DiffCalculation` `CalcJob` class
* [`cli.py`](aiida_mlip/cli.py): Extensions of the `verdi data` command line interface for the `DiffParameters` class
* [`helpers.py`](aiida_mlip/helpers.py): Helpers for setting up an AiiDA code for `diff` automatically
* [`parsers.py`](aiida_mlip/parsers.py): A new `Parser` for the `DiffCalculation`
* [`docs/`](docs/): A documentation template ready for publication on [Read the Docs](http://aiida-diff.readthedocs.io/en/latest/)
* [`examples/`](examples/): An example of how to submit a calculation using this plugin
* [`data/`](aiida_mlip/data/): Plugin `Data` classes
* [`model.py/`](aiida_mlip/data/model.py) `ModelData` class to save mlip models as AiiDA data types
* [`calculations/`](aiida_mlip/calculations/): Plugin `Calcjob` classes
* [`singlepoint.py](aiida_mlip/calculations/singlepoint.py ): `Calcjob` class to run single point calculations using mlips
* [`parsers.py`](aiida_mlip/parsers.py): `Parser` for the `Singlepoint` calculation
* [`docs/`](docs/source/): Code documentation
* [`apidoc/`](docs/source/apidoc/): API documentation
* [`developer_guide/`](docs/source/developer_guide/): Documentation for developers
* [`user_guide/`](docs/source/user_guide/): Documentation for users
* [`images/`](docs/source/images/): Logos etc used in the documentation
* [`examples/`](examples/): Examples for submitting calculations using this plugin
* [`calculations/submit_singlepoint.py`](examples/calculations/submit_singlepoint.py): Script for submitting a singlepoint calculation
* [`tests/`](tests/): Basic regression tests using the [pytest](https://docs.pytest.org/en/latest/) framework (submitting a calculation, ...). Install `pip install -e .[testing]` and run `pytest`.
* [`conftest.py`](tests/conftest.py): Configuration of fixtures for [pytest](https://docs.pytest.org/en/latest/)
* [`calculations/`](tests/calculations): Calculations
* [`test_singlepoint.py`](tests/calculations/test_singlepoint.py): Test `SinglePoint` calculation
* [`data/`](tests/data): `ModelData`
* [`test_model.py`](tests/data/test_model.py): Test `ModelData` type
* [`.gitignore`](.gitignore): Telling git which files to ignore
* [`.pre-commit-config.yaml`](.pre-commit-config.yaml): Configuration of [pre-commit hooks](https://pre-commit.com/) that sanitize coding style and check for syntax errors. Enable via `pip install -e .[pre-commit] && pre-commit install`
* [`.readthedocs.yml`](.readthedocs.yml): Configuration of documentation build for [Read the Docs](https://readthedocs.org/)
* [`LICENSE`](LICENSE): License for your plugin
* [`LICENSE`](LICENSE): License for the plugin
* [`README.md`](README.md): This file
* [`conftest.py`](conftest.py): Configuration of fixtures for [pytest](https://docs.pytest.org/en/latest/)
* [`pyproject.toml`](setup.json): Python package metadata for registration on [PyPI](https://pypi.org/) and the [AiiDA plugin registry](https://aiidateam.github.io/aiida-registry/) (including entry points)

See also the following video sequences from the 2019-05 AiiDA tutorial:

* [run aiida-diff example calculation](https://www.youtube.com/watch?v=2CxiuiA1uVs&t=403s)
* [aiida-diff CalcJob plugin](https://www.youtube.com/watch?v=2CxiuiA1uVs&t=685s)
* [aiida-diff Parser plugin](https://www.youtube.com/watch?v=2CxiuiA1uVs&t=936s)
* [aiida-diff computer/code helpers](https://www.youtube.com/watch?v=2CxiuiA1uVs&t=1238s)
* [aiida-diff input data (with validation)](https://www.youtube.com/watch?v=2CxiuiA1uVs&t=1353s)
* [aiida-diff cli](https://www.youtube.com/watch?v=2CxiuiA1uVs&t=1621s)
* [aiida-diff tests](https://www.youtube.com/watch?v=2CxiuiA1uVs&t=1931s)
* [Adding your plugin to the registry](https://www.youtube.com/watch?v=760O2lDB-TM&t=112s)
* [pre-commit hooks](https://www.youtube.com/watch?v=760O2lDB-TM&t=333s)

For more information, see the [developer guide](https://aiida-diff.readthedocs.io/en/latest/developer_guide) of your plugin.


## Features

* Add input files using `SinglefileData`:
```python
SinglefileData = DataFactory('core.singlefile')
inputs['file1'] = SinglefileData(file='/path/to/file1')
inputs['file2'] = SinglefileData(file='/path/to/file2')
```

* Specify command line options via a python dictionary and `DiffParameters`:
```python
d = { 'ignore-case': True }
DiffParameters = DataFactory('mlip')
inputs['parameters'] = DiffParameters(dict=d)
```

* `DiffParameters` dictionaries are validated using [voluptuous](https://github.com/alecthomas/voluptuous).
Find out about supported options:
```python
DiffParameters = DataFactory('mlip')
print(DiffParameters.schema.schema)
```
* [`tox.ini`](tox.ini): File to set up tox
* [`pyproject.toml`](pyproject.toml): Python package metadata for registration on [PyPI](https://pypi.org/) and the [AiiDA plugin registry](https://aiidateam.github.io/aiida-registry/) (including entry points)



## Features (in development)

- [x] Supports multiple MLIPs
- MACE
- M3GNET
- CHGNET
- [x] Single point calculations
- [ ] Geometry optimisation
- [ ] Molecular Dynamics:
- NVE
- NVT (Langevin(Eijnden/Ciccotti flavour) and Nosé-Hoover (Melchionna flavour))
- NPT (Nosé-Hoover (Melchiona flavour))
- [ ] Training ML potentials (MACE only planned)
- [ ] Fine tunning MLIPs (MACE only planned)

The code relies heavily on ASE, unless something else is mentioned.


## Installation

```shell
pip install aiida-mlip
verdi quicksetup # better to set up a new profile
verdi plugin list aiida.calculations # should now show your calclulation plugins
verdi plugin list aiida.calculations # should now show your calculation plugins
```


Expand All @@ -90,16 +82,10 @@ A quick demo of how to submit a calculation:
```shell
verdi daemon start # make sure the daemon is running
cd examples
./example_01.py # run test calculation
verdi run submit_singlepoint.py "janus@localhost" --calctype "singlepoint" --architecture mace --model "~./cache/mlips/mace/46jrkm3v" # run test calculation
verdi process list -a # check record of calculation
```

The plugin also includes verdi commands to inspect its data types:
```shell
verdi data mlip list
verdi data mlip export <PK>
```

## Development

1. Install [poetry](https://python-poetry.org/docs/#installation)
Expand Down
4 changes: 1 addition & 3 deletions aiida_mlip/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""
aiida_mlip
machine learning interatomic potentials aiida plugin
Machine learning interatomic potentials aiida plugin.
"""

__version__ = "0.1.0a1"
93 changes: 0 additions & 93 deletions aiida_mlip/calculations.py

This file was deleted.

3 changes: 3 additions & 0 deletions aiida_mlip/calculations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Calculations using MLIPs.
"""
Loading

0 comments on commit c9700ee

Please sign in to comment.