diff --git a/pyscf/grad/cmspdft.py b/pyscf/grad/cmspdft.py index 48a6bb1..1e904ee 100644 --- a/pyscf/grad/cmspdft.py +++ b/pyscf/grad/cmspdft.py @@ -359,7 +359,7 @@ def trans_rdm12 (ci1, ci0, *args, **kwargs): ci_arr = np.asarray (mc.ci) mc_grad = mc.nuc_grad_method () - Lis = math.pi * (np.random.rand ((3)) - 0.5) + Lis = math.pi * (np.random.rand (3) - 0.5) eris = mc.ao2mo (mc.mo_coeff) dw_test = diab_response (mc_grad, Lis, mo=mc.mo_coeff, ci=mc.ci, diff --git a/pyscf/grad/mspdft.py b/pyscf/grad/mspdft.py index 9831a05..e75f0fc 100644 --- a/pyscf/grad/mspdft.py +++ b/pyscf/grad/mspdft.py @@ -36,7 +36,7 @@ from mrh.my_pyscf.fci.csf import CSFFCISolver except ModuleNotFoundError: # dummy - class CSFFCISolver (object): + class CSFFCISolver : pass def _unpack_state (state): @@ -656,9 +656,9 @@ def is_prec (self, xis): def do_sing_warn (self): if self.sing_warned: return - self.log.warn (('Model-space frame-rotation Hessian is singular! ' + self.log.warn ('Model-space frame-rotation Hessian is singular! ' 'Response equations may not be solvable to arbitrary ' - 'precision!')) + 'precision!') self.sing_warned = True diff --git a/pyscf/grad/test/test_grad_cmspdft.py b/pyscf/grad/test/test_grad_cmspdft.py index f66fe71..8c04c64 100644 --- a/pyscf/grad/test/test_grad_cmspdft.py +++ b/pyscf/grad/test/test_grad_cmspdft.py @@ -31,7 +31,7 @@ H 1.102430 0.000000 -0.920125''' mol_nosymm = gto.M (atom = h2co_casscf66_631g_xyz, basis = '6-31g', symmetry = False, output='/dev/null', verbose = 0) mol_symm = gto.M (atom = h2co_casscf66_631g_xyz, basis = '6-31g', symmetry = True, output='/dev/null', verbose = 0) -Lis = math.pi * (np.random.rand ((1)) - 0.5) +Lis = math.pi * (np.random.rand (1) - 0.5) def get_mc_ref (mol, ri=False, sam=False): mf = scf.RHF (mol) if ri: mf = mf.density_fit (auxbasis = df.aug_etb (mol)) diff --git a/pyscf/mcdcft/mcdcft.py b/pyscf/mcdcft/mcdcft.py index bdd3468..e9ff83d 100644 --- a/pyscf/mcdcft/mcdcft.py +++ b/pyscf/mcdcft/mcdcft.py @@ -216,7 +216,7 @@ def __init__(self, scf, ncas, nelecas, my_ot=None, ot_name=None, grids_level=Non # I think this is the same DFCASSCF problem as with the DF-SACASSCF gradients earlier super().__init__() keys = set(('e_ot', 'e_mcscf', 'e_states')) - self._keys = set ((self.__dict__.keys())).union(keys) + self._keys = set (self.__dict__.keys()).union(keys) self.grids_level = grids_level if my_ot is not None: self._init_ot_grids(my_ot, ot_name, grids_level=grids_level) diff --git a/pyscf/mcpdft/__init__.py b/pyscf/mcpdft/__init__.py index c30d6fb..0c6560e 100644 --- a/pyscf/mcpdft/__init__.py +++ b/pyscf/mcpdft/__init__.py @@ -56,7 +56,7 @@ def CASCIPDFT (mc_or_mf_or_mol, ot, ncas, nelecas, ncore=None, **kwargs): CASSCF=CASSCFPDFT CASCI=CASCIPDFT -class MultiStateMCPDFTSolver (): +class MultiStateMCPDFTSolver : pass # tag diff --git a/pyscf/mcpdft/_dms.py b/pyscf/mcpdft/_dms.py index 647f4c6..edde07c 100644 --- a/pyscf/mcpdft/_dms.py +++ b/pyscf/mcpdft/_dms.py @@ -26,7 +26,7 @@ from pyscf import dmrgscf DMRGCI = dmrgscf.DMRGCI except ImportError: - class DMRGCI (object): + class DMRGCI : pass def _get_fcisolver (mc, ci, state=0): diff --git a/pyscf/mcpdft/lpdft.py b/pyscf/mcpdft/lpdft.py index 7a29b56..4c6362d 100644 --- a/pyscf/mcpdft/lpdft.py +++ b/pyscf/mcpdft/lpdft.py @@ -319,7 +319,7 @@ def __init__(self, mc): self.si_pdft = None self.veff1 = None self.veff2 = None - self._keys = set((self.__dict__.keys())).union(keys) + self._keys = set(self.__dict__.keys()).union(keys) @property def e_states(self): diff --git a/pyscf/mcpdft/mcpdft.py b/pyscf/mcpdft/mcpdft.py index a1d242a..e7e43d6 100644 --- a/pyscf/mcpdft/mcpdft.py +++ b/pyscf/mcpdft/mcpdft.py @@ -337,7 +337,7 @@ def _get_e_decomp(mc, ot, mo_coeff, ci, e_nuc, h, nelecas): return e_1e, e_coul, e_otxc, e_ncwfn -class _mcscf_env(object): +class _mcscf_env: '''Prevent MC-SCF step of MC-PDFT from overwriting redefined quantities e_states and e_tot ''' @@ -365,7 +365,7 @@ def __exit__(self, type, value, traceback): self.mc._in_mcscf_env = False -class _PDFT(): +class _PDFT: # Metaclass parent; unusable on its own '''MC-PDFT child class. All total energy quantities (e_tot, e_states) are MC-PDFT total energies: @@ -411,7 +411,7 @@ def __init__(self, scf, ncas, nelecas, my_ot=None, grids_level=None, 'mcscf_mcpdft_conv_tol_ci_fp', 1e-8) self.mcscf_kernel = self._mc_class.kernel self._in_mcscf_env = False - self._keys = set((self.__dict__.keys())).union(keys) + self._keys = set(self.__dict__.keys()).union(keys) if grids_level is not None: grids_attr['level'] = grids_level if my_ot is not None: diff --git a/pyscf/mcpdft/mspdft.py b/pyscf/mcpdft/mspdft.py index 1879d8a..4496b37 100644 --- a/pyscf/mcpdft/mspdft.py +++ b/pyscf/mcpdft/mspdft.py @@ -183,8 +183,8 @@ def si_newton (mc, ci=None, objfn=None, max_cyc=None, conv_tol=None, if conv: log.note ("{} optimization CONVERGED".format (hdr)) else: - log.note (("{} optimization did not converge after {} " - "cycles".format (hdr, it))) + log.note ("{} optimization did not converge after {} " + "cycles".format (hdr, it)) return conv, list (ci) @@ -262,7 +262,7 @@ def __init__(self, mc, diabatizer, diabatize, diabatization): self.diabatization = diabatization self.si_mcscf = None self.si_pdft = None - self._keys = set ((self.__dict__.keys ())).union (keys) + self._keys = set (self.__dict__.keys ()).union (keys) @property def e_states (self): diff --git a/pyscf/mcpdft/otfnal.py b/pyscf/mcpdft/otfnal.py index 134a980..a988cc3 100644 --- a/pyscf/mcpdft/otfnal.py +++ b/pyscf/mcpdft/otfnal.py @@ -739,11 +739,11 @@ def get_transfnal (mol, otxc): xc_base = OT_HYB_ALIAS.get (xc_base.upper (), xc_base) if ',' not in xc_base and _libxc.is_hybrid_or_rsh (xc_base): raise NotImplementedError ( - ('Aliased or built-in translated hybrid or range-separated ' + 'Aliased or built-in translated hybrid or range-separated ' 'functionals\nother than those listed in otfnal.OT_HYB_ALIAS. ' 'Build a compound functional\nstring with a comma separating the ' 'exchange and correlation parts, or use\notfnal.make_hybrid_fnal ' - 'instead.') + 'instead.' ) ks = dft.RKS (mol) ks.xc = xc_base diff --git a/pyscf/mcpdft/pdft_eff.py b/pyscf/mcpdft/pdft_eff.py index a4dd409..2273dfe 100644 --- a/pyscf/mcpdft/pdft_eff.py +++ b/pyscf/mcpdft/pdft_eff.py @@ -28,7 +28,7 @@ # TODO: outcore implementation; can I use properties instead of copying? -class _ERIS(object): +class _ERIS: '''Stores two-body PDFT on-top effective integral arrays in a form compatible with existing MC-SCF kernel and derivative functions. Unlike actual eris, PDFT 2-electron effective integrals have 24-fold diff --git a/pyscf/mcpdft/tfnal_derivs.py b/pyscf/mcpdft/tfnal_derivs.py index d9a4a2c..66f7fae 100644 --- a/pyscf/mcpdft/tfnal_derivs.py +++ b/pyscf/mcpdft/tfnal_derivs.py @@ -274,8 +274,8 @@ def contract_fot(otfnal, fot, rho0, Pi0, rho1, Pi1, unpack=True, vrho1, vPi1 = _unpack_sigma_vector(v1, rho0p, Pi0p) if ggrad: if vot_packed is None: - raise RuntimeError(("Cannot evaluate fot.x in terms of " - "unpacked density gradients without vot_packed")) + raise RuntimeError("Cannot evaluate fot.x in terms of " + "unpacked density gradients without vot_packed") vrho2, vPi2 = _unpack_sigma_vector(vot_packed, rho1p, Pi1p) if vrho1.shape[0] > 1: vrho1[1:4, :] += vrho2[1:4, :] if vPi1.shape[0] > 1: vPi1[1:4, :] += vPi2[1:4, :] diff --git a/pyscf/mcpdft/xmspdft.py b/pyscf/mcpdft/xmspdft.py index dbf5200..4145a24 100644 --- a/pyscf/mcpdft/xmspdft.py +++ b/pyscf/mcpdft/xmspdft.py @@ -139,7 +139,7 @@ def safock_energy(mc, **kwargs): ''' dsa_fock = np.zeros( int(mc.fcisolver.nroots * (mc.fcisolver.nroots - 1) / 2)) - # TODO fix, this redundacy...no need to compute fock matrix twice.. + # TODO fix, this redundancy...no need to compute fock matrix twice.. e_states, _ = diagonalize_safock(mc) return np.dot(e_states, mc.weights), dsa_fock, None diff --git a/pyscf/prop/dip_moment/test/test_mcpdft_pdm.py b/pyscf/prop/dip_moment/test/test_mcpdft_pdm.py index 1420cb2..b57888a 100644 --- a/pyscf/prop/dip_moment/test/test_mcpdft_pdm.py +++ b/pyscf/prop/dip_moment/test/test_mcpdft_pdm.py @@ -46,7 +46,7 @@ def get_mc_ref (mol, ri=False, sa2=False): # ref = ref.reshape (2,2,4,3)[int(ri)] # else: # ref = np.load (os.path.join (topdir, 'h2co_tpbe66_631g_grad_num.npy'))[int(ri)] - #this refernce is obtained by mcpdft numerical differentiation in pyscf + #this reference is obtained by mcpdft numerical differentiation in pyscf #using central differences with a second order accuracy and step size of 1e-4 ref = np.load (os.path.join (topdir, 'h2co_tpbe66_631g_edipole_num.npy'))[int(ri)] return mc.run (), ref