Skip to content

Commit

Permalink
apply "ruff --fix check --select=C40 pyscf"
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton authored and sunqm committed Oct 31, 2023
1 parent c19cacc commit 14d8882
Show file tree
Hide file tree
Showing 124 changed files with 250 additions and 251 deletions.
4 changes: 2 additions & 2 deletions pyscf/adc/radc.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ class RADC(lib.StreamObject):
blkmin = getattr(__config__, 'adc_radc_RADC_blkmin', 4)
memorymin = getattr(__config__, 'adc_radc_RADC_memorymin', 2000)

_keys = set((
_keys = {
'tol_residual','conv_tol', 'e_corr', 'method', 'mo_coeff',
'mol', 'mo_energy', 'incore_complete',
'scf_energy', 'e_tot', 't1', 'frozen', 'chkfile',
'max_space', 't2', 'mo_occ', 'max_cycle',
'imds', 'method', 'method_type', 'with_df', 'compute_properties',
'approx_trans_moments', 'evec_print_tol', 'spec_factor_print_tol',
'ncvs', 'E', 'U', 'P', 'X',
))
}

def __init__(self, mf, frozen=0, mo_coeff=None, mo_occ=None):
from pyscf import gto
Expand Down
4 changes: 2 additions & 2 deletions pyscf/adc/radc_ea.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,13 +966,13 @@ class RADCEA(radc.RADC):
Spectroscopic amplitudes for each EA transition.
'''

_keys = set((
_keys = {
'tol_residual','conv_tol', 'e_corr', 'method', 'mo_coeff',
'mo_energy', 't1', 'max_space', 't2', 'max_cycle',
'nmo', 'transform_integrals', 'with_df', 'compute_properties',
'approx_trans_moments', 'E', 'U', 'P', 'X',
'evec_print_tol', 'spec_factor_print_tol',
))
}

def __init__(self, adc):
self.mol = adc.mol
Expand Down
4 changes: 2 additions & 2 deletions pyscf/adc/radc_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,14 +921,14 @@ class RADCIP(radc.RADC):
Spectroscopic amplitudes for each IP transition.
'''

_keys = set((
_keys = {
'tol_residual','conv_tol', 'e_corr', 'method', 'mo_coeff',
'mo_energy_b', 't1', 'mo_energy_a',
'max_space', 't2', 'max_cycle',
'nmo', 'transform_integrals', 'with_df', 'compute_properties',
'approx_trans_moments', 'E', 'U', 'P', 'X',
'evec_print_tol', 'spec_factor_print_tol',
))
}

def __init__(self, adc):
self.mol = adc.mol
Expand Down
4 changes: 2 additions & 2 deletions pyscf/adc/radc_ip_cvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,14 +938,14 @@ class RADCIPCVS(radc.RADC):
Spectroscopic amplitudes for each IP transition.
'''

_keys = set((
_keys = {
'tol_residual','conv_tol', 'e_corr', 'method', 'mo_coeff',
'mo_energy_b', 't1', 'mo_energy_a',
'max_space', 't2', 'max_cycle',
'nmo', 'transform_integrals', 'with_df', 'compute_properties',
'approx_trans_moments', 'E', 'U', 'P', 'X',
'evec_print_tol', 'spec_factor_print_tol', 'ncvs',
))
}

def __init__(self, adc):
self.mol = adc.mol
Expand Down
4 changes: 2 additions & 2 deletions pyscf/adc/uadc.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class UADC(lib.StreamObject):
'''
incore_complete = getattr(__config__, 'adc_uadc_UADC_incore_complete', False)

_keys = set((
_keys = {
'tol_residual','conv_tol', 'e_corr', 'method',
'method_type', 'mo_coeff', 'mol', 'mo_energy_b',
'scf_energy', 'e_tot', 't1', 'frozen',
Expand All @@ -122,7 +122,7 @@ class UADC(lib.StreamObject):
'compute_mpn_energy', 'compute_spec', 'compute_properties',
'approx_trans_moments', 'evec_print_tol', 'spec_factor_print_tol',
'E', 'U', 'P', 'X', 'ncvs',
))
}

