Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added to_cisdtq functionality to RFCI wave function types for extract… #69

Merged
merged 77 commits into from
Apr 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
81a7715
Added to_cisdtq functionality to RFCI wave function types for extract…
Nov 3, 2022
5080b65
Added cisdtq -> ccsdtq functionality for restricted wave functions
Nov 4, 2022
9e306b9
pass in tuple for t4 and c4 arguments rather than individual spin sig…
Nov 4, 2022
847f0f5
Fix string format
Nov 4, 2022
5105d8a
Update example to non-deprecated practices
Nov 12, 2022
410a320
Add OBC 1D chain of atoms constructor
Nov 12, 2022
14de2a2
WIP
Nov 12, 2022
cdff3cb
Merge remote-tracking branch 'origin/v1.0.2a' into to_cisdtq
Nov 12, 2022
bf6d8d8
Complete code for ec-cc with all hamiltonian terms from child cluster.
Nov 14, 2022
da04535
Local external correction implemented and running. Now to debug...!
Nov 15, 2022
6d187ce
fix for 2e systems
Nov 15, 2022
b8262a8
ec-cc now exact for 4-electron systems and full FCI space. Seems to b…
Nov 15, 2022
4d7381f
Energy denominators now dealt with effectively outside the callback
Nov 17, 2022
ab487aa
Address Max comments on code style. Fix bug in external-ccsdv
Nov 17, 2022
b8fd264
Added alternate equations to check consistency of EC implementation. …
Nov 18, 2022
15d4fbf
Passed in ERIs sometimes fails, as they are stored as HDF5 file, rath…
Nov 18, 2022
31f5b79
Add tests for external correction, including Hubbard model and LiH (w…
Nov 18, 2022
befe789
Add example of EC-CCSD via local FCI clusters, both for a full system…
Nov 18, 2022
4b45e16
Add example of various external corrections on the Hubbard model. Wil…
Nov 18, 2022
d46d0db
Clean up ext-corr hubbard example
Nov 20, 2022
87d34bd
Allow external correction to be used along with scmf
Nov 21, 2022
75103a7
Update Hubbard EC-CC example to print out whether converged.
Nov 21, 2022
a5dec5b
Fix for use of delta-tailoring correction with symmetry-derived fragm…
Nov 22, 2022
b174b0e
Merge. Also include test for symmetry in external corrections
Nov 22, 2022
d949b68
Update EC-CC example to use symmetry correctly. Put note in external-…
Nov 22, 2022
2549eef
Tidying in response to PR comments.
Nov 22, 2022
c341e98
Merge remote-tracking branch 'origin/v1.0.2a' into to_cisdtq
Nov 23, 2022
c8e5b2a
Merge remote-tracking branch 'origin/v1.0.2a' into to_cisdtq
Nov 24, 2022
6aaff99
Update examples and tests for (single kernel) EC
Nov 24, 2022
b70ae52
Merge branch 'v1.0.2a' into to_cisdtq
Nov 24, 2022
90e7319
WIP to prep for UHF implementation
Jan 26, 2023
c2a04c0
Code to create packed C1 -> C4 UHF arrays. Need to unpack.
Jan 27, 2023
11089bd
Add unpacking for unrestricted C amplitudes via ebcc
obackhouse Jan 27, 2023
e847618
Implemented C to T conversion for UHF
obackhouse Jan 27, 2023
5ba4933
Adds routine to build external correction in UHF
obackhouse Jan 27, 2023
6e1b83a
Enable external correction for UHF
obackhouse Jan 27, 2023
1835603
Fixes for UHF external correction
obackhouse Jan 27, 2023
8ee1b3b
Some fixes for UHF external corrections
obackhouse Jan 27, 2023
d31532c
Forgot T4 contractions
obackhouse Jan 27, 2023
65289e1
Comment
Jan 27, 2023
779e95d
Resolve merge
Feb 7, 2023
822c69f
Merge branch 'master' into to_cisdtq
Feb 7, 2023
a6b3fbd
Fix bug in array sizes
obackhouse Feb 28, 2023
4b26d22
Merge branch 'to_cisdtq' of github.com:BoothGroup/Vayesta into to_cisdtq
Feb 28, 2023
6c6138d
Allow slicing for FCI vector with empty lists
Feb 28, 2023
9e7f0f9
Refactorises conversion UHF C->T conversion routines
obackhouse Mar 1, 2023
8262222
Fixes factors in ECCC contractions
obackhouse Mar 2, 2023
701dbe3
Bugfix for C_abaa amplitudes to get EC-CC (RHF) working.
Mar 2, 2023
4645f13
added tests for unrestricted ec-cc
Mar 13, 2023
c24dea2
Resolve minor comments
obackhouse Mar 14, 2023
cc198d3
Updated ec-cc unit tests with UHF, regression
Mar 16, 2023
a3d53b9
added a testsytem variation lih_631g
Mar 16, 2023
8def64f
Fix to example 25-externally-correct.
Mar 16, 2023
b5fb8a5
Changes filename of conversion routines
obackhouse Mar 17, 2023
f6db4e4
Merge branch 'to_cisdtq' of https://github.com/BoothGroup/Vayesta int…
obackhouse Mar 17, 2023
24898b2
Cleans up conversion routines
obackhouse Mar 17, 2023
5c52285
Refactoring and cleaning
obackhouse Mar 20, 2023
cb37eeb
More cleanup and addressing reviews
obackhouse Mar 20, 2023
9d003dd
Fix bug in integral unpacking
obackhouse Mar 20, 2023
9e4dc54
Move t3v terms into separate function
obackhouse Mar 20, 2023
ff11ba5
Starting UHF t3v (buggy)
obackhouse Mar 21, 2023
cabb987
Fixes bugs in UHF external-ccsdv
obackhouse Mar 23, 2023
c98b0c5
Cleans up tests
obackhouse Mar 23, 2023
c1bca35
Fixed bug with single-site embedding in AFM systems.
cjcscott Mar 24, 2023
b0e860d
Added test for dissociated H2 with symmetry broken, reference, as wel…
cjcscott Mar 24, 2023
4806b24
fixed UHF external-ccsdv regression tests
Mar 27, 2023
d9c63e5
Merge pull request #80 from BoothGroup/fix_AFM_single_site
ghb24 Mar 27, 2023
6c04dee
Removed many redundant tests, external-fciv tests
Apr 3, 2023
859b6bf
Trigger CI build
obackhouse Apr 5, 2023
f02001c
Address Max's comments
obackhouse Apr 5, 2023
544cc66
Merge branch 'v1.0.2a' into to_cisdtq
cjcscott Apr 12, 2023
7fe0cdf
Moved to not using density fitting for dissociated UHF test. Also ens…
cjcscott Apr 14, 2023
07f2773
Remove separate options 'external-ccsdv' and 'external-fciv'.
Apr 14, 2023
54e0fa3
Update externally corrected Hubbard model exammple too.
Apr 14, 2023
9f60bcb
TODO added to improve integral transformation for delta-tailoring
Apr 14, 2023
18aa87a
Fixes for tests.
Apr 15, 2023
0c962df
Merge pull request #88 from BoothGroup/fix_h2_dissoc_test
ghb24 Apr 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions vayesta/solver/coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def _integrals_for_extcorr(fragment, fock):
if emb.spinsym == 'restricted':
occ = np.s_[:cluster.nocc_active]
vir = np.s_[cluster.nocc_active:]
govov = eris[occ,vir,occ,vir]
govov = eris[occ,vir,occ,vir] # chemical notation
fov = dot(cluster.c_active_occ.T, fock, cluster.c_active_vir)
if emb.spinsym == 'unrestricted':
oa = np.s_[:cluster.nocc_active[0]]
Expand All @@ -291,23 +291,50 @@ def _get_delta_t_for_extcorr(fragment, fock):
# to avoid storing all

wf = fragment.results.wf.as_ccsdtq()
t1, t2, t3, t4 = wf.t1, wf.t2, wf.t3, wf.t4
t1, t2, t3 = wf.t1, wf.t2, wf.t3
t4_abaa, t4_abab = wf.t4

# Get ERIs and Fock matrix
# Get ERIs and Fock matrix for the given fragment
fov, govov = _integrals_for_extcorr(fragment, fock)
# --- Make correction to T1 and T2 amplitudes
# J. Chem. Theory Comput. 2021, 17, 182−190
# [what is v_ef^mn? (em|fn) ?]
dt1 = spinalg.zeros_like(t1)
dt2 = spinalg.zeros_like(t2)

obackhouse marked this conversation as resolved.
Show resolved Hide resolved
raise NotImplementedError
if emb.spinsym == 'restricted':
# TODO: o Are the f_ov blocks just ignored? Only (ov) block contributes - check if it is zero or not.
# o If not, will need to integrate it from the spin-orbital expressions.
# o Compare to equations in literature??

# o Some terms want to be contracted with the integrals in the parent cluster. Don't pass back delta_T2,
# but quantities to contract with in parent cluster. This is option to max_coul_coup.
# o When do we want to project terms. Presumably not after contraction with integrals if we can help it?
# o For just testing of correctness, we can just do it naievely to start, as it should still be exact.

# TO TEST:
# o Exact cf FCI for four electron systems and full CCSD and FCI fragments
# o Exact cf FCI for four electron systems and full bath CCSD and FCI fragments? Or just one? (only if zero projectors?)
# o Rotate (ov) space and ensure invariant
# o Extensivity checks for separated fragments? (Two LiH clusters separated should be exact, then check approximate systems)
# --- T1
# T3 * V
# V are antisymmetrized integrals of V[i,j,a,b] = 2<ij|ab> - <ij|ba>
# Vint are the <ij|ab>
dt1 += einsum('ijab, jiupab -> up', 2.*govov - govov.transpose(0,3,2,1), self.T3)
obackhouse marked this conversation as resolved.
Show resolved Hide resolved
#dt1 += einsum('imnaef,menf->ia', t3, govov)
# --- T2
self.T3onT2 = 0.5*np.einsum('bmef, jimeaf -> ijab', (self.Vint - self.Vint.swapaxes(2,3))[v,o,v,v], self.T3) \
+ np.einsum('bmef, ijmaef -> ijab', self.Vint[v,o,v,v], self.T3) \
-0.5*np.einsum('mnje, minbae -> ijab', (self.Vint - self.Vint.swapaxes(2,3))[o,o,o,v], self.T3) \
- np.einsum('mnje, imnabe -> ijab', self.Vint[o,o,o,v], self.T3)

self.T3onT2 = self.T3onT2 + np.einsum('ijab -> jiba', self.T3onT2)



# F * T3

#dt2 += einsum('me,ijmabe->ijab', fov, t3)
# T1 * T3 * V
#dt2 += einsum('me,ijnabf,menf->ijab', t1, t3, govov)
Expand All @@ -319,6 +346,7 @@ def _get_delta_t_for_extcorr(fragment, fock):
# T4 * V
pass
elif emb.spinsym == 'unrestricted':
raise NotImplementedError
# TODO
pass
else:
Expand Down