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

Computing the expectation value of J^2 fails for non-relativistic spin-orbitals #14

Open
jagot opened this issue Sep 13, 2022 · 0 comments

Comments

@jagot
Copy link
Member

jagot commented Sep 13, 2022

Setup:

julia> using AtomicLevels

julia> using EnergyExpressions

julia> import EnergyExpressions: OrbitalMatrixElement

julia> using AngularMomentumAlgebra

julia> import AngularMomentumAlgebra: integrate_spinor

julia> 𝐉 = TotalAngularMomentum()
𝐉̂⁽¹⁾

julia> 𝐉² = 𝐉𝐉
(𝐉̂⁽¹⁾𝐉̂⁽¹⁾)

The one-body part $j_i^2$ of $J^2 = j_i^2 + \mathbf{j}_i\cdot\mathbf{j}_j$ works fine:

julia> integrate_spinor(OrbitalMatrixElement([so"ls₀α"], TensorOperator{1}(𝐉²), [so"1s₀α"]))
0.75⟨ls₀α|1s₀α⟩ᵣ

whereas the two-body part $\mathbf{j}_i\cdot\mathbf{j}_j$ does not:

julia> integrate_spinor(OrbitalMatrixElement([so"1s₀β", so"ls₀α"], TensorOperator{2}(𝐉²), [so"1s₀α", so"ks₀β"]))
ERROR: MethodError: no method matching -(::Tuple{HalfIntegers.Half{Int64}, HalfIntegers.Half{Int64}}, ::Tuple{HalfIntegers.Half{Int64}, HalfIntegers.Half{Int64}})
Closest candidates are:
  -(::LC, ::T) where {T, N, LC<:(AngularMomentumAlgebra.LinearCombination{<:T, N})} at ~/.julia/dev/AngularMomentumAlgebra/src/linear_combinations.jl:61
  -(::T, ::LC) where {T, N, LC<:(AngularMomentumAlgebra.LinearCombination{<:T, N})} at ~/.julia/dev/AngularMomentumAlgebra/src/linear_combinations.jl:64
Stacktrace:
 [1] matrix_element2(γjm₁′::Tuple{Tuple{Int64, Int64}, Tuple{HalfIntegers.Half{Int64}, HalfIntegers.Half{Int64}}}, γjm₂′::Tuple{Tuple{Int64, Int64}, Tuple{HalfIntegers.Half{Int64}, HalfIntegers.Half{Int64}}}, X::TensorScalarProduct{TotalAngularMomentum, TotalAngularMomentum}, γjm₁::Tuple{Tuple{Int64, Int64}, Tuple{HalfIntegers.Half{Int64}, HalfIntegers.Half{Int64}}}, γjm₂::Tuple{Tuple{Int64, Int64}, Tuple{HalfIntegers.Half{Int64}, HalfIntegers.Half{Int64}}})
   @ AngularMomentumAlgebra ~/.julia/dev/AngularMomentumAlgebra/src/tensor_matrix_elements.jl:451
 [2] matrix_element(::Tuple{TotalAngularMomentumSubSystem, TotalAngularMomentumSubSystem}, ::Tuple{SpinOrbital{Orbital{Int64}, Tuple{Int64, HalfIntegers.Half{Int64}}}, SpinOrbital{Orbital{Symbol}, Tuple{Int64, HalfIntegers.Half{Int64}}}}, X::TensorScalarProduct{TotalAngularMomentum, TotalAngularMomentum}, ::Tuple{SpinOrbital{Orbital{Int64}, Tuple{Int64, HalfIntegers.Half{Int64}}}, SpinOrbital{Orbital{Symbol}, Tuple{Int64, HalfIntegers.Half{Int64}}}})
   @ AngularMomentumAlgebra ~/.julia/dev/AngularMomentumAlgebra/src/tensor_matrix_elements.jl:979
 [3] dot(::Tuple{SpinOrbital{Orbital{Int64}, Tuple{Int64, HalfIntegers.Half{Int64}}}, SpinOrbital{Orbital{Symbol}, Tuple{Int64, HalfIntegers.Half{Int64}}}}, X::TensorScalarProduct{TotalAngularMomentum, TotalAngularMomentum}, ::Tuple{SpinOrbital{Orbital{Int64}, Tuple{Int64, HalfIntegers.Half{Int64}}}, SpinOrbital{Orbital{Symbol}, Tuple{Int64, HalfIntegers.Half{Int64}}}})
   @ AngularMomentumAlgebra ~/.julia/dev/AngularMomentumAlgebra/src/tensor_matrix_elements.jl:687
 [4] spin_ang_coeff(me::OrbitalMatrixElement{2, SpinOrbital{<:Orbital, Tuple{Int64, HalfIntegers.Half{Int64}}}, TensorOperator{2, TensorScalarProduct{TotalAngularMomentum, TotalAngularMomentum}}, SpinOrbital{<:Orbital, Tuple{Int64, HalfIntegers.Half{Int64}}}})
   @ AngularMomentumAlgebra ~/.julia/dev/AngularMomentumAlgebra/src/tensors.jl:304
 [5] integrate_spinor(me::OrbitalMatrixElement{2, SpinOrbital{<:Orbital, Tuple{Int64, HalfIntegers.Half{Int64}}}, TensorOperator{2, TensorScalarProduct{TotalAngularMomentum, TotalAngularMomentum}}, SpinOrbital{<:Orbital, Tuple{Int64, HalfIntegers.Half{Int64}}}})
   @ AngularMomentumAlgebra ~/.julia/dev/AngularMomentumAlgebra/src/tensors.jl:311
 [6] top-level scope
   @ REPL[11]:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant