Skip to content

Commit 3eca24e

Browse files
Merge pull request mala-project#634 from mala-project/ace_develop
Implementation of ACE descriptors (new)
2 parents f481cd5 + cde583b commit 3eca24e

45 files changed

Lines changed: 6170 additions & 74 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cpu-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ jobs:
230230
231231
- name: Test mala
232232
shell: 'bash -c "docker exec -i mala-cpu bash < {0}"'
233-
run: MALA_DATA_REPO=$(pwd)/mala_data pytest --cov=mala --cov-fail-under=60 -m "not examples" --disable-warnings
233+
run: MALA_DATA_REPO=$(pwd)/mala_data pytest --cov=mala --cov-fail-under=50 -m "not examples" --disable-warnings
234234

235235
retag-docker-image-cpu:
236236
needs: [cpu-tests, build-docker-image-cpu]

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
3+
__pycache__
34
*.py[cod]
45
*$py.class
56

@@ -186,3 +187,7 @@ wandb/
186187

187188
*.zip
188189
*~
190+
191+
# ACE files & libraries
192+
*.pkl
193+

docs/source/advanced_usage/descriptors.rst

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _tuning descriptors:
22

3-
Improved data conversion
4-
========================
3+
Advanced descriptor options
4+
===========================
55

66
As a general remark please be reminded that if you have not used LAMMPS
77
for your first steps in MALA, and instead used the python-based descriptor
@@ -118,3 +118,44 @@ Parallelization may also generally be used for data conversion via the
118118
prior to using the ``DataConverter`` class. Then, all processing will
119119
be done in parallel - both the descriptor calculation as well as the LDOS
120120
parsing.
121+
122+
ACE Descriptors
123+
******************
124+
125+
.. note::
126+
127+
To use ACE descriptors with MALA, you need to install LAMMPS from source
128+
using the ACE descriptor development branch, since the ACE descriptors
129+
are not yet part of the descriptor calculation code the MALA team has
130+
integrated into mainline LAMMPS. You can find the code here:
131+
https://github.com/jmgoff/lammps_compute_PACE/tree/mala-ace-grid.
132+
133+
Recently, and as described in the
134+
`MALA technical paper <https://arxiv.org/abs/2411.19617>`_ ACE descriptors
135+
have been implemented as an alternative to bispectrum descriptors. They
136+
follow the Atomic Cluster Expansion (ACE) formalism, introduced by
137+
the `eponymous publication <https://journals.aps.org/prb/abstract/10.1103/PhysRevB.99.014104>`_
138+
by Ralf Drautz. ACE descriptors hold the promise of being more descriptive and
139+
accurate than bispectrum descriptors and are currently being investigated by
140+
the MALA team. MALA already implements most functionalities of bispectrum
141+
descriptors for ACE descriptors. You can use them in the same fashion as
142+
the bispectrum descriptors, with the only difference being the hyperparameters
143+
you need to set.
144+
145+
Specifically, by replacing all bispectrum hyperparameters in your script
146+
with code such as this
147+
148+
.. code-block:: python
149+
150+
parameters.descriptors.descriptor_type = "ACE"
151+
parameters.descriptors.ace_cutoff = 5.8
152+
parameters.descriptors.ace_included_expansion_ranks = [1, 2, 3]
153+
parameters.descriptors.ace_maximum_l_per_rank = [0, 1, 1]
154+
parameters.descriptors.ace_maximum_n_per_rank = [1, 1, 1]
155+
parameters.descriptors.ace_minimum_l_per_rank = [0, 0, 0]
156+
157+
ACE descriptors will be used in your processing/training/testing scripts.
158+
ACE_DOCS_MISSING: Describe what the parameters mean/how to best tune them.
159+
160+
A known current limitation is that ACE descriptors can only be run on CPU.
161+
A GPU version is currently being developed.

docs/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
"openpmd_io",
8181
"skspatial",
8282
"tqdm",
83+
"mendeleev",
84+
"sympy",
8385
]
8486

8587
myst_heading_anchors = 3