def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
from pyscf import gto
Expand Down
4 changes: 2 additions & 2 deletions pyscf/adc/uadc_ea.py
Original file line number Diff line number Diff line change
Expand Up @@ -1960,15 +1960,15 @@ class UADCEA(uadc.UADC):
Spectroscopic amplitudes for each EA transition.
'''

_keys = set((
_keys = {
'tol_residual','conv_tol', 'e_corr', 'method',
'method_type', 'mo_coeff', 'mo_energy_b', 'max_memory',
't1', 'mo_energy_a', 'max_space', 't2', 'max_cycle',
'nocc_a', 'nocc_b', 'nvir_a', 'nvir_b', 'mo_coeff', 'mo_energy_a',
'mo_energy_b', 'nmo_a', 'nmo_b', 'mol', 'transform_integrals',
'with_df', 'spec_factor_print_tol', 'evec_print_tol',
'compute_properties', 'approx_trans_moments', 'E', 'U', 'P', 'X',
))
}

def __init__(self, adc):
self.verbose = adc.verbose
Expand Down
4 changes: 2 additions & 2 deletions pyscf/adc/uadc_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -1838,15 +1838,15 @@ class UADCIP(uadc.UADC):
Spectroscopic amplitudes for each IP transition.
'''

_keys = set((
_keys = {
'tol_residual','conv_tol', 'e_corr', 'method',
'method_type', 'mo_coeff', 'mo_energy_b', 'max_memory',
't1', 'mo_energy_a', 'max_space', 't2', 'max_cycle',
'nocc_a', 'nocc_b', 'nvir_a', 'nvir_b', 'mo_coeff', 'mo_energy_a',
'mo_energy_b', 'nmo_a', 'nmo_b', 'mol', 'transform_integrals',
'with_df', 'spec_factor_print_tol', 'evec_print_tol',
'compute_properties', 'approx_trans_moments', 'E', 'U', 'P', 'X',
))
}

def __init__(self, adc):
self.verbose = adc.verbose
Expand Down
4 changes: 2 additions & 2 deletions pyscf/adc/uadc_ip_cvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2035,15 +2035,15 @@ class UADCIPCVS(uadc.UADC):
Spectroscopic amplitudes for each IP transition.
'''

_keys = set((
_keys = {
'tol_residual','conv_tol', 'e_corr', 'method',
'method_type', 'mo_coeff', 'mo_energy_b', 'max_memory',
't1', 'mo_energy_a', 'max_space', 't2', 'max_cycle',
'nocc_a', 'nocc_b', 'nvir_a', 'nvir_b', 'mo_coeff', 'mo_energy_a',
'mo_energy_b', 'nmo_a', 'nmo_b', 'mol', 'transform_integrals',
'with_df', 'spec_factor_print_tol', 'evec_print_tol', 'ncvs',
'compute_properties', 'approx_trans_moments', 'E', 'U', 'P', 'X',
))
}

def __init__(self, adc):
self.verbose = adc.verbose
Expand Down
4 changes: 2 additions & 2 deletions pyscf/agf2/chempot.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def minimize_chempot(se, fock, nelec, occupancy=2, x0=0.0, tol=1e-6, maxiter=200
buf = np.zeros((se.nphys+se.naux, se.nphys+se.naux), dtype=dtype)
fargs = (se, fock, nelec, occupancy, buf)

options = dict(maxiter=maxiter, ftol=tol, xtol=tol, gtol=tol)
kwargs = dict(x0=x0, method='TNC', jac=jac, options=options)
options = {'maxiter': maxiter, 'ftol': tol, 'xtol': tol, 'gtol': tol}
kwargs = {'x0': x0, 'method': 'TNC', 'jac': jac, 'options': options}
fun = _objective if not jac else _gradient

opt = optimize.minimize(fun, args=fargs, **kwargs)
Expand Down
8 changes: 4 additions & 4 deletions pyscf/agf2/dfragf2.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def build_se_part(agf2, eri, gf_occ, gf_vir, os_factor=1.0, ss_factor=1.0):
nocc, nvir = gf_occ.naux, gf_vir.naux
naux = agf2.with_df.get_naoaux()
tol = agf2.weight_tol
facs = dict(os_factor=os_factor, ss_factor=ss_factor)
facs = {'os_factor': os_factor, 'ss_factor': ss_factor}

ei, ci = gf_occ.energy, gf_occ.coupling
ea, ca = gf_vir.energy, gf_vir.coupling
Expand Down Expand Up @@ -258,7 +258,7 @@ class DFRAGF2(ragf2.RAGF2):
Auxiliaries of the Green's function
'''

