# Coupled-cluster methods

ElemCo.CoupledClusterModule

Coupled-cluster methods

The following coupled-cluster methods are implemented in ElemCo.jl:

• ccsd - closed-shell implementation, for open-shell systems defaults to uccsd,
• uccsd - unrestricted implementation,
• rccsd - restricted implementation (for high-spin RHF reference only),
• ccsd(t) - closed-shell implementation,
• dcsd - closed-shell implementation, for open-shell systems defaults to udcsd,
• udcsd - unrestricted implementation,
• rdcsd - restricted implementation (for high-spin RHF reference only),
• λccsd - calculation of Lagrange multipliers, closed-shell implementation,
• λccsd(t) - closed-shell implementation,
• λdcsd - calculation of Lagrange multipliers, closed-shell implementation.

The most efficient version of closed-shell CCSD/DCSD in ElemCo.jl combines the dressed factorization from [Kats2013] with the cckext type of factorization from [Hampel1992] and is given by

\begin{align*} \mathcal{L} &= v_{kl}^{cd} \tilde T^{kl}_{cd} + \left(\hat f_k^c + f_k^c\right) T^k_c + Λ_{ij}^{ab} \left(\hat v_{kl}^{ij} \red{+ v_{kl}^{cd} T^{ij}_{cd}}\right) T^{kl}_{ab} + Λ_{ij}^{ab} R^{ij}_{pq} δ_a^p δ_b^q \red{+Λ_{ij}^{ab} v_{kl}^{cd}T^{kj}_{ad}T^{il}_{cb}}\\ &+ Λ_{ij}^{ab} \mathcal{P}(ai;bj)\left\{\left(\hat f_a^c - \red{2\times}\frac{1}{2}v_{kl}^{cd} \tilde T^{kl}_{ad}\right)T^{ij}_{cb} - \left(\hat f_k^i + \red{2\times}\frac{1}{2}v_{kl}^{cd}\tilde T^{il}_{cd}\right)T^{kj}_{ab} \right.\\ &+ \left(\hat v_{al}^{id} + \frac{1}{2} v_{kl}^{cd}\tilde T^{ik}_{ac}\right)\tilde T^{lj}_{db} - \hat v_{ka}^{ic} T^{kj}_{cb} -\hat v_{kb}^{ic} T^{kj}_{ac} \red{-v_{kl}^{cd}T^{ki}_{da}\left(T^{lj}_{cb}-T^{lj}_{bc}\right)}\\ &\left.- R^{ij}_{pq} \left(δ_k^p δ_b^q - \frac{1}{2} δ_k^p δ_l^q T^l_b\right) T^k_a \right\} +Λ_i^a R^{ij}_{pq}\left( 2δ_a^p δ_j^q - δ_j^p δ_a^q \right) -Λ_i^a T^k_a R^{ij}_{pq}\left( 2δ_k^p δ_j^q - δ_j^p δ_k^q \right)\\ &+Λ_i^a \hat h_a^i + Λ_i^a \hat f_j^b \tilde T^{ij}_{ab} - Λ_i^a \hat v_{jk}^{ic} \tilde T^{kj}_{ca}, \end{align*}

where

$$$R^{ij}_{pq} = v_{pq}^{rs} \left(\left(T^{ij}_{ab}+T^i_a T^j_b\right)δ_r^a δ_s^b +δ_r^i T^j_b δ_s^b + T^i_a δ_r^a δ_s^j + δ_r^i δ_s^j \right).$$$

The DCSD Lagrangian is obtained by removing terms in red. Integrals with hats are dressed integrals, i.e. they are obtained by dressing the integrals with the singles amplitudes, e.g., $\hat v_{kl}^{id} = v_{kl}^{id} + v_{kl}^{cd} T^i_c$.

Lagrange multiplier equations for coupled cluster singles/doubles methods:

