diff --git a/pyscf/dft/rks.py b/pyscf/dft/rks.py index 70f5fdea37..807e32a0f5 100644 --- a/pyscf/dft/rks.py +++ b/pyscf/dft/rks.py @@ -539,5 +539,4 @@ def to_gpu(self): obj = lib.to_gpu(hf.SCF.reset(self.view(RKS))) # Attributes only defined in gpu4pyscf.RKS obj.screen_tol = 1e-14 - obj.disp = None return obj diff --git a/pyscf/dft/uks.py b/pyscf/dft/uks.py index 19491012a7..cf2f7d7486 100644 --- a/pyscf/dft/uks.py +++ b/pyscf/dft/uks.py @@ -203,5 +203,4 @@ def to_gpu(self): obj = lib.to_gpu(SCF.reset(self.view(UKS))) # Attributes only defined in gpu4pyscf.RKS obj.screen_tol = 1e-14 - obj.disp = None return obj diff --git a/pyscf/gto/mole.py b/pyscf/gto/mole.py index 0b09a51bdf..e330758b3c 100644 --- a/pyscf/gto/mole.py +++ b/pyscf/gto/mole.py @@ -3700,7 +3700,7 @@ def __getattr__(self, key): '_repr_mimebundle_'): # https://github.com/mewwts/addict/issues/26 # https://github.com/jupyter/notebook/issues/2014 - raise AttributeError + raise AttributeError(f'Mole object has no attribute {key}') # Import all available modules. Some methods are registered to other # classes/modules when importing modules in __all__. @@ -3721,8 +3721,10 @@ def __getattr__(self, key): if xc in dft.XC: mf.xc = xc key = 'TDDFT' - else: + elif 'CI' in key or 'CC' in key or 'CAS' in key or 'MP' in key: mf = scf.HF(self) + else: + raise AttributeError(f'Mole object has no attribute {key}') method = getattr(mf, key) diff --git a/pyscf/pbc/gto/cell.py b/pyscf/pbc/gto/cell.py index 33891fd6c7..813cabe258 100644 --- a/pyscf/pbc/gto/cell.py +++ b/pyscf/pbc/gto/cell.py @@ -971,7 +971,7 @@ def __getattr__(self, key): '_repr_mimebundle_'): # https://github.com/mewwts/addict/issues/26 # https://github.com/jupyter/notebook/issues/2014 - raise AttributeError + raise AttributeError(f'Cell object has no attribute {key}') # Import all available modules. Some methods are registered to other # classes/modules when importing modules in __all__. @@ -994,8 +994,10 @@ def __getattr__(self, key): if xc in XC: mf.xc = xc key = 'KTDDFT' - else: + elif 'CI' in key or 'CC' in key or 'MP' in key: mf = scf.KHF(self) + else: + raise AttributeError(f'Cell object has no attribute {key}') # Remove prefix 'K' because methods are registered without the leading 'K' key = key[1:] else: @@ -1008,8 +1010,10 @@ def __getattr__(self, key): if xc in XC: mf.xc = xc key = 'TDDFT' - else: + elif 'CI' in key or 'CC' in key or 'MP' in key: mf = scf.HF(self) + else: + raise AttributeError(f'Cell object has no attribute {key}') method = getattr(mf, key)