# Density-fitted Coupled Cluster methods

## Internal functions

ElemCo.DFCoupledCluster.calc_3idx_svd_decompositionMethod
calc_3idx_svd_decomposition(EC::ECInfo, full_voL::AbstractArray)

Calculate $U^{iX}_a$ from $v_a^{iL}$ using SVD.

Version without holding all $v_a^{iL}$ integrals in memory. full_voL is the full 3-index integral $v_a^{iL}$ (can be mmaped).

ElemCo.DFCoupledCluster.calc_MP2_from_3idxMethod
calc_MP2_from_3idx(EC::ECInfo, voL::AbstractArray, ishift)

Calculate MP2 energy from $v_a^{iL}$.

The imaginary shift ishift is used in the denominator in the calculation of the MP2 amplitudes. Returns total energy, SS, OS and Openshell (0.0) contributions as OutDict with keys (E,ESS,EOS,EO).

ElemCo.DFCoupledCluster.calc_deco_doubles_energyMethod
calc_deco_doubles_energy(EC::ECInfo, T2)

Calculate closed-shell doubles energy using decomposed doubles amplitudes T2=$T_{XY}$ or T2=$T^{ij}_{ab}$ using density-fitted integrals.

Returns total energy, SS, OS and Openshell (0.0) contributions as OutDict with keys (E,ESS,EOS,EO).

ElemCo.DFCoupledCluster.calc_deco_hylleraasMethod
calc_deco_hylleraas(EC::ECInfo, T1, T2, R1, R2)

Calculate closed-shell singles and doubles Hylleraas energy using contravariant decomposed doubles amplitudes T2=$T_{XY}$ or full contravariant doubles amplitude T2=$T^{ij}_{ab}$.

Returns total energy, SS, OS and Openshell (0.0) contributions as OutDict with keys (E,ESS,EOS,EO).

ElemCo.DFCoupledCluster.calc_df_doubles_energyMethod
calc_df_doubles_energy(EC::ECInfo, T2)

Calculate closed-shell doubles energy using DF integrals and T2[a,b,i,j] = $T^{ij}_{ab}$.

Returns total energy, SS, OS and Openshell (0.0) contributions as OutDict with keys (E,ESS,EOS,EO).

ElemCo.DFCoupledCluster.calc_doubles_decomposition_without_doublesMethod
calc_doubles_decomposition_without_doubles(EC::ECInfo)

Decompose $T^{ij}_{ab}=U^{iX}_a U^{jY}_b T_{XY}$ without explicit calculation of $T^{ij}_{ab}$.

The decomposition is done in two steps:

1. $\bar U^{i\bar X}_a$ is calculated from $v_a^{iL}$ using SVD (with threshold CcOptions.ampsvdtol×CcOptions.ampsvdfac);
2. MP2 doubles $T^{i}_{aX}$ are calculated from $v_a^{iL}$ and $U^{iX}_a$ and again decomposed using SVD and threshold CcOptions.ampsvdtol.

The SVD-basis is rotated to pseudocanonical basis to diagonalize orbital-energy differences, $ϵ_X = U^{iX}_{a}(ϵ_a-ϵ_i)U^{iX}_a$. The imaginary shift CcOptions.deco_ishiftp is used in the denominator in the calculation of the MP2 amplitudes. The orbital energy differences are saved in file e_X. The SVD-coefficients $U^{iX}_a$ are saved in file C_voX. The starting guess for doubles $T_{XY}$ is saved in file T_XX. Return full MP2 correlation energy, SS, OS, and Openshell(0.0) (using the imaginary shift) as OutDict with keys (E,ESS,EOS,EO).

ElemCo.DFCoupledCluster.calc_svd_dcsd_residualMethod
calc_svd_dcsd_residual(EC::ECInfo, T1, T2)

Calculate decomposed closed-shell DCSD residual with $T^{ij}_{ab}=U^{iX}_a U^{jY}_b T_{XY}$ and $R_{XY}=U^{iX†}_a U^{jY†}_b R^{ij}_{ab}$. T2 contains decomposed amplitudes $T_{XY}$ or full amplitudes $T^{ij}_{ab}$.

If T2 is $T^{ij}_{ab}$, the residual is also returned in full form.

ElemCo.DFCoupledCluster.calc_voXMethod
calc_voX(EC::ECInfo; calc_vᵥᵒˣ=false, calc_vᵛₒₓ=false)

Calculate $\hat v_a^{iX} = \hat v_{ak}^{ci} U^{kX}_c$ and/or $\hat v^c_{kX} = \hat v_{ak}^{ci} U^{†a}_{kX}$ with $\hat v_{ak}^{ci} = \hat v_a^{cL} \hat v_k^{iL}$ and $U^{kX}_c$ from file C_voX.

Return a tuple (vᵥᵒˣ, vᵛₒₓ) (not calculated intermediates are empty arrays).

ElemCo.DFCoupledCluster.contravariant_deco_doublesFunction
contravariant_deco_doubles(EC::ECInfo, T2, projx=false)

Calculate contravariant doubles amplitudes $T̃^{ij}_{ab} = 2T^{ij}_{ab} - T^{ij}_{ba}$ with $T^{ij}_{ab} = U^{iX}_a U^{jY}_b T_{XY}$. If projx is true, the projected exchange is returned: $T̃_{XY} = U^{†a}_{iX} U^{†b}_{jY} T̃^{ij}_{ab}$

ElemCo.DFCoupledCluster.dress_df_fockMethod
dress_df_fock(EC::ECInfo, T1)

Dress DF fock matrix with DF 3-index integrals.

The dress-contribution is added to the original fock matrix from file f_mm. The dressed fock matrix is stored in file df_mm. Additionally, the coulomb and exchange dressing contributions to $\hat f_k^c$ are stored in files dfc_ov and dfe_ov.

ElemCo.DFCoupledCluster.gen_vₓˣᴸMethod
gen_vₓˣᴸ(EC::ECInfo)

Generate $v_X^{X'L} = v_a^{cL} U^{†a}_{kX} U^{kX'}_c$ using bare integrals.

The integrals and the SVD-coefficients are read from files mmL and C_voX, and the result is stored in file X^XL.

ElemCo.DFCoupledCluster.get_ssv_osvˣˣMethod
get_ssv_osvˣˣ(EC::ECInfo)

Return $ssv^{XY} = U^{kX}_c U^{lX}_d (v_{kl}^{cd} - v_{lk}^{cd} )$ and $osv^{XY} = U^{kX}_c U^{lX}_d v_{kl}^{cd}$ with $v_{kl}^{cd} = v_k^{cL} v_l^{dL'}δ_{LL'}$.

The integrals will be read from files ssd_^XX and osd_^XX. If the files do not exist, the integrals will be calculated and stored in files ssd_^XX and osd_^XX. vk^{cL} and U^{kX}c are read from files d_ovL and C_voX.