@@ -139,16 +139,14 @@ def get(self, struct: PeriodicStructure, site_class: str = None) -> Neighborhood
139139 else :
140140 sites_to_process = struct .sites (site_class = site_class )
141141
142- n_sites = len (all_sites )
143-
144142 # Extract locations and IDs as arrays for vectorized operations
145143 locations = np .array ([s [LOCATION ] for s in all_sites ])
146144 site_ids = np .array ([s [SITE_ID ] for s in all_sites ])
147145
148146 # Convert to fractional coordinates for periodic KD-tree
149- frac_coords = np .array ([
150- struct .lattice .get_fractional_coords (loc ) for loc in locations
151- ] )
147+ frac_coords = np .array (
148+ [ struct .lattice .get_fractional_coords (loc ) for loc in locations ]
149+ )
152150
153151 # Compute the maximum fractional radius that could correspond to
154152 # the Cartesian cutoff. For non-orthogonal lattices, we need to use
@@ -163,9 +161,7 @@ def get(self, struct: PeriodicStructure, site_class: str = None) -> Neighborhood
163161 dim = struct .lattice .dim
164162
165163 # Build boxsize array: 1.0 for periodic dimensions, large value for non-periodic
166- boxsize = np .array ([
167- 1.0 if periodic [i ] else 1e10 for i in range (dim )
168- ])
164+ boxsize = np .array ([1.0 if periodic [i ] else 1e10 for i in range (dim )])
169165
170166 # Wrap fractional coordinates to [0, 1) for periodic dimensions
171167 frac_coords_wrapped = frac_coords .copy ()
@@ -176,9 +172,6 @@ def get(self, struct: PeriodicStructure, site_class: str = None) -> Neighborhood
176172 # Build KD-tree with periodic boundary conditions
177173 tree = cKDTree (frac_coords_wrapped , boxsize = boxsize )
178174
179- # Create index mapping from site_id to array index
180- id_to_idx = {sid : idx for idx , sid in enumerate (site_ids )}
181-
182175 # Process each site
183176 sites_to_process_ids = set (s [SITE_ID ] for s in sites_to_process )
184177
@@ -296,9 +289,9 @@ def get(self, struct: PeriodicStructure, site_class: str = None) -> Neighborhood
296289 site_ids = np .array ([s [SITE_ID ] for s in all_sites ])
297290
298291 # Convert to fractional coordinates for periodic KD-tree
299- frac_coords = np .array ([
300- struct .lattice .get_fractional_coords (loc ) for loc in locations
301- ] )
292+ frac_coords = np .array (
293+ [ struct .lattice .get_fractional_coords (loc ) for loc in locations ]
294+ )
302295
303296 # Compute the maximum fractional radius for the outer cutoff.
304297 # Use the maximum stretch factor of the inverse matrix for non-orthogonal lattices.
@@ -311,9 +304,7 @@ def get(self, struct: PeriodicStructure, site_class: str = None) -> Neighborhood
311304 dim = struct .lattice .dim
312305
313306 # Build boxsize array
314- boxsize = np .array ([
315- 1.0 if periodic [i ] else 1e10 for i in range (dim )
316- ])
307+ boxsize = np .array ([1.0 if periodic [i ] else 1e10 for i in range (dim )])
317308
318309 # Wrap fractional coordinates to [0, 1) for periodic dimensions
319310 frac_coords_wrapped = frac_coords .copy ()
0 commit comments