matcalc 0.2.2__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {matcalc-0.2.2/src/matcalc.egg-info → matcalc-0.3.2}/PKG-INFO +40 -40
- {matcalc-0.2.2 → matcalc-0.3.2}/README.md +25 -25
- {matcalc-0.2.2 → matcalc-0.3.2}/pyproject.toml +30 -18
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc/__init__.py +9 -8
- matcalc-0.2.2/src/matcalc/base.py → matcalc-0.3.2/src/matcalc/_base.py +52 -26
- matcalc-0.3.2/src/matcalc/_elasticity.py +216 -0
- matcalc-0.3.2/src/matcalc/_eos.py +178 -0
- matcalc-0.2.2/src/matcalc/neb.py → matcalc-0.3.2/src/matcalc/_neb.py +5 -5
- matcalc-0.2.2/src/matcalc/phonon.py → matcalc-0.3.2/src/matcalc/_phonon.py +46 -29
- matcalc-0.3.2/src/matcalc/_phonon3.py +184 -0
- matcalc-0.2.2/src/matcalc/qha.py → matcalc-0.3.2/src/matcalc/_qha.py +53 -37
- matcalc-0.3.2/src/matcalc/_relaxation.py +250 -0
- matcalc-0.2.2/src/matcalc/stability.py → matcalc-0.3.2/src/matcalc/_stability.py +44 -21
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc/benchmark.py +56 -46
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc/config.py +9 -3
- matcalc-0.3.2/src/matcalc/utils.py +483 -0
- {matcalc-0.2.2 → matcalc-0.3.2/src/matcalc.egg-info}/PKG-INFO +40 -40
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc.egg-info/SOURCES.txt +11 -9
- matcalc-0.3.2/src/matcalc.egg-info/entry_points.txt +2 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc.egg-info/requires.txt +9 -10
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_chain.py +1 -4
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_cli.py +1 -1
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_elasticity.py +1 -1
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_eos.py +1 -1
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_neb.py +3 -3
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_phonon.py +1 -1
- matcalc-0.3.2/tests/test_phonon3.py +64 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_qha.py +1 -1
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_relaxation.py +1 -1
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_stability.py +1 -1
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_utils.py +54 -15
- matcalc-0.2.2/src/matcalc/elasticity.py +0 -166
- matcalc-0.2.2/src/matcalc/eos.py +0 -130
- matcalc-0.2.2/src/matcalc/relaxation.py +0 -185
- matcalc-0.2.2/src/matcalc/utils.py +0 -375
- matcalc-0.2.2/src/matcalc.egg-info/entry_points.txt +0 -2
- {matcalc-0.2.2 → matcalc-0.3.2}/LICENSE +0 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/setup.cfg +0 -0
- /matcalc-0.2.2/src/matcalc/cli.py → /matcalc-0.3.2/src/matcalc/_cli.py +0 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc/elemental_refs/MatPES-PBE-Element-Refs.json.gz +0 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc/elemental_refs/MatPES-r2SCAN-Element-Refs.json.gz +0 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc/py.typed +0 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc/units.py +0 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc.egg-info/dependency_links.txt +0 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/src/matcalc.egg-info/top_level.txt +0 -0
- {matcalc-0.2.2 → matcalc-0.3.2}/tests/test_benchmark.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: matcalc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Calculators for materials properties from the potential energy surface.
|
|
5
5
|
Author-email: Runze Liu <rul048@ucsd.edu>, Eliott Liu <elliottliu17@gmail.com>, Janosh Riebesell <janosh@lbl.gov>, Ji Qi <j1qi@ucsd.edu>, Shyue Ping Ong <ongsp@ucsd.edu>, Tsz Wai Ko <t1ko@ucsd.edu>
|
|
6
6
|
Keywords: AI,deep learning,force field,graph,interatomic potential,machine learning,materials,property prediction,science
|
|
@@ -19,32 +19,32 @@ Requires-Python: >=3.10
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: ase>=3.23.0
|
|
22
|
-
Requires-Dist: joblib
|
|
23
|
-
Requires-Dist: phonopy
|
|
24
|
-
Requires-Dist: pymatgen
|
|
25
22
|
Requires-Dist: numpy<2.0.0
|
|
26
|
-
Requires-Dist: fsspec
|
|
27
23
|
Requires-Dist: scikit-learn>=1.6.1
|
|
24
|
+
Requires-Dist: pymatgen>=2025.3.10
|
|
25
|
+
Requires-Dist: fsspec>=2025.3.0
|
|
26
|
+
Requires-Dist: joblib>=1.4.2
|
|
27
|
+
Requires-Dist: phonopy>=2.38.0
|
|
28
|
+
Requires-Dist: phono3py>=3.15.0
|
|
28
29
|
Provides-Extra: phonon
|
|
29
30
|
Requires-Dist: seekpath; extra == "phonon"
|
|
30
31
|
Provides-Extra: benchmark
|
|
31
32
|
Requires-Dist: matminer>=0.9.3; extra == "benchmark"
|
|
32
|
-
Provides-Extra:
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Provides-Extra: sevennet
|
|
35
|
-
Requires-Dist: sevenn>=0.10.4; extra == "sevennet"
|
|
33
|
+
Provides-Extra: ace
|
|
34
|
+
Requires-Dist: pyace>=0.1.1; extra == "ace"
|
|
36
35
|
Provides-Extra: mace
|
|
37
36
|
Requires-Dist: mace-torch>=0.3.12; extra == "mace"
|
|
38
|
-
Provides-Extra:
|
|
39
|
-
Requires-Dist:
|
|
37
|
+
Provides-Extra: deepmd
|
|
38
|
+
Requires-Dist: deepmd-kit>=3.0.2; extra == "deepmd"
|
|
40
39
|
Provides-Extra: grace
|
|
41
40
|
Requires-Dist: tensorpotential>=0.5.1; extra == "grace"
|
|
42
|
-
Provides-Extra:
|
|
43
|
-
Requires-Dist:
|
|
41
|
+
Provides-Extra: maml
|
|
42
|
+
Requires-Dist: maml>=2025.2.25; extra == "maml"
|
|
44
43
|
Provides-Extra: orb
|
|
45
44
|
Requires-Dist: orb-models>=0.4.2; extra == "orb"
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
Requires-Dist: pynanoflann>=0.10.0; extra == "orb"
|
|
46
|
+
Provides-Extra: sevennet
|
|
47
|
+
Requires-Dist: sevenn>=0.10.4; extra == "sevennet"
|
|
48
48
|
Dynamic: license-file
|
|
49
49
|
|
|
50
50
|
<h1 align="center">
|
|
@@ -52,8 +52,8 @@ Dynamic: license-file
|
|
|
52
52
|
width="200" alt="MatCalc" style="vertical-align: middle;" /><br>
|
|
53
53
|
</h1>
|
|
54
54
|
|
|
55
|
-
[](https://github.com/materialsvirtuallab/matcalc/workflows/Test/badge.svg)
|
|
56
|
+
[](https://github.com/materialsvirtuallab/matcalc/workflows/Lint/badge.svg)
|
|
57
57
|
[](https://codecov.io/gh/materialsvirtuallab/matcalc)
|
|
58
58
|
[](https://python.org/downloads)
|
|
59
59
|
[](https://pypi.org/project/matcalc?logo=pypi&logoColor=white)
|
|
@@ -91,12 +91,12 @@ MatCalc provides convenient methods to quickly compute properties, using a minim
|
|
|
91
91
|
an example of a computation of the elastic constants of Si using the `TensorNet-MatPES-PBE-v2025.1-PES` universal MLIP.
|
|
92
92
|
|
|
93
93
|
```python
|
|
94
|
-
|
|
94
|
+
import matcalc as mtc
|
|
95
95
|
from pymatgen.ext.matproj import MPRester
|
|
96
96
|
|
|
97
97
|
mpr = MPRester()
|
|
98
98
|
si = mpr.get_structure_by_material_id("mp-149")
|
|
99
|
-
c = ElasticityCalc(load_up("TensorNet-MatPES-PBE-v2025.1-PES"), relax_structure=True)
|
|
99
|
+
c = mtc.ElasticityCalc(mtc.load_up("TensorNet-MatPES-PBE-v2025.1-PES"), relax_structure=True)
|
|
100
100
|
props = c.calc(si)
|
|
101
101
|
print(f"K_VRH = {props['bulk_modulus_vrh'] * 160.2176621} GPa")
|
|
102
102
|
```
|
|
@@ -107,9 +107,9 @@ While we generally recommend users to specify exactly the model they would like
|
|
|
107
107
|
(case-insensitive) aliases to our recommended models for PBE and r2SCAN predictions. These can be loaded using:
|
|
108
108
|
|
|
109
109
|
```python
|
|
110
|
-
|
|
111
|
-
pbe_calculator = load_up("pbe")
|
|
112
|
-
r2scan_calculator = load_up("r2scan")
|
|
110
|
+
import matcalc as mtc
|
|
111
|
+
pbe_calculator = mtc.load_up("pbe")
|
|
112
|
+
r2scan_calculator = mtc.load_up("r2scan")
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
At the time of writing, these are the TensorNet-MatPES models. However, these recommendations may updated as improved
|
|
@@ -142,20 +142,20 @@ computed by all steps. Note that the `relax_structure` should be set to False in
|
|
|
142
142
|
do not redo the relatively expensive relaxation.
|
|
143
143
|
|
|
144
144
|
```python
|
|
145
|
-
|
|
145
|
+
import matcalc as mtc
|
|
146
146
|
import numpy as np
|
|
147
|
-
calculator = load_up("pbe")
|
|
148
|
-
relax_calc = RelaxCalc(
|
|
147
|
+
calculator = mtc.load_up("pbe")
|
|
148
|
+
relax_calc = mtc.RelaxCalc(
|
|
149
149
|
calculator,
|
|
150
150
|
optimizer="FIRE",
|
|
151
151
|
relax_atoms=True,
|
|
152
152
|
relax_cell=True,
|
|
153
153
|
)
|
|
154
|
-
energetics_calc = EnergeticsCalc(
|
|
154
|
+
energetics_calc = mtc.EnergeticsCalc(
|
|
155
155
|
calculator,
|
|
156
156
|
relax_structure=False # Since we are chaining, we do not need to relax structure in later steps.
|
|
157
157
|
)
|
|
158
|
-
elast_calc = ElasticityCalc(
|
|
158
|
+
elast_calc = mtc.ElasticityCalc(
|
|
159
159
|
calculator,
|
|
160
160
|
fmax=0.1,
|
|
161
161
|
norm_strains=list(np.linspace(-0.004, 0.004, num=4)),
|
|
@@ -164,7 +164,7 @@ elast_calc = ElasticityCalc(
|
|
|
164
164
|
relax_structure=False, # Since we are chaining, we do not need to relax structure in later steps.
|
|
165
165
|
relax_deformed_structures=True,
|
|
166
166
|
)
|
|
167
|
-
prop_calc = ChainedCalc([relax_calc, energetics_calc, elast_calc])
|
|
167
|
+
prop_calc = mtc.ChainedCalc([relax_calc, energetics_calc, elast_calc])
|
|
168
168
|
results = prop_calc.calc(structure)
|
|
169
169
|
```
|
|
170
170
|
|
|
@@ -186,10 +186,10 @@ the `MatCalc-Benchmark`.
|
|
|
186
186
|
For example, the following code can be used to run the ElasticityBenchmark on `TensorNet-MatPES-PBE-v2025.1-PES` UMLIP.
|
|
187
187
|
|
|
188
188
|
```python
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
benchmark = ElasticityBenchmark(fmax=0.05, relax_structure=True)
|
|
189
|
+
import matcalc as mtc
|
|
190
|
+
|
|
191
|
+
calculator = mtc.load_up("TensorNet-MatPES-PBE-v2025.1-PES")
|
|
192
|
+
benchmark = mtc.benchmark.ElasticityBenchmark(fmax=0.05, relax_structure=True)
|
|
193
193
|
results = benchmark.run(calculator, "TensorNet-MatPES")
|
|
194
194
|
```
|
|
195
195
|
|
|
@@ -198,14 +198,14 @@ The entire run takes ~ 16mins when parallelized over 10 CPUs on a Mac.
|
|
|
198
198
|
You can even run entire suites of benchmarks on multiple models, as follows:
|
|
199
199
|
|
|
200
200
|
```python
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
elasticity_benchmark = ElasticityBenchmark(fmax=0.5, relax_structure=True)
|
|
207
|
-
phonon_benchmark = PhononBenchmark(write_phonon=False)
|
|
208
|
-
suite = BenchmarkSuite(benchmarks=[elasticity_benchmark, phonon_benchmark])
|
|
201
|
+
import matcalc as mtc
|
|
202
|
+
|
|
203
|
+
tensornet = mtc.load_up("TensorNet-MatPES-PBE-v2025.1-PES")
|
|
204
|
+
m3gnet = mtc.load_up("M3GNet-MatPES-PBE-v2025.1-PES")
|
|
205
|
+
|
|
206
|
+
elasticity_benchmark = mtc.benchmark.ElasticityBenchmark(fmax=0.5, relax_structure=True)
|
|
207
|
+
phonon_benchmark = mtc.benchmark.PhononBenchmark(write_phonon=False)
|
|
208
|
+
suite = mtc.benchmark.BenchmarkSuite(benchmarks=[elasticity_benchmark, phonon_benchmark])
|
|
209
209
|
results = suite.run({"M3GNet": m3gnet, "TensorNet": tensornet})
|
|
210
210
|
results.to_csv("benchmark_results.csv")
|
|
211
211
|
```
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
width="200" alt="MatCalc" style="vertical-align: middle;" /><br>
|
|
4
4
|
</h1>
|
|
5
5
|
|
|
6
|
-
[](https://github.com/materialsvirtuallab/matcalc/workflows/Test/badge.svg)
|
|
7
|
+
[](https://github.com/materialsvirtuallab/matcalc/workflows/Lint/badge.svg)
|
|
8
8
|
[](https://codecov.io/gh/materialsvirtuallab/matcalc)
|
|
9
9
|
[](https://python.org/downloads)
|
|
10
10
|
[](https://pypi.org/project/matcalc?logo=pypi&logoColor=white)
|
|
@@ -42,12 +42,12 @@ MatCalc provides convenient methods to quickly compute properties, using a minim
|
|
|
42
42
|
an example of a computation of the elastic constants of Si using the `TensorNet-MatPES-PBE-v2025.1-PES` universal MLIP.
|
|
43
43
|
|
|
44
44
|
```python
|
|
45
|
-
|
|
45
|
+
import matcalc as mtc
|
|
46
46
|
from pymatgen.ext.matproj import MPRester
|
|
47
47
|
|
|
48
48
|
mpr = MPRester()
|
|
49
49
|
si = mpr.get_structure_by_material_id("mp-149")
|
|
50
|
-
c = ElasticityCalc(load_up("TensorNet-MatPES-PBE-v2025.1-PES"), relax_structure=True)
|
|
50
|
+
c = mtc.ElasticityCalc(mtc.load_up("TensorNet-MatPES-PBE-v2025.1-PES"), relax_structure=True)
|
|
51
51
|
props = c.calc(si)
|
|
52
52
|
print(f"K_VRH = {props['bulk_modulus_vrh'] * 160.2176621} GPa")
|
|
53
53
|
```
|
|
@@ -58,9 +58,9 @@ While we generally recommend users to specify exactly the model they would like
|
|
|
58
58
|
(case-insensitive) aliases to our recommended models for PBE and r2SCAN predictions. These can be loaded using:
|
|
59
59
|
|
|
60
60
|
```python
|
|
61
|
-
|
|
62
|
-
pbe_calculator = load_up("pbe")
|
|
63
|
-
r2scan_calculator = load_up("r2scan")
|
|
61
|
+
import matcalc as mtc
|
|
62
|
+
pbe_calculator = mtc.load_up("pbe")
|
|
63
|
+
r2scan_calculator = mtc.load_up("r2scan")
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
At the time of writing, these are the TensorNet-MatPES models. However, these recommendations may updated as improved
|
|
@@ -93,20 +93,20 @@ computed by all steps. Note that the `relax_structure` should be set to False in
|
|
|
93
93
|
do not redo the relatively expensive relaxation.
|
|
94
94
|
|
|
95
95
|
```python
|
|
96
|
-
|
|
96
|
+
import matcalc as mtc
|
|
97
97
|
import numpy as np
|
|
98
|
-
calculator = load_up("pbe")
|
|
99
|
-
relax_calc = RelaxCalc(
|
|
98
|
+
calculator = mtc.load_up("pbe")
|
|
99
|
+
relax_calc = mtc.RelaxCalc(
|
|
100
100
|
calculator,
|
|
101
101
|
optimizer="FIRE",
|
|
102
102
|
relax_atoms=True,
|
|
103
103
|
relax_cell=True,
|
|
104
104
|
)
|
|
105
|
-
energetics_calc = EnergeticsCalc(
|
|
105
|
+
energetics_calc = mtc.EnergeticsCalc(
|
|
106
106
|
calculator,
|
|
107
107
|
relax_structure=False # Since we are chaining, we do not need to relax structure in later steps.
|
|
108
108
|
)
|
|
109
|
-
elast_calc = ElasticityCalc(
|
|
109
|
+
elast_calc = mtc.ElasticityCalc(
|
|
110
110
|
calculator,
|
|
111
111
|
fmax=0.1,
|
|
112
112
|
norm_strains=list(np.linspace(-0.004, 0.004, num=4)),
|
|
@@ -115,7 +115,7 @@ elast_calc = ElasticityCalc(
|
|
|
115
115
|
relax_structure=False, # Since we are chaining, we do not need to relax structure in later steps.
|
|
116
116
|
relax_deformed_structures=True,
|
|
117
117
|
)
|
|
118
|
-
prop_calc = ChainedCalc([relax_calc, energetics_calc, elast_calc])
|
|
118
|
+
prop_calc = mtc.ChainedCalc([relax_calc, energetics_calc, elast_calc])
|
|
119
119
|
results = prop_calc.calc(structure)
|
|
120
120
|
```
|
|
121
121
|
|
|
@@ -137,10 +137,10 @@ the `MatCalc-Benchmark`.
|
|
|
137
137
|
For example, the following code can be used to run the ElasticityBenchmark on `TensorNet-MatPES-PBE-v2025.1-PES` UMLIP.
|
|
138
138
|
|
|
139
139
|
```python
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
benchmark = ElasticityBenchmark(fmax=0.05, relax_structure=True)
|
|
140
|
+
import matcalc as mtc
|
|
141
|
+
|
|
142
|
+
calculator = mtc.load_up("TensorNet-MatPES-PBE-v2025.1-PES")
|
|
143
|
+
benchmark = mtc.benchmark.ElasticityBenchmark(fmax=0.05, relax_structure=True)
|
|
144
144
|
results = benchmark.run(calculator, "TensorNet-MatPES")
|
|
145
145
|
```
|
|
146
146
|
|
|
@@ -149,14 +149,14 @@ The entire run takes ~ 16mins when parallelized over 10 CPUs on a Mac.
|
|
|
149
149
|
You can even run entire suites of benchmarks on multiple models, as follows:
|
|
150
150
|
|
|
151
151
|
```python
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
elasticity_benchmark = ElasticityBenchmark(fmax=0.5, relax_structure=True)
|
|
158
|
-
phonon_benchmark = PhononBenchmark(write_phonon=False)
|
|
159
|
-
suite = BenchmarkSuite(benchmarks=[elasticity_benchmark, phonon_benchmark])
|
|
152
|
+
import matcalc as mtc
|
|
153
|
+
|
|
154
|
+
tensornet = mtc.load_up("TensorNet-MatPES-PBE-v2025.1-PES")
|
|
155
|
+
m3gnet = mtc.load_up("M3GNet-MatPES-PBE-v2025.1-PES")
|
|
156
|
+
|
|
157
|
+
elasticity_benchmark = mtc.benchmark.ElasticityBenchmark(fmax=0.5, relax_structure=True)
|
|
158
|
+
phonon_benchmark = mtc.benchmark.PhononBenchmark(write_phonon=False)
|
|
159
|
+
suite = mtc.benchmark.BenchmarkSuite(benchmarks=[elasticity_benchmark, phonon_benchmark])
|
|
160
160
|
results = suite.run({"M3GNet": m3gnet, "TensorNet": tensornet})
|
|
161
161
|
results.to_csv("benchmark_results.csv")
|
|
162
162
|
```
|
|
@@ -37,45 +37,44 @@ classifiers = [
|
|
|
37
37
|
]
|
|
38
38
|
dependencies = [
|
|
39
39
|
"ase>=3.23.0",
|
|
40
|
-
"joblib",
|
|
41
|
-
"phonopy",
|
|
42
|
-
"pymatgen",
|
|
43
40
|
"numpy<2.0.0",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
41
|
+
"scikit-learn>=1.6.1",
|
|
42
|
+
"pymatgen>=2025.3.10",
|
|
43
|
+
"fsspec>=2025.3.0",
|
|
44
|
+
"joblib>=1.4.2",
|
|
45
|
+
"phonopy>=2.38.0",
|
|
46
|
+
"phono3py>=3.15.0",
|
|
46
47
|
]
|
|
47
|
-
version = "0.
|
|
48
|
+
version = "0.3.2"
|
|
48
49
|
|
|
49
50
|
[project.optional-dependencies]
|
|
50
51
|
phonon = ["seekpath"]
|
|
51
52
|
benchmark = ["matminer>=0.9.3"]
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
]
|
|
55
|
-
sevennet = [
|
|
56
|
-
"sevenn>=0.10.4",
|
|
53
|
+
ace = [
|
|
54
|
+
"pyace>=0.1.1",
|
|
57
55
|
]
|
|
58
56
|
mace = [
|
|
59
57
|
"mace-torch>=0.3.12",
|
|
60
58
|
]
|
|
61
|
-
|
|
62
|
-
"
|
|
59
|
+
deepmd = [
|
|
60
|
+
"deepmd-kit>=3.0.2",
|
|
63
61
|
]
|
|
64
62
|
grace = [
|
|
65
63
|
"tensorpotential>=0.5.1",
|
|
66
64
|
]
|
|
67
|
-
|
|
68
|
-
"
|
|
65
|
+
maml = [
|
|
66
|
+
"maml>=2025.2.25",
|
|
69
67
|
]
|
|
70
68
|
orb = [
|
|
71
69
|
"orb-models>=0.4.2",
|
|
70
|
+
"pynanoflann>=0.10.0",
|
|
72
71
|
]
|
|
73
|
-
|
|
74
|
-
"
|
|
72
|
+
sevennet = [
|
|
73
|
+
"sevenn>=0.10.4",
|
|
75
74
|
]
|
|
76
75
|
|
|
77
76
|
[project.scripts]
|
|
78
|
-
matcalc = "matcalc.
|
|
77
|
+
matcalc = "matcalc._cli:main"
|
|
79
78
|
|
|
80
79
|
[tool.setuptools.packages.find]
|
|
81
80
|
where = ["src"]
|
|
@@ -117,12 +116,22 @@ maintain = [
|
|
|
117
116
|
]
|
|
118
117
|
test-models = [
|
|
119
118
|
"mace-torch>=0.3.12",
|
|
119
|
+
"nequip>=0.6.2",
|
|
120
120
|
"orb-models>=0.4.2",
|
|
121
121
|
"pynanoflann>=0.10.0",
|
|
122
122
|
"sevenn>=0.10.4",
|
|
123
123
|
"tensorpotential>=0.5.1",
|
|
124
124
|
]
|
|
125
125
|
|
|
126
|
+
[tool.uv]
|
|
127
|
+
conflicts = [
|
|
128
|
+
[
|
|
129
|
+
{ extra = "mace" },
|
|
130
|
+
{ extra = "fairchem" },
|
|
131
|
+
{ extra = "mattersim" },
|
|
132
|
+
],
|
|
133
|
+
]
|
|
134
|
+
|
|
126
135
|
[tool.ruff]
|
|
127
136
|
target-version = "py310"
|
|
128
137
|
line-length = 120
|
|
@@ -182,6 +191,9 @@ exclude_lines = [
|
|
|
182
191
|
"@deprecated",
|
|
183
192
|
"def __repr__",
|
|
184
193
|
"except PackageNotFoundError:",
|
|
194
|
+
"except Exception:",
|
|
195
|
+
"except:",
|
|
196
|
+
"except FileNotFoundError:",
|
|
185
197
|
"if 0:",
|
|
186
198
|
"if TYPE_CHECKING:",
|
|
187
199
|
"if typing.TYPE_CHECKING:",
|
|
@@ -9,15 +9,16 @@ try:
|
|
|
9
9
|
except PackageNotFoundError:
|
|
10
10
|
pass # package not installed
|
|
11
11
|
|
|
12
|
-
from .
|
|
12
|
+
from ._base import ChainedCalc, PropCalc
|
|
13
|
+
from ._elasticity import ElasticityCalc
|
|
14
|
+
from ._eos import EOSCalc
|
|
15
|
+
from ._neb import NEBCalc
|
|
16
|
+
from ._phonon import PhononCalc
|
|
17
|
+
from ._phonon3 import Phonon3Calc
|
|
18
|
+
from ._qha import QHACalc
|
|
19
|
+
from ._relaxation import RelaxCalc
|
|
20
|
+
from ._stability import EnergeticsCalc
|
|
13
21
|
from .config import clear_cache
|
|
14
|
-
from .elasticity import ElasticityCalc
|
|
15
|
-
from .eos import EOSCalc
|
|
16
|
-
from .neb import NEBCalc
|
|
17
|
-
from .phonon import PhononCalc
|
|
18
|
-
from .qha import QHACalc
|
|
19
|
-
from .relaxation import RelaxCalc
|
|
20
|
-
from .stability import EnergeticsCalc
|
|
21
22
|
from .utils import UNIVERSAL_CALCULATORS, PESCalculator
|
|
22
23
|
|
|
23
24
|
# Provide an alias for loading calculators quickly.
|
|
@@ -14,21 +14,39 @@ if TYPE_CHECKING:
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class PropCalc(abc.ABC):
|
|
17
|
-
"""
|
|
17
|
+
"""
|
|
18
|
+
Abstract base class for property calculations.
|
|
19
|
+
|
|
20
|
+
This class defines the interface for performing property calculations on
|
|
21
|
+
structures (using pymatgen's Structure objects or a dictionary containing a
|
|
22
|
+
pymatgen structure). Subclasses are expected to implement the `calc` method
|
|
23
|
+
to define specific property calculation logic. Additionally, this class provides
|
|
24
|
+
an implementation of the `calc_many` method, which enables concurrent calculations
|
|
25
|
+
on multiple structures using joblib.
|
|
26
|
+
"""
|
|
18
27
|
|
|
19
28
|
@abc.abstractmethod
|
|
20
29
|
def calc(self, structure: Structure | dict[str, Any]) -> dict[str, Any]:
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
call to the abstract base method to obtain an initial result dict.
|
|
30
|
+
"""
|
|
31
|
+
Abstract method to calculate and return a standardized format of structural data.
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
This method processes input structural data, which could either be a dictionary
|
|
34
|
+
or a pymatgen Structure object, and returns a dictionary representation. If a
|
|
35
|
+
dictionary is provided, it must include either the key ``final_structure`` or
|
|
36
|
+
``structure``. For a pymatgen Structure input, it will be converted to a dictionary
|
|
37
|
+
with the key ``final_structure``. To support chaining, a super() call should be made
|
|
38
|
+
by subclasses to ensure that the input dictionary is standardized.
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
:param structure: A pymatgen Structure object or a dictionary containing structural
|
|
41
|
+
data with keys such as ``final_structure`` or ``structure``.
|
|
42
|
+
:type structure: Structure | dict[str, Any]
|
|
43
|
+
|
|
44
|
+
:return: A dictionary with the key ``final_structure`` mapping to the corresponding
|
|
45
|
+
structural data.
|
|
46
|
+
:rtype: dict[str, Any]
|
|
47
|
+
|
|
48
|
+
:raises ValueError: If the input dictionary does not include the required keys
|
|
49
|
+
``final_structure`` or ``structure``.
|
|
32
50
|
"""
|
|
33
51
|
if isinstance(structure, dict):
|
|
34
52
|
if "final_structure" in structure:
|
|
@@ -49,22 +67,30 @@ class PropCalc(abc.ABC):
|
|
|
49
67
|
allow_errors: bool = False, # noqa: FBT001,FBT002
|
|
50
68
|
**kwargs: Any,
|
|
51
69
|
) -> Generator[dict | None]:
|
|
52
|
-
"""
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
"""
|
|
71
|
+
Calculate properties for multiple structures concurrently.
|
|
72
|
+
|
|
73
|
+
This method leverages parallel processing to compute properties for a
|
|
74
|
+
given sequence of structures. It uses the `joblib.Parallel` library to
|
|
75
|
+
support multi-job execution and manage error handling behavior based
|
|
76
|
+
on user configuration.
|
|
77
|
+
|
|
78
|
+
:param structures: A sequence of `Structure` objects or dictionaries
|
|
79
|
+
representing the input structures to be processed. Each entry in
|
|
80
|
+
the sequence is processed independently.
|
|
81
|
+
:param n_jobs: The number of jobs to run in parallel. If set to None,
|
|
82
|
+
joblib will determine the optimal number of jobs based on the
|
|
83
|
+
system's CPU configuration.
|
|
84
|
+
:param allow_errors: A boolean flag indicating whether to tolerate
|
|
85
|
+
exceptions during processing. When set to True, any failed
|
|
86
|
+
calculation will result in a `None` value for that structure
|
|
87
|
+
instead of raising an exception.
|
|
88
|
+
:param kwargs: Additional keyword arguments passed directly to
|
|
89
|
+
`joblib.Parallel`, which allows customization of parallel
|
|
90
|
+
processing behavior.
|
|
91
|
+
:return: A generator yielding dictionaries with computed properties
|
|
92
|
+
for each structure or `None` if an error occurred (depending on
|
|
93
|
+
the `allow_errors` flag).
|
|
68
94
|
"""
|
|
69
95
|
parallel = Parallel(n_jobs=n_jobs, return_as="generator", **kwargs)
|
|
70
96
|
if allow_errors:
|