Skip to content

Commit

Permalink
Fix inconsistency between _bas and _basis (related to issue pyscf#1770)
Browse files Browse the repository at this point in the history
update __getattr__
  • Loading branch information
sunqm committed Sep 10, 2023
1 parent d5b5bd2 commit 78b7b05
Show file tree
Hide file tree
Showing 6 changed files with 900 additions and 862 deletions.
14 changes: 11 additions & 3 deletions pyscf/dft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
XC = {**xcfun.XC, **xcfun.XC_ALIAS}
except (ImportError, OSError):
pass
from pyscf import gto
#from pyscf.dft import xc
from pyscf.dft import rks
from pyscf.dft import roks
Expand Down Expand Up @@ -65,7 +66,7 @@ def KS(mol, xc='LDA,VWN'):
KS.__doc__ = '''
A wrap function to create DFT object (RKS or UKS).\n
''' + rks.RKS.__doc__
DFT = KS
gto.Mole.KS = gto.Mole.DFT = DFT = KS

def RKS(mol, xc='LDA,VWN'):
if mol.spin == 0:
Expand All @@ -76,27 +77,31 @@ def RKS(mol, xc='LDA,VWN'):
else:
return ROKS(mol, xc)
RKS.__doc__ = rks.RKS.__doc__
gto.Mole.RKS = RKS

def ROKS(mol, xc='LDA,VWN'):
if not mol.symmetry or mol.groupname == 'C1':
return roks.ROKS(mol, xc)
else:
return rks_symm.ROKS(mol, xc)
ROKS.__doc__ = roks.ROKS.__doc__
gto.Mole.ROKS = ROKS

def UKS(mol, xc='LDA,VWN'):
if not mol.symmetry or mol.groupname == 'C1':
return uks.UKS(mol, xc)
else:
return uks_symm.UKS(mol, xc)
UKS.__doc__ = uks.UKS.__doc__
gto.Mole.UKS = UKS

def GKS(mol, xc='LDA,VWN'):
if not mol.symmetry or mol.groupname == 'C1':
return gks.GKS(mol, xc)
else:
return gks_symm.GKS(mol, xc)
GKS.__doc__ = gks.GKS.__doc__
gto.Mole.GKS = GKS

def DKS(mol, xc='LDA,VWN'):
from pyscf.scf import dhf
Expand All @@ -105,8 +110,10 @@ def DKS(mol, xc='LDA,VWN'):
else:
return dks.UDKS(mol, xc=xc)

UDKS = dks.UDKS
RDKS = dks.RDKS
gto.Mole.DKS = DKS
gto.Mole.UDKS = UDKS = dks.UDKS
gto.Mole.RDKS = RDKS = dks.RDKS


def X2C(mol, *args):
'''X2C Kohn-Sham'''
Expand All @@ -116,3 +123,4 @@ def X2C(mol, *args):
return dft.RKS(mol, *args)
else:
return dft.UKS(mol, *args)
gto.Mole.X2C_KS = X2C
Loading

0 comments on commit 78b7b05

Please sign in to comment.