Skip to content

Commit

Permalink
Modify examples
Browse files Browse the repository at this point in the history
  • Loading branch information
basilib committed Mar 27, 2024
1 parent 563c1bf commit 1a2b802
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions examples/ewdmet/01-sc-qp-ewdmet-hubbard1d-exact-limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
solver = MixedMBLGF(solverh, solverp)
solver.kernel()
se = solver.get_self_energy()
solver = AuxiliaryShift(th[1]+tp[1], se, natom, log=NullLogger())
solver = AuxiliaryShift(th[1]+tp[1], se, nelec, log=NullLogger())
solver.kernel()
static_potential = se.as_static_potential(mf.mo_energy, eta=1e-2)
gf = solver.get_greens_function()
Expand All @@ -43,7 +43,7 @@
sc = mf.get_ovlp() @ mf.mo_coeff
new_fock = sc @ (th[1] + tp[1] + static_potential) @ sc.T
e, mo_coeff = np.linalg.eigh(new_fock)
chempot = (e[natom//2-1] + e[natom//2] ) / 2
chempot = (e[nelec//2-1] + e[nelec//2] ) / 2
gf_static = Lehmann(e, mo_coeff, chempot=chempot)

gap = lambda gf: gf.physical().virtual().energies[0] - gf.physical().occupied().energies[-1]
Expand All @@ -53,7 +53,9 @@
# QP-EwDMET GF
opts = dict(sc=False, store_hist=True, aux_shift=True, store_scfs=True, diis=True, damping=0, static_potential_conv_tol=1e-6, use_sym=False, eta=1e-2)
emb = vayesta.ewf.EWF(mf, solver='FCI', bath_options=dict(bathtype='full', dmet_threshold=1e-12), solver_options=dict(conv_tol=1e-15, n_moments=nmom_max_fci))
emb.qpewdmet_scmf(proj=1, maxiter=1000, **opts)
emb.qpewdmet_scmf(proj=1, maxiter=10, **opts)
nimages = [nsite//nfrag, 1, 1]
emb.symmetry.set_translations(nimages)
with emb.site_fragmentation() as f:
f.add_atomic_fragment(range(nfrag))
emb.kernel()
Expand Down
10 changes: 5 additions & 5 deletions examples/ewdmet/03-sc-qp-ewdmet-hubbard1d-bethe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
from dyson import Lehmann, FCI, CCSD

u = 3
natom = 128
nelec = natom
nsite = 128
nelec = nsite
nfrag = 2
nmom_max_bath = 1
nmom_max_fci = (4,4)
solv = 'FCI'
EXPR = FCI if solv=='FCI' else CCSD
hubbard = Hubbard1D(nsite=natom, nelectron=nelec, hubbard_u=u, verbose=0)
hubbard = Hubbard1D(nsite=nsite, nelectron=nelec, hubbard_u=u, verbose=0)
mf = LatticeRHF(hubbard)
mf.kernel()

chempot = (mf.mo_energy[natom//2-1] + mf.mo_energy[natom//2] ) / 2
chempot = (mf.mo_energy[nsite//2-1] + mf.mo_energy[nsite//2] ) / 2
gf_hf = Lehmann(mf.mo_energy, np.eye(mf.mo_coeff.shape[0]), chempot=chempot)


emb = vayesta.ewf.EWF(mf, solver=solv, bath_options=dict(bathtype='ewdmet', max_order=nmom_max_bath, order=nmom_max_bath, dmet_threshold=1e-12), solver_options=dict(conv_tol=1e-12, n_moments=nmom_max_fci))
emb.qpewdmet_scmf(proj=2, maxiter=10)
nimages = [natom//nfrag, 1, 1]
nimages = [nsite//nfrag, 1, 1]
emb.symmetry.set_translations(nimages)
with emb.site_fragmentation() as f:
f.add_atomic_fragment(list(range(nfrag)))
Expand Down

0 comments on commit 1a2b802

Please sign in to comment.