Skip to content

Commit

Permalink
re-enabled rdm1 that was disabled at debug time.
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek Khedkar committed Aug 16, 2023
1 parent f9a1654 commit 03655fb
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions vayesta/misc/variational_embedding/calc_nonorth_couplings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def calc_ci_elements(ci, h1e, h2e, ovlp, mo, nmo, nocc, nact, ncore, enuc=0.0):
nstate = len(ci)
h = np.zeros((nstate, nstate))
s = np.zeros((nstate, nstate))
rdm1 = None
# rdm1 = np.zeros((nstate, nstate, nmo, nmo))
rdm1 = np.zeros((nstate, nstate, nmo, nmo))

Check warning on line 46 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L43-L46

Added lines #L43 - L46 were not covered by tests
for x in range(nstate):
for w in range(x, nstate):
# Setup biorthogonalised orbital pair
Expand Down Expand Up @@ -72,16 +71,16 @@ def calc_ci_elements(ci, h1e, h2e, ovlp, mo, nmo, nocc, nact, ncore, enuc=0.0):
s[x, w] += stmp * ci[w][iwa, iwb] * ci[x][ixa, ixb]

Check warning on line 71 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L69-L71

Added lines #L69 - L71 were not covered by tests

# Compute RDM1 contribution for this pair of determinants
# tmpPa = np.zeros((orbs.m_nmo, orbs.m_nmo))
# tmpPb = np.zeros((orbs.m_nmo, orbs.m_nmo))
# mb.evaluate_rdm1(vx[ixa], vx[ixb], vw[iwa], vw[iwb], stmp, tmpPa, tmpPb)
# rdm1[x, w] += (tmpPa + tmpPb) * ci[w][iwa, iwb] * ci[x][ixa, ixb]
tmpPa = np.zeros((orbs.m_nmo, orbs.m_nmo))
tmpPb = np.zeros((orbs.m_nmo, orbs.m_nmo))
mb.evaluate_rdm1(vx[ixa], vx[ixb], vw[iwa], vw[iwb], stmp, tmpPa, tmpPb)
rdm1[x, w] += (tmpPa + tmpPb) * ci[w][iwa, iwb] * ci[x][ixa, ixb]

Check warning on line 77 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L74-L77

Added lines #L74 - L77 were not covered by tests

# rdm1[x, w] = np.linalg.multi_dot((mo[w], rdm1[x, w], mo[x].T))
rdm1[x, w] = np.linalg.multi_dot((mo[w], rdm1[x, w], mo[x].T))

Check warning on line 79 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L79

Added line #L79 was not covered by tests

h[w, x] = h[x, w]
s[w, x] = s[x, w]
# rdm1[w, x] = rdm1[x, w].T
rdm1[w, x] = rdm1[x, w].T

Check warning on line 83 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L81-L83

Added lines #L81 - L83 were not covered by tests

return rdm1, h, s

Check warning on line 85 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L85

Added line #L85 was not covered by tests

Expand All @@ -95,8 +94,7 @@ def calc_ci_elements_uhf(ci, h1e, h2e, ovlp, mo, nmo, nocc, nact, ncore, enuc=0.
nstate = len(ci)
h = np.zeros((nstate, nstate))
s = np.zeros((nstate, nstate))
rdm1 = None
# rdm1 = np.zeros((nstate, nstate, 2, nmo, nmo))
rdm1 = np.zeros((nstate, nstate, 2, nmo, nmo))

Check warning on line 97 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L94-L97

Added lines #L94 - L97 were not covered by tests
for x in range(nstate):
for w in range(x, nstate):
# Setup biorthogonalised orbital pairs
Expand Down Expand Up @@ -130,19 +128,19 @@ def calc_ci_elements_uhf(ci, h1e, h2e, ovlp, mo, nmo, nocc, nact, ncore, enuc=0.
s[x, w] += stmp * ci[w][iwa, iwb] * ci[x][ixa, ixb]

Check warning on line 128 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L126-L128

Added lines #L126 - L128 were not covered by tests

# Compute RDM1 contribution for this pair of determinants
# tmpPa = np.zeros((orbs1.m_nmo, orbs1.m_nmo))
# tmpPb = np.zeros((orbs1.m_nmo, orbs1.m_nmo))
# mb.evaluate_rdm1(vxa[ixa], vxb[ixb], vwa[iwa], vwb[iwb], stmp, tmpPa, tmpPb)
# rdm1[x, w, 0] += tmpPa * ci[w][iwa, iwb] * ci[x][ixa, ixb]
# rdm1[x, w, 1] += tmpPb * ci[w][iwa, iwb] * ci[x][ixa, ixb]
tmpPa = np.zeros((orbs1.m_nmo, orbs1.m_nmo))
tmpPb = np.zeros((orbs1.m_nmo, orbs1.m_nmo))
mb.evaluate_rdm1(vxa[ixa], vxb[ixb], vwa[iwa], vwb[iwb], stmp, tmpPa, tmpPb)
rdm1[x, w, 0] += tmpPa * ci[w][iwa, iwb] * ci[x][ixa, ixb]
rdm1[x, w, 1] += tmpPb * ci[w][iwa, iwb] * ci[x][ixa, ixb]

Check warning on line 135 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L131-L135

Added lines #L131 - L135 were not covered by tests

# rdm1[x, w, 0] = np.linalg.multi_dot((mo2[0], rdm1[x, w, 0], mo1[0].T))
# rdm1[x, w, 0] = np.linalg.multi_dot((mo2[1], rdm1[x, w, 1], mo1[1].T))
rdm1[x, w, 0] = np.linalg.multi_dot((mo2[0], rdm1[x, w, 0], mo1[0].T))
rdm1[x, w, 0] = np.linalg.multi_dot((mo2[1], rdm1[x, w, 1], mo1[1].T))

Check warning on line 138 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L137-L138

Added lines #L137 - L138 were not covered by tests

h[w, x] = h[x, w]
s[w, x] = s[x, w]
# rdm1[w, x, 0] = rdm1[x, w, 0].T
# rdm1[w, x, 1] = rdm1[x, w, 1].T
rdm1[w, x, 0] = rdm1[x, w, 0].T
rdm1[w, x, 1] = rdm1[x, w, 1].T
return rdm1, h, s

Check warning on line 144 in vayesta/misc/variational_embedding/calc_nonorth_couplings.py

View check run for this annotation

Codecov / codecov/patch

vayesta/misc/variational_embedding/calc_nonorth_couplings.py#L140-L144

Added lines #L140 - L144 were not covered by tests


Expand Down

0 comments on commit 03655fb

Please sign in to comment.