Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculus of variations for OrbitalRadialOverlap #17

Merged
merged 2 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AngularMomentumAlgebra"
uuid = "0bb1b1ac-0216-11e9-361b-bb110c659ce1"
authors = ["Stefanos Carlström <[email protected]>"]
version = "0.3.0"
version = "0.3.1"

[deps]
AtomicLevels = "10933b4c-d60f-11e8-1fc6-bd9035a249a1"
Expand Down
18 changes: 18 additions & 0 deletions src/tensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,24 @@ EnergyExpressions.isdependent(o::OrbitalRadialOverlap, orb::O) where O = o.b ==
Base.show(io::IO, o::OrbitalRadialOverlap) =
write(io, "⟨$(o.a)|$(o.b)⟩ᵣ")

"""
diff(ab::OrbitalRadialOverlap, o::O)

Vary the orbital radial overlap ⟨a|b⟩ᵣ with respect to |o⟩.
"""
Base.diff(ab::OrbitalRadialOverlap, o::O) where O =
o == ab.b ? NBodyEquation(Conjugate(ab.a),
IdentityOperator{1}()) : 0

"""
diff(ab::OrbitalRadialOverlap, o::Conjugate{O})

Vary the orbital radial overlap ⟨a|b⟩ᵣ with respect to ⟨o|.
"""
Base.diff(ab::OrbitalRadialOverlap, o::Conjugate{O}) where O =
conj(o) == ab.a ? NBodyEquation(ab.b,
IdentityOperator{1}()) : 0

# * Tensor operators

"""
Expand Down
10 changes: 9 additions & 1 deletion test/tensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import AngularMomentumAlgebra: components, component,
RadialOperator, RadialGradientOperator,
OrbitalRadialOverlap, OrbitalRadialMatrixElement, radial_integral, integrate_spinor
import EnergyExpressions: NBodyTerm, NBodyMatrixElement, OrbitalMatrixElement
import EnergyExpressions: NBodyTerm, NBodyMatrixElement, OrbitalMatrixElement, NBodyEquation
@test system(Tensor) == FullSystem()

𝐂⁵ = SphericalTensor(5)
Expand Down Expand Up @@ -59,6 +59,14 @@
@test isdependent(oro, so"1s₀β")

@test string(oro) == "⟨1s₀α|1s₀β⟩ᵣ"

eq(orb, op, args...) = NBodyEquation(orb, op, args...)
I₁ = IdentityOperator{1}()

@test diff(oro, conj(so"1s₀α")) == eq(so"1s₀β", I₁)
@test iszero(diff(oro, conj(so"1s₀β")))
@test iszero(diff(oro, so"1s₀α"))
@test diff(oro, so"1s₀β") == eq(conj(so"1s₀α"), I₁)
end

@testset "TensorOperator" begin
Expand Down