lammpsparser 0.0.6__tar.gz → 0.0.7__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.6 → lammpsparser-0.0.7}/PKG-INFO +1 -1
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/_version.py +2 -2
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/compatibility/file.py +25 -2
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/compatibility/structure.py +29 -13
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/.gitignore +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/LICENSE +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/README.md +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/pyproject.toml +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/__init__.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/compatibility/__init__.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/compatibility/calculate.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/compatibility/constraints.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/compatibility/data.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/compatibility/output.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/output.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/output_raw.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/potential.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/structure.py +0 -0
- {lammpsparser-0.0.6 → lammpsparser-0.0.7}/src/lammpsparser/units.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lammpsparser
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
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
|
|
@@ -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.7'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 0, 7)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -33,6 +33,7 @@ def lammps_file_interface_function(
|
|
|
33
33
|
write_restart_file: bool = False,
|
|
34
34
|
read_restart_file: bool = False,
|
|
35
35
|
restart_file: str = "restart.out",
|
|
36
|
+
dump_final_structure: bool = False,
|
|
36
37
|
):
|
|
37
38
|
"""
|
|
38
39
|
A single function to execute a LAMMPS calculation based on the LAMMPS job implemented in pyiron
|
|
@@ -85,6 +86,8 @@ def lammps_file_interface_function(
|
|
|
85
86
|
write_restart_file (bool): enable writing the LAMMPS restart file
|
|
86
87
|
read_restart_file (bool): enable loading the LAMMPS restart file
|
|
87
88
|
restart_file (str): file name of the LAMMPS restart file to copy
|
|
89
|
+
dump_final_structure (bool): in "md" mode, append a ``write_dump`` command after the ``run`` command to capture
|
|
90
|
+
the final structure in ``dump.out`` if last step is not a regular dump step. Disabled by default.
|
|
88
91
|
executable_version (str): LAMMPS version to for the execution
|
|
89
92
|
executable_path (str): path to the LAMMPS executable
|
|
90
93
|
input_control_file (str|list|dict): Option to modify the LAMMPS input file directly
|
|
@@ -141,14 +144,21 @@ def lammps_file_interface_function(
|
|
|
141
144
|
else:
|
|
142
145
|
lmp_str_lst.append(line)
|
|
143
146
|
|
|
147
|
+
dump_fields = "id type xsu ysu zsu fx fy fz vx vy vz"
|
|
148
|
+
dump_format = '"%d %d %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g"'
|
|
149
|
+
|
|
144
150
|
lmp_str_lst += potential_lst
|
|
145
151
|
lmp_str_lst += ["variable dumptime equal {} ".format(calc_kwargs.get("n_print", 1))]
|
|
146
152
|
lmp_str_lst += [
|
|
147
|
-
"dump 1 all custom ${dumptime} dump.out
|
|
148
|
-
|
|
153
|
+
"dump 1 all custom ${dumptime} dump.out " + dump_fields,
|
|
154
|
+
"dump_modify 1 sort id format line " + dump_format,
|
|
149
155
|
]
|
|
150
156
|
|
|
151
157
|
if calc_mode == "static":
|
|
158
|
+
if dump_final_structure:
|
|
159
|
+
raise ValueError(
|
|
160
|
+
"dump_final_structure is only applicable for molecular dynamics (md) calculations."
|
|
161
|
+
)
|
|
152
162
|
lmp_str_constraint_lst = [
|
|
153
163
|
k + " " + v
|
|
154
164
|
for k, v in set_selective_dynamics(
|
|
@@ -183,7 +193,20 @@ def lammps_file_interface_function(
|
|
|
183
193
|
if read_restart_file:
|
|
184
194
|
lmp_str_lst += ["reset_timestep 0"]
|
|
185
195
|
lmp_str_lst += ["run {} ".format(n_ionic_steps)]
|
|
196
|
+
last_step_is_regular_dump = n_ionic_steps % calc_kwargs.get("n_print", 1) == 0
|
|
197
|
+
if dump_final_structure and not last_step_is_regular_dump:
|
|
198
|
+
lmp_str_lst += [
|
|
199
|
+
"write_dump all custom dump.out "
|
|
200
|
+
+ dump_fields
|
|
201
|
+
+ " modify sort id format line "
|
|
202
|
+
+ dump_format
|
|
203
|
+
+ " append yes"
|
|
204
|
+
]
|
|
186
205
|
elif calc_mode == "minimize":
|
|
206
|
+
if dump_final_structure:
|
|
207
|
+
raise ValueError(
|
|
208
|
+
"dump_final_structure is only applicable for molecular dynamics (md) calculations."
|
|
209
|
+
)
|
|
187
210
|
calc_kwargs["units"] = units
|
|
188
211
|
lmp_str_constraint_lst = [
|
|
189
212
|
k + " " + v
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from collections import OrderedDict
|
|
2
|
-
from typing import Dict, Optional
|
|
2
|
+
from typing import Dict, List, Optional, Union, cast
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
from ase.atoms import Atoms
|
|
@@ -17,7 +17,7 @@ class LammpsStructureCompatibility(LammpsStructure):
|
|
|
17
17
|
atom_type: str = "atomic",
|
|
18
18
|
):
|
|
19
19
|
super().__init__(bond_dict=bond_dict, units=units, atom_type=atom_type)
|
|
20
|
-
self._molecule_ids:
|
|
20
|
+
self._molecule_ids: Optional[List[int]] = []
|
|
21
21
|
|
|
22
22
|
@property
|
|
23
23
|
def structure(self) -> Optional[Atoms]:
|
|
@@ -37,17 +37,28 @@ class LammpsStructureCompatibility(LammpsStructure):
|
|
|
37
37
|
structure (ase.atoms.Atoms): The structure to serialise.
|
|
38
38
|
"""
|
|
39
39
|
self._structure = structure
|
|
40
|
-
if self.
|
|
40
|
+
if self._atom_type == "full":
|
|
41
41
|
input_str = self.structure_full()
|
|
42
|
-
elif self.
|
|
42
|
+
elif self._atom_type == "bond":
|
|
43
43
|
input_str = self.structure_bond()
|
|
44
|
-
elif self.
|
|
44
|
+
elif self._atom_type == "charge":
|
|
45
45
|
input_str = self.structure_charge()
|
|
46
|
-
else: # self.
|
|
46
|
+
else: # self._atom_type == 'atomic'
|
|
47
47
|
input_str = self.structure_atomic()
|
|
48
48
|
|
|
49
49
|
self._string_input = input_str + self._get_velocities_input_string()
|
|
50
50
|
|
|
51
|
+
@property
|
|
52
|
+
def molecule_ids(self) -> Union[List[int], np.ndarray]:
|
|
53
|
+
"""Per-atom molecule IDs; defaults to all atoms in a single molecule."""
|
|
54
|
+
if self._molecule_ids is None or len(self._molecule_ids) == 0:
|
|
55
|
+
return np.ones(len(cast(Atoms, self._structure)), dtype=int)
|
|
56
|
+
return self._molecule_ids
|
|
57
|
+
|
|
58
|
+
@molecule_ids.setter
|
|
59
|
+
def molecule_ids(self, molecule_ids: Optional[List[int]]):
|
|
60
|
+
self._molecule_ids = molecule_ids
|
|
61
|
+
|
|
51
62
|
def structure_bond(self):
|
|
52
63
|
"""
|
|
53
64
|
Serialise the structure for LAMMPS ``atom_style bond``.
|
|
@@ -120,7 +131,7 @@ class LammpsStructureCompatibility(LammpsStructure):
|
|
|
120
131
|
bond_type[i, j] = count
|
|
121
132
|
bond_type[j, i] = count
|
|
122
133
|
|
|
123
|
-
if self.structure
|
|
134
|
+
if getattr(self.structure, "bonds", None) is None:
|
|
124
135
|
if self.cutoff_radius is None:
|
|
125
136
|
bonds_lst = get_bonds(structure=self.structure, max_shells=1)
|
|
126
137
|
else:
|
|
@@ -182,16 +193,22 @@ class LammpsStructureCompatibility(LammpsStructure):
|
|
|
182
193
|
coords = self.rotate_positions(self._structure)
|
|
183
194
|
|
|
184
195
|
# extract electric charges from potential file
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
196
|
+
if self.potential is not None:
|
|
197
|
+
q_dict = {
|
|
198
|
+
species_name: self.potential.get_charge(species_name)
|
|
199
|
+
for species_name in set(self.structure.get_chemical_symbols())
|
|
200
|
+
}
|
|
201
|
+
else:
|
|
202
|
+
q_dict = {
|
|
203
|
+
species_name: 0.0
|
|
204
|
+
for species_name in set(self.structure.get_chemical_symbols())
|
|
205
|
+
}
|
|
189
206
|
|
|
190
207
|
bonds_lst, angles_lst = [], []
|
|
191
208
|
bond_type_lst, angle_type_lst = [], []
|
|
192
209
|
# Using a cutoff distance to draw the bonds instead of the number of neighbors
|
|
193
210
|
# Only if any bonds are defined
|
|
194
|
-
if len(self._bond_dict.keys()) > 0:
|
|
211
|
+
if self._bond_dict is not None and len(self._bond_dict.keys()) > 0:
|
|
195
212
|
cutoff_list = list()
|
|
196
213
|
for val in self._bond_dict.values():
|
|
197
214
|
cutoff_list.append(np.max(val["cutoff_list"]))
|
|
@@ -350,7 +367,6 @@ def get_bonds(
|
|
|
350
367
|
tolerance=2,
|
|
351
368
|
id_list=None,
|
|
352
369
|
width_buffer=1.2,
|
|
353
|
-
allow_ragged=None,
|
|
354
370
|
mode="ragged",
|
|
355
371
|
norm_order=2,
|
|
356
372
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|