Skip to content

Commit

Permalink
rename FragPart back to fragpart to have less changed files
Browse files Browse the repository at this point in the history
do that in another commit or at the end
  • Loading branch information
mcocdawc committed Jan 17, 2025
1 parent 53d7faf commit 4664380
Show file tree
Hide file tree
Showing 30 changed files with 64 additions and 64 deletions.
4 changes: 2 additions & 2 deletions example/kbe_polyacetylene.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from pyscf.pbc import df, gto, scf

from quemb.kbe import BE, FragPart
from quemb.kbe import BE, fragpart

kpt = [1, 1, 3]
cell = gto.Cell()
Expand Down Expand Up @@ -48,7 +48,7 @@
kpoint_energy = kmf.kernel()

# Define fragment in the supercell
kfrag = FragPart(be_type="be2", mol=cell, kpt=kpt, frozen_core=True)
kfrag = fragpart(be_type="be2", mol=cell, kpt=kpt, frozen_core=True)
# Initialize BE
mykbe = BE(kmf, kfrag, kpts=kpts)

Expand Down
6 changes: 3 additions & 3 deletions example/molbe_dmrg_block2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
from pyscf import cc, fci, gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart
from quemb.molbe.solver import DMRG_ArgsUser

# We'll consider the dissociation curve for a 1D chain of 8 H-atoms:
Expand Down Expand Up @@ -42,7 +42,7 @@
# any clear advantage to using any one scheme over another,
# the Pipek-Mezey scheme continues to be the most popular. With
# BE-DMRG, localization takes place prior to fragmentation:
fobj = FragPart(be_type="be1", mol=mol)
fobj = fragpart(be_type="be1", mol=mol)
mybe = BE(
mf,
fobj,
Expand Down Expand Up @@ -88,7 +88,7 @@
mol.charge = 0
mol.spin = 0
mol.build()
fobj = FragPart(be_type="be2", mol=mol)
fobj = fragpart(be_type="be2", mol=mol)
mybe = BE(mf, fobj, lo_method="pipek-mezey", pop_method="lowdin")

# We automatically construct the fragment DMRG schedules based on user keywords.
Expand Down
8 changes: 4 additions & 4 deletions example/molbe_h8_chemical_potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from pyscf import fci, gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart

# PySCF HF generated mol & mf (molecular desciption & HF object)
mol = gto.M(
Expand Down Expand Up @@ -33,7 +33,7 @@
# Perform BE calculations with different fragment schemes:

# Define BE1 fragments
fobj = FragPart(be_type="be1", mol=mol)
fobj = fragpart(be_type="be1", mol=mol)
# Initialize BE
mybe = BE(mf, fobj)
# Perform chemical potential optimization
Expand All @@ -45,7 +45,7 @@
print(f"*** BE1 Correlation Energy Error (%) : {err_:>8.4f} %")

# Define BE2 fragments
fobj = FragPart(be_type="be2", mol=mol)
fobj = fragpart(be_type="be2", mol=mol)
mybe = BE(mf, fobj)
mybe.optimize(solver="FCI", only_chem=True)

Expand All @@ -55,7 +55,7 @@
print(f"*** BE2 Correlation Energy Error (%) : {err_:>8.4f} %")

# Define BE3 fragments
fobj = FragPart(be_type="be3", mol=mol)
fobj = fragpart(be_type="be3", mol=mol)
mybe = BE(mf, fobj)
mybe.optimize(solver="FCI", only_chem=True)

Expand Down
6 changes: 3 additions & 3 deletions example/molbe_h8_density_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from pyscf import fci, gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart

# PySCF HF generated mol & mf (molecular desciption & HF object)
mol = gto.M(
Expand Down Expand Up @@ -33,7 +33,7 @@
# Perform BE calculations with different fragment schemes:

# Define BE2 fragments
fobj = FragPart(be_type="be2", mol=mol)
fobj = fragpart(be_type="be2", mol=mol)
mybe = BE(mf, fobj)
mybe.optimize(solver="FCI")

Expand All @@ -43,7 +43,7 @@
print(f"*** BE2 Correlation Energy Error (%) : {err_:>8.4f} %")

# Define BE3 fragments
fobj = FragPart(be_type="be3", mol=mol)
fobj = fragpart(be_type="be3", mol=mol)
mybe = BE(mf, fobj)
mybe.optimize(solver="FCI")

Expand Down
4 changes: 2 additions & 2 deletions example/molbe_hexene_oneshot_uccsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pyscf import gto, scf

from quemb.molbe import UBE, FragPart
from quemb.molbe import UBE, fragpart

# Give path to structure xyz file
structure = "data/hexene.xyz"
Expand All @@ -25,7 +25,7 @@
nproc = 1

# Initialize fragments without frozen core approximation at BE2 level
fobj = FragPart(frag_type="autogen", be_type="be2", mol=mol, frozen_core=False)
fobj = fragpart(frag_type="autogen", be_type="be2", mol=mol, frozen_core=False)
# Initialize UBE
mybe = UBE(mf, fobj)

Expand Down
4 changes: 2 additions & 2 deletions example/molbe_io_fcidump.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Illustrates how fcidump file containing fragment hamiltonian
# can be generated using be2fcidump

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart
from quemb.molbe.misc import be2fcidump, libint2pyscf
from quemb.shared.config import settings

Expand All @@ -15,7 +15,7 @@
mf.kernel()

# Construct fragments for BE
fobj = FragPart(be_type="be2", mol=mol)
fobj = fragpart(be_type="be2", mol=mol)
oct_be = BE(mf, fobj)

# Write out fcidump file for each fragment
Expand Down
4 changes: 2 additions & 2 deletions example/molbe_octane.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pyscf import cc, gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart

# Perform pyscf HF calculation to get mol & mf objects
mol = gto.M(
Expand Down Expand Up @@ -50,7 +50,7 @@
print(f"*** CCSD Correlation Energy: {ccsd_ecorr:>14.8f} Ha", flush=True)

# initialize fragments (use frozen core approximation)
fobj = FragPart(be_type="be2", mol=mol, frozen_core=True)
fobj = fragpart(be_type="be2", mol=mol, frozen_core=True)
# Initialize BE
mybe = BE(mf, fobj)

Expand Down
4 changes: 2 additions & 2 deletions example/molbe_octane_get_rdms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pyscf import gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart

# Perform pyscf HF calculation to get mol & mf objects
mol = gto.M(
Expand Down Expand Up @@ -44,7 +44,7 @@
mf.kernel()

# initialize fragments (use frozen core approximation)
fobj = FragPart(be_type="be2", mol=mol, frozen_core=True)
fobj = fragpart(be_type="be2", mol=mol, frozen_core=True)
# Initialize BE
mybe = BE(mf, fobj)

Expand Down
4 changes: 2 additions & 2 deletions example/molbe_ppp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pyscf import gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart

# Perform pyscf HF calculation to get mol & mf objects
mol = gto.M(
Expand Down Expand Up @@ -32,7 +32,7 @@
mf.kernel()

# Define fragments; use IAO scheme with 'sto-3g' as the minimal basis set
fobj = FragPart(be_type="be2", mol=mol, iao_valence_basis="sto-3g", frozen_core=True)
fobj = fragpart(be_type="be2", mol=mol, iao_valence_basis="sto-3g", frozen_core=True)

# Initialize BE
mybe = BE(mf, fobj, lo_method="iao")
Expand Down
4 changes: 2 additions & 2 deletions src/quemb/kbe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from quemb.kbe.fragment import FragPart
from quemb.kbe.fragment import fragpart
from quemb.kbe.pbe import BE

__all__ = ["FragPart", "BE"]
__all__ = ["fragpart", "BE"]
2 changes: 1 addition & 1 deletion src/quemb/kbe/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from quemb.shared.helper import copy_docstring


class FragPart:
class fragpart:
def __init__(
self,
natom=0,
Expand Down
4 changes: 2 additions & 2 deletions src/quemb/kbe/pbe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pyscf.pbc import df, gto
from pyscf.pbc.df.df_jk import _ewald_exxdiv_for_G0

from quemb.kbe.fragment import FragPart
from quemb.kbe.fragment import fragpart
from quemb.kbe.lo import Mixin_k_Localize
from quemb.kbe.misc import print_energy, storePBE
from quemb.kbe.pfrag import Frags
Expand Down Expand Up @@ -51,7 +51,7 @@ class BE(Mixin_k_Localize):
def __init__(
self,
mf: pbc.scf.hf.SCF,
fobj: FragPart,
fobj: fragpart,
eri_file: PathLike = "eri_file.h5",
lo_method: str = "lowdin",
compute_hf: bool = True,
Expand Down
4 changes: 2 additions & 2 deletions src/quemb/molbe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from quemb.molbe.fragment import FragPart
from quemb.molbe.fragment import fragpart
from quemb.molbe.mbe import BE
from quemb.molbe.ube import UBE

__all__ = ["FragPart", "BE", "UBE"]
__all__ = ["fragpart", "BE", "UBE"]
2 changes: 1 addition & 1 deletion src/quemb/molbe/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from quemb.shared.helper import copy_docstring


class FragPart:
class fragpart:
"""Fragment/partitioning definition
Interfaces two main fragmentation functions (autogen & chain) in MolBE. It defines
Expand Down
4 changes: 2 additions & 2 deletions src/quemb/molbe/mbe.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from quemb.molbe.be_parallel import be_func_parallel
from quemb.molbe.eri_onthefly import integral_direct_DF
from quemb.molbe.fragment import FragPart
from quemb.molbe.fragment import fragpart
from quemb.molbe.lo import MixinLocalize
from quemb.molbe.misc import print_energy_cumulant, print_energy_noncumulant
from quemb.molbe.opt import BEOPT
Expand Down Expand Up @@ -67,7 +67,7 @@ class BE(MixinLocalize):
def __init__(
self,
mf: scf.hf.SCF,
fobj: FragPart,
fobj: fragpart,
eri_file: PathLike = "eri_file.h5",
lo_method: str = "lowdin",
pop_method: str | None = None,
Expand Down
4 changes: 2 additions & 2 deletions src/quemb/molbe/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pyscf.lib import chkfile
from pyscf.tools import fcidump

from quemb.molbe.fragment import FragPart
from quemb.molbe.fragment import fragpart


def libint2pyscf(
Expand Down Expand Up @@ -438,7 +438,7 @@ def be2puffin(

# Finished initial reference HF: now, fragmentation step

fobj = FragPart(
fobj = fragpart(
be_type=be_type, frag_type="autogen", mol=mol, frozen_core=frozen_core
)
time_post_fragpart = time.time()
Expand Down
4 changes: 2 additions & 2 deletions src/quemb/molbe/ube.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from pyscf.scf.uhf import UHF

from quemb.molbe.be_parallel import be_func_parallel_u
from quemb.molbe.fragment import FragPart
from quemb.molbe.fragment import fragpart
from quemb.molbe.mbe import BE
from quemb.molbe.pfrag import Frags
from quemb.molbe.solver import be_func_u
Expand All @@ -33,7 +33,7 @@ class UBE(BE): # 🍠
def __init__(
self,
mf: UHF,
fobj: FragPart,
fobj: fragpart,
scratch_dir: WorkDir | None = None,
eri_file: PathLike = "eri_file.h5",
lo_method: PathLike = "lowdin",
Expand Down
4 changes: 2 additions & 2 deletions tests/chem_dm_kBE_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from numpy import eye
from pyscf.pbc import df, gto, scf

from quemb.kbe import BE, FragPart
from quemb.kbe import BE, fragpart

try:
import libdmet
Expand Down Expand Up @@ -98,7 +98,7 @@ def periodic_test(
kmf.conv_tol = 1e-12
kmf.kernel()

kfrag = FragPart(
kfrag = fragpart(
be_type=be_type, mol=cell, frag_type=frag_type, kpt=kpt, frozen_core=True
)
mykbe = BE(kmf, kfrag, kpts=kpts)
Expand Down
4 changes: 2 additions & 2 deletions tests/chempot_molBE_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from pyscf import gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart


class TestBE_restricted(unittest.TestCase):
Expand Down Expand Up @@ -52,7 +52,7 @@ def molecular_restricted_test(
):
mf = scf.RHF(mol)
mf.kernel()
fobj = FragPart(frag_type=frag_type, be_type=be_type, mol=mol)
fobj = fragpart(frag_type=frag_type, be_type=be_type, mol=mol)
mybe = BE(mf, fobj)
mybe.optimize(solver="CCSD", method="QN", only_chem=only_chem)
self.assertAlmostEqual(
Expand Down
4 changes: 2 additions & 2 deletions tests/dm_molBE_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from pyscf import gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart


class TestBE_restricted(unittest.TestCase):
Expand All @@ -31,7 +31,7 @@ def molecular_QN_test(
mf = scf.RHF(mol)
mf.max_cycle = 100
mf.kernel()
fobj = FragPart(frag_type=frag_type, be_type=be_type, mol=mol)
fobj = fragpart(frag_type=frag_type, be_type=be_type, mol=mol)
mybe1 = BE(mf, fobj)
mybe1.optimize(
solver="CCSD", method="QN", trust_region=False, only_chem=only_chem
Expand Down
4 changes: 2 additions & 2 deletions tests/dmrg_molBE_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from pyscf import gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart

try:
from pyscf import dmrgscf
Expand Down Expand Up @@ -39,7 +39,7 @@ def molecular_DMRG_test(
with tempfile.TemporaryDirectory() as tmp:
mf = scf.RHF(mol)
mf.kernel()
fobj = FragPart(frag_type=frag_type, be_type=be_type, mol=mol)
fobj = fragpart(frag_type=frag_type, be_type=be_type, mol=mol)
mybe = BE(mf, fobj, lo_method="pipek", pop_method="lowdin")
mybe.oneshot(
solver="block2",
Expand Down
4 changes: 2 additions & 2 deletions tests/eri_onthefly_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from pyscf import gto, scf

from quemb.molbe import BE, FragPart
from quemb.molbe import BE, fragpart


class TestDF_ontheflyERI(unittest.TestCase):
Expand All @@ -29,7 +29,7 @@ def test_octane_BE2(self):
mf = scf.RHF(mol)
mf.direct_scf = True
mf.kernel()
fobj = FragPart(frag_type="autogen", be_type="be2", mol=mol)
fobj = fragpart(frag_type="autogen", be_type="be2", mol=mol)
mybe = BE(mf, fobj, integral_direct_DF=True)
self.assertAlmostEqual(
mybe.ebe_hf,
Expand Down
Loading

0 comments on commit 4664380

Please sign in to comment.