@@ -56,9 +56,9 @@ class Spin:
5656 #: The :math:`\boldsymbol\sigma_z` Pauli matrix
5757 Z = np .array ([[1 , 0 ], [0 , - 1 ]], np .complex128 )
5858
59- __slots__ = (' _size' , ' _kind' , ' _dtype' )
59+ __slots__ = (" _size" , " _kind" , " _dtype" )
6060
61- def __init__ (self , kind = '' , dtype = None ):
61+ def __init__ (self , kind = "" , dtype = None ):
6262
6363 if isinstance (kind , Spin ):
6464 if dtype is None :
@@ -77,24 +77,27 @@ def __init__(self, kind='', dtype=None):
7777 if isinstance (kind , str ):
7878 kind = kind .lower ()
7979
80- kind = {' unpolarized' : Spin .UNPOLARIZED , '' : Spin .UNPOLARIZED ,
80+ kind = {" unpolarized" : Spin .UNPOLARIZED , "" : Spin .UNPOLARIZED ,
8181 Spin .UNPOLARIZED : Spin .UNPOLARIZED ,
82- ' polarized' : Spin .POLARIZED , 'p' : Spin .POLARIZED ,
83- ' pol' : Spin .POLARIZED ,
82+ " polarized" : Spin .POLARIZED , "p" : Spin .POLARIZED ,
83+ " pol" : Spin .POLARIZED ,
8484 Spin .POLARIZED : Spin .POLARIZED ,
85- 'non-colinear' : Spin .NONCOLINEAR ,
86- 'non-collinear' : Spin .NONCOLINEAR , 'nc' : Spin .NONCOLINEAR ,
85+ "noncolinear" : Spin .NONCOLINEAR ,
86+ "noncollinear" : Spin .NONCOLINEAR ,
87+ "non-colinear" : Spin .NONCOLINEAR ,
88+ "non-collinear" : Spin .NONCOLINEAR , "nc" : Spin .NONCOLINEAR ,
8789 Spin .NONCOLINEAR : Spin .NONCOLINEAR ,
88- 'spin-orbit' : Spin .SPINORBIT , 'so' : Spin .SPINORBIT ,
89- 'soc' : Spin .SPINORBIT , Spin .SPINORBIT : Spin .SPINORBIT }.get (kind )
90+ "spinorbit" : Spin .SPINORBIT ,
91+ "spin-orbit" : Spin .SPINORBIT , "so" : Spin .SPINORBIT ,
92+ "soc" : Spin .SPINORBIT , Spin .SPINORBIT : Spin .SPINORBIT }.get (kind )
9093 if kind is None :
9194 raise ValueError (f"{ self .__class__ .__name__ } initialization went wrong because of wrong "
9295 "kind specification. Could not determine the kind of spin!" )
9396
9497 # Now assert the checks
9598 self ._kind = kind
9699
97- if np .dtype (dtype ).kind == 'c' :
100+ if np .dtype (dtype ).kind == "c" :
98101 size = {self .UNPOLARIZED : 1 ,
99102 self .POLARIZED : 2 ,
100103 self .NONCOLINEAR : 4 ,
@@ -110,12 +113,12 @@ def __init__(self, kind='', dtype=None):
110113
111114 def __str__ (self ):
112115 if self .is_unpolarized :
113- return f' { self .__class__ .__name__ } {{unpolarized, kind={ self .dkind } }}'
116+ return f" { self .__class__ .__name__ } {{unpolarized, kind={ self .dkind } }}"
114117 if self .is_polarized :
115- return f' { self .__class__ .__name__ } {{polarized, kind={ self .dkind } }}'
118+ return f" { self .__class__ .__name__ } {{polarized, kind={ self .dkind } }}"
116119 if self .is_noncolinear :
117- return f' { self .__class__ .__name__ } {{non-colinear, kind={ self .dkind } }}'
118- return f' { self .__class__ .__name__ } {{spin-orbit, kind={ self .dkind } }}'
120+ return f" { self .__class__ .__name__ } {{non-colinear, kind={ self .dkind } }}"
121+ return f" { self .__class__ .__name__ } {{spin-orbit, kind={ self .dkind } }}"
119122
120123 def copy (self ):
121124 """ Create a copy of the spin-object """
@@ -214,12 +217,12 @@ def __ge__(self, other):
214217
215218 def __getstate__ (self ):
216219 return {
217- ' size' : self .size ,
218- ' kind' : self .kind ,
219- ' dtype' : self .dtype
220+ " size" : self .size ,
221+ " kind" : self .kind ,
222+ " dtype" : self .dtype
220223 }
221224
222225 def __setstate__ (self , state ):
223- self ._size = state [' size' ]
224- self ._kind = state [' kind' ]
225- self ._dtype = state [' dtype' ]
226+ self ._size = state [" size" ]
227+ self ._kind = state [" kind" ]
228+ self ._dtype = state [" dtype" ]
0 commit comments