\begin{aligned} \frac{\partial\mathcal{L}}{\partial T^m_e}&= \left(2 v_{qm}^{pe} - v_{qm}^{ep}\right) \hat D_p^q + 2f_m^e - 2 Λ_{ij}^{eb} \hat v_{mb}^{ij} + 2 K_{mj}^{rs} \delta_r^e \left(\delta_s^j + \delta_s^b T^j_b \right) \\ &+2 D_{mj}^{kl} \hat v_{kl}^{ej} - 2 Λ_{ij}^{eb} \left(\hat v_{mb}^{cd} T^{ij}_{cd}\right) - D_d^e \hat f_m^d + D_m^k \hat f_k^e - 2 D_{id}^{el} \hat v_{ml}^{id} + 2 D_{md}^{al} \hat v_{al}^{ed}\\ &+ 2\bar D_{ic}^{ek} \hat v_{km}^{ic} - 2\bar D_{mc}^{ak} \hat v_{ka}^{ec} - Λ_{i}^{e} \hat f_{m}^{i} + Λ_{m}^{a} \hat f_{a}^{e} - Λ_i^e x_m^i - Λ_m^a x_a^e. \end{aligned}\begin{aligned} \frac{\partial\mathcal{L}}{\partial T^{mn}_{ef}}&= \tilde v_{mn}^{ef} + Λ_{ij}^{ef} \left(\hat v_{mn}^{ij} \red{+ v_{mn}^{cd} T^{ij}_{cd}}\right) \red{+ D_{mn}^{kl} v_{kl}^{ef} } + K_{mn}^{rs} \delta_r^e \delta_s^f\\ &+ \mathcal{P}(em;fn)\left\{ Λ_{mn}^{af} \left(\hat f_a^e - \red{2\times}\frac{1}{2} x_a^e\right) - Λ_{in}^{ef} \left(\hat f_m^i + \red{2\times}\frac{1}{2} x_m^i\right) \right. \\ &+ \mathcal{T}(mn) \left[\red{2\times}\frac{1}{4} v_{kn}^{ef} D_m^k - \red{2\times}\frac{1}{4} v_{mn}^{cf} D_c^e + Λ_{in}^{af}\left(\hat v_{am}^{ie} + v_{km}^{ce}\tilde T^{ik}_{ac}\right)\right.\\ &\left.+ \frac{1}{2} \left( Λ_m^e \hat f_n^f + Λ_n^a \hat v_{am}^{fe} - Λ_i^f \hat v_{nm}^{ie} \right) \right] \\ &\left.- Λ_{in}^{af} \hat v_{ma}^{ie} - Λ_{in}^{eb} \hat v_{mb}^{if} \red{-D_{nc}^{fl} v_{ml}^{ce} +\bar D_{nd}^{ek}v_{km}^{fd}} \right\},\\ \end{aligned}

with

\begin{aligned} &K_{mn}^{rs} = \hat \Lambda_{mn}^{pq} v_{pq}^{rs} \\ &\hat \Lambda_{mn}^{pq} = Λ_{mn}^{ab}\delta_a^p\delta_b^q - Λ_{mn}^{ab} T^i_a \delta_i^p \delta_b^q - Λ_{mn}^{ab} \delta_a^p T^j_b \delta_j^q + Λ_{mn}^{ab} T^i_a T^j_b \delta_i^p \delta_j^q\\ &x_m^i = \tilde T^{il}_{cd} v_{ml}^{cd} \qquad\qquad x_a^e = \tilde T^{kl}_{ac} v_{kl}^{ec}\\ &\mathcal{T}(mn) X_{mn}^{ef} = 2X_{mn}^{ef} - X_{nm}^{ef}\\ &D_{ij}^{kl} = \Lambda_{ij}^{cd} T^{kl}_{cd} \\ &D_{ib}^{aj} = \Lambda_{ik}^{ac} \tilde T^{kj}_{cb} \\ &\bar D_{ib}^{aj} = \Lambda_{ik}^{ac} T^{kj}_{cb} + \Lambda_{ik}^{ca} T^{kj}_{bc} \\ \end{aligned}

## Exported functions

ElemCo.CoupledCluster.calc_1RDMMethod
calc_1RDM(EC::ECInfo, U1, U2, T1, T2)

Calculate the 1RDM for the closed-shell CCSD or DCSD equations.

Return D1[p,q]=$D_p^q$, the 1RDM without T1 singles terms, and dD1[p,q]=$\hat D_p^q$, the 1RDM with all T1 terms included.

