@@ -28,9 +28,9 @@ class ConfigEnumAllOccupations:
2828 """Enumerate configuration occupations"""
2929
3030 def __init__ (
31- self ,
32- prim : casmconfig .Prim ,
33- supercell_set : Optional [casmconfig .SupercellSet ] = None ,
31+ self ,
32+ prim : casmconfig .Prim ,
33+ supercell_set : Optional [casmconfig .SupercellSet ] = None ,
3434 ):
3535 """
3636 .. rubric:: Constructor
@@ -105,9 +105,9 @@ def _set_motif(self, motif: Optional[casmconfig.Configuration] = None):
105105 return motif
106106
107107 def _make_supercell_list (
108- self ,
109- background : casmconfig .Configuration ,
110- supercells : Optional [dict ] = None ,
108+ self ,
109+ background : casmconfig .Configuration ,
110+ supercells : Optional [dict ] = None ,
111111 ):
112112 """Make supercell list from `supercells` or just background supercell"""
113113 if supercells is None :
@@ -125,9 +125,9 @@ def _make_supercell_list(
125125 return supercell_list
126126
127127 def _make_super_backgrounds (
128- self ,
129- background : casmconfig .Configuration ,
130- supercells : Optional [dict ] = None ,
128+ self ,
129+ background : casmconfig .Configuration ,
130+ supercells : Optional [dict ] = None ,
131131 ):
132132 """Fill the background configuration into enumerated supercells, maintaining
133133 the orientation of the background configuration.
@@ -156,20 +156,20 @@ def _make_super_backgrounds(
156156 )
157157 super_backgrounds = []
158158 for config in super_config_enum .by_supercell (
159- motif = background ,
160- ** supercells ,
159+ motif = background ,
160+ ** supercells ,
161161 ):
162162 super_backgrounds .append (config .copy ())
163163 return super_backgrounds
164164
165165 def _by_site (
166- self ,
167- background : casmconfig .Configuration ,
168- sites : set [int ],
169- skip_non_primitive : bool ,
170- skip_equivalents : bool ,
171- use_background_invariant_group : bool ,
172- which_dofs : Optional [set [str ]] = None ,
166+ self ,
167+ background : casmconfig .Configuration ,
168+ sites : set [int ],
169+ skip_non_primitive : bool ,
170+ skip_equivalents : bool ,
171+ use_background_invariant_group : bool ,
172+ which_dofs : Optional [set [str ]] = None ,
173173 ):
174174 """Run the inner loop of enumerating occupations on sites in a background
175175
@@ -231,29 +231,29 @@ def _by_site(
231231 canonicalization_group = None
232232 while config_enum .is_valid ():
233233 if skip_non_primitive and not casmconfig .is_primitive_configuration (
234- configuration = config_enum .value ()
234+ configuration = config_enum .value ()
235235 ):
236236 config_enum .advance ()
237237 continue
238238 if skip_equivalents and not casmconfig .is_canonical_configuration (
239- configuration = config_enum .value (),
240- subgroup = canonicalization_group ,
239+ configuration = config_enum .value (),
240+ subgroup = canonicalization_group ,
241241 ):
242242 config_enum .advance ()
243243 continue
244244 yield config_enum .value ()
245245 config_enum .advance ()
246246
247247 def by_supercell (
248- self ,
249- max : int ,
250- min : int = 1 ,
251- unit_cell : Optional [np .ndarray ] = None ,
252- dirs : str = "abc" ,
253- diagonal_only : bool = False ,
254- fixed_shape : bool = False ,
255- skip_non_primitive : bool = True ,
256- skip_non_canonical : bool = True ,
248+ self ,
249+ max : int ,
250+ min : int = 1 ,
251+ unit_cell : Optional [np .ndarray ] = None ,
252+ dirs : str = "abc" ,
253+ diagonal_only : bool = False ,
254+ fixed_shape : bool = False ,
255+ skip_non_primitive : bool = True ,
256+ skip_non_canonical : bool = True ,
257257 ):
258258 """Enumerate all occupations in a series of enumerated supercells
259259
@@ -295,7 +295,6 @@ def by_supercell(
295295 A :class:`~casmconfig.Configuration`. All configurations are in the
296296 canonical supercell.
297297 """
298- import warnings
299298
300299 _supercells = dict (
301300 max = max ,
@@ -312,24 +311,24 @@ def by_supercell(
312311 supercell_set = self .supercell_set ,
313312 )
314313 for supercell in scel_enum .by_volume (
315- ** _supercells ,
314+ ** _supercells ,
316315 ):
317316 sites = set (range (supercell .n_sites ))
318317 default_config = casmconfig .Configuration (supercell )
319318 for config in self ._by_site (
320- background = default_config ,
321- sites = sites ,
322- skip_non_primitive = skip_non_primitive ,
323- skip_equivalents = skip_non_canonical ,
324- use_background_invariant_group = False ,
319+ background = default_config ,
320+ sites = sites ,
321+ skip_non_primitive = skip_non_primitive ,
322+ skip_equivalents = skip_non_canonical ,
323+ use_background_invariant_group = False ,
325324 ):
326325 yield config
327326
328327 def by_supercell_list (
329- self ,
330- supercells : list [casmconfig .Supercell ],
331- skip_non_primitive : bool = True ,
332- skip_non_canonical : bool = True ,
328+ self ,
329+ supercells : list [casmconfig .Supercell ],
330+ skip_non_primitive : bool = True ,
331+ skip_non_canonical : bool = True ,
333332 ):
334333 """Enumerate all occupations in a list of supercells explicitly provided
335334
@@ -357,25 +356,25 @@ def by_supercell_list(
357356 sites = set (range (supercell .n_sites ))
358357 default_config = casmconfig .Configuration (supercell )
359358 for config in self ._by_site (
360- background = default_config ,
361- sites = sites ,
362- skip_non_primitive = skip_non_primitive ,
363- skip_equivalents = skip_non_canonical ,
364- use_background_invariant_group = False ,
359+ background = default_config ,
360+ sites = sites ,
361+ skip_non_primitive = skip_non_primitive ,
362+ skip_equivalents = skip_non_canonical ,
363+ use_background_invariant_group = False ,
365364 ):
366365 yield config
367366
368367 def by_supercell_with_continuous_dof (
369- self ,
370- source : casmconfig .Configuration ,
371- max : int ,
372- min : int = 1 ,
373- unit_cell : Optional [np .ndarray ] = None ,
374- dirs : str = "abc" ,
375- diagonal_only : bool = False ,
376- fixed_shape : bool = False ,
377- skip_non_primitive : bool = True ,
378- skip_equivalents : bool = True ,
368+ self ,
369+ source : casmconfig .Configuration ,
370+ max : int ,
371+ min : int = 1 ,
372+ unit_cell : Optional [np .ndarray ] = None ,
373+ dirs : str = "abc" ,
374+ diagonal_only : bool = False ,
375+ fixed_shape : bool = False ,
376+ skip_non_primitive : bool = True ,
377+ skip_equivalents : bool = True ,
379378 ):
380379 """Enumerate all occupations in a series of enumerated supercells, with
381380 non-default continuous DoF
@@ -449,21 +448,21 @@ def by_supercell_with_continuous_dof(
449448 for super_background in super_backgrounds :
450449 sites = set (range (super_background .supercell .n_sites ))
451450 for config in self ._by_site (
452- background = super_background ,
453- sites = sites ,
454- skip_non_primitive = skip_non_primitive ,
455- skip_equivalents = skip_equivalents ,
456- use_background_invariant_group = True ,
457- which_dofs = which_dofs ,
451+ background = super_background ,
452+ sites = sites ,
453+ skip_non_primitive = skip_non_primitive ,
454+ skip_equivalents = skip_equivalents ,
455+ use_background_invariant_group = True ,
456+ which_dofs = which_dofs ,
458457 ):
459458 yield config
460459
461460 def by_linear_site_indices (
462- self ,
463- background : casmconfig .Configuration ,
464- sites : set [int ],
465- skip_non_primitive : bool = False ,
466- skip_equivalents : bool = True ,
461+ self ,
462+ background : casmconfig .Configuration ,
463+ sites : set [int ],
464+ skip_non_primitive : bool = False ,
465+ skip_equivalents : bool = True ,
467466 ):
468467 """Enumerate occupation perturbations of a background configuration on
469468 specified sites
@@ -490,20 +489,20 @@ def by_linear_site_indices(
490489 """
491490 self ._begin ()
492491 for config in self ._by_site (
493- background = background ,
494- sites = sites ,
495- skip_non_primitive = skip_non_primitive ,
496- skip_equivalents = skip_equivalents ,
497- use_background_invariant_group = True ,
492+ background = background ,
493+ sites = sites ,
494+ skip_non_primitive = skip_non_primitive ,
495+ skip_equivalents = skip_equivalents ,
496+ use_background_invariant_group = True ,
498497 ):
499498 yield config
500499
501500 def by_integral_site_coordinates (
502- self ,
503- background : casmconfig .Configuration ,
504- sites : list [xtal .IntegralSiteCoordinate ],
505- skip_non_primitive : bool = False ,
506- skip_equivalents : bool = True ,
501+ self ,
502+ background : casmconfig .Configuration ,
503+ sites : list [xtal .IntegralSiteCoordinate ],
504+ skip_non_primitive : bool = False ,
505+ skip_equivalents : bool = True ,
507506 ):
508507 """Enumerate occupation perturbations of a background configuration on
509508 specified sites
@@ -532,21 +531,21 @@ def by_integral_site_coordinates(
532531 converter = background .supercell .site_index_converter
533532 site_indices = set ([converter .linear_site_index (site ) for site in sites ])
534533 for config in self ._by_site (
535- background = background ,
536- sites = site_indices ,
537- skip_non_primitive = skip_non_primitive ,
538- skip_equivalents = skip_equivalents ,
539- use_background_invariant_group = True ,
534+ background = background ,
535+ sites = site_indices ,
536+ skip_non_primitive = skip_non_primitive ,
537+ skip_equivalents = skip_equivalents ,
538+ use_background_invariant_group = True ,
540539 ):
541540 yield config
542541
543542 def by_sublattice (
544- self ,
545- background : casmconfig .Configuration ,
546- sublats : set [int ],
547- supercells : Optional [dict ] = None ,
548- skip_non_primitive : bool = True ,
549- skip_equivalents : bool = True ,
543+ self ,
544+ background : casmconfig .Configuration ,
545+ sublats : set [int ],
546+ supercells : Optional [dict ] = None ,
547+ skip_non_primitive : bool = True ,
548+ skip_equivalents : bool = True ,
550549 ):
551550 """Enumerate occupation perturbations of a background configuration on
552551 specified sublattices
@@ -587,21 +586,21 @@ def by_sublattice(
587586 for super_background in super_backgrounds :
588587 sublat_sites = _make_sublat_sites (super_background .supercell , sublats )
589588 for config in self ._by_site (
590- background = super_background ,
591- sites = sublat_sites ,
592- skip_non_primitive = skip_non_primitive ,
593- skip_equivalents = skip_equivalents ,
594- use_background_invariant_group = True ,
589+ background = super_background ,
590+ sites = sublat_sites ,
591+ skip_non_primitive = skip_non_primitive ,
592+ skip_equivalents = skip_equivalents ,
593+ use_background_invariant_group = True ,
595594 ):
596595 yield config
597596
598597 def by_cluster (
599- self ,
600- background : casmconfig .Configuration ,
601- cluster_specs : dict ,
602- supercells : Optional [dict ] = None ,
603- skip_non_primitive : bool = False ,
604- skip_equivalents : bool = True ,
598+ self ,
599+ background : casmconfig .Configuration ,
600+ cluster_specs : dict ,
601+ supercells : Optional [dict ] = None ,
602+ skip_non_primitive : bool = False ,
603+ skip_equivalents : bool = True ,
605604 ):
606605 """Enumerate occupation perturbations of a background configuration on
607606 specified clusters
@@ -659,21 +658,21 @@ def by_cluster(
659658 )
660659 for cluster_sites in distinct_cluster_sites :
661660 for config in self ._by_site (
662- background = super_background ,
663- sites = cluster_sites ,
664- skip_non_primitive = skip_non_primitive ,
665- skip_equivalents = skip_equivalents ,
666- use_background_invariant_group = True ,
661+ background = super_background ,
662+ sites = cluster_sites ,
663+ skip_non_primitive = skip_non_primitive ,
664+ skip_equivalents = skip_equivalents ,
665+ use_background_invariant_group = True ,
667666 ):
668667 yield config
669668
670669 def by_cluster_list (
671- self ,
672- background : casmconfig .Configuration ,
673- clusters : list [casmclust .Cluster ],
674- supercells : Optional [dict ] = None ,
675- skip_non_primitive : bool = False ,
676- skip_equivalents : bool = True ,
670+ self ,
671+ background : casmconfig .Configuration ,
672+ clusters : list [casmclust .Cluster ],
673+ supercells : Optional [dict ] = None ,
674+ skip_non_primitive : bool = False ,
675+ skip_equivalents : bool = True ,
677676 ):
678677 """Enumerate occupation perturbations of a background configuration on
679678 an explicitly provided list of clusters
@@ -731,10 +730,10 @@ def by_cluster_list(
731730 )
732731 for cluster_sites in distinct_cluster_sites :
733732 for config in self ._by_site (
734- background = super_background ,
735- sites = cluster_sites ,
736- skip_non_primitive = skip_non_primitive ,
737- skip_equivalents = skip_equivalents ,
738- use_background_invariant_group = True ,
733+ background = super_background ,
734+ sites = cluster_sites ,
735+ skip_non_primitive = skip_non_primitive ,
736+ skip_equivalents = skip_equivalents ,
737+ use_background_invariant_group = True ,
739738 ):
740739 yield config
0 commit comments