Skip to content

Commit

Permalink
Fock changes
Browse files Browse the repository at this point in the history
  • Loading branch information
obackhouse committed Aug 7, 2023
1 parent 6599b50 commit 30f9c8b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions momentGW/pbc/fock.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ def fock_loop(
fock = integrals.get_fock(rdm1, h1e)
fock = diis.update(fock, xerr=None)

rdm1_ao = lib.einsum("kij,kpi,kqj->kpq", rdm1, gw.mo_coeff, np.conj(gw.mo_coeff))
fock_ao = gw._scf.get_fock(dm=rdm1_ao)
fock_test = lib.einsum("kpq,kpi,kqj->kij", fock_ao, np.conj(gw.mo_coeff), gw.mo_coeff)
assert np.allclose(integrals.get_fock(rdm1, h1e), fock_test)

nerr = nerr[np.argmax(np.abs(nerr))]
if niter2 > 1:
derr = np.max(np.absolute(rdm1 - rdm1_prev))
Expand Down
11 changes: 6 additions & 5 deletions momentGW/pbc/ints.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def transform(self, do_Lpq=None, do_Lpx=True, do_Lia=True):
if self._rot is None:
self._rot = self.get_compression_metric()
rot = self._rot
dtype = complex
if rot is None:
rot = np.eye(self.naux_full)

do_Lpq = self.store_full if do_Lpq is None else do_Lpq
if not any([do_Lpq, do_Lpx, do_Lia]):
Expand All @@ -140,10 +141,10 @@ def transform(self, do_Lpq=None, do_Lpx=True, do_Lia=True):
o0, o1 = 0, self.nmo
p0, p1 = 0, self.nmo_g[ki]
q0, q1 = 0, self.nocc_w[kj] * self.nvir_w[kj]
Lpq_k = np.zeros((self.naux_full, self.nmo, o1 - o0), dtype=dtype) if do_Lpq else None
Lpx_k = np.zeros((self.naux, self.nmo, p1 - p0), dtype=dtype) if do_Lpx else None
Lia_k = np.zeros((self.naux, q1 - q0), dtype=dtype) if do_Lia else None
Lai_k = np.zeros((self.naux, q1 - q0), dtype=dtype) if do_Lia else None
Lpq_k = np.zeros((self.naux_full, self.nmo, o1 - o0), dtype=complex) if do_Lpq else None
Lpx_k = np.zeros((self.naux, self.nmo, p1 - p0), dtype=complex) if do_Lpx else None
Lia_k = np.zeros((self.naux, q1 - q0), dtype=complex) if do_Lia else None
Lai_k = np.zeros((self.naux, q1 - q0), dtype=complex) if do_Lia else None

# Build the integrals blockwise
b1 = 0
Expand Down

0 comments on commit 30f9c8b

Please sign in to comment.