ElemCo.CoupledCluster.calc_1RDMMethod
calc_1RDM(EC::ECInfo, U1, U1os, U2, U2ab, T1, T2, T2ab, spin)

Calculate the spin-1RDM for the unrestricted CCSD or DCSD equations.

U1, U2, T1, T2 are the Lagrange multipliers and amplitudes for spin∈{:α,:β}, U1os are the singles Lagrange multipliers for opposite spin, and U2ab, T2ab are the αβ Lagrange multipliers and amplitudes.

Return D1[p,q]=$D_p^q$, the 1RDM without T1 singles terms, and dD1[p,q]=$\hat D_p^q$, the 1RDM with all T1 terms included.

ElemCo.CoupledCluster.calc_MP2Function
calc_MP2(EC::ECInfo, addsingles=true)

Calculate closed-shell MP2 energy and amplitudes. The amplitudes are stored in T_vvoo file. If addsingles: singles are also calculated and stored in T_vo file. Return EMp2 OutDict with keys (E, ESS, EOS, EO).

ElemCo.CoupledCluster.calc_UMP2Function
calc_UMP2(EC::ECInfo, addsingles=true)

Calculate unrestricted MP2 energy and amplitudes. The amplitudes are stored in T_vvoo, T_VVOO, and T_vVoO files. If addsingles: singles are also calculated and stored in T_vo and T_VO files. Return EMp2 OutDict with keys (E, ESS, EOS, EO).

ElemCo.CoupledCluster.calc_UMP2_energyFunction
calc_UMP2_energy(EC::ECInfo, addsingles=true)

Calculate open-shell MP2 energy from precalculated amplitudes. If addsingles: singles energy is also calculated. Return EMp2 OutDict with keys (E, ESS, EOS, EO).

ElemCo.CoupledCluster.calc_ccMethod
calc_cc(EC::ECInfo, method::ECMethod)

Calculate coupled cluster amplitudes.

Exact specification of the method is given by method. Returns energies ::OutDict with the following keys:

• "E" - correlation energy
• "ESS" - same-spin component
• "EOS" - opposite-spin component
• "EO" - open-shell component (defined as $E_{αα} - E_{ββ}$)
• "EIAS" - internal-active singles (for 2D methods)
• "EW" - singlet/triplet energy contribution (for 2D methods)
ElemCo.CoupledCluster.calc_lm_ccMethod
calc_lm_cc(EC::ECInfo, method::ECMethod)

Calculate coupled cluster Lagrange multipliers.

Exact specification of the method is given by method.

ElemCo.CoupledCluster.calc_pertTMethod
calc_pertT(EC::ECInfo, method::ECMethod; save_t3=false)

Calculate (T) correction for [Λ][U]CCSD(T)

Return ( "ET3"=(T)-energy, "ET3b"=[T]-energy)) OutDict. If save_t3 is true, the T3 amplitudes are saved in T_vvvooo file (only for closed-shell).

## Internal functions

ElemCo.CoupledCluster.calc_4idx_T3T3_XYMethod
calc_4idx_T3T3_XY(EC::ECInfo, T2, UvoX, ϵX)

Calculate $D^{ij}_{ab} = T^i_{aXY} T^j_{bXY}$ using half-decomposed imaginary-shifted perturbative triple amplitudes $T^i_{aXY}$ from T2 (and UvoX)

ElemCo.CoupledCluster.calc_D2Function
calc_D2(EC::ECInfo, T1, T2, scalepp=false)

Calculate $D^{ij}_{pq} = T^{ij}_{cd} + T^i_c T^j_d +δ_{ik} T^j_d + T^i_c δ_{jl} + δ_{ik} δ_{jl}$. Return as D[pqij]

If scalepp: D[ppij] elements are scaled by 0.5 (for triangular summation).

ElemCo.CoupledCluster.calc_D2Method
calc_D2(EC::ECInfo, T1, T2, spin::Symbol)

Calculate $^{σσ}D^{ij}_{pq} = T^{ij}_{cd} + P_{ij}(T^i_c T^j_d +δ_{ik} T^j_d + T^i_c δ_{jl} + δ_{ik} δ_{jl})$ with $P_{ij} X_{ij} = X_{ij} - X_{ji}$. Return as D[pqij]