_keys = set(['_with_df', 'allow_lowmem_build'])
_keys = {'_with_df', 'allow_lowmem_build'}

def __init__(self, mf, frozen=None, mo_energy=None, mo_coeff=None, mo_occ=None):
ragf2.RAGF2.__init__(self, mf, frozen=frozen, mo_energy=mo_energy,
Expand Down Expand Up @@ -335,7 +335,7 @@ def _make_mo_eris_incore(agf2, mo_coeff=None):
qxy = np.zeros((naux, npair))
mo = np.asarray(eris.mo_coeff, order='F')
sij = (0, nmo, 0, nmo)
sym = dict(aosym='s2', mosym='s2')
sym = {'aosym': 's2', 'mosym': 's2'}

for p0, p1 in with_df.prange():
eri0 = with_df._cderi[p0:p1]
Expand Down Expand Up @@ -370,7 +370,7 @@ def _make_qmo_eris_incore(agf2, eri, coeffs):

xisym, nxi, cxi, sxi = ao2mo.incore._conc_mos(cx, ci, compact=False)
jasym, nja, cja, sja = ao2mo.incore._conc_mos(cj, ca, compact=False)
sym = dict(aosym='s2', mosym='s1')
sym = {'aosym': 's2', 'mosym': 's1'}

qxi = np.zeros((naux, nxi))
qja = np.zeros((naux, nja))
Expand Down
8 changes: 4 additions & 4 deletions pyscf/agf2/dfuagf2.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def build_se_part(agf2, eri, gf_occ, gf_vir, os_factor=1.0, ss_factor=1.0):
noccb, nvirb = gf_occ[1].naux, gf_vir[1].naux
naux = agf2.with_df.get_naoaux()
tol = agf2.weight_tol
facs = dict(os_factor=os_factor, ss_factor=ss_factor)
facs = {'os_factor': os_factor, 'ss_factor': ss_factor}

ci_a, ei_a = gf_occ[0].coupling, gf_occ[0].energy
ci_b, ei_b = gf_occ[1].coupling, gf_occ[1].energy
Expand Down Expand Up @@ -209,7 +209,7 @@ class DFUAGF2(uagf2.UAGF2):
Auxiliaries of the Green's function for each spin
'''

_keys = set(['_with_df', 'allow_lowmem_build'])
_keys = {'_with_df', 'allow_lowmem_build'}

def __init__(self, mf, frozen=None, mo_energy=None, mo_coeff=None, mo_occ=None):
uagf2.UAGF2.__init__(self, mf, frozen=frozen, mo_energy=mo_energy,
Expand Down Expand Up @@ -277,7 +277,7 @@ def _make_mo_eris_incore(agf2, mo_coeff=None):
mob = np.asarray(mob, order='F')
sija = (0, nmoa, 0, nmoa)
sijb = (0, nmob, 0, nmob)
sym = dict(aosym='s2', mosym='s2')
sym = {'aosym': 's2', 'mosym': 's2'}

for p0, p1 in with_df.prange():
eri0 = with_df._cderi[p0:p1]
Expand Down Expand Up @@ -324,7 +324,7 @@ def _make_qmo_eris_incore(agf2, eri, coeffs_a, coeffs_b):
jasym_a, nja_a, cja_a, sja_a = ao2mo.incore._conc_mos(cja, caa, compact=False)
xisym_b, nxi_b, cxi_b, sxi_b = ao2mo.incore._conc_mos(cxb, cib, compact=False)
jasym_b, nja_b, cja_b, sja_b = ao2mo.incore._conc_mos(cjb, cab, compact=False)
sym = dict(aosym='s2', mosym='s1')
sym = {'aosym': 's2', 'mosym': 's1'}

qxi_a = np.zeros((naux, nxi_a))
qxi_b = np.zeros((naux, nxi_b))
Expand Down
10 changes: 5 additions & 5 deletions pyscf/agf2/ragf2.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def build_se_part(agf2, eri, gf_occ, gf_vir, os_factor=1.0, ss_factor=1.0):

nmo = eri.nmo
tol = agf2.weight_tol
facs = dict(os_factor=os_factor, ss_factor=ss_factor)
facs = {'os_factor': os_factor, 'ss_factor': ss_factor}

ci, ei = gf_occ.coupling, gf_occ.energy
ca, ea = gf_vir.coupling, gf_vir.energy
Expand Down Expand Up @@ -304,7 +304,7 @@ def fock_loop(agf2, eri, gf, se):
nqmo = nmo + naux
buf = np.zeros((nqmo, nqmo))
converged = False
opts = dict(tol=agf2.conv_tol_nelec, maxiter=agf2.max_cycle_inner)
opts = {'tol': agf2.conv_tol_nelec, 'maxiter': agf2.max_cycle_inner}
rdm1_prev = 0

for niter1 in range(1, agf2.max_cycle_outer+1):
Expand Down Expand Up @@ -507,15 +507,15 @@ class RAGF2(lib.StreamObject):
async_io = getattr(__config__, 'agf2_async_io', True)
incore_complete = getattr(__config__, 'agf2_incore_complete', False)

_keys = set((
_keys = {
'async_io', 'mol', 'incore_complete',
'conv_tol', 'conv_tol_rdm1', 'conv_tol_nelec', 'max_cycle',
'max_cycle_outer', 'max_cycle_inner', 'weight_tol', 'fock_diis_space',
'fock_diis_min_space', 'diis', 'diis_space', 'diis_min_space',
'os_factor', 'ss_factor', 'damping',
'mo_energy', 'mo_coeff', 'mo_occ', 'se', 'gf', 'e_1b', 'e_2b', 'e_init',
'frozen', 'converged', 'chkfile',
))
}

def __init__(self, mf, frozen=None, mo_energy=None, mo_coeff=None, mo_occ=None):

Expand Down Expand Up @@ -697,7 +697,7 @@ def build_se(self, eri=None, gf=None, os_factor=None, ss_factor=None, se_prev=No
if os_factor is None: os_factor = self.os_factor
if ss_factor is None: ss_factor = self.ss_factor

facs = dict(os_factor=os_factor, ss_factor=ss_factor)
facs = {'os_factor': os_factor, 'ss_factor': ss_factor}
gf_occ = gf.get_occupied()
gf_vir = gf.get_virtual()

Expand Down
4 changes: 2 additions & 2 deletions pyscf/agf2/ragf2_slow.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class RAGF2(ragf2.RAGF2):
Auxiliaries of the Green's function
'''

_keys = set(['nmom'])
_keys = {'nmom'}

def __init__(self, mf, nmom=(None,0), frozen=None, mo_energy=None, mo_coeff=None, mo_occ=None):

Expand Down Expand Up @@ -222,7 +222,7 @@ def build_se(self, eri=None, gf=None, os_factor=None, ss_factor=None, se_prev=No
if os_factor is None: os_factor = self.os_factor
if ss_factor is None: ss_factor = self.ss_factor

facs = dict(os_factor=os_factor, ss_factor=ss_factor)
facs = {'os_factor': os_factor, 'ss_factor': ss_factor}
gf_occ = gf.get_occupied()
gf_vir = gf.get_virtual()

Expand Down
6 changes: 3 additions & 3 deletions pyscf/agf2/uagf2.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def build_se_part(agf2, eri, gf_occ, gf_vir, os_factor=1.0, ss_factor=1.0):
noa, nob = gf_occ[0].naux, gf_occ[1].naux
nva, nvb = gf_vir[0].naux, gf_vir[1].naux
tol = agf2.weight_tol
facs = dict(os_factor=os_factor, ss_factor=ss_factor)
facs = {'os_factor': os_factor, 'ss_factor': ss_factor}

ci_a, ei_a = gf_occ[0].coupling, gf_occ[0].energy
ci_b, ei_b = gf_occ[1].coupling, gf_occ[1].energy
Expand Down Expand Up @@ -206,7 +206,7 @@ def fock_loop(agf2, eri, gf, se):
rdm1a_prev = 0
rdm1b_prev = 0
converged = False
opts = dict(tol=agf2.conv_tol_nelec, maxiter=agf2.max_cycle_inner)
opts = {'tol': agf2.conv_tol_nelec, 'maxiter': agf2.max_cycle_inner}

for niter1 in range(1, agf2.max_cycle_outer+1):
sea, opt = minimize_chempot(sea, focka, nalph, x0=sea.chempot,
Expand Down Expand Up @@ -557,7 +557,7 @@ def build_se(self, eri=None, gf=None, os_factor=None, ss_factor=None, se_prev=No
if os_factor is None: os_factor = self.os_factor
if ss_factor is None: ss_factor = self.ss_factor

facs = dict(os_factor=os_factor, ss_factor=ss_factor)
facs = {'os_factor': os_factor, 'ss_factor': ss_factor}
gf_occ = (gf[0].get_occupied(), gf[1].get_occupied())
gf_vir = (gf[0].get_virtual(), gf[1].get_virtual())

Expand Down
4 changes: 2 additions & 2 deletions pyscf/agf2/uagf2_slow.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class UAGF2(uagf2.UAGF2):
Auxiliaries of the Green's function for each spin
'''

_keys = set(['nmom'])
_keys = {'nmom'}

def __init__(self, mf, nmom=(None,0), frozen=None, mo_energy=None, mo_coeff=None, mo_occ=None):

Expand Down Expand Up @@ -250,7 +250,7 @@ def build_se(self, eri=None, gf=None, os_factor=None, ss_factor=None, se_prev=No
if os_factor is None: os_factor = self.os_factor
if ss_factor is None: ss_factor = self.ss_factor

facs = dict(os_factor=os_factor, ss_factor=ss_factor)
facs = {'os_factor': os_factor, 'ss_factor': ss_factor}
gf_occ = (gf[0].get_occupied(), gf[1].get_occupied())
gf_vir = (gf[0].get_virtual(), gf[1].get_virtual())

Expand Down
4 changes: 2 additions & 2 deletions pyscf/cc/ccsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,15 +923,15 @@ class CCSDBase(lib.StreamObject):
cc2 = getattr(__config__, 'cc_ccsd_CCSD_cc2', False)
callback = None

_keys = set((
_keys = {
'max_cycle', 'conv_tol', 'iterative_damping',
'conv_tol_normt', 'diis', 'diis_space', 'diis_file',
'diis_start_cycle', 'diis_start_energy_diff', 'direct',
'async_io', 'incore_complete', 'cc2', 'callback',
'mol', 'verbose', 'stdout', 'frozen', 'level_shift',
'mo_coeff', 'mo_occ', 'converged', 'converged_lambda', 'emp2', 'e_hf',
'e_corr', 't1', 't2', 'l1', 'l2', 'chkfile',
))
}

def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
from pyscf.scf import hf
Expand Down
2 changes: 1 addition & 1 deletion pyscf/cc/dfccsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
MEMORYMIN = getattr(__config__, 'cc_ccsd_memorymin', 2000)

class RCCSD(ccsd.CCSD):
_keys = set(['with_df'])
_keys = {'with_df'}

def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
ccsd.CCSD.__init__(self, mf, frozen, mo_coeff, mo_occ)
Expand Down
4 changes: 2 additions & 2 deletions pyscf/cc/eom_rccsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ def pickeig(w, v, nroots, envs):


class EOM(lib.StreamObject):
_keys = set((
_keys = {
'mol', 'max_space', 'max_cycle', 'conv_tol', 'partition',
'e', 'v', 'nocc', 'nmo',
))
}

def __init__(self, cc):
self.mol = cc.mol
Expand Down
4 changes: 2 additions & 2 deletions pyscf/cc/momgfccsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,10 @@ class MomGFCCSD(lib.StreamObject):
particle Green's function
"""

_keys = set((
_keys = {
'verbose', 'stdout', 'niter', 'weight_tol',
'hermi_moments', 'hermi_solver', 'eh', 'ep', 'vh', 'vp', 'chkfile',
))
}

def __init__(self, mycc, niter=(2, 2)):
self._cc = mycc
Expand Down
2 changes: 1 addition & 1 deletion pyscf/cc/rccsd_slow.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def energy(cc, t1, t2, eris):


class RCCSD(ccsd.CCSD):
_keys = set(['max_space'])
_keys = {'max_space'}

def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
ccsd.CCSD.__init__(self, mf, frozen, mo_coeff, mo_occ)
Expand Down
Loading

0 comments on commit 14d8882

Please sign in to comment.