Skip to content

Commit

Permalink
Degeneracy issue in KGKS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Jun 18, 2024
1 parent 4451b15 commit 39d1ff2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pyscf/pbc/dft/kgks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from pyscf.pbc.dft import rks
from pyscf.pbc.dft import multigrid
from pyscf.pbc.dft.numint2c import KNumInt2C
from pyscf.dft import gks as mol_ks
from pyscf import __config__

def get_veff(ks, cell=None, dm=None, dm_last=0, vhf_last=0, hermi=1,
Expand Down Expand Up @@ -117,6 +118,8 @@ class KGKS(rks.KohnShamDFT, kghf.KGHF):
'''GKS class adapted for PBCs with k-point sampling.
'''

collinear = mol_ks.GKS.collinear
spin_samples = mol_ks.GKS.spin_samples
get_veff = get_veff
energy_elec = krks.energy_elec
get_rho = krks.get_rho
Expand Down
2 changes: 1 addition & 1 deletion pyscf/pbc/dft/test/test_kgks.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_collinear_kgks_gga(self):
mf.xc = 'pbe'
mf.collinear = 'col'
mf.run()
self.assertAlmostEqual(mf.e_tot, -1.5775787238220018, 7)
self.assertAlmostEqual(mf.e_tot, -1.6373456924395708, 7)

@unittest.skipIf(mcfun is None, "mcfun library not found.")
def test_mcol_kgks_gga(self):
Expand Down
1 change: 1 addition & 0 deletions pyscf/pbc/scf/ghf.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def get_jk(mf, cell=None, dm=None, hermi=0, kpt=None, kpts_band=None,
class GHF(pbchf.SCF):
'''GHF class for PBCs.
'''
_keys = {'with_soc'}

def __init__(self, cell, kpt=np.zeros(3),
exxdiv=getattr(__config__, 'pbc_scf_SCF_exxdiv', 'ewald')):
Expand Down
2 changes: 2 additions & 0 deletions pyscf/pbc/scf/kghf.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ def fn_init_guess(mf, cell=None, kpts=None):
class KGHF(khf.KSCF):
'''GHF class for PBCs.
'''
_keys = {'with_soc'}

def __init__(self, cell, kpts=np.zeros((1,3)),
exxdiv=getattr(__config__, 'pbc_scf_SCF_exxdiv', 'ewald')):
khf.KSCF.__init__(self, cell, kpts, exxdiv)
Expand Down

0 comments on commit 39d1ff2

Please sign in to comment.