ElemCo.CoupledCluster.calc_D2abFunction
calc_D2ab(EC::ECInfo, T1a, T1b, T2ab, scalepp=false)

Calculate $^{αβ}D^{ij}_{pq} = T^{ij}_{cd} + T^i_c T^j_d +δ_{ik} T^j_d + T^i_c δ_{jl} + δ_{ik} δ_{jl}$ Return as D[pqij]

If scalepp: D[ppij] elements are scaled by 0.5 (for triangular summation)

ElemCo.CoupledCluster.calc_ccsd_vector_times_Jacobian4abMethod
calc_ccsd_vector_times_Jacobian4ab(EC::ECInfo, U1a, U1b, U2a, U2b, U2ab, D1a, D1b; dc=false)

Calculate the left vector times the CCSD/DCSD Jacobian for αβ component. Additionally, remaining contributions to the singles residual are calculated.

Return ΔR1a, ΔR1b, R2ab

ElemCo.CoupledCluster.calc_ccsd_vector_times_Jacobian4spinMethod
calc_ccsd_vector_times_Jacobian4spin(EC::ECInfo, U1a, U1b, U2a, U2b, U2ab, D1, dD1, dD1os, spin; dc=false)

Calculate the vector times the CCSD/DCSD Jacobian for the given spin (same-spin residual for doubles). The singles residual is missing some terms which are added in calc_ccsd_vector_times_Jacobian4ab.

Return R1 and R2

ElemCo.CoupledCluster.calc_ccsdtFunction
calc_ccsdt(EC::ECInfo, useT3=false, cc3=false)

Calculate decomposed closed-shell DC-CCSDT amplitudes.

If useT3: (T) amplitudes from a preceding calculations will be used as starting guess. If cc3: calculate CC3 amplitudes.

ElemCo.CoupledCluster.calc_correlation_normMethod
calc_correlation_norm(EC::ECInfo, U1, U2)

Calculate the norm of the correlation part of the CCSD or DCSD equations using Lagrange multipliers and amplitudes.

Return $⟨Λ|Ψ⟩ = ⟨Λ_1|T_1⟩ + ⟨Λ_2|T_2+\frac{1}{2}T_1 T_1⟩$.

ElemCo.CoupledCluster.calc_correlation_normMethod
calc_correlation_norm(EC::ECInfo, U1a, U1b, U2a, U2b, U2ab)

Calculate the norm of the correlation part of the UCCSD or UDCSD equations using Lagrange multipliers and amplitudes.

Return $⟨Λ|Ψ⟩ = ⟨Λ_1|T_1⟩ + ⟨Λ_2|T_2+\frac{1}{2}T_1 T_1⟩$.

ElemCo.CoupledCluster.calc_dU2Function
calc_dU2(EC::ECInfo, T1, T12, U2, o1='o', v1='v', o2='o', v2='v')

Calculate the "dressed" $Λ_2$ for CCSD/DCSD.

T12 is the T1 amplitude for the second electron of U2 (=T1 for closed-shell and same-spin U2). Return dU2[p,q,m,n]=$Λ_{mn}^{ab}δ_a^p δ_b^q - Λ_{mn}^{ab}T^i_a δ_i^p δ_b^q - Λ_{mn}^{ab}δ_a^p T^j_b δ_j^q + Λ_{mn}^{ab}T^i_a T^j_b δ_i^p δ_j^q$.

ElemCo.CoupledCluster.calc_doubles_energyMethod
calc_doubles_energy(EC::ECInfo, T2a, T2b, T2ab)

Calculate energy for αα (T2a), ββ (T2b) and αβ (T2ab) doubles amplitudes. Returns total energy, SS, OS and Openshell contributions as OutDict with keys (E,ESS,EOS,EO).

ElemCo.CoupledCluster.calc_doubles_energyMethod
calc_doubles_energy(EC::ECInfo, T2)

Calculate coupled-cluster closed-shell doubles energy. Returns total energy, SS, OS and Openshell (0.0) contributions as OutDict with keys (E,ESS,EOS,EO).