docs/source/install/installing_lammps.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Installing LAMMPS
66
Every LAMMPS release released after January 23th, 2025 contains the
77
functionalities needed for descriptor calculation with MALA. If you are working
88
on a high perfomance computing cluster, check if you have a LAMMPS version
9-
installed that may already be used with LAMMPS. Note that in order to use
9+
installed that may already be used with MALA. Note that in order to use
1010
GPU acceleration, you need access to a GPU version
1111
(i.e., Kokkos enabled version) of LAMMPS. In the following, a brief overview
1212
of how to build LAMMPS is provided. The MALA team recommends to build LAMMPS
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import os
2+
3+
import mala
4+
5+
from mala.datahandling.data_repo import data_path
6+
7+
"""
8+
Shows how ACE descriptors can be calculated with MALA. ACE descriptors
9+
hold the promise of being more descriptive and accurate than bispectrum
10+
descriptors and are currently being investigated by the MALA team.
11+
MALA already implements most functionalities of bispectrum descriptors for
12+
ACE descriptors.
13+
After preprocessing data to ACE descriptors with this example, all other
14+
examples can be run with the ACE descriptors by simply pointing to the
15+
appropriate ACE descriptor numpy files.
16+
17+
REQUIRES LAMMPS.
18+
"""
19+
20+
21+
####################
22+
# 1. PARAMETERS
23+
# Compare to the bispectrum descriptors, ACE descriptors have slightly more
24+
# hyperparameters to consider. For more information on the hyperparameters,
25+
# please refer to https://arxiv.org/abs/2411.19617.
26+
# ACE_DOCS_MISSING: Is it enough to refer to the paper here or should
27+
# we include more information here?
28+
####################
29+
30+
parameters = mala.Parameters()
31+
# Bispectrum parameters.
32+
parameters.descriptors.descriptor_type = "ACE"
33+
parameters.descriptors.ace_cutoff_factor = 5.8
34+
parameters.descriptors.ace_included_expansion_ranks = [1, 2, 3]
35+
parameters.descriptors.ace_maximum_l_per_rank = [0, 1, 1]
36+
parameters.descriptors.ace_maximum_n_per_rank = [1, 1, 1]
37+
parameters.descriptors.ace_minimum_l_per_rank = [0, 0, 0]
38+
39+
####################
40+
# 2. ADDING DATA FOR DATA CONVERSION
41+
# As detailed in the basic preprocessing example, we can process
42+
# input and output data separately. This example only computes descriptor data
43+
# as it is assumed that the LDOS data has already been processed in an earlier
44+
# example.
45+
####################
46+
47+
data_converter = mala.DataConverter(parameters)
48+
outfile = os.path.join(data_path, "Be_snapshot0.out")
49+
50+
# Converting a snapshot for training on precomputed descriptor data.
51+
data_converter.add_snapshot(
52+
descriptor_input_type="espresso-out",
53+
descriptor_input_path=outfile,
54+
)
55+
56+
####################
57+
# 3. Converting the data
58+
# Since we are only converting descriptor data here, target and simulation
59+
# output paths can be ommitted.
60+
####################
61+
62+
data_converter.convert_snapshots(
63+
descriptor_save_path="./",
64+
naming_scheme="Be_snapshot*_ACE.npy",
65+
descriptor_calculation_kwargs={"working_directory": data_path},
66+
)

install/mala_cpu_base_environment.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ dependencies:
1010
- optuna
1111
- pandas
1212
- ase
13-
- pytorch-cpu
13+
- pytorch-cpu<2.6.0
1414
- mpmath
1515
- tensorboard
1616
- scikit-spatial
17+
- mendeleev
18+
- sympy
19+
- requests
1720
- pip:
1821
- openpmd-api

install/mala_cpu_environment.yml

Lines changed: 74 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,35 @@ dependencies:
66
- _libgcc_mutex=0.1
77
- _openmp_mutex=4.5
88
- absl-py=2.1.0
9-
- alembic=1.14.0
10-
- ase=3.23.0
9+
- alembic=1.14.1
10+
- annotated-types=0.7.0
11+
- ase=3.24.0
1112
- blinker=1.9.0
1213
- brotli-bin=1.1.0
13-
- brotli-python=1.0.9
14+
- brotli-python=1.1.0
1415
- bzip2=1.0.8
15-
- c-ares=1.34.3
16-
- ca-certificates=2024.9.24
17-
- click=8.1.7
16+
- c-ares=1.34.4
17+
- ca-certificates=2025.1.31
18+
- certifi=2025.1.31
19+
- charset-normalizer=3.4.1
20+
- click=8.1.8
1821
- colorama=0.4.6
1922
- colorlog=6.9.0
2023
- cycler=0.12.1
21-
- filelock=3.16.1
24+
- deprecated=1.2.18
25+
- filelock=3.17.0
2226
- flask=3.1.0
2327
- freetype=2.12.1
24-
- fsspec=2024.10.0
28+
- fsspec=2025.2.0
2529
- gmp=6.3.0
26-
- importlib-metadata=8.5.0
27-
- importlib_resources=6.4.5
30+
- h2=4.2.0
31+
- hpack=4.1.0
32+
- hyperframe=6.1.0
33+
- idna=3.10
34+
- importlib-metadata=8.6.1
2835
- itsdangerous=2.2.0
29-
- jinja2=3.1.4
30-
- lcms2=2.16
36+
- jinja2=3.1.5
37+
- lcms2=2.17
3138
- ld_impl_linux-64=2.43
3239
- lerc=4.0.0
3340
- libabseil=20240722.0
@@ -36,106 +43,116 @@ dependencies:
3643
- libbrotlidec=1.1.0
3744
- libbrotlienc=1.1.0
3845
- libcblas=3.9.0
39-
- libdeflate=1.22
40-
- libffi=3.4.2
46+
- libdeflate=1.23
47+
- libffi=3.4.6
4148
- libgcc=14.2.0
4249
- libgcc-ng=14.2.0
4350
- libgfortran=14.2.0
4451
- libgfortran5=14.2.0
4552
- libgrpc=1.67.1
46-
- libhwloc=2.11.1
47-
- libiconv=1.17
53+
- libhwloc=2.11.2
54+
- libiconv=1.18
4855
- libjpeg-turbo=3.0.0
4956
- liblapack=3.9.0
57+
- liblzma=5.6.4
58+
- liblzma-devel=5.6.4
5059
- libnsl=2.0.1
51-
- libopenblas=0.3.28
52-
- libpng=1.6.44
53-
- libprotobuf=5.28.2
60+
- libopenblas=0.3.29
61+
- libpng=1.6.47
62+
- libprotobuf=5.28.3
5463
- libre2-11=2024.07.02
55-
- libsqlite=3.47.0
64+
- libsqlite=3.49.1
5665
- libstdcxx=14.2.0
5766
- libstdcxx-ng=14.2.0
5867
- libtiff=4.7.0
5968
- libtorch=2.5.1
6069
- libuuid=2.38.1
61-
- libuv=1.49.2
62-
- libwebp-base=1.4.0
70+
- libuv=1.50.0
71+
- libwebp-base=1.5.0
6372
- libxcb=1.17.0
64-
- libxml2=2.13.5
73+
- libxml2=2.13.6
6574
- libzlib=1.3.1
66-
- llvm-openmp=19.1.4
67-
- mako=1.3.6
75+
- llvm-openmp=19.1.7
76+
- mako=1.3.9
6877
- markdown=3.6
69-
- matplotlib-base=3.9.2
78+
- matplotlib-base=3.10.0
79+
- mendeleev=0.20.1
7080
- mkl=2024.2.2
7181
- mpc=1.3.1
7282
- mpfr=4.2.1
7383
- mpmath=1.3.0
7484
- munkres=1.1.4
7585
- ncurses=6.5
7686
- networkx=3.4.2
77-
- openjpeg=2.5.2
78-
- openssl=3.4.0
79-
- optuna=4.1.0
87+
- openjpeg=2.5.3
88+
- openssl=3.4.1
89+
- optuna=4.2.1
8090
- packaging=24.2
81-
- pip=24.3.1
91+
- pip=25.0.1
8292
- pthread-stubs=0.4
83-
- pyparsing=3.2.0
93+
- pycparser=2.22
94+
- pydantic=2.10.6
95+
- pyfiglet=0.8.post1
96+
- pygments=2.19.1
97+
- pyparsing=3.2.1
98+
- pysocks=1.7.1
8499
- python=3.10.4
85100
- python-dateutil=2.9.0.post0
86-
- python-tzdata=2024.2
101+
- python-tzdata=2025.1
87102
- python_abi=3.10
88103
- pytorch=2.5.1
89104
- pytorch-cpu=2.5.1
90105
- pytz=2024.1
91106
- qhull=2020.2
92107
- re2=2024.07.02
93108
- readline=8.2
94-
- scikit-spatial=8.0.0
95-
- setuptools=75.6.0
96-
- six=1.16.0
97-
- sleef=3.7
98-
- sqlite=3.47.0
109+
- requests=2.32.3
110+
- scikit-spatial=8.1.0
111+
- setuptools=75.8.2
112+
- six=1.17.0
113+
- sleef=3.8
114+
- sqlite=3.49.1
99115
- sympy=1.13.3
100116
- tbb=2021.13.0
101-
- tensorboard=2.18.0
117+
- tensorboard=2.19.0
102118
- tk=8.6.13
103119
- tqdm=4.67.1
104120
- typing-extensions=4.12.2
105121
- typing_extensions=4.12.2
106-
- tzdata=2024b
122+
- tzdata=2025a
123+
- urllib3=2.3.0
107124
- werkzeug=3.1.3
108125
- wheel=0.45.1
109-
- xorg-libxau=1.0.11
126+
- xorg-libxau=1.0.12
110127
- xorg-libxdmcp=1.1.5
111-
- xz=5.2.6
128+
- xz=5.6.4
129+
- xz-gpl-tools=5.6.4
130+
- xz-tools=5.6.4
112131
- yaml=0.2.5
113132
- zipp=3.21.0
114133
- zstd=1.5.6
115134
- pip:
116-
- brotli==1.0.9
117-
- certifi==2024.8.30
118-
- charset-normalizer==3.4.0
135+
- brotli==1.1.0
136+
- cffi==1.17.1
119137
- contourpy==1.3.1
120-
- fonttools==4.55.0
138+
- fonttools==4.56.0
121139
- gmpy2==2.1.5
122140
- greenlet==3.1.1
123141
- grpcio==1.67.1
124-
- idna==3.10
125142
- kiwisolver==1.4.7
126143
- markupsafe==3.0.2
127-
- matplotlib==3.9.2
144+
- matplotlib==3.10.0
128145
- numpy==1.26.4
129-
- oauthlib==3.2.2
130-
- openpmd-api==0.15.2
146+
- openpmd-api==0.16.1
131147
- pandas==2.2.3
132-
- pillow==11.0.0
133-
- protobuf==3.19.6
134-
- pysocks==1.7.1
148+
- pillow==11.1.0
149+
- protobuf==5.28.3
150+
- pydantic-core==2.27.2
135151
- pyyaml==6.0.2
136-
- requests==2.32.3
137-
- scipy==1.14.1
138-
- sqlalchemy==2.0.36
152+
- scipy==1.15.2
153+
- sqlalchemy==2.0.38
139154
- tensorboard-data-server==0.7.0
140-
- torch==2.5.1.post103
141-
- unicodedata2==15.1.0
155+
- torch==2.5.1.post108
156+
- unicodedata2==16.0.0
157+
- wrapt==1.17.2
158+
- zstandard==0.23.0

mala/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
Descriptor,
2020
AtomicDensity,
2121
MinterpyDescriptors,
22+
ACE,
2223
)
2324
from .datahandling import (
2425
DataHandler,

0 commit comments

Comments
 (0)