lammpsparser 0.0.1__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.
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2023, pyiron
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,146 @@
1
+ Metadata-Version: 2.4
2
+ Name: lammpsparser
3
+ Version: 0.0.1
4
+ Summary: Vector-oriented LAMMPS interface to rapidly iterate over series of atomistic structures or interatomic potentials.
5
+ Project-URL: Homepage, https://github.com/pyiron/lammpsparser
6
+ Project-URL: Documentation, https://github.com/pyiron/lammpsparser
7
+ Project-URL: Repository, https://github.com/pyiron/lammpsparser
8
+ Author-email: Jan Janssen <janssen@mpie.de>
9
+ License: BSD 3-Clause License
10
+
11
+ Copyright (c) 2023, pyiron
12
+ All rights reserved.
13
+
14
+ Redistribution and use in source and binary forms, with or without
15
+ modification, are permitted provided that the following conditions are met:
16
+
17
+ * Redistributions of source code must retain the above copyright notice, this
18
+ list of conditions and the following disclaimer.
19
+
20
+ * Redistributions in binary form must reproduce the above copyright notice,
21
+ this list of conditions and the following disclaimer in the documentation
22
+ and/or other materials provided with the distribution.
23
+
24
+ * Neither the name of the copyright holder nor the names of its
25
+ contributors may be used to endorse or promote products derived from
26
+ this software without specific prior written permission.
27
+
28
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
32
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+ License-File: LICENSE
39
+ Keywords: pyiron
40
+ Classifier: Development Status :: 5 - Production/Stable
41
+ Classifier: Intended Audience :: Science/Research
42
+ Classifier: License :: OSI Approved :: BSD License
43
+ Classifier: Operating System :: OS Independent
44
+ Classifier: Programming Language :: Python :: 3.9
45
+ Classifier: Programming Language :: Python :: 3.10
46
+ Classifier: Programming Language :: Python :: 3.11
47
+ Classifier: Programming Language :: Python :: 3.12
48
+ Classifier: Programming Language :: Python :: 3.13
49
+ Classifier: Programming Language :: Python :: 3.14
50
+ Classifier: Topic :: Scientific/Engineering :: Physics
51
+ Requires-Python: <3.15,>=3.9
52
+ Requires-Dist: ase<=3.27.0,>=3.22.1
53
+ Requires-Dist: numpy<=2.4.2,>=1.26.0
54
+ Requires-Dist: pandas<=3.0.0,>=2.0.3
55
+ Requires-Dist: scipy<=1.17.0,>=1.11.1
56
+ Provides-Extra: h5md
57
+ Requires-Dist: h5py<=3.15.1,>=3.9.0; extra == 'h5md'
58
+ Description-Content-Type: text/markdown
59
+
60
+ # lammpsparser
61
+
62
+ [![Pipeline](https://github.com/pyiron/lammpsparser/actions/workflows/pipeline.yml/badge.svg)](https://github.com/pyiron/lammpsparser/actions/workflows/pipeline.yml)
63
+ [![codecov](https://codecov.io/gh/pyiron/lammpsparser/graph/badge.svg?token=OeZVIJ9vyW)](https://codecov.io/gh/pyiron/lammpsparser)
64
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyiron/lammpsparser/main?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fexample.ipynb)
65
+
66
+ The `lammpsparser` packages provides primarily two functions. A `write_lammps_structure()` function to write an `ase.atoms.Atoms`
67
+ structure to an LAMMPS data file and a `parse_lammps_output_files()` function to parse the `log.lammps`, `dump.out` and
68
+ `dump.h5` files from the LAMMPS `thermo` and `dump` commands.
69
+
70
+ ## Installation
71
+ The `lammpsparser` package is distributed via both [pypi](https://pypi.org/project/lammpsparser/):
72
+ ```
73
+ pip install lammpsparser
74
+ ```
75
+ and [conda-forge](https://anaconda.org/conda-forge/lammpsparser):
76
+ ```
77
+ conda install -c conda-forge lammpsparser
78
+ ```
79
+
80
+ ## Write LAMMPS structure
81
+ The `write_lammps_structure()` function is designed to write an `ase.atoms.Atoms` structure to an LAMMPS data file:
82
+ ```python
83
+ from lammpsparser import write_lammps_structure
84
+
85
+ write_lammps_structure(
86
+ structure,
87
+ potential_elements,
88
+ units="metal",
89
+ file_name="lammps.data",
90
+ working_directory=None,
91
+ )
92
+ ```
93
+ The `structure` parameter refers to the `ase.atoms.Atoms` structure and the `potential_elements` refers to the list of
94
+ elements implemented in the specific interatomic potential. For example the [NiAlH_jea.eam.alloy](https://github.com/lammps/lammps/blob/develop/potentials/NiAlH_jea.eam.alloy)
95
+ potential implements the elements `Ni`, `Al` and `H`, so when writing a structure for a simulation with this potential
96
+ the `potential_elements=["Ni", "Al", "H"]`. It is important to maintain the order of the elements as LAMMPS internally
97
+ references the elements based on their index, starting from one. The `units` parameter refers to the LAMMPS internal
98
+ [units](https://docs.lammps.org/units.html) to convert the `ase.atoms.Atoms` object which is defined in Angstrom to the
99
+ length scale of the LAMMPS simulation. Finally, `file_name` parameter and the current working directory `working_directory`
100
+ parameter are designed to select the location where the LAMMPS structure should be written. With the default parameters
101
+ the LAMMPS structure is written in the `lammps.data` file in the current directory.
102
+
103
+ ## Parse LAMMPS output
104
+ In addition to writing the LAMMPS input structure `lammpsparser` also provide the `parse_lammps_output_files()` function
105
+ to parse the LAMMPS output files, namely the `log.lammps`, `dump.out` and `dump.h5` files:
106
+ ```python
107
+ from lammpsparser import parse_lammps_output_files
108
+
109
+ parse_lammps_output_files(
110
+ working_directory,
111
+ structure,
112
+ potential_elements,
113
+ units="metal",
114
+ dump_h5_file_name="dump.h5",
115
+ dump_out_file_name="dump.out",
116
+ log_lammps_file_name="log.lammps",
117
+ )
118
+ ```
119
+ In analogy to the `write_lammps_structure()` function the `working_directory` parameter refers to the directory which
120
+ contains the output files. The `structure` parameter reefers to the `ase.atoms.Atoms` object which should be used as
121
+ template to parse the structure from the dump files. This structure is again required as LAMMPS internally references
122
+ elements only by an index, so the template structure is required to map the elements from the interatomic potential back
123
+ to the elements of the `ase.atoms.Atoms` object. In the same way the `potential_elements` refers to the list of
124
+ elements implemented in the specific interatomic potential. The `units` parameter refers to the LAMMPS internal
125
+ [units](https://docs.lammps.org/units.html) to convert the `ase.atoms.Atoms` object which is defined in Angstrom to the
126
+ length scale of the LAMMPS simulation. Finally, the parameters `dump_h5_file_name`, `dump_out_file_name` and `log_lammps_file_name`
127
+ refer to the output file names.
128
+
129
+ For the `dump.out` file the following LAMMPS `dump` command should be added to the LAMMPS input file:
130
+ ```
131
+ dump 1 all custom 100 dump.out id type xsu ysu zsu fx fy fz vx vy vz
132
+ dump_modify 1 sort id format line "%d %d %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g"
133
+ ```
134
+
135
+ For the `log.lammps` file the following LAMMPS `thermo` command should be added to the LAMMPS input file:
136
+ ```
137
+ thermo_style custom step temp pe etotal pxx pxy pxz pyy pyz pzz vol
138
+ thermo_modify format float %20.15g
139
+ thermo 100
140
+ ```
141
+
142
+ ## Usage
143
+ Currently, the `lammpsparser` parser is primarily used in the [pyiron_atomistics](https://github.com/pyiron/pyiron_atomistics)
144
+ package and its successor the [atomistics](https://github.com/pyiron/atomistics) package to provide a simple LAMMPS
145
+ parser. It only depends on `ase`, `numpy`, `pandas` and `scipy` and has an optional dependency on `h5py` to parse the
146
+ LAMMPS [h5md](https://docs.lammps.org/dump_h5md.html) format.
@@ -0,0 +1,87 @@
1
+ # lammpsparser
2
+
3
+ [![Pipeline](https://github.com/pyiron/lammpsparser/actions/workflows/pipeline.yml/badge.svg)](https://github.com/pyiron/lammpsparser/actions/workflows/pipeline.yml)
4
+ [![codecov](https://codecov.io/gh/pyiron/lammpsparser/graph/badge.svg?token=OeZVIJ9vyW)](https://codecov.io/gh/pyiron/lammpsparser)
5
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyiron/lammpsparser/main?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fexample.ipynb)
6
+
7
+ The `lammpsparser` packages provides primarily two functions. A `write_lammps_structure()` function to write an `ase.atoms.Atoms`
8
+ structure to an LAMMPS data file and a `parse_lammps_output_files()` function to parse the `log.lammps`, `dump.out` and
9
+ `dump.h5` files from the LAMMPS `thermo` and `dump` commands.
10
+
11
+ ## Installation
12
+ The `lammpsparser` package is distributed via both [pypi](https://pypi.org/project/lammpsparser/):
13
+ ```
14
+ pip install lammpsparser
15
+ ```
16
+ and [conda-forge](https://anaconda.org/conda-forge/lammpsparser):
17
+ ```
18
+ conda install -c conda-forge lammpsparser
19
+ ```
20
+
21
+ ## Write LAMMPS structure
22
+ The `write_lammps_structure()` function is designed to write an `ase.atoms.Atoms` structure to an LAMMPS data file:
23
+ ```python
24
+ from lammpsparser import write_lammps_structure
25
+
26
+ write_lammps_structure(
27
+ structure,
28
+ potential_elements,
29
+ units="metal",
30
+ file_name="lammps.data",
31
+ working_directory=None,
32
+ )
33
+ ```
34
+ The `structure` parameter refers to the `ase.atoms.Atoms` structure and the `potential_elements` refers to the list of
35
+ elements implemented in the specific interatomic potential. For example the [NiAlH_jea.eam.alloy](https://github.com/lammps/lammps/blob/develop/potentials/NiAlH_jea.eam.alloy)
36
+ potential implements the elements `Ni`, `Al` and `H`, so when writing a structure for a simulation with this potential
37
+ the `potential_elements=["Ni", "Al", "H"]`. It is important to maintain the order of the elements as LAMMPS internally
38
+ references the elements based on their index, starting from one. The `units` parameter refers to the LAMMPS internal
39
+ [units](https://docs.lammps.org/units.html) to convert the `ase.atoms.Atoms` object which is defined in Angstrom to the
40
+ length scale of the LAMMPS simulation. Finally, `file_name` parameter and the current working directory `working_directory`
41
+ parameter are designed to select the location where the LAMMPS structure should be written. With the default parameters
42
+ the LAMMPS structure is written in the `lammps.data` file in the current directory.
43
+
44
+ ## Parse LAMMPS output
45
+ In addition to writing the LAMMPS input structure `lammpsparser` also provide the `parse_lammps_output_files()` function
46
+ to parse the LAMMPS output files, namely the `log.lammps`, `dump.out` and `dump.h5` files:
47
+ ```python
48
+ from lammpsparser import parse_lammps_output_files
49
+
50
+ parse_lammps_output_files(
51
+ working_directory,
52
+ structure,
53
+ potential_elements,
54
+ units="metal",
55
+ dump_h5_file_name="dump.h5",
56
+ dump_out_file_name="dump.out",
57
+ log_lammps_file_name="log.lammps",
58
+ )
59
+ ```
60
+ In analogy to the `write_lammps_structure()` function the `working_directory` parameter refers to the directory which
61
+ contains the output files. The `structure` parameter reefers to the `ase.atoms.Atoms` object which should be used as
62
+ template to parse the structure from the dump files. This structure is again required as LAMMPS internally references
63
+ elements only by an index, so the template structure is required to map the elements from the interatomic potential back
64
+ to the elements of the `ase.atoms.Atoms` object. In the same way the `potential_elements` refers to the list of
65
+ elements implemented in the specific interatomic potential. The `units` parameter refers to the LAMMPS internal
66
+ [units](https://docs.lammps.org/units.html) to convert the `ase.atoms.Atoms` object which is defined in Angstrom to the
67
+ length scale of the LAMMPS simulation. Finally, the parameters `dump_h5_file_name`, `dump_out_file_name` and `log_lammps_file_name`
68
+ refer to the output file names.
69
+
70
+ For the `dump.out` file the following LAMMPS `dump` command should be added to the LAMMPS input file:
71
+ ```
72
+ dump 1 all custom 100 dump.out id type xsu ysu zsu fx fy fz vx vy vz
73
+ dump_modify 1 sort id format line "%d %d %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g"
74
+ ```
75
+
76
+ For the `log.lammps` file the following LAMMPS `thermo` command should be added to the LAMMPS input file:
77
+ ```
78
+ thermo_style custom step temp pe etotal pxx pxy pxz pyy pyz pzz vol
79
+ thermo_modify format float %20.15g
80
+ thermo 100
81
+ ```
82
+
83
+ ## Usage
84
+ Currently, the `lammpsparser` parser is primarily used in the [pyiron_atomistics](https://github.com/pyiron/pyiron_atomistics)
85
+ package and its successor the [atomistics](https://github.com/pyiron/atomistics) package to provide a simple LAMMPS
86
+ parser. It only depends on `ase`, `numpy`, `pandas` and `scipy` and has an optional dependency on `h5py` to parse the
87
+ LAMMPS [h5md](https://docs.lammps.org/dump_h5md.html) format.
@@ -0,0 +1,76 @@
1
+ [build-system]
2
+ requires = [
3
+ "ase",
4
+ "numpy",
5
+ "h5py",
6
+ "pandas",
7
+ "scipy",
8
+ "hatchling==1.28.0",
9
+ "hatch-vcs==0.5.0",
10
+ ]
11
+ build-backend = "hatchling.build"
12
+
13
+ [project]
14
+ name = "lammpsparser"
15
+ description = "Vector-oriented LAMMPS interface to rapidly iterate over series of atomistic structures or interatomic potentials."
16
+ authors = [
17
+ { name = "Jan Janssen", email = "janssen@mpie.de" },
18
+ ]
19
+ readme = "README.md"
20
+ license = { file = "LICENSE" }
21
+ keywords = ["pyiron"]
22
+ requires-python = ">=3.9, <3.15"
23
+ classifiers = [
24
+ "Development Status :: 5 - Production/Stable",
25
+ "Topic :: Scientific/Engineering :: Physics",
26
+ "License :: OSI Approved :: BSD License",
27
+ "Intended Audience :: Science/Research",
28
+ "Operating System :: OS Independent",
29
+ "Programming Language :: Python :: 3.9",
30
+ "Programming Language :: Python :: 3.10",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Programming Language :: Python :: 3.14",
35
+ ]
36
+ dependencies = [
37
+ "ase>=3.22.1,<=3.27.0",
38
+ "numpy>=1.26.0,<=2.4.2",
39
+ "pandas>=2.0.3,<=3.0.0",
40
+ "scipy>=1.11.1,<=1.17.0",
41
+ ]
42
+ dynamic = ["version"]
43
+
44
+ [project.urls]
45
+ Homepage = "https://github.com/pyiron/lammpsparser"
46
+ Documentation = "https://github.com/pyiron/lammpsparser"
47
+ Repository = "https://github.com/pyiron/lammpsparser"
48
+
49
+ [project.optional-dependencies]
50
+ h5md = ["h5py>=3.9.0,<=3.15.1"]
51
+
52
+ [tool.hatch.build]
53
+ include = [
54
+ "src/lammpsparser"
55
+ ]
56
+
57
+ [tool.hatch.build.hooks.vcs]
58
+ version-file = "src/lammpsparser/_version.py"
59
+
60
+ [tool.hatch.build.targets.sdist]
61
+ include = [
62
+ "src/lammpsparser"
63
+ ]
64
+
65
+ [tool.hatch.build.targets.wheel]
66
+ packages = [
67
+ "src/lammpsparser"
68
+ ]
69
+
70
+ [tool.hatch.version]
71
+ source = "vcs"
72
+ path = "src/lammpsparser/_version.py"
73
+
74
+ [tool.coverage.run]
75
+ source = ["lammpsparser"]
76
+ command_line = "-m unittest discover tests"
@@ -0,0 +1,38 @@
1
+ import lammpsparser._version
2
+ from lammpsparser.compatibility.calculate import calc_md, calc_minimize, calc_static
3
+ from lammpsparser.compatibility.file import (
4
+ lammps_file_initialization,
5
+ lammps_file_interface_function,
6
+ )
7
+ from lammpsparser.output import parse_lammps_output as parse_lammps_output_files
8
+ from lammpsparser.potential import (
9
+ get_potential_by_name,
10
+ get_potential_dataframe,
11
+ validate_potential_dataframe,
12
+ )
13
+ from lammpsparser.structure import write_lammps_datafile as write_lammps_structure
14
+
15
+ DUMP_COMMANDS = [
16
+ "dump 1 all custom 100 dump.out id type xsu ysu zsu fx fy fz vx vy vz\n",
17
+ 'dump_modify 1 sort id format line "%d %d %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g"\n',
18
+ ]
19
+
20
+ THERMO_COMMANDS = [
21
+ "thermo_style custom step temp pe etotal pxx pxy pxz pyy pyz pzz vol\n",
22
+ "thermo_modify format float %20.15g\n",
23
+ "thermo 100\n",
24
+ ]
25
+
26
+ __version__ = lammpsparser._version.__version__
27
+ __all__ = [
28
+ "calc_md",
29
+ "calc_minimize",
30
+ "calc_static",
31
+ "get_potential_by_name",
32
+ "get_potential_dataframe",
33
+ "lammps_file_initialization",
34
+ "lammps_file_interface_function",
35
+ "parse_lammps_output_files",
36
+ "validate_potential_dataframe",
37
+ "write_lammps_structure",
38
+ ]
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '0.0.1'
32
+ __version_tuple__ = version_tuple = (0, 0, 1)
33
+
34
+ __commit_id__ = commit_id = None