@@ -61,6 +61,7 @@ def __init__(
6161 tm = None ,
6262 use_hall = False ,
6363 random_state : int | None | Generator = None ,
64+ use_asu : bool = False ,
6465 ):
6566 # Initialize
6667 self .rng = np .random .default_rng (random_state )
@@ -71,6 +72,7 @@ def __init__(
7172 self .valid = False
7273 self .factor = factor
7374 self .min_density = 0.75
75+ self .use_asu = use_asu
7476
7577 # Dimesion
7678 self .dim = dim
@@ -377,7 +379,13 @@ def _set_ion_wyckoffs(self, numIon, specie, cell, wyks):
377379 else :
378380 if site is not None :
379381 wp = self .group [site ]
380- pt = self .lattice .generate_point ()
382+ if self .use_asu :
383+ xmin , xmax , ymin , ymax , zmin , zmax = self .group .get_ASU ()
384+ # Generate a random point based on (min, max) ranges
385+ pt = self .rng .uniform ([xmin , ymin , zmin ], [xmax , ymax , zmax ])
386+ else :
387+ pt = self .lattice .generate_point ()
388+
381389 # avoid using the merge function
382390 if len (wp .short_distances (pt , cell , tol )) > 0 :
383391 # print('bad pt', pt, wp.short_distances(pt, cell, tol))
@@ -392,7 +400,12 @@ def _set_ion_wyckoffs(self, numIon, specie, cell, wyks):
392400 if wp is not False :
393401 # print(wp.letter)
394402 # Generate a list of coords from ops
395- pt = self .lattice .generate_point ()
403+ if self .use_asu :
404+ xmin , xmax , ymin , ymax , zmin , zmax = self .group .get_ASU ()
405+ # Generate a random point based on (min, max) ranges
406+ pt = self .rng .uniform ([xmin , ymin , zmin ], [xmax , ymax , zmax ])
407+ else :
408+ pt = self .lattice .generate_point ()
396409 pt , wp , _ = wp .merge (pt , cell , tol , group = self .group )
397410 # print('good pt', pt)
398411 if wp is not False :
0 commit comments