# DSL for specifying new tensors

When specifying a new tensor type, a few functions need to be provided:

• AngularMomentumAlgebra.system(::Type{TensorType}) which returns the AngularMomentumAlgebra.System the tensor acts on,
• Base.iszero which indicates whether a reduced matrix element of the tensor vanishes without actually computing it,
• couplings which generates all sets of quantum numbers the tensor couples to from a given set of quantum numbers,
• rme which computes the actual reduced matrix element.
AngularMomentumAlgebra.identify_quantum_numbersFunction
identify_quantum_numbers(selection_rules)

Given the block of selection rules, identify the quantum numbers pertaining to the tensor under consideration. It is assumed that the left-hand side consists of a primed quantum number only, which is specified to be equal to an expression or belonging to a set/interval.

source
AngularMomentumAlgebra.recursepmFunction
recursepm(e::Expr)

Recursively expand the expression e for instances of ± and ∓, generating + and - minus branches.

source
recursepm(lhs, rhs)

Recursively expand lhs and rhs for instances of ± and ∓ and join all resulting cases into a short-circuiting || test.

source
AngularMomentumAlgebra.generate_iszeroFunction
generate_iszero(TensorType, selection_rules, selection_rules_linenum)

Generate a function for testing if the matrix element of TensorType vanishes, given a set a quantum number deduced from selection_rules, given at line number selection_rules_linenum.

source
AngularMomentumAlgebra.generate_rmeFunction
generate_rme(TensorType, selection_rules, doc, rme, rme_linenum)

Generate a function for computing the reduced matrix element of TensorType, given a set a quantum number deduced from selection_rules, along with the docstring and the definition rme, given at line number rme_linenum.

source
AngularMomentumAlgebra.generate_couplingsFunction
generate_copulings(TensorType, selection_rules, selection_rules_linenum)

Generate a function that given the quantum numbers γj generates lists of all permissible γj′ for which the reduced matrix element ⟨γj′||::TensorType||γj⟩ does not vanish. This is deduced from the selection_rules, given at line number selection_rules_linenum.

source