ElemCo.CoupledCluster.calc_dressed_intsMethod
calc_dressed_ints(EC::ECInfo, T1, T12, o1::Char, v1::Char, o2::Char, v2::Char;
calc_d_vvvv=EC.options.cc.calc_d_vvvv, calc_d_vvvo=EC.options.cc.calc_d_vvvo,
calc_d_vovv=EC.options.cc.calc_d_vovv, calc_d_vvoo=EC.options.cc.calc_d_vvoo)

Dress integrals with singles amplitudes.

The singles and orbspaces for first and second electron are T1, o1, v1 and T12, o2, v2, respectively. The integrals from EC.fd are used and dressed integrals are stored as d_????. $\hat v_{ab}^{cd}$, $\hat v_{ab}^{ci}$, $\hat v_{ak}^{cd}$ and $\hat v_{ab}^{ij}$ are only calculated if requested in EC.options.cc or using keyword-arguments.

ElemCo.CoupledCluster.calc_dressed_intsMethod
calc_dressed_ints(EC::ECInfo, T1;
calc_d_vvvv=EC.options.cc.calc_d_vvvv, calc_d_vvvo=EC.options.cc.calc_d_vvvo,
calc_d_vovv=EC.options.cc.calc_d_vovv, calc_d_vvoo=EC.options.cc.calc_d_vvoo)

Dress integrals with singles.

$\hat v_{ab}^{cd}$, $\hat v_{ab}^{ci}$, $\hat v_{ak}^{cd}$ and $\hat v_{ab}^{ij}$ are only calculated if requested in EC.options.cc or using keyword-arguments.

ElemCo.CoupledCluster.calc_focklike_vT2Method
calc_focklike_vT2(EC::ECInfo, T2a::AbstractArray, T2b::AbstractArray, T2ab::AbstractArray)

Calculate the fock-like intermediates $v_{kl}^{cd} T^{il}_{cd}$ and v_{kl}^{cd} T^{kl}_{ad} required in calc_ccsd_vector_times_Jacobian for αα/ββ, and αβ amplitudes. Store as vT_oo[ki], vT_vv[ac], vT_OO[ki] and vT_VV[ac].

ElemCo.CoupledCluster.calc_hylleraasMethod
calc_hylleraas(EC::ECInfo, T1a, T1b, T2a, T2b, T2ab, R1a, R1b, R2a, R2b, R2ab)

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

ElemCo.CoupledCluster.calc_hylleraasMethod
calc_hylleraas(EC::ECInfo, T1, T2, R1, R2)

Calculate closed-shell singles and doubles Hylleraas energy. Returns total energy, SS, OS and Openshell (0.0) contributions as OutDict with keys (E,ESS,EOS,EO).

ElemCo.CoupledCluster.calc_pertT_mixedspinMethod
calc_pertT_mixedspin(EC::ECInfo, T1, T2, T1os, T2mix, spin::Symbol)

Calculate mixed-spin (T) correction for UCCSD(T) (i.e., ααβ or ββα).

spin ∈ (:α,:β) T1 and T2 are same-spin amplitudes, T1os are opposite-spin amplitudes, and T2mix are mixed-spin amplitudes with the second electron being spin, i.e., Tβα for spin == :α and Tαβ for spin == :β. Return ( "ET3"=(T)-energy, "ET3b"=[T]-energy)) OutDict.

ElemCo.CoupledCluster.calc_pertT_samespinMethod
calc_pertT_samespin(EC::ECInfo, T1, T2, spin::Symbol)

Calculate same-spin (T) correction for UCCSD(T) (i.e., ααα or βββ). spin ∈ (:α,:β)

Return ( "ET3"=(T)-energy, "ET3b"=[T]-energy)) OutDict.

ElemCo.CoupledCluster.calc_rings_vT2Method
calc_rings_vT2(EC::ECInfo, T2a::AbstractArray, T2b::AbstractArray, T2ab::AbstractArray; dc=false)

Calculate the ring intermediates required in calc_ccsd_vector_times_Jacobian $\hat y_{am}^{ie} = \hat v_{am}^{ie} - \hat v_{am}^{ei} + 2x_{am}^{ie} + v_{mL}^{eD} T^{iL}_{aD}$ and $\hat y_{Bn}^{Jf} = \hat v_{nB}^{fJ} + 2x_{Bn}^{Jf} + v_{nL}^{fD} T^{LJ}_{DB}$ and the spin-flip version of them, with $2x_{am}^{ie} = T^{il}_{ad} (v_{lm}^{de} \red{- v_{ml}^{de}})$ and $2x_{Am}^{Ie} = T^{Il}_{Ad} (v_{lm}^{de} \red{- v_{ml}^{de}})$

The intermediates are stored as vT_voov[amie], vT_VOOV[AMIE], vT_VoOv[BnJf], vT_vOoV[bNjF],

ElemCo.CoupledCluster.calc_singles_energyMethod
calc_singles_energy(EC::ECInfo, T1a, T1b; fock_only=false)

Calculate energy for α (T1a) and β (T1b) singles amplitudes. Returns total energy, SS, OS and Openshell contributions as OutDict with keys (E,ESS,EOS,EO).

ElemCo.CoupledCluster.calc_singles_energyMethod
calc_singles_energy(EC::ECInfo, T1; fock_only=false)

Calculate coupled-cluster closed-shell singles energy. Returns total energy, SS, OS and Openshell (0.0) contributions as OutDict with keys (E,ESS,EOS,EO).

ElemCo.CoupledCluster.calc_triples_decomposition_without_triplesMethod
calc_triples_decomposition_without_triples(EC::ECInfo, T2)

Decompose $T^{ijk}_{abc}$ as $U^{iX}_a U^{jY}_b U^{kZ}_c T_{XYZ}$ without explicit calculation of $T^{ijk}_{abc}$.

Compute perturbative $T^i_{aXY}$ and decompose $D^{ij}_{ab} = (T^i_{aXY} T^j_{bXY})$ to get $U^{iX}_a$.

ElemCo.CoupledCluster.calc_ΛpertT_closed_shellMethod
calc_ΛpertT_closed_shell(EC::ECInfo)

Calculate (T) correction for closed-shell ΛCCSD(T).

The amplitudes are stored in T_vvoo file, and the Lagrangian multipliers are stored in U_vvoo file. Return ( "ET3"=(T) energy, "ET3b"=[T] energy) OutDict.

ElemCo.CoupledCluster.calc_ΛpertT_mixedspinMethod
calc_ΛpertT_mixedspin(EC::ECInfo, T2, T2mix, U1, U2, U1os, U2mix, spin::Symbol)

Calculate mixed-spin (T) correction for ΛUCCSD(T) (i.e., ααβ or ββα).

spin ∈ (:α,:β) U1 and U2/T2 are same-spin Lagrange multipliers/amplitudes, U1os are opposite-spin Lagrange multipliers, and U2mix/T2mix are mixed-spin Lagrange multipliers/amplitudes with the second electron being spin, i.e., Tβα for spin == :α and Tαβ for spin == :β. Return ( "ET3"=(T)-energy, "ET3b"=[T]-energy)) OutDict.

ElemCo.CoupledCluster.calc_ΛpertT_samespinMethod
calc_ΛpertT_samespin(EC::ECInfo, T2, U1, U2, spin::Symbol)

Calculate same-spin (T) correction for ΛUCCSD(T) (i.e., ααα or βββ). spin ∈ (:α,:β)

Return ( "ET3"=(T)-energy, "ET3b"=[T]-energy)) OutDict.

ElemCo.CoupledCluster.pseudo_dressed_intsFunction
pseudo_dressed_ints(EC::ECInfo, unrestricted=false;
calc_d_vvvv=EC.options.cc.calc_d_vvvv, calc_d_vvvo=EC.options.cc.calc_d_vvvo,
calc_d_vovv=EC.options.cc.calc_d_vovv, calc_d_vvoo=EC.options.cc.calc_d_vvoo)

Save non-dressed integrals in files instead of dressed integrals.

• Kats2013D. Kats, and F.R. Manby, Sparse tensor framework for implementation of general local correlation methods, J. Chem. Phys. 138 (2013) 144101. doi:10.1063/1.4798940.
• Hampel1992C. Hampel, K.A. Peterson, and H.-J. Werner, A comparison of the efficiency and accuracy of the quadratic configuration interaction (QCISD), coupled cluster (CCSD), and Brueckner coupled cluster (BCCD) methods, Chem. Phys. Lett. 190 (1992) 1. doi:10.1016/0009-2614(92)86093-W.