ipyvasp 1.1.3__tar.gz → 1.1.4__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 (30) hide show
  1. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/PKG-INFO +1 -1
  2. ipyvasp-1.1.4/ipyvasp/_version.py +1 -0
  3. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/core/serializer.py +55 -13
  4. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp.egg-info/PKG-INFO +1 -1
  5. ipyvasp-1.1.3/ipyvasp/_version.py +0 -1
  6. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/LICENSE +0 -0
  7. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/README.md +0 -0
  8. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/__init__.py +0 -0
  9. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/__main__.py +0 -0
  10. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/_enplots.py +0 -0
  11. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/_lattice.py +0 -0
  12. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/bsdos.py +0 -0
  13. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/cli.py +0 -0
  14. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/core/__init__.py +0 -0
  15. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/core/parser.py +0 -0
  16. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/core/plot_toolkit.py +0 -0
  17. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/core/spatial_toolkit.py +0 -0
  18. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/evals_dataframe.py +0 -0
  19. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/lattice.py +0 -0
  20. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/misc.py +0 -0
  21. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/potential.py +0 -0
  22. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/utils.py +0 -0
  23. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp/widgets.py +0 -0
  24. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp.egg-info/SOURCES.txt +0 -0
  25. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp.egg-info/dependency_links.txt +0 -0
  26. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp.egg-info/entry_points.txt +0 -0
  27. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp.egg-info/requires.txt +0 -0
  28. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/ipyvasp.egg-info/top_level.txt +0 -0
  29. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/setup.cfg +0 -0
  30. {ipyvasp-1.1.3 → ipyvasp-1.1.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipyvasp
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: A processing tool for VASP DFT input/output processing in Jupyter Notebook.
5
5
  Home-page: https://github.com/massgh/ipyvasp
6
6
  Author: Abdul Saboor
@@ -0,0 +1 @@
1
+ __version__ = "1.1.4"
@@ -766,16 +766,19 @@ class BrZoneData(Dict2Data):
766
766
  d.update({"faces": faces, "vertices": vertices, "_specials": specials})
767
767
  return self.__class__(d)
768
768
 
769
- def tile(self, nxyz, filter=None):
770
- """Create a tiled array of BZ centers for visualization.
769
+ def tile(self, nxyz, filter=None, primitive=False):
770
+ """Create a tiled rectangular array of BZ centers for visualization. Use in `center` parameter for BZ plotting.
771
771
 
772
772
  Parameters
773
773
  ----------
774
774
  nxyz : list or tuple of 3 ints
775
775
  Number of tiles along each cartesian direction [nx, ny, nz].
776
776
  Must be 3 positive integers.
777
+ If primitive = False, result is not guaranteed to be same size as ``nx * ny * nz`` due to shape distortion.
777
778
  filter : callable, optional
778
- Function filter(x,y,z) that takes cartesian coordinates and returns bool.
779
+ Function filter(x,y,z) that takes normalized (to 1) cartesian coordinates and returns bool.
780
+ primitive : bool
781
+ If True, tile points in basis rather than orthogonal geometry. Default is False.
779
782
 
780
783
  Returns
781
784
  -------
@@ -794,17 +797,56 @@ class BrZoneData(Dict2Data):
794
797
  if not isinstance(n, int) or n < 1:
795
798
  raise ValueError(f"nxyz[{i}] must be a positive integer")
796
799
 
797
- xyz = self.to_cartesian(np.indices(np.ceil(nxyz).astype(int)).reshape((3,-1)).T)
798
- # Apply filter if provided
799
- if filter is not None:
800
- if not callable(filter):
801
- raise TypeError("filter must be callable")
802
-
803
- mask = np.array([filter(x, y, z) for x, y, z in xyz])
804
- xyz = xyz[mask]
800
+ if filter is not None and not callable(filter):
801
+ raise ValueError("filter must be callable")
802
+
803
+ # Tile in shape of cell if primitive
804
+ if primitive:
805
+ pts = np.indices(nxyz).reshape((3,-1)).T
806
+ if filter and len(pts) > 0:
807
+ # Per-dimension normalization for primitive
808
+ norms = np.array([max(1, n - 1) for n in nxyz])
809
+ mask = np.array([filter(*(p/norms)) for p in pts])
810
+ pts = pts[mask]
811
+ return pts
812
+
813
+ # Orthogonal/Cartesian-aligned case
814
+ target_span = np.linalg.norm(self.basis.sum(axis=0)) * (np.array(nxyz) - 1)
815
+
816
+ # 2. Map Cartesian box corners to Lattice Space
817
+ corners_cart = np.array([[i, j, k] for i in [0, 1] for j in [0, 1] for k in [0, 1]]) * target_span
818
+ corners_frac = self.to_fractional(corners_cart)
819
+
820
+ # 3. Find integer bounds (Must use +1 for inclusive arange)
821
+ n_min = np.floor(corners_frac.min(axis=0)).astype(int)
822
+ n_max = np.ceil(corners_frac.max(axis=0)).astype(int)
805
823
 
806
- # Convert to fractional coordinates and return
807
- return self.to_fractional(xyz)
824
+ ranges = [np.arange(n_min[i], n_max[i] + 1) for i in range(3)]
825
+ grid_n = np.array(np.meshgrid(*ranges, indexing='ij')).T.reshape(-1, 3)
826
+
827
+ all_pts = self.to_cartesian(grid_n)
828
+
829
+ # 4. Clipping with a slightly more generous epsilon to prevent missing bridge points
830
+ eps = 1e-9
831
+ mask = (all_pts >= -eps).all(axis=1) & (all_pts <= target_span + eps).all(axis=1)
832
+ pts = all_pts[mask]
833
+
834
+ N = np.cumprod(nxyz)[-1]
835
+ if len(pts) > N: # box becomes too much inclusive at larger points, restrict that
836
+ dist = np.linalg.norm(pts - pts.mean(axis=0), axis=1)
837
+ pts = pts[np.argsort(dist)[:N]]
838
+
839
+ # 5. Apply Global Normalized filter (preserves geometry)
840
+ if filter and len(pts) > 0:
841
+ p_min, p_max = pts.min(axis=0), pts.max(axis=0)
842
+ global_range = np.max(p_max - p_min) or 1.0
843
+ norm_pts = (pts - p_min) / global_range
844
+
845
+ f_mask = np.array([filter(*p) for p in norm_pts])
846
+ pts = pts[f_mask]
847
+
848
+ pts = pts[np.lexsort((pts[:, 0], pts[:, 1], pts[:, 2]))] # reorder for easy reading of points
849
+ return self.to_fractional(pts).round(12) # no need to ceil or int here, that makes empty areas, just remove values like E-17
808
850
 
809
851
 
810
852
  class CellData(Dict2Data):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipyvasp
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: A processing tool for VASP DFT input/output processing in Jupyter Notebook.
5
5
  Home-page: https://github.com/massgh/ipyvasp
6
6
  Author: Abdul Saboor
@@ -1 +0,0 @@
1
- __version__ = "1.1.3"
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
File without changes