Common routines
AngularMomentumAlgebra.∏ — Function∏(ℓs...)Calculates √((2ℓ₁+1)(2ℓ₂+1)...(2ℓₙ+1)), which is a common factor in angular momentum algebra.
AngularMomentumAlgebra.triangle_range — Functiontriangle_range(a,b)Find all k such that |a-b| ≤ k ≤ a + b. This is useful when expanding matrix elements of tensors between angular momenta a and b in multipoles k; triangle_range can then be used to decided which multipole terms are required.
AngularMomentumAlgebra.powneg1 — Functionpowneg1(k) = (-)ᵏCalculates powers of negative unity for integer k.
AngularMomentumAlgebra.jmⱼ — Functionjmⱼ(o::SpinOrbital)Return the angular momentum and its projection on the z axis of the spin-orbital o.
AngularMomentumAlgebra.spin — Functionspin(o::SpinOrbital)Return the spin of the spin-orbital o.
AngularMomentumAlgebra.LinearCombination — TypeLinearCombination(Ts::Vector{T}, coeffs::Vector{N})Represents a general linear combination of objects of type T.
AngularMomentumAlgebra.@linearly_combinable — Macro@linearly_combinable TTTurns the type TT into a linearly combinable type, i.e. defines arithmetic operators.
Examples
julia> @linearly_combinable Symbol
julia> 4*(:x) - 5*(:y)
4 :x - 5 :yAngularMomentumAlgebra.@δ — Macro@δ (a,b)[, (c,d) ...]Kronecker $\delta_{ab}\delta_{cd}...$ that tests each pair of values for equality and quick-returns 0 at the first inequality. Thus intended usage is within a function body, and not as part of an expression.
Example
julia> import AngularMomentumAlgebra: @δ
julia> function my_function(a,b)
@δ a,b # Quick-returns unless a and b are equal
sin(a)
end
my_function (generic function with 1 method)
julia> my_function(1,1)
0.8414709848078965
julia> my_function(1,0)
0AngularMomentumAlgebra.couplings — Methodcouplings(j₁, m₁, j₂, m₂)Return all j, m for which the Clebsch–Gordan coefficient ⟨j₁m₁ j₂m₂|jm⟩ is non-zero.