@@ -31,12 +31,28 @@ def smearing(mf, sigma=None, method=SMEARING_METHOD, mu0=None, fix_spin=False):
3131 mf .fix_spin = fix_spin
3232 return mf
3333
34- assert not mf .istype ('KSCF' )
35- if mf .istype ('ROHF' ):
36- # ROHF leads to two Fock matrices. It's not clear how to define the
37- # Roothaan effective Fock matrix from the two.
38- raise NotImplementedError ('Smearing-ROHF' )
34+ if mf .istype ('_CIAH_SOSCF' ):
35+ raise NotImplementedError ('Smearing with second order SCF is not supported' )
36+
37+ if mf .istype ('KSCF' ):
38+ from pyscf .pbc .scf .smearing import smearing
39+ return smearing (mf , sigma , method , mu0 , fix_spin )
3940
41+ if mf .istype ('ROHF' ):
42+ if fix_spin :
43+ raise RuntimeError ('Smearing-ROHF with fix_spin not supported. Use UHF instead.' )
44+ # Roothaan Fock matrix for ROHF is not supported by the smearing method.
45+ # The single occupancy can be handled using the regular RHF class
46+ from pyscf .scf .addons import _object_without_soscf
47+ from pyscf import scf
48+ from pyscf import dft
49+ known_class = {
50+ dft .rks_symm .ROKS : dft .rks_symm .RKS ,
51+ dft .roks .ROKS : dft .rks .RKS ,
52+ scf .hf_symm .ROHF : scf .hf_symm .RHF ,
53+ scf .rohf .ROHF : scf .hf .RHF ,
54+ }
55+ mf = _object_without_soscf (mf , known_class )
4056 return lib .set_class (_SmearingSCF (mf , sigma , method , mu0 , fix_spin ),
4157 (_SmearingSCF , mf .__class__ ))
4258
@@ -136,8 +152,12 @@ def get_occ(self, mo_energy=None, mo_coeff=None):
136152 mo_occ = super ().get_occ (mo_energy , mo_coeff )
137153 return mo_occ
138154
155+ if self .istype ('ROHF' ):
156+ # ROHF leads to two Fock matrices. It's not clear how to define the
157+ # Roothaan effective Fock matrix from the two.
158+ raise NotImplementedError ('Smearing-ROHF' )
139159 is_uhf = self .istype ('UHF' )
140- is_rhf = self . istype ( 'RHF' )
160+ is_rhf = not is_uhf
141161
142162 sigma = self .sigma
143163 if self .smearing_method .lower () == 'fermi' :
0 commit comments