gridmlip 0.2.6__tar.gz → 0.2.6.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.
Files changed (35) hide show
  1. {gridmlip-0.2.6/gridmlip.egg-info → gridmlip-0.2.6.2}/PKG-INFO +1 -1
  2. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/_distortion.py +29 -6
  3. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/_generate.py +1 -14
  4. gridmlip-0.2.6.2/gridmlip/_version.py +1 -0
  5. {gridmlip-0.2.6 → gridmlip-0.2.6.2/gridmlip.egg-info}/PKG-INFO +1 -1
  6. gridmlip-0.2.6/gridmlip/_version.py +0 -1
  7. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/LICENSE +0 -0
  8. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/MANIFEST.in +0 -0
  9. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/README.md +0 -0
  10. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/__init__.py +0 -0
  11. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/_mesh.py +0 -0
  12. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/_neighborhood.py +0 -0
  13. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/_percolation_analysis.py +0 -0
  14. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/_void_search.py +0 -0
  15. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/cli.py +0 -0
  16. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/core.py +0 -0
  17. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/integrations/__init__.py +0 -0
  18. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/integrations/bvse.py +0 -0
  19. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/integrations/gnn_lib.py +0 -0
  20. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/integrations/mace.py +0 -0
  21. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/integrations/sevennet.py +0 -0
  22. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/select.py +0 -0
  23. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip/utils.py +0 -0
  24. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip.egg-info/SOURCES.txt +0 -0
  25. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip.egg-info/dependency_links.txt +0 -0
  26. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip.egg-info/requires.txt +0 -0
  27. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip.egg-info/top_level.txt +0 -0
  28. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/gridmlip.egg-info/zip-safe +0 -0
  29. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/pyproject.toml +0 -0
  30. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/scripts/__init__.py +0 -0
  31. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/scripts/_nebtools.py +0 -0
  32. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/scripts/_void_search.py +0 -0
  33. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/scripts/estimate_bvel13k_dataset_size.py +0 -0
  34. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/setup.cfg +0 -0
  35. {gridmlip-0.2.6 → gridmlip-0.2.6.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gridmlip
3
- Version: 0.2.6
3
+ Version: 0.2.6.2
4
4
  Summary: gridmlip
5
5
  Home-page: https://github.com/dembart/gridmlip
6
6
  Author: Artem Dembitskiy
@@ -1,6 +1,7 @@
1
1
  import warnings
2
2
  import numpy as np
3
3
  from ase import Atoms
4
+ from vesin import ase_neighbor_list
4
5
 
5
6
 
6
7
  def _get_rng(rng=None):
@@ -78,6 +79,7 @@ def rattle_positions(atoms, std=0.05, rng=None):
78
79
  return rattled
79
80
 
80
81
 
82
+
81
83
  def rattle_atoms(
82
84
  atoms: Atoms,
83
85
  pos_std: float = 0.05,
@@ -87,13 +89,35 @@ def rattle_atoms(
87
89
  max_abs_shear_strain: float = 0.05,
88
90
  rng: np.random.Generator | None = None,
89
91
  max_attempts: int = 100,
92
+ d_min: float = 1.4,
90
93
  ) -> Atoms:
91
94
 
92
- rattled_pos = rattle_positions(atoms, std=pos_std, rng=rng)
95
+ rattled = atoms.copy()
96
+ valid_positions_found = False
97
+
98
+ for _ in range(max_attempts):
99
+ rattled_candidate = rattle_positions(atoms, std=pos_std, rng=rng)
100
+
101
+ i, j, d = ase_neighbor_list("ijd", rattled_candidate, cutoff=d_min)
102
+
103
+ if len(d) > 0 and np.min(d) < d_min:
104
+ continue
105
+
106
+ rattled = rattled_candidate
107
+ valid_positions_found = True
108
+ break
93
109
 
110
+ if not valid_positions_found:
111
+ warnings.warn(
112
+ f"Could not satisfy minimum distance cutoff {d_min} Å within {max_attempts} attempts. "
113
+ "Proceeding to cell distortion using the un-rattled structure.",
114
+ UserWarning,
115
+ stacklevel=2
116
+ )
117
+
94
118
  try:
95
- final_structure = distort_cell_bounded(
96
- rattled_pos,
119
+ rattled = distort_cell_bounded(
120
+ rattled,
97
121
  strain_std=strain_std,
98
122
  max_volume_change=max_volume_change,
99
123
  max_principal_strain=max_principal_strain,
@@ -101,12 +125,11 @@ def rattle_atoms(
101
125
  rng=rng,
102
126
  max_attempts=max_attempts,
103
127
  )
104
- return final_structure
105
128
  except RuntimeError as e:
106
- # Catch the exception, trigger a warning, and fall back to the position-rattled structure
107
129
  warnings.warn(
108
130
  f"Cell distortion failed: {e}. Returning position-rattled structure only.",
109
131
  UserWarning,
110
132
  stacklevel=2
111
133
  )
112
- return rattled_pos
134
+
135
+ return rattled
@@ -6,7 +6,6 @@ from ions import Percolator, Edge
6
6
 
7
7
  from .core import Grid
8
8
  from ._neighborhood import nn_list
9
- from ._distortion import rattle_positions, distort_lattice
10
9
 
11
10
 
12
11
 
@@ -23,7 +22,6 @@ class DefectGenerator:
23
22
  max_sep_dist: float | str = 'auto',
24
23
  upper_bound: float = 6.0,
25
24
  verbose: bool = False,
26
- seed: int | np.random.Generator | None = None,
27
25
  ):
28
26
  if specie is None:
29
27
  raise ValueError("specie is required (atomic number of the mobile species)")
@@ -38,7 +36,6 @@ class DefectGenerator:
38
36
  self.verbose = verbose
39
37
  self.upper_bound = upper_bound
40
38
  self._specie_symbol = atoms[atoms.numbers == specie].symbols[0]
41
- self.rng = np.random.default_rng(seed)
42
39
  self._percolator = None # placeholder
43
40
  self._mincut_maxdim = None # placeholder
44
41
 
@@ -194,22 +191,16 @@ class DefectGenerator:
194
191
  return summary
195
192
 
196
193
 
197
- def _append_configurations(self, base, mesh_pos, pos_std=None, strain_std=None, verbose=False):
194
+ def _append_configurations(self, base, mesh_pos, verbose=False):
198
195
  """Construct configurations"""
199
196
  configs = []
200
197
 
201
198
  for p in tqdm(mesh_pos, desc="creating configurations", disable=not verbose):
202
199
  framework = base.copy()
203
-
204
- if pos_std is not None:
205
- framework = rattle_positions(framework, std=pos_std, rng=self.rng) # rng added
206
200
 
207
201
  framework.append(self.specie)
208
202
  framework.positions[-1] = p
209
203
 
210
- if strain_std is not None:
211
- framework = distort_lattice(framework, std=strain_std, rng=self.rng) # rng added
212
-
213
204
  configs.append(framework)
214
205
 
215
206
  return configs
@@ -218,8 +209,6 @@ class DefectGenerator:
218
209
  def generate_dataset(
219
210
  self,
220
211
  defect_type: str,
221
- pos_std: float | None = None,
222
- strain_std: float | None = None,
223
212
  verbose: bool = False,
224
213
  dry_run: bool = False,
225
214
  ):
@@ -243,8 +232,6 @@ class DefectGenerator:
243
232
  self._append_configurations(
244
233
  base,
245
234
  mesh_pos,
246
- pos_std=pos_std,
247
- strain_std=strain_std,
248
235
  verbose=verbose,
249
236
  )
250
237
  )
@@ -0,0 +1 @@
1
+ __version__ = "0.2.6.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gridmlip
3
- Version: 0.2.6
3
+ Version: 0.2.6.2
4
4
  Summary: gridmlip
5
5
  Home-page: https://github.com/dembart/gridmlip
6
6
  Author: Artem Dembitskiy
@@ -1 +0,0 @@
1
- __version__ = "0.2.6"
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