lammpsparser 0.0.8__tar.gz → 0.0.10__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.
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/PKG-INFO +6 -6
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/pyproject.toml +5 -5
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/_version.py +2 -2
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/compatibility/calculate.py +3 -4
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/compatibility/file.py +4 -4
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/compatibility/structure.py +3 -6
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/output.py +10 -10
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/output_raw.py +3 -2
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/potential.py +13 -16
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/structure.py +2 -1
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/units.py +5 -6
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/.gitignore +0 -0
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/LICENSE +0 -0
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/README.md +0 -0
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/__init__.py +0 -0
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/compatibility/__init__.py +0 -0
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/compatibility/constraints.py +0 -0
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/compatibility/data.py +0 -0
- {lammpsparser-0.0.8 → lammpsparser-0.0.10}/src/lammpsparser/compatibility/output.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: lammpsparser
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.10
|
|
4
4
|
Summary: Vector-oriented LAMMPS interface to rapidly iterate over series of atomistic structures or interatomic potentials.
|
|
5
5
|
Project-URL: Homepage, https://github.com/pyiron/lammpsparser
|
|
6
6
|
Project-URL: Documentation, https://github.com/pyiron/lammpsparser
|
|
@@ -50,11 +50,11 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
50
50
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
51
51
|
Requires-Python: <3.15,>=3.9
|
|
52
52
|
Requires-Dist: ase<=3.29.0,>=3.22.1
|
|
53
|
-
Requires-Dist: numpy<=2.
|
|
54
|
-
Requires-Dist: pandas<=3.0.
|
|
55
|
-
Requires-Dist: scipy<=1.
|
|
53
|
+
Requires-Dist: numpy<=2.5.3,>=1.26.0
|
|
54
|
+
Requires-Dist: pandas<=3.0.6,>=2.0.3
|
|
55
|
+
Requires-Dist: scipy<=1.18.1,>=1.11.1
|
|
56
56
|
Provides-Extra: compatibility
|
|
57
|
-
Requires-Dist: structuretoolkit<=0.0.
|
|
57
|
+
Requires-Dist: structuretoolkit<=0.0.47,>=0.0.30; extra == 'compatibility'
|
|
58
58
|
Provides-Extra: h5md
|
|
59
59
|
Requires-Dist: h5py<=3.16.0,>=3.9.0; extra == 'h5md'
|
|
60
60
|
Description-Content-Type: text/markdown
|
|
@@ -5,7 +5,7 @@ requires = [
|
|
|
5
5
|
"h5py",
|
|
6
6
|
"pandas",
|
|
7
7
|
"scipy",
|
|
8
|
-
"hatchling==1.
|
|
8
|
+
"hatchling==1.32.4",
|
|
9
9
|
"hatch-vcs==0.5.0",
|
|
10
10
|
]
|
|
11
11
|
build-backend = "hatchling.build"
|
|
@@ -35,9 +35,9 @@ classifiers = [
|
|
|
35
35
|
]
|
|
36
36
|
dependencies = [
|
|
37
37
|
"ase>=3.22.1,<=3.29.0",
|
|
38
|
-
"numpy>=1.26.0,<=2.
|
|
39
|
-
"pandas>=2.0.3,<=3.0.
|
|
40
|
-
"scipy>=1.11.1,<=1.
|
|
38
|
+
"numpy>=1.26.0,<=2.5.3",
|
|
39
|
+
"pandas>=2.0.3,<=3.0.6",
|
|
40
|
+
"scipy>=1.11.1,<=1.18.1",
|
|
41
41
|
]
|
|
42
42
|
dynamic = ["version"]
|
|
43
43
|
|
|
@@ -48,7 +48,7 @@ Repository = "https://github.com/pyiron/lammpsparser"
|
|
|
48
48
|
|
|
49
49
|
[project.optional-dependencies]
|
|
50
50
|
h5md = ["h5py>=3.9.0,<=3.16.0"]
|
|
51
|
-
compatibility = ["structuretoolkit>=0.0.30,<=0.0.
|
|
51
|
+
compatibility = ["structuretoolkit>=0.0.30,<=0.0.47"]
|
|
52
52
|
|
|
53
53
|
[tool.hatch.build]
|
|
54
54
|
include = [
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.0.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 0,
|
|
21
|
+
__version__ = version = '0.0.10'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 0, 10)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -245,10 +245,9 @@ def calc_minimize(
|
|
|
245
245
|
"No rotation matrix given while trying to convert pressure. "
|
|
246
246
|
"This is most likely due to no structure being defined."
|
|
247
247
|
)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
)
|
|
248
|
+
rotation_matrix, structure = _get_rotation_matrix(
|
|
249
|
+
structure=structure, pressure=pressure
|
|
250
|
+
)
|
|
252
251
|
# force_skewed = False
|
|
253
252
|
pressure = _pressure_to_lammps(
|
|
254
253
|
pressure=pressure, rotation_matrix=rotation_matrix, units=units
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
+
import pathlib
|
|
4
5
|
import shutil
|
|
5
6
|
import subprocess
|
|
6
7
|
from dataclasses import asdict
|
|
@@ -120,7 +121,7 @@ def lammps_file_interface_function(
|
|
|
120
121
|
+ " -in lmp.in"
|
|
121
122
|
)
|
|
122
123
|
|
|
123
|
-
|
|
124
|
+
pathlib.Path(working_directory).mkdir(exist_ok=True, parents=True)
|
|
124
125
|
potential_lst, potential_replace, species = _get_potential(
|
|
125
126
|
potential=potential, resource_path=resource_path
|
|
126
127
|
)
|
|
@@ -233,7 +234,7 @@ def lammps_file_interface_function(
|
|
|
233
234
|
if write_restart_file:
|
|
234
235
|
lmp_str_lst.append(f"write_restart {os.path.basename(restart_file)}")
|
|
235
236
|
|
|
236
|
-
with
|
|
237
|
+
with pathlib.Path(os.path.join(working_directory, "lmp.in")).open("w") as f:
|
|
237
238
|
f.writelines([line + "\n" for line in lmp_str_lst])
|
|
238
239
|
|
|
239
240
|
write_lammps_datafile(
|
|
@@ -344,8 +345,7 @@ def _modify_input_dict(
|
|
|
344
345
|
lmp_tmp_lst.append(k + " " + v)
|
|
345
346
|
|
|
346
347
|
return lmp_tmp_lst
|
|
347
|
-
|
|
348
|
-
return lmp_str_lst
|
|
348
|
+
return lmp_str_lst
|
|
349
349
|
|
|
350
350
|
|
|
351
351
|
def _get_potential(potential, resource_path: str | None = None):
|
|
@@ -81,7 +81,7 @@ class LammpsStructureCompatibility(LammpsStructure):
|
|
|
81
81
|
|
|
82
82
|
elements = self._structure.get_chemical_symbols()
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
# Standard atoms stuff
|
|
85
85
|
atoms = "Atoms \n\n"
|
|
86
86
|
# atom_style bond
|
|
87
87
|
# format: atom-ID, molecule-ID, atom_type, x, y, z
|
|
@@ -117,7 +117,7 @@ class LammpsStructureCompatibility(LammpsStructure):
|
|
|
117
117
|
else:
|
|
118
118
|
raise ValueError("dimension 1 not yet implemented")
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
# Bond related.
|
|
121
121
|
# This seems independent from the lammps atom type ids, because bonds only use atom ids
|
|
122
122
|
el_list = set(self._structure.get_chemical_symbols())
|
|
123
123
|
el_dict = OrderedDict()
|
|
@@ -199,10 +199,7 @@ class LammpsStructureCompatibility(LammpsStructure):
|
|
|
199
199
|
for species_name in set(self.structure.get_chemical_symbols())
|
|
200
200
|
}
|
|
201
201
|
else:
|
|
202
|
-
q_dict =
|
|
203
|
-
species_name: 0.0
|
|
204
|
-
for species_name in set(self.structure.get_chemical_symbols())
|
|
205
|
-
}
|
|
202
|
+
q_dict = dict.fromkeys(set(self.structure.get_chemical_symbols()), 0.0)
|
|
206
203
|
|
|
207
204
|
bonds_lst, angles_lst = [], []
|
|
208
205
|
bond_type_lst, angle_type_lst = [], []
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
+
import pathlib
|
|
4
5
|
import warnings
|
|
5
|
-
from
|
|
6
|
+
from collections.abc import Callable
|
|
7
|
+
from typing import Any
|
|
6
8
|
|
|
7
9
|
import numpy as np
|
|
8
10
|
import pandas as pd
|
|
@@ -200,7 +202,7 @@ def _parse_dump(
|
|
|
200
202
|
RuntimeError: If an H5MD file is present but the prism is not orthorhombic.
|
|
201
203
|
FileNotFoundError: If neither dump file exists.
|
|
202
204
|
"""
|
|
203
|
-
if
|
|
205
|
+
if pathlib.Path(dump_h5_full_file_name).is_file():
|
|
204
206
|
if not _check_ortho_prism(prism=prism):
|
|
205
207
|
raise RuntimeError(
|
|
206
208
|
"The Lammps output will not be mapped back onto the structure correctly."
|
|
@@ -208,7 +210,7 @@ def _parse_dump(
|
|
|
208
210
|
return parse_raw_dump_from_h5md(
|
|
209
211
|
file_name=dump_h5_full_file_name,
|
|
210
212
|
)
|
|
211
|
-
|
|
213
|
+
if pathlib.Path(dump_out_full_file_name).exists():
|
|
212
214
|
return _collect_dump_from_text(
|
|
213
215
|
file_name=dump_out_full_file_name,
|
|
214
216
|
prism=prism,
|
|
@@ -216,10 +218,9 @@ def _parse_dump(
|
|
|
216
218
|
potential_elements=potential_elements,
|
|
217
219
|
remap_indices_funct=remap_indices_funct,
|
|
218
220
|
)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
)
|
|
221
|
+
raise FileNotFoundError(
|
|
222
|
+
f"Neither {dump_h5_full_file_name} nor {dump_out_full_file_name} exist."
|
|
223
|
+
)
|
|
223
224
|
|
|
224
225
|
|
|
225
226
|
def _collect_dump_from_text(
|
|
@@ -306,13 +307,12 @@ def _parse_log(
|
|
|
306
307
|
Raises:
|
|
307
308
|
(RuntimeError): If there are "ERROR" tags in the log.
|
|
308
309
|
"""
|
|
309
|
-
if
|
|
310
|
+
if pathlib.Path(log_lammps_full_file_name).exists():
|
|
310
311
|
return _collect_output_log(
|
|
311
312
|
file_name=log_lammps_full_file_name,
|
|
312
313
|
prism=prism,
|
|
313
314
|
)
|
|
314
|
-
|
|
315
|
-
return None, None, None
|
|
315
|
+
return None, None, None
|
|
316
316
|
|
|
317
317
|
|
|
318
318
|
def _collect_output_log(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import pathlib
|
|
3
4
|
import warnings
|
|
4
5
|
from dataclasses import asdict, dataclass, field
|
|
5
6
|
from io import StringIO
|
|
@@ -162,7 +163,7 @@ def parse_raw_dump_from_text(file_name: str) -> dict:
|
|
|
162
163
|
- ``"positions"`` (list of numpy.ndarray): Wrapped fractional coordinates, shape ``(N, 3)``.
|
|
163
164
|
- ``"computes"`` (dict): Per-atom compute results keyed by compute ID (``c_`` prefix stripped).
|
|
164
165
|
"""
|
|
165
|
-
with open(
|
|
166
|
+
with pathlib.Path(file_name).open("r") as f:
|
|
166
167
|
dump = DumpData()
|
|
167
168
|
|
|
168
169
|
for line in f:
|
|
@@ -302,7 +303,7 @@ def parse_raw_lammps_log(file_name: str) -> pd.DataFrame:
|
|
|
302
303
|
are present a ``LogStep`` column (integer run index, 0-based) is
|
|
303
304
|
appended.
|
|
304
305
|
"""
|
|
305
|
-
with open(
|
|
306
|
+
with pathlib.Path(file_name).open("r") as f:
|
|
306
307
|
dfs = []
|
|
307
308
|
read_thermo = False
|
|
308
309
|
for line in f:
|
|
@@ -277,8 +277,7 @@ class PotentialAvailable:
|
|
|
277
277
|
def __getattr__(self, name):
|
|
278
278
|
if name in self._list_of_potentials:
|
|
279
279
|
return self._list_of_potentials[name]
|
|
280
|
-
|
|
281
|
-
raise AttributeError
|
|
280
|
+
raise AttributeError
|
|
282
281
|
|
|
283
282
|
def __dir__(self):
|
|
284
283
|
return list(self._list_of_potentials.keys())
|
|
@@ -312,9 +311,9 @@ def find_potential_file_base(path, resource_path_lst, rel_path):
|
|
|
312
311
|
for resource_path in resource_path_lst:
|
|
313
312
|
path_direct = os.path.join(resource_path, path)
|
|
314
313
|
path_indirect = os.path.join(resource_path, rel_path, path)
|
|
315
|
-
if
|
|
314
|
+
if Path(path_direct).exists():
|
|
316
315
|
return path_direct
|
|
317
|
-
|
|
316
|
+
if Path(path_indirect).exists():
|
|
318
317
|
return path_indirect
|
|
319
318
|
raise ValueError(
|
|
320
319
|
"Either the filename or the functional has to be defined.",
|
|
@@ -424,7 +423,7 @@ def get_resource_path_from_conda(
|
|
|
424
423
|
for conda_var in env_variables:
|
|
425
424
|
if conda_var in env:
|
|
426
425
|
resource_path = os.path.join(env[conda_var], "share", "iprpy")
|
|
427
|
-
if
|
|
426
|
+
if Path(resource_path).exists():
|
|
428
427
|
return resource_path
|
|
429
428
|
raise ValueError("No resource_path found" + potential_installation)
|
|
430
429
|
|
|
@@ -507,21 +506,19 @@ def validate_potential_dataframe(
|
|
|
507
506
|
"""
|
|
508
507
|
if isinstance(potential_dataframe, pandas.Series):
|
|
509
508
|
return potential_dataframe
|
|
510
|
-
|
|
509
|
+
if isinstance(potential_dataframe, pandas.DataFrame):
|
|
511
510
|
if len(potential_dataframe) == 1:
|
|
512
511
|
return potential_dataframe.iloc[0]
|
|
513
|
-
|
|
512
|
+
if len(potential_dataframe) == 0:
|
|
514
513
|
raise ValueError(
|
|
515
514
|
"The potential_dataframe is an empty pandas.DataFrame:",
|
|
516
515
|
potential_dataframe,
|
|
517
516
|
)
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
potential_dataframe,
|
|
522
|
-
)
|
|
523
|
-
else:
|
|
524
|
-
raise TypeError(
|
|
525
|
-
"The potential_dataframe should be a pandas.DataFrame or pandas.Series, but instead it is of type:",
|
|
526
|
-
type(potential_dataframe),
|
|
517
|
+
raise ValueError(
|
|
518
|
+
"The potential_dataframe contains more than one interatomic potential, please select one:",
|
|
519
|
+
potential_dataframe,
|
|
527
520
|
)
|
|
521
|
+
raise TypeError(
|
|
522
|
+
"The potential_dataframe should be a pandas.DataFrame or pandas.Series, but instead it is of type:",
|
|
523
|
+
type(potential_dataframe),
|
|
524
|
+
)
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
6
|
import decimal as dec
|
|
7
|
+
import pathlib
|
|
7
8
|
import posixpath
|
|
8
9
|
import warnings
|
|
9
10
|
from typing import Any, cast
|
|
@@ -524,7 +525,7 @@ class LammpsStructure:
|
|
|
524
525
|
if cwd is not None:
|
|
525
526
|
file_name = posixpath.join(cwd, file_name)
|
|
526
527
|
|
|
527
|
-
with open(
|
|
528
|
+
with pathlib.Path(file_name).open("w") as f:
|
|
528
529
|
f.writelines(self._string_input)
|
|
529
530
|
|
|
530
531
|
|
|
@@ -237,9 +237,8 @@ class UnitConverter:
|
|
|
237
237
|
np.array(array) * self.lammps_to_pyiron(quantity_dict[label]),
|
|
238
238
|
dtype=dtype_dict[label],
|
|
239
239
|
)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return np.array(array)
|
|
240
|
+
warnings.warn(
|
|
241
|
+
message="Warning: Couldn't determine the LAMMPS to pyiron unit conversion type of quantity "
|
|
242
|
+
f"{label}. Returning un-normalized quantity"
|
|
243
|
+
)
|
|
244
|
+
return np.array(array)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|