Coupled-cluster tools
ElemCo.CCTools
— ModuleCCTools
A collection of tools for working with coupled cluster theory.
Exported functions
ElemCo.CCTools.calc_HF_energy
— Methodcalc_HF_energy(EC::ECInfo, closed_shell)
Calculate HF energy from FCIDump and EC info.
ElemCo.CCTools.calc_ab_doubles_dot
— Methodcalc_ab_doubles_dot(T2, T2_)
Calculate dot of unrestricted αβ doubles amplitudes.
ElemCo.CCTools.calc_contra_doubles_norm
— Methodcalc_contra_doubles_norm(T2a, T2b, T2ab)
Calculate squared norm of unrestricted doubles amplitudes (the same as calc_doubles_norm
)
ElemCo.CCTools.calc_contra_doubles_norm
— Methodcalc_contra_doubles_norm(T2)
Calculate squared norm of closed-shell contravariant doubles amplitudes.
ElemCo.CCTools.calc_contra_singles_norm
— Methodcalc_contra_singles_norm(T1a, T1b)
Calculate squared norm of unrestricted singles amplitudes (same as calc_singles_norm(T1a, T1b)
).
ElemCo.CCTools.calc_contra_singles_norm
— Methodcalc_contra_singles_norm(T1)
Calculate squared norm of closed-shell contravariant singles amplitudes.
ElemCo.CCTools.calc_cs_doubles_dot
— Methodcalc_cs_doubles_dot(T2, T2_)
Calculate dot of closed-shell doubles amplitudes.
ElemCo.CCTools.calc_cs_singles_dot
— Methodcalc_cs_singles_dot(T1, T1_)
Calculate dot product of closed-shell singles amplitudes.
ElemCo.CCTools.calc_cs_triples_dot
— Methodcalc_cs_triples_dot(T3, T3_)
Calculate dot of closed-shell triples amplitudes.
ElemCo.CCTools.calc_deco_doubles_norm
— Functioncalc_deco_doubles_norm(T2, tT2=Float64[])
Calculate squared norm of doubles (for decomposed doubles: without contravariant!) T2 are decomposed doubles amplitudes T2[X,Y]
=$T_{XY}$ or full doubles amplitudes T2[a,b,i,j]
=$T^{ij}_{ab}$.
If the contravariant amplitude tT2
is provided, the norm will be calculated as $T_{XY} T̃_{XY}$.
ElemCo.CCTools.calc_deco_triples_norm
— Methodcalc_deco_triples_norm(T3)
Calculate a simple norm of triples (without contravariant!)
ElemCo.CCTools.calc_doubles_norm
— Methodcalc_doubles_norm(T2a, T2b, T2ab)
Calculate squared norm of unrestricted doubles amplitudes.
ElemCo.CCTools.calc_doubles_norm
— Methodcalc_doubles_norm(T2)
Calculate squared norm of closed-shell doubles amplitudes.
ElemCo.CCTools.calc_fock_matrix
— Methodcalc_fock_matrix(EC::ECInfo, closed_shell)
Calculate fock matrix from FCIDump
ElemCo.CCTools.calc_mixedspin_triples_dot
— Methodcalc_mixedspin_triples_dot(T3, T3_)
Calculate dot of unrestricted mixed-spin triples amplitudes.
ElemCo.CCTools.calc_samespin_doubles_dot
— Methodcalc_samespin_doubles_dot(T2, T2_)
Calculate dot of unrestricted same-spin doubles amplitudes.
ElemCo.CCTools.calc_samespin_triples_dot
— Methodcalc_samespin_triples_dot(T3, T3_)
Calculate dot of unrestricted same-spin triples amplitudes.
ElemCo.CCTools.calc_singles_energy_using_dfock
— Methodcalc_singles_energy_using_dfock(EC::ECInfo, T1; fock_only=false)
Calculate coupled-cluster closed-shell singles energy using dressed fock matrix.
if fock_only
is true, the energy will be calculated using only non-dressed fock matrix. Returns total energy, SS, OS, and Openshell (0.0) contributions as OutDict
with keys (E
, ESS
, EOS
, EO
).
ElemCo.CCTools.calc_singles_norm
— Methodcalc_singles_norm(T1a, T1b)
Calculate squared norm of unrestricted singles amplitudes.
ElemCo.CCTools.calc_singles_norm
— Methodcalc_singles_norm(T1)
Calculate squared norm of closed-shell singles amplitudes.
ElemCo.CCTools.calc_triples_norm
— Methodcalc_triples_norm(T3aaa, T3bbb, T3abb, T3aab)
Calculate squared norm of unrestricted triples amplitudes.
ElemCo.CCTools.calc_triples_norm
— Methodcalc_triples_norm(T3)
Calculate squared norm of triples amplitudes.
ElemCo.CCTools.calc_u_singles_dot
— Methodcalc_u_singles_dot(T1, T1_)
Calculate dot of unrestricted singles amplitudes.
ElemCo.CCTools.clean_cs_triples!
— Methodclean_cs_triples!(T3)
Clean closed-shell triples amplitudes by setting $T^{iii}_{abc} = T^{ijk}_{aaa} = 0$.
ElemCo.CCTools.contra2covariant
— Methodcontra2covariant(T2)
Transform contravariant doubles amplitudes to covariant.
ElemCo.CCTools.read_starting_guess4amplitudes
— Methodread_starting_guess4amplitudes(EC::ECInfo, ::Val{level}, spins...)
Read starting guess for excitation level
.
The guess will be read from T_vo
, T_VO
, T_vvoo
etc files. If the file does not exist, the guess will be a zeroed-vector.
ElemCo.CCTools.save_current_doubles
— Methodsave_current_doubles(EC::ECInfo, T2a, T2b, T2ab; prefix="T")
Save current doubles amplitudes T2a
, T2b
, and T2ab
to files prefix*"_vvoo"
, prefix*"_VVOO"
, and prefix*"_vVoO"
ElemCo.CCTools.save_current_doubles
— Methodsave_current_doubles(EC::ECInfo, T2; prefix="T")
Save current doubles amplitudes T2
to file prefix*"_vvoo"
ElemCo.CCTools.save_current_singles
— Methodsave_current_singles(EC::ECInfo, T1a, T1b; prefix="T")
Save current singles amplitudes T1a
and T1b
to files prefix*"_vo"
and prefix*"_VO"
ElemCo.CCTools.save_current_singles
— Methodsave_current_singles(EC::ECInfo, T1; prefix="T")
Save current singles amplitudes T1
to file prefix*"_vo"
ElemCo.CCTools.save_or_start_file
— Functionsave_or_start_file(EC::ECInfo, type, excitation_level, save=true)
Return filename and description for saving or starting amplitudes/lagrange multipliers.
type
is either "T"
for amplitudes or "LM"
for Lagrange multipliers. excitation_level
is the excitation level of the amplitudes (1, 2 etc.) If save
is true, the filename for saving is returned, otherwise the filename for starting.
ElemCo.CCTools.spin_project!
— Methodspin_project!(EC::ECInfo, T1a, T1b, T2a, T2b, T2ab)
Spin-project singles and doubles amplitudes/residuals.
Only possible for high-spin states.
ElemCo.CCTools.spin_project_amplitudes
— Functionspin_project_amplitudes(EC::ECInfo, with_singles=true)
Spin-project singles (if withsingles) and doubles amplitudes from files `"Tvo",
"TVO",
"Tvvoo",
"TVVOO"and
"TvVoO"`.
ElemCo.CCTools.transform_amplitudes2lagrange_multipliers!
— Methodtransform_amplitudes2lagrange_multipliers!(Amps1, Amps2)
Transform amplitudes to first guess for Lagrange multipliers.
The amplitudes are transformed in-place.
ElemCo.CCTools.triples_4ext!
— Methodtriples_4ext!(EC::ECInfo, R3, T3)
Calculate 4-external contraction with triples amplitudes and store the result in R3
.
ElemCo.CCTools.try2save_amps!
— Methodtry2save_amps!(EC::ECInfo, ::Val{excitation_level}, amps...; type="T")
Save amplitudes (type="T") or Lagrange multipliers (type="LM") to file EC.options.cc.save[_lm]*"_excitation_level"
.
ElemCo.CCTools.try2save_doubles!
— Methodtry2save_doubles!(EC::ECInfo, doubles...; type="T")
Save doubles amplitudes (type="T") or Lagrange multipliers (type="LM") to file EC.options.cc.save[_lm]*"_2"
.
ElemCo.CCTools.try2save_singles!
— Methodtry2save_singles!(EC::ECInfo, singles...; type="T")
Save singles amplitudes (type="T") or Lagrange multipliers (type="LM") to file EC.options.cc.save[_lm]*"_1"
.
ElemCo.CCTools.try2start_amps
— Methodtry2start_amps(EC::ECInfo, ::Val{excitation_level}; type="T")
Read amplitudes (type="T") or Lagrange multipliers (type="LM") from file EC.options.cc.start[_lm]*"_excitation_level"
.
ElemCo.CCTools.try2start_doubles
— Methodtry2start_doubles(EC::ECInfo; type="T")
Read doubles amplitudes (type="T") or Lagrange multipliers (type="LM") from file EC.options.cc.start[_lm]*"_2"
.
ElemCo.CCTools.try2start_singles
— Methodtry2start_singles(EC::ECInfo; type="T")
Read singles amplitudes (type="T") or Lagrange multipliers (type="LM") from file EC.options.cc.start[_lm]*"_1"
.
ElemCo.CCTools.update_deco_doubles
— Methodupdate_deco_doubles(EC, R2; use_shift=true)
Update decomposed doubles amplitudes.
If R2
is $R^{ij}_{ab}$, the update is calculated using update_doubles(EC, R2, use_shift=use_shift)
.
ElemCo.CCTools.update_deco_triples
— Functionupdate_deco_triples(EC, R3, use_shift=true)
Update decomposed triples amplitudes.
Note that the sign of the residual is opposite to the usual definition of the triples residual and therefore the update is calculated using a positive denominator...
ElemCo.CCTools.update_doubles
— Functionupdate_doubles(R2, ϵo1, ϵv1, ϵo2, ϵv2, shift)
Calculate update for doubles amplitudes.
ElemCo.CCTools.update_doubles!
— Methodupdate_doubles!(EC::ECInfo, T2, R2)
Update doubles amplitudes in T2
with R2
.
ElemCo.CCTools.update_doubles!
— Methodupdate_doubles!(EC::ECInfo, T2a, T2b, T2ab, R2a, R2b, R2ab)
Update doubles amplitudes in T2a
, T2b
, T2ab
with R2a
, R2b
, R2ab
.
ElemCo.CCTools.update_doubles
— Methodupdate_doubles(EC::ECInfo, R2; spincase::Symbol=:α, antisymmetrize=false, use_shift=true)
Calculate update for doubles amplitudes for a given spincase
∈{:α
,:β
,:αβ
}.
ElemCo.CCTools.update_singles!
— Methodupdate_singles!(EC::ECInfo, T1, R1)
Update singles amplitudes in T1
with R1
.
ElemCo.CCTools.update_singles!
— Methodupdate_singles!(EC::ECInfo, T1a, T1b, R1a, R1b)
Update singles amplitudes in T1a
, T1b
with R1a
, R1b
.
ElemCo.CCTools.update_singles
— Methodupdate_singles(R1, ϵo, ϵv, shift)
Calculate update for singles amplitudes.
ElemCo.CCTools.update_singles
— Methodupdate_singles(EC::ECInfo, R1; spincase::Symbol=:α, use_shift=true)
Calculate update for singles amplitudes for a given spincase
∈{:α
,:β
}.
ElemCo.CCTools.update_triples!
— Methodupdate_triples!(EC::ECInfo, T3, R3)
Update triples amplitudes in T3
, with R3
.
ElemCo.CCTools.update_triples!
— Methodupdate_triples!(EC::ECInfo, T3a, T3b, T3aab, T3abb, R3a, R3b, R3aab, R3abb)
Update triples amplitudes in T3a
, T3b
, T3aab
and T3abb
with R3a
, R3b
, R3aab
and R3abb
.
Internal functions
ElemCo.CCTools.add_singles2doubles!
— Methodadd_singles2doubles!(T2aa, T2bb, T2ab, T1a, T1b)
Add singles to doubles amplitudes.
ElemCo.CCTools.add_singles2doubles!
— Methodadd_singles2doubles!(T2, T1; make_contravariant=true)
Add singles to doubles amplitudes.
If make_contravariant
is true, the amplitudes will be made contravariant.
ElemCo.CCTools.update_triples
— Methodupdate_triples(R3, ϵo1, ϵv1, ϵo2, ϵv2, ϵo3, ϵv3, shift)
Calculate update for triples amplitudes.
ElemCo.CCTools.update_triples
— Methodupdate_triples(EC::ECInfo, R3; spincase::Symbol=:α, antisymmetrize=false, use_shift=true)
Calculate update for triples amplitudes for a given spincase
∈{:α
,:β
,:ααβ
,:αββ
}.