LLUMYS: Learning Loss informed Uncertainty Aware MLIP from Yonsei and Sydney
LLUMYS is an E(3)-equivariant graph neural network interatomic potential that learns per-atom uncertainty based on the learning loss concept. It has been developed as a companion package to NARA (a Firefly algorithm based atomic structure optimization framework). The name LLUMYS originates from lumen, meaning "light", symbolizing the glow of a firefly.
Prerequisites
- Python ≥ 3.10
- ASE ≥ 3.26.0
Earlier versions are compatible, but 3.26.0 or later is recommended because optimizer.irun now explicitly includes gradient evaluation/log
- e3nn
- pytorch ≥ 2.4
Please follow the installation guide on the official PyTorch website
- (optional) openequivariance, GCC≥9
For additional GPU acceleration. Requires installation of the matching CUDA toolkit for your PyTorch and CUDA driver versions.
Installation
Using PIP
You can install LLUMYS directly from PyPI:
pip install llumys
→ To use OpenEquivariance, install openequivariance package first, matching with your GPU environment ($pip install openequivariance)
Usage
(1) Import LLUMYS (choose one based on your case)
## a. For import default GNN model
from llumys.gnn import EquivariantGNN
from llumys.train import main_GNN
## b. For import learning-loss model
from llumys.gnn_LL import EquivariantGNN_UC
from llumys.train import main_UC
## c. For import OpenEquivariance-implemented versions of default GNN model
from llumys.gnn_oeq import EquivariantGNN
from llumys.train_oeq import main_GNN
## d. For import OpenEquivariance-implemented versions of LL model
from llumys.gnn_LL_oeq import EquivariantGNN_UC
from llumys.train_oeq import main_UC
(2) Train the model
# Setting
device = "cuda" # or mps or cpu
### tag-out parameters will be set as default
gnn_config = dict(
r_cut = 5.0, # radius cutoff
irreps_hidden = "128x0e+128x1o", # low option. -> '256x0e' (invariant) or '128x0e+128x1o' or '32x0e+32x0o+32x1e+32x1o' are usually used for real cases
dtype = "float64", # float64 is overally recommended for optimization, float32 could be enough for MD simulations
# irreps_out_hidden = "16x0e",
# node_embedding_dim = 32,
# edge_n_basis = 8,
# n_invariant_neurons = 8, # number of hidden neurons in radial function, smaller is faster [from nequip documentatoin]
# n_invariant_layers = 1, # number of radial layers, Usually 1-3 works best, smaller is faster [from nequip documentatoin]
# n_message_passing = 3,
# max_grad_norm = 10,
)
# Training
## for a or c -> use main_GNN
main = main_GNN
## for b or d -> use main_UC
main = main_UC
main(
xyz_filename = "[your_train_dataset_filename.xyz]",
valid_xyz = "[your_valid_dataset_filename.xyz]", # or use train_ratio for splitting the xyz
device = device,
batch_size = 5, # when including forces, 1-5 will be more appropriate.
valid_batch_size = 10, # higher the faster. set this below OOM
max_epoch = 1000,
patience = 50, # to not use early_stopping, set patience=None
best_model_filename = "[filename-for-best-model]",
loss_filename = "[filename-for-losses]",
gnn_config = gnn_config,
)
(3) Usage: using LLUMYS as an ASE calculator
# import GNN wrapper
## a. default GNN model
from llumys.ase_wrapper import GNNWrapper
## b. LL model
from llumys.ase_wrapper import GNNUCWrapper
## c. default GNN model - OEQ
from llumys.ase_wrapper_oeq import GNNWrapper
## d. LL model - OEQ
from llumys.ase_wrapper_oeq import GNNUCWrapper
# loading the best-model.pt
## for a or c
WRAPPER = GNNWrapper
## for b or d
WRAPPER = GNNUCWrapper
ase_calc = WRAPPER(gnn_model="[filename-for-best-model.pt]", device=device)
→ For more detailed information, please see Tutorials
Acknowledgement
TBD
License Information
This project is licensed under the MIT License - see the LICENSE file for details.
Troubleshooting
- CUDA error: invalid device ordinal
RuntimeError: CUDA error: invalid device ordinal
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
→ This error occurs when multiple GPUs exist on a node but the user explicitly selects a non-allocated GPU (ex. device=torch.device("cuda:2")). In such cases, specify the target GPU when running the Python script:
CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES=2 python [your-script-name.py]
- ImportError when
import openequivariance
ImportError: Unable to load OpenEquivariance extension library: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
Check if nvcc --version runs properly.
→ If it doesn’t work, you may need to reinstall CUDA toolkit.
→ If it does work, add the following line to your .bashrc or job script to make sure OpenEquivariance recognizes CUDA:
export CUDA_HOME="$(dirname "$(dirname "$(which nvcc)")")"
- GCC version error: Please use GCC 9 or later
#error "You're trying to build PyTorch with a too old version of GCC. We need GCC 9 or later."
Check the gcc versions with gcc -v
- Import hangs with no error message
If a Python script hangs during import without showing any error message, first check whether the issue is related to the OpenEquivariance JIT extension by running:
$ python -c "import openequivariance"
If this also hangs without any error message, the problem may be caused by the PyTorch extensions cache. In this case, set TORCH_EXTENSIONS_DIR to a job-local or user-defined directory before running the script.
For example:
export TORCH_EXTENSIONS_DIR=$PBS_JOBFS/torch_extensions
mkdir -p "$TORCH_EXTENSIONS_DIR"
This forces PyTorch to build extensions in the specified directory instead of reusing the default cache path, which can help avoid stale lock or shared-cache issues on HPC systems.
Metadata
Release files for llumys 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llumys-1.0.2.tar.gz | 38.4 kB | Without provenance | Details for llumys-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llumys-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for llumys-1.0.2-py3-none-any.whl |
Total release size: 86.7 kB
Release files / llumys-1.0.2.tar.gz
| Download URL | llumys-1.0.2.tar.gz |
|---|---|
| Size | 38.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df56cdfb25b5744ee994679d6a6b164e7a6afd4055255e3206e52a6705dc19a3
|
|
BLAKE2b-256 checksum How to use checksums |
f8b987f485283b03899920d843b0aad2caaf0b9aea6e46112d73b7ad2c192626
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / llumys-1.0.2-py3-none-any.whl
| Download URL | llumys-1.0.2-py3-none-any.whl |
|---|---|
| Size | 48.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8fd0f1739eed527b6569dc4acda59b0276a3daea5d386e23194fd9244dedb2cd
|
|
BLAKE2b-256 checksum How to use checksums |
fcd1921854cd59e2d4669bfbd7f07a91c6200059894e5e6cd870aa41aed177be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for llumys 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.