Calculus of Variations – Implementation
Base.diff
— Functiondiff(ab::OrbitalOverlap, o::O)
Vary the orbital overlap ⟨a|b⟩ with respect to |o⟩.
diff(ab::OrbitalOverlap, o::Conjugate{O})
Vary the orbital overlap ⟨a|b⟩ with respect to ⟨o|.
diff(ome::OrbitalMatrixElement, o::O)
Vary the orbital overlap ⟨abc...|Ω|xyz...⟩ with respect to |o⟩.
diff(ome::OrbitalMatrixElement, o::Conjugate{O})
Vary the orbital overlap ⟨abc...|Ω|xyz...⟩ with respect to ⟨o|.
diff(me::NBodyMatrixElement, o::O)
Vary the NBodyMatrixElement
me
with respect to the orbital o
.
diff(E::Matrix{NBodyMatrixElement}, o::O)
Vary the matrix of NBodyMatrixElement
s with respect to the orbital o
.
Examples
julia> E = Matrix(OneBodyHamiltonian()+CoulombInteraction(),
SlaterDeterminant.([[:a, :b], [:c, :d]]))
2×2 Array{EnergyExpressions.NBodyMatrixElement,2}:
(a|a) + (b|b) - G(a,b) + F(a,b) - [a b|d c] + [a b|c d]
- [c d|b a] + [c d|a b] (c|c) + (d|d) - G(c,d) + F(c,d)
julia> diff(E, :a)
2×2 SparseArrays.SparseMatrixCSC{LinearCombinationEquation,Int64} with 2 stored entries:
[1, 1] = ⟨a|ĥ + -⟨b|[a|b] + ⟨a|[b|b]
[2, 1] = -⟨d|[c|b] + ⟨c|[d|b]
julia> diff(E, Conjugate(:b))
2×2 SparseArrays.SparseMatrixCSC{LinearCombinationEquation,Int64} with 2 stored entries:
[1, 1] = ĥ|b⟩ + -[a|b]|a⟩ + [a|a]|b⟩
[1, 2] = -[a|d]|c⟩ + [a|c]|d⟩
diff(energy_expression, orbitals)
Derive the integro-differential equations for all orbitals
, from energy_expression
. Returns a MCEquationSystem
, that gathers information on which integrals are common to all equations, for efficient equation solving.