DeePMD-kit plugin for graph neural network models.
Project description
DeePMD-kit plugin for various graph neural network models
deepmd-gnn
is a DeePMD-kit plugin for various graph neural network (GNN) models, which connects DeePMD-kit and atomistic GNN packages by enabling GNN models in DeePMD-kit.
Supported packages and models include:
After installing the plugin, you can train the GNN models using DeePMD-kit, run active learning cycles for the GNN models using DP-GEN, perform simulations with the MACE model using molecular dynamic packages supported by DeePMD-kit, such as LAMMPS and AMBER. You can follow DeePMD-kit documentation to train the GNN models using its PyTorch backend, after using the specific model parameters.
Credits
If you use this software, please cite the following unpublish paper:
- Jinzhe Zeng, Timothy J. Giese, Duo Zhang, Han Wang, Darrin M. York, DeePMD-GNN: A DeePMD-kit Plugin for External Graph Neural Network Potentials, unpublished.
We will update the credit information once it is published.
Installation
First, clone this repository:
git clone https://gitlab.com/RutgersLBSR/deepmd-gnn
cd deepmd-gnn
Python interface plugin
Python 3.9 or above is required. A C++ compiler that supports C++ 14 (for PyTorch 2.0) or C++ 17 (for PyTorch 2.1 or above) is required.
Assume you have installed DeePMD-kit (v3.0.0b2 or above) and PyTorch in an environment, then execute
# expose PyTorch CMake modules
export CMAKE_PREFIX_PATH=$(python -c "import torch;print(torch.utils.cmake_prefix_path)")
pip install .
C++ interface plugin
DeePMD-kit version should be v3.0.0b4 or later.
Follow DeePMD-kit documentation to install DeePMD-kit C++ interface with PyTorch backend support and other related MD packages. After that, you can build the plugin
# Assume libtorch has been contained in CMAKE_PREFIX_PATH
mkdir -p build
cd build
cmake .. -D CMAKE_INSTALL_PREFIX=/prefix/to/install
cmake --build . -j8
cmake --install .
libdeepmd_gnn.so
will be installed into the directory you assign.
When using any DeePMD-kit C++ interface, set the following environment variable in advance:
export DP_PLUGIN_PATH=/prefix/to/install/lib/libdeepmd_gnn.so
Usage
Follow Parameters section to prepare a DeePMD-kit input file.
dp --pt train input.json
dp --pt freeze
A frozen model file named frozen_model.pth
will be generated. You can use it in the MD packages or other interfaces.
For details, follow DeePMD-kit documentation.
Running LAMMPS + MACE with period boundary conditions
GNN models use message passing neural networks,
so the neighbor list built with traditional cutoff radius will not work,
since the ghost atoms also need to build neighbor list.
By default, the model requests the neighbor list with a cutoff radius of $r_c \times N_{L}$,
where $r_c$ is set by r_max
and $N_L$ is set by num_interactions
(MACE) / num_layers
(NequIP),
and rebuilds the neighbor list for ghost atoms.
However, this approach is very inefficient.
The alternative approach for the MACE model (note: NequIP doesn't support such approach) is to use the mapping passed from LAMMPS, which does not support MPI.
One needs to set DP_GNN_USE_MAPPING
when freezing the models,
DP_GNN_USE_MAPPING=1 dp --pt freeze
and request the mapping when using LAMMPS (also requires DeePMD-kit v3.0.0rc0 or above). By using the mapping, the ghost atoms will be mapped to the real atoms, so the regular neighbor list with a cutoff radius of $r_c$ can be used.
atom_modify map array
In the future, we will explore utilizing the MPI to communicate the neighbor list, while this approach requires a deep hack for external packages.
Parameters
MACE
To use the MACE model, set "type": "mace"
in the model
section of the training script.
Below is default values for the MACE model, most of which follows default values in the MACE package:
"model": {
"type": "mace",
"type_map": [
"O",
"H"
],
"r_max": 5.0,
"sel": "auto",
"num_radial_basis": 8,
"num_cutoff_basis": 5,
"max_ell": 3,
"interaction": "RealAgnosticResidualInteractionBlock",
"num_interactions": 2,
"hidden_irreps": "128x0e + 128x1o",
"pair_repulsion": false,
"distance_transform": "None",
"correlation": 3,
"gate": "silu",
"MLP_irreps": "16x0e",
"radial_type": "bessel",
"radial_MLP": [64, 64, 64],
"std": 1.0,
"precision": "float32"
}
NequIP
"model": {
"type": "nequip",
"type_map": [
"O",
"H"
],
"r_max": 5.0,
"sel": "auto",
"num_layers": 4,
"l_max": 2,
"num_features": 32,
"nonlinearity_type": "gate",
"parity": true,
"num_basis": 8,
"BesselBasis_trainable": true,
"PolynomialCutoff_p": 6,
"invariant_layers": 2,
"invariant_neurons": 64,
"use_sc": true,
"irreps_edge_sh": "0e + 1e",
"feature_irreps_hidden": "32x0o + 32x0e + 32x1o + 32x1e",
"chemical_embedding_irreps_out": "32x0e",
"conv_to_output_hidden_irreps_out": "16x0e",
"precision": "float32"
}
DPRc support
In deepmd-gnn
, the GNN model can be used in a DPRc way.
Type maps that starts with m
(such as mH
) or OW
or HW
will be recognized as MM types.
Two MM atoms will not build edges with each other.
Such GNN+DPRc model can be directly used in AmberTools24.
Examples
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file deepmd_gnn-0.1.1.tar.gz
.
File metadata
- Download URL: deepmd_gnn-0.1.1.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6772f1a6a9adcbfbfb63676c9aec19251eb9544ab95819243868eee1e2165821 |
|
MD5 | 5397dbb3e4aa46de8aa83c0cd411396a |
|
BLAKE2b-256 | ab82de0e56536370d7b1a7e9e5a9b2e3a30d8d36c30f0675dc41ce8d7a38b9e2 |
Provenance
The following attestation bundles were made for deepmd_gnn-0.1.1.tar.gz
:
Publisher:
release.yaml
on deepmodeling/deepmd-gnn
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
deepmd_gnn-0.1.1.tar.gz
- Subject digest:
6772f1a6a9adcbfbfb63676c9aec19251eb9544ab95819243868eee1e2165821
- Sigstore transparency entry: 177343732
- Sigstore integration time:
- Permalink:
deepmodeling/deepmd-gnn@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Branch / Tag:
refs/tags/v0.1.1
- Owner: https://github.com/deepmodeling
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yaml@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Trigger Event:
push
- Statement type:
File details
Details for the file deepmd_gnn-0.1.1-py2.py3-none-win_amd64.whl
.
File metadata
- Download URL: deepmd_gnn-0.1.1-py2.py3-none-win_amd64.whl
- Upload date:
- Size: 73.0 kB
- Tags: Python 2, Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 443f8511eb5ca8e704ffc9b4dfd2cf1a07c462e82ad9b1b3033a5d77583d4df3 |
|
MD5 | 2fa0e40f73a4b7916bb5d27fbaf7a924 |
|
BLAKE2b-256 | 515341fbf7fc8a0878e803ee2d15f4e35ef36f068a62c88361d2f72fad28c09a |
Provenance
The following attestation bundles were made for deepmd_gnn-0.1.1-py2.py3-none-win_amd64.whl
:
Publisher:
release.yaml
on deepmodeling/deepmd-gnn
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
deepmd_gnn-0.1.1-py2.py3-none-win_amd64.whl
- Subject digest:
443f8511eb5ca8e704ffc9b4dfd2cf1a07c462e82ad9b1b3033a5d77583d4df3
- Sigstore transparency entry: 177343737
- Sigstore integration time:
- Permalink:
deepmodeling/deepmd-gnn@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Branch / Tag:
refs/tags/v0.1.1
- Owner: https://github.com/deepmodeling
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yaml@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Trigger Event:
push
- Statement type:
File details
Details for the file deepmd_gnn-0.1.1-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: deepmd_gnn-0.1.1-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 48.1 kB
- Tags: Python 2, Python 3, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5174ce97ccf32570d1c59a412130a91234f42db1282f43e09d7366f2ed6e4b44 |
|
MD5 | 96f45974931a331bd9ed79f5fed31279 |
|
BLAKE2b-256 | de1540030113b05503d2ad728e4fb84ba7eda2f1b72ba60ef8702e3b7e383f57 |
Provenance
The following attestation bundles were made for deepmd_gnn-0.1.1-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
:
Publisher:
release.yaml
on deepmodeling/deepmd-gnn
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
deepmd_gnn-0.1.1-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Subject digest:
5174ce97ccf32570d1c59a412130a91234f42db1282f43e09d7366f2ed6e4b44
- Sigstore transparency entry: 177343734
- Sigstore integration time:
- Permalink:
deepmodeling/deepmd-gnn@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Branch / Tag:
refs/tags/v0.1.1
- Owner: https://github.com/deepmodeling
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yaml@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Trigger Event:
push
- Statement type:
File details
Details for the file deepmd_gnn-0.1.1-py2.py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: deepmd_gnn-0.1.1-py2.py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 47.0 kB
- Tags: Python 2, Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e59179c3b5b6841f79e22971286e9418e1824fc5f98d2af150cea23ac356261 |
|
MD5 | c174e9ef89cb6f3da65c78212578b94e |
|
BLAKE2b-256 | 336cf61a06f4203098cf890ef8d54d02d7d180e0d4537c7d298a838ed49a2b27 |
Provenance
The following attestation bundles were made for deepmd_gnn-0.1.1-py2.py3-none-macosx_11_0_arm64.whl
:
Publisher:
release.yaml
on deepmodeling/deepmd-gnn
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
deepmd_gnn-0.1.1-py2.py3-none-macosx_11_0_arm64.whl
- Subject digest:
3e59179c3b5b6841f79e22971286e9418e1824fc5f98d2af150cea23ac356261
- Sigstore transparency entry: 177343740
- Sigstore integration time:
- Permalink:
deepmodeling/deepmd-gnn@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Branch / Tag:
refs/tags/v0.1.1
- Owner: https://github.com/deepmodeling
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yaml@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Trigger Event:
push
- Statement type:
File details
Details for the file deepmd_gnn-0.1.1-py2.py3-none-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: deepmd_gnn-0.1.1-py2.py3-none-macosx_10_13_x86_64.whl
- Upload date:
- Size: 47.5 kB
- Tags: Python 2, Python 3, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b6b977d2127601eec1e2b480810da22a143f25d1f8710d925afc41c16205386 |
|
MD5 | ba77919e4da86793b31fcbcb8792b1ba |
|
BLAKE2b-256 | 37cd69803b6026b8b7036de48bf42fa2790cd38d6c5504d09c4e43f5507c2df8 |
Provenance
The following attestation bundles were made for deepmd_gnn-0.1.1-py2.py3-none-macosx_10_13_x86_64.whl
:
Publisher:
release.yaml
on deepmodeling/deepmd-gnn
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
deepmd_gnn-0.1.1-py2.py3-none-macosx_10_13_x86_64.whl
- Subject digest:
6b6b977d2127601eec1e2b480810da22a143f25d1f8710d925afc41c16205386
- Sigstore transparency entry: 177343735
- Sigstore integration time:
- Permalink:
deepmodeling/deepmd-gnn@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Branch / Tag:
refs/tags/v0.1.1
- Owner: https://github.com/deepmodeling
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yaml@d2c8bbc33dc8e06cf885d64695381efd332fddcf
- Trigger Event:
push
- Statement type: