BergEC-jl/test/OSBRACKETS.jl

43 lines
1.3 KiB
Julia
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# compile using
# gfortran -shared -fPIC osbrac.f90 -o osbrac.so
# gfortran -shared -fPIC allosbrac.f90 -o allosbrac.so
println("OSBRACKETS test against Brody et al.")
Emax = 3
Λ = 1
l1 = 1
l2 = 2
ϵ = (Emax - Λ) % 2
N = (l1 - l2 + Λ - ϵ) ÷ 2
M = (l1 + l2 - Λ - ϵ) ÷ 2
L = Λ
NQMAX = Emax
CO = 1/sqrt(2)
SI = 1/sqrt(2)
FIRSTCALL = true
# from source: BRAC(NP,N1P,MP,N1,N2) with dimensions BRAC(0:L,0:(NQMAX-L)/2,0:(NQMAX-L)/2,0:(NQMAX-L)/2,0:(NQMAX-L)/2)
BRAC = zeros(Float64, L + 1, (NQMAX - L) ÷ 2 + 1,(NQMAX - L) ÷ 2 + 1,(NQMAX - L) ÷ 2 + 1,(NQMAX - L) ÷ 2 + 1)
@ccall "../OSBRACKETS/osbrac.so".osbrac_(N::Ref{Int32},M::Ref{Int32},L::Ref{Int32},NQMAX::Ref{Int32},CO::Ref{Float64},SI::Ref{Float64},FIRSTCALL::Ref{UInt8},BRAC::Ptr{Array{Float64}})::Cvoid
function get_bracket(n1, l1, n2, l2, n1, n2)
Nq = l1 + l2 + 2 * (n1 + n2)
Nq = l1 + l2 + 2 * (n1 + n2)
if Nq Nq; return 0; end
N = (l1 - l2 + Λ - ϵ) ÷ 2
N1 = n1
M = (l1 + l2 - Λ - ϵ) ÷ 2
N1 = n1
N2 = n2
return BRAC[N + 1, N1 + 1, M + 1, N1 + 1, N2 + 1]
end
test_n = [0 0 0 0 1 1]
test_l = [0 1 1 2 0 1]
test_N = [1 0 1 0 0 0]
test_L = [1 2 0 1 1 0]
bracs = get_bracket.(test_n, test_l, test_N, test_L, 0, 0)
display(bracs)