MCSCF program
Exported functions
ElemCo.DFMCSCF.dfmcscf
— Methoddfmcscf(EC::ECInfo; direct=false)
Main body of Density-Fitted Multi-Configurational Self-Consistent-Field method
Internal functions
ElemCo.DFMCSCF.G_risj_calc
— MethodG_risj_calc(typer::Integer, types::Integer, num_MO, index_MO, fock_MO::Matrix, DFint_MO)
Calculate the Grisj tensor for the given type of indices r and s. Typer and types are the type of indices r and s, respectively: 1 for doubly occupied orbitals, 2 for singly occupied orbitals, 3 for virtual orbitals. indexMO is the index of the given type of orbitals. DFintMO is the density fitting integrals in molecular orbital basis. Return Grisj tensor.
ElemCo.DFMCSCF.G_rtsj_calc
— Methodfunction G_rtsj_calc(typer::Integer,types::Integer, num_MO, DFint_MO, D1::Matrix)
Calculate the Grtsj tensor for the given type of indices r and s. Return Grtsj tensor.
ElemCo.DFMCSCF.G_rtsu_calc
— MethodG_rtsu_calc(typer::Integer,types::Integer, num_MO, index_MO, DFint_MO, D1::Matrix, D2, fockClosed_MO::Matrix)
Calculate the Grtsu tensor for the given type of indices r and s. Return Grtsu tensor.
ElemCo.DFMCSCF.H_multiply
— MethodH_multiply(EC::ECInfo, fock_MO::Matrix, cMO::Matrix, D1::Matrix, v::Vector, num_MO, g::Vector, λ::Number, h_block::NTuple{10, Matrix{Float64}}, HessianType::Symbol)
Do the H * x calculation Depending on the Hessian type, do the calculation from unsimplified and simplified parts of blocks seperatly Calculate the first element of Hv vector, and the part of Hv from the multiplying of first element of v and g vector(first column of Hessian Matrix) Assembly the matrix the Hessian Matrix is | 0 g21'*λ g31'λ g_22'λ g32'*λ | | g21λ h2121 h2131 h2122 h2132 | | g_31λ h3121 h3131 h3122 h3132 | | g22*λ h2221 h2231 h2222 h2232 | | g32*λ h3221 h3231 h3222 h3232 | Return vector σ in the order of [σ[1];σ21;σ31;σ22;σ32]
ElemCo.DFMCSCF.Hx_SCI
— MethodHx_SCI(EC::ECInfo, fock_MO::Matrix, cMO::Matrix, x::Vector, num_MO, D1::Matrix)
Calculate the SCI part of σ which are from 3 blocks which are zero from the Hessian caclulation funcion. SOSCI, SOSCI_original, SCI Hessians need this function Return vector σ in the order of [σ21;σ31;σ22;σ32]
ElemCo.DFMCSCF.Hx_SO
— MethodHx_SO(h_3131, h_3231, h_3121, x, num_MO)
Calculate the SO part of σ which are from the 3 non-zero blocks of SO Hessian. Return vector σ in the order of [σ21;σ31;σ22;σ32]
ElemCo.DFMCSCF.Hx_common
— MethodHx_common(h_2121, h_2221, h_3221, h_2231, h_2222, h_3222, h_3232, x)
Calculate the common part of the σ which are from the 7 non-zero blocks for both SO and other simplified Hessian. Return vector σ in the order of [σ21;σ31;σ22;σ32]
ElemCo.DFMCSCF.calc_U
— Methodcalc_U(EC::ECInfo, N_MO::Integer, x::Vector)
calculate orbital-rotational matrix U (approximately unitary because of the anti-hermitian property of the R which is constructed from x
).
ElemCo.DFMCSCF.calc_g
— Methodcalc_g(EC::ECInfo, A::Matrix)
Calculate the orbital gradient g by antisymmetrizing the matrix A and rearranging the elements. The order of the elements in vector gblockwise is vectorized g21, g31, g22, g32, among which g21 = g[occ1o,occ2], g31 = g[occv,occ2], g22 = g[occ1o,occ1o], g32 = g[occv,occ1o] return vector gblockwise
ElemCo.DFMCSCF.calc_h_SCI
— Functioncalc_h_SCI(EC::ECInfo, μjL, μuL, cMO::Matrix, D1::Matrix, D2, fock_MO::Matrix, fockClosed_MO::Matrix, A::Matrix, HessianType::Symbol=:SCI)
Calculate the SCI Hessian and modified SOSCI Hessian. Modified SOSCI method includes fixed part 4 blocks, the SO part 2 blocks, the SCI version of the rest 4 blocks(including h3232), among which 3(except h3232) are caculated in Hmultiply SCI Hessian includes fixed part 4 blocks, SCI special part 6 blocks, among which 3 blocks are caculated in this function, and 3 are caculated in Hmultiply Return h2121, h3121, h3131, h2221, h2231, h2222, h3221, h3231, h3222, h3232
ElemCo.DFMCSCF.calc_h_SO
— Methodcalc_h_SO(EC::ECInfo, μjL, μuL, abL, cMO::Matrix, D1::Matrix, D2, fock_MO::Matrix, fockClosed_MO::Matrix, A::Matrix)
Calculate the Second Order Hessian. Second Order Hessian includes fixed part 4 blocks, 2 SO part blocks, the rest 4 blocks (including H3232) are calculated as SO special part, which are implemented in this function. Return h2121, h3121, h3131, h2221, h2231, h2222, h3221, h3231, h3222, h_3232
ElemCo.DFMCSCF.calc_h_SO_SCI_original
— Methodcalc_h_SO_SCI_original(EC::ECInfo, μjL, μuL, abL, cMO::Matrix, D1::Matrix, D2, fock_MO::Matrix, fockClosed_MO::Matrix, A::Matrix)
Calculate the original SOSCI Hessian. Original SOSCI Hessian includes fixed part 4 blocks, the SO part 3 blocks (including h3232), and the 3 SCI blocks. These 3 SCI blocks are returned as [1,1] zero matrix in this function, the calculation is done in the Hmultiply function. Return h2121, h3121, h3131, h2221, h2231, h2222, h3221, h3231, h3222, h3232
ElemCo.DFMCSCF.calc_realE
— Methodcalc_realE(EC::ECInfo, μuL, fockClosed_MO::Matrix, D1::Matrix, D2, cMO::Matrix)
Calculate the energy with the given density matrices and (updated) cMO, $E = (h_i^i + ^cf_i^i) + ^1D^t_u ^cf_t^u + 0.5 ^2D^{tv}_{uw} v_{tv}^{uw}$.
ElemCo.DFMCSCF.checkE_modifyTrust
— MethodcheckE_modifyTrust(E::Number, E_former::Number, E_2o::Number, trust::Number)
Check if the energy E is lower than the former energy E_former, if not, reject the update of coefficients and modify the trust region. Return reject::Bool and trust.
ElemCo.DFMCSCF.denMatCreate
— MethoddenMatCreate(EC::ECInfo)
Calculate the one particle density matrix and two particle density matrix of active electrons for high-spin determinant. D1[t,u] = $^1D^t_u = ⟨Ψ|\hat{E}^t_u|Ψ⟩ = ⟨ Ψ |∑_σ \hat{a}^†_{tσ} \hat{a}_{uσ}|Ψ⟩$, D2[t,u,v,w] = $=^2D^{tv}_{uw}=0.5 ⟨Ψ|\hat{E}^{tv}_{uw}+\hat{E}^{uv}_{tw}|Ψ⟩$, in which $\hat{E}_{tu,vw} = \hat{E}^t_u \hat{E}^v_w - δ_{uv} \hat{E}^t_w = ∑_{στ}\hat{a}^†_{tσ} \hat{a}^†_{vτ} \hat{a}_{wτ} \hat{a}_{uσ}$. Return D1 and D2.
ElemCo.DFMCSCF.dfACAS
— MethoddfACAS(EC::ECInfo, μuL, cMO::Matrix, D1::Matrix, D2, fock_MO::Matrix, fockClosed_MO::Matrix)
Calculate the A-intermediate matrix in molecular orbital basis. return matrix A[p,q]
ElemCo.DFMCSCF.dffockCAS
— MethoddffockCAS(EC::ECInfo, μνL, μjL, μuL, cMO::Matrix, D1::Matrix)
Calculate fock matrices in molecular orbital basis. fockClosed[μ,ν] = $^cf_μ^ν = h_μ^ν + 2v_{μi}^{νi} - v_{μi}^{iν}$, fock[μ,ν] = $f_μ^ν = ^cf_μ^ν + D^t_u (v_{μt}^{νu} - 0.5 v_{μt}^{uν})$. fockMO and fockClosedMO are fock and fockClosed transformed into MO basis with coefficients cMO. Return matrix fockMO and fockClosedMO.
ElemCo.DFMCSCF.h_calc_SOpart
— Methodh_calc_SOpart(num_MO, index_MO, DFint_MO, D1::Matrix, D2, fock_MO::Matrix, fockClosed_MO::Matrix, A::Matrix)
Calculate the SO version of the h tensor, including h3221, h2121. This function is used in SO, SOSCIorigin, SOSCI Hessian calculation. Return h3221, h_2121.
ElemCo.DFMCSCF.h_calc_fixed
— Methodh_calc_fixed(num_MO, index_MO, D1::Matrix, D2, fockClosed_MO::Matrix, A::Matrix, DFint_MO)
Calculate the fixed part of the h tensor, including h2221, h2231, h2222, h3222. This function is used in all the Hessian calculation. Return h2221, h2231, h2222, h3222.
ElemCo.DFMCSCF.print_initial
— Methodprint_initial(Enuc::Float64, HessianType::Symbol)
Print the information of the Hessian type
ElemCo.DFMCSCF.λTuning
— MethodλTuning(EC::ECInfo, trust::Number, maxit4λ::Integer, λmax::Number, λ::Number, h::Matrix, g::Vector)
Find the rotation parameters as the vector x in trust region, tuning λ with the norm of x in the iterations. Return λ and x.