Compare commits
32 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
7545ebf5b5 | |
|
|
840efad148 | |
|
|
cf9de201a9 | |
|
|
37acda8fac | |
|
|
45b43728fb | |
|
|
850447a507 | |
|
|
df0b5820ea | |
|
|
1f4a648d52 | |
|
|
8ee4057f7e | |
|
|
d3a25b2ccf | |
|
|
922807eca1 | |
|
|
7cc20a9c27 | |
|
|
547be9fa98 | |
|
|
7a74745f7e | |
|
|
3d29c323d0 | |
|
|
7fdb5947a1 | |
|
|
0bcb7b3d16 | |
|
|
3f0d7566fa | |
|
|
1195e63f51 | |
|
|
b05fb757b1 | |
|
|
3b6a57c512 | |
|
|
490e94262b | |
|
|
e6f32295f5 | |
|
|
cbd0460600 | |
|
|
911143a9ca | |
|
|
8ce0f749b7 | |
|
|
700d2b4308 | |
|
|
d3726c725b | |
|
|
c831c52f78 | |
|
|
77eea9319c | |
|
|
7879f047f2 | |
|
|
0c3fb156ae |
|
|
@ -1,3 +1,9 @@
|
||||||
|
# VSCode
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# HPC scripts and logs
|
||||||
|
hpc/
|
||||||
|
|
||||||
# Calculation outputs
|
# Calculation outputs
|
||||||
*.dat
|
*.dat
|
||||||
*.csv
|
*.csv
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,8 @@ end
|
||||||
|
|
||||||
"cuTENSOR contraction and accumulation (C = A * B + C)"
|
"cuTENSOR contraction and accumulation (C = A * B + C)"
|
||||||
function contract_accumulate!(C::CuTensor, A::CuTensor, B::CuTensor)::CuTensor
|
function contract_accumulate!(C::CuTensor, A::CuTensor, B::CuTensor)::CuTensor
|
||||||
CUTENSOR.contraction!(one(eltype(C)), A.data, A.inds, CUTENSOR.CUTENSOR_OP_IDENTITY, B.data, B.inds, CUTENSOR.CUTENSOR_OP_IDENTITY,
|
cuTENSOR.contraction!(one(eltype(C)), A.data, A.inds, cuTENSOR.CUTENSOR_OP_IDENTITY, B.data, B.inds, cuTENSOR.CUTENSOR_OP_IDENTITY,
|
||||||
one(eltype(C)), C.data, C.inds, CUTENSOR.CUTENSOR_OP_IDENTITY, CUTENSOR.CUTENSOR_OP_IDENTITY)
|
one(eltype(C)), C.data, C.inds, cuTENSOR.CUTENSOR_OP_IDENTITY, cuTENSOR.CUTENSOR_OP_IDENTITY)
|
||||||
return C
|
return C
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
[TensorOperations]
|
||||||
|
precompile_workload = true
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
[deps]
|
||||||
|
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
|
||||||
|
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
|
||||||
|
NVTX = "5da4648a-3479-48b8-97b9-01cb529c0a1f"
|
||||||
|
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
|
||||||
|
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
|
||||||
|
cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1"
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
# DVR-jl
|
||||||
|
|
||||||
|
Solves the quantum $n$-body problem in finite volume (lattice) with periodic boundary conditions. Uses discrete variable representation (DVR) with optional support for complex scaling to study resonances. All details can be found in [H. Yu, N. Yapa, and S. König, Complex scaling in finite volume, Phys. Rev. C 109, 014316 (2024)](https://doi.org/10.1103/PhysRevC.109.014316).
|
||||||
|
|
||||||
|
Written in Julia with optional CUDA GPU acceleration (experimental).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Make sure you have Julia installed. Required packages can be installed with a single command:
|
||||||
|
```bash
|
||||||
|
julia --project=. -e 'import Pkg; Pkg.instantiate()'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
See `calculations/3b_bound.jl` for an example on a 3-body bound state.
|
||||||
|
See `calculations/3b_res_from_paper.jl` for an example of a 3-body resonance via complex scaling.
|
||||||
|
|
||||||
|
## Planned features
|
||||||
|
|
||||||
|
- [ ] Spin and isospin degrees of freedom for nuclear calculations
|
||||||
|
- [ ] Multi-node HPC support
|
||||||
|
- [ ] Parity and cubic symmetries ($S_4$)
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
|
||||||
|
The author gratefully acknowledges the guidance from Sebastian König.
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
include("../Hamiltonian.jl")
|
||||||
|
mode = cpu_tensor
|
||||||
|
T = Float32
|
||||||
|
|
||||||
|
V_gauss(r2) = -2 * exp(-r2 / 4)
|
||||||
|
|
||||||
|
d = 3
|
||||||
|
n = 3
|
||||||
|
N = 20
|
||||||
|
L = 15
|
||||||
|
n_imag = 1
|
||||||
|
ϕ = 0
|
||||||
|
|
||||||
|
s = system{T}(d, n, N, L)
|
||||||
|
H = Hamiltonian{T}(s, V_gauss, ϕ, n_imag, mode)
|
||||||
|
@time evals, _, info = eig(H, 5)
|
||||||
|
|
||||||
|
print(info.numops, " operations")
|
||||||
|
display(evals)
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
# 10.1007/s00601-020-01550-8
|
||||||
|
# Fig. 7
|
||||||
|
# E_R = 4.18(8)
|
||||||
|
|
||||||
|
#./En.run -d 3 -n 3 -N 16 -c pot=v_shifted_gauss,v0=2.0,r=1.5,a=3.0 -c n_eig=20 -c which=li -c tol=1e-6 -L 16 -c phi=0.3 -v
|
||||||
|
|
||||||
|
include("../Hamiltonian.jl")
|
||||||
|
mode = cpu_tensor
|
||||||
|
T = Float32 # single-precision mode
|
||||||
|
|
||||||
|
using Plots
|
||||||
|
|
||||||
|
V_gauss(r2) =
|
||||||
|
2 * exp(-((sqrt(r2) - 3) / 1.5) ^ 2)
|
||||||
|
|
||||||
|
d = 3
|
||||||
|
n = 3
|
||||||
|
N = 16
|
||||||
|
L = 16
|
||||||
|
n_imag = 0
|
||||||
|
|
||||||
|
for ϕ::T in 0.2:0.05:0.4
|
||||||
|
s = system{T}(d, n, N, L)
|
||||||
|
H = Hamiltonian{T}(s, V_gauss, ϕ, n_imag, mode)
|
||||||
|
@time evals, _, info = eig(H, 20)
|
||||||
|
|
||||||
|
print(info.numops, " operations")
|
||||||
|
display(evals)
|
||||||
|
|
||||||
|
scatter(real.(evals), imag.(evals); legend=false)
|
||||||
|
xlabel!("Re E")
|
||||||
|
ylabel!("Im E")
|
||||||
|
xlims!(0, 6)
|
||||||
|
ylims!(-0.6, 0)
|
||||||
|
savefig("temp/phi$(Int(round(ϕ * 100))).png")
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
include("../Hamiltonian.jl")
|
||||||
|
mode = cpu_tensor
|
||||||
|
T = Float32 # single-precision mode
|
||||||
|
|
||||||
|
V_gauss(r2) =
|
||||||
|
-10 * exp(-(sqrt(r2)) ^ 2)
|
||||||
|
|
||||||
|
d = 3
|
||||||
|
n = 2
|
||||||
|
N = 96
|
||||||
|
ϕ = pi/6
|
||||||
|
n_imag = 1
|
||||||
|
|
||||||
|
open("ComplexScaling-FV-P-res.dat", "w") do f
|
||||||
|
for L = range(20, 35, length=16)
|
||||||
|
println("Calculating L=", L)
|
||||||
|
s = system{T}(d, n, N, L)
|
||||||
|
H = Hamiltonian{T}(s, V_gauss, ϕ, n_imag, mode)
|
||||||
|
@time evals, _, info = eig(H, 40)
|
||||||
|
|
||||||
|
dataline = vcat([L], hcat(real.(evals), imag.(evals))'[:])
|
||||||
|
println(f, join(dataline, '\t'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
include("../Hamiltonian.jl")
|
||||||
|
mode = cpu_tensor
|
||||||
|
T = Float32 # single-precision mode
|
||||||
|
|
||||||
|
V_gauss(r2) =
|
||||||
|
-10 * exp(-(sqrt(r2)) ^ 2)
|
||||||
|
|
||||||
|
d = 3
|
||||||
|
n = 2
|
||||||
|
N = 30
|
||||||
|
L = 6
|
||||||
|
n_imag = 1
|
||||||
|
|
||||||
|
open("ComplexScaling-FV-S-bound-phi.dat", "w") do f
|
||||||
|
for ϕ = range(0.0, 0.5, length=11)
|
||||||
|
println("Calculating ϕ=", ϕ)
|
||||||
|
s = system{T}(d, n, N, L)
|
||||||
|
H = Hamiltonian{T}(s, V_gauss, ϕ, n_imag, mode)
|
||||||
|
@time evals, _, info = eig(H, 10, resonances = false)
|
||||||
|
|
||||||
|
dataline = vcat([ϕ], hcat(real.(evals), imag.(evals))'[:])
|
||||||
|
println(f, join(dataline, '\t'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
include("../Hamiltonian.jl")
|
||||||
|
mode = cpu_tensor
|
||||||
|
T = Float32 # single-precision mode
|
||||||
|
|
||||||
|
V_gauss(r2) =
|
||||||
|
2 * exp(- ((sqrt(r2)-3)/1.5) ^ 2)
|
||||||
|
|
||||||
|
d = 3
|
||||||
|
n = 2
|
||||||
|
N = 96
|
||||||
|
L = 30
|
||||||
|
n_imag = 1
|
||||||
|
|
||||||
|
open("ComplexScaling-FV-S-res-phi.dat", "w") do f
|
||||||
|
for ϕ = range(0.1, 0.6, length=26)
|
||||||
|
println("Calculating ϕ=", ϕ)
|
||||||
|
s = system{T}(d, n, N, L)
|
||||||
|
H = Hamiltonian{T}(s, V_gauss, ϕ, n_imag, mode)
|
||||||
|
@time evals, _, info = eig(H, 40, resonances = true)
|
||||||
|
|
||||||
|
dataline = vcat([ϕ], hcat(real.(evals), imag.(evals))'[:])
|
||||||
|
println(f, join(dataline, '\t'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
using Plots, Arpack
|
||||||
|
|
||||||
|
include("../helper.jl")
|
||||||
|
include("../Hamiltonian.jl")
|
||||||
|
|
||||||
|
mode = cpu_tensor
|
||||||
|
T = Float32 # single-precision mode
|
||||||
|
|
||||||
|
V_r2(c) = r2 -> c * (-5 * exp(-r2/3) + 2 * exp(-r2/10))
|
||||||
|
|
||||||
|
d = 3
|
||||||
|
n = 2
|
||||||
|
N = 48
|
||||||
|
L = 30
|
||||||
|
ϕ = pi/6
|
||||||
|
n_imag = 1
|
||||||
|
s = system{T}(d, n, N, L)
|
||||||
|
|
||||||
|
train_cs = range(0.78, 0.45, length=5)
|
||||||
|
train_ref = reverse([0.05387926313545913-0.008900278182520881im,
|
||||||
|
0.11254295298924327-0.020515067379548786im,
|
||||||
|
0.16060154707503538-0.03716539208626717im,
|
||||||
|
0.19741353362674618-0.05994519982799412im,
|
||||||
|
0.2219100763497223-0.08959449893439568im])
|
||||||
|
|
||||||
|
extrapolate_cs = range(0.38, 0.22, length=5)
|
||||||
|
extrapolate_ref = reverse([0.23165109150003316-0.12052751440975719im,
|
||||||
|
0.23190549514995962-0.1406687118589838im,
|
||||||
|
0.22763660218046278-0.1626190970863793im,
|
||||||
|
0.21807104244164865-0.18635600686249373im,
|
||||||
|
0.2020979906072586-0.21180157628258728im])
|
||||||
|
|
||||||
|
training_E = ComplexF64[]
|
||||||
|
training_vec = Array[]
|
||||||
|
exact_E = ComplexF64[]
|
||||||
|
extrapolated_E = ComplexF64[]
|
||||||
|
|
||||||
|
for c in train_cs
|
||||||
|
println("Training c=", c)
|
||||||
|
H = Hamiltonian{T}(s, V_r2(c), ϕ, n_imag, mode)
|
||||||
|
@time evals, evecs, info = eig(H, 20, resonances = true)
|
||||||
|
i = nearestIndex(evals, pop!(train_ref))
|
||||||
|
push!(training_E, evals[i])
|
||||||
|
push!(training_vec, evecs[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
N_EC = [sum(x .* y) for (x, y) in Iterators.product(training_vec, training_vec)]
|
||||||
|
|
||||||
|
for c in extrapolate_cs
|
||||||
|
println("Extrapolating c=", c)
|
||||||
|
H = Hamiltonian{T}(s, V_r2(c), ϕ, n_imag, mode)
|
||||||
|
@time evals, _, info = eig(H, 40, resonances = true)
|
||||||
|
nearestE = nearest(evals, pop!(extrapolate_ref))
|
||||||
|
push!(exact_E, nearestE)
|
||||||
|
|
||||||
|
# EC extrapolation
|
||||||
|
H_training_vec = H.(training_vec)
|
||||||
|
H_EC = [sum(x .* y) for (x, y) in Iterators.product(training_vec, H_training_vec)]
|
||||||
|
|
||||||
|
evals = eigvals(H_EC, N_EC)
|
||||||
|
push!(extrapolated_E, nearestE)
|
||||||
|
end
|
||||||
|
|
||||||
|
scatter(real.(training_E), imag.(training_E), label="training")
|
||||||
|
scatter!(real.(exact_E), imag.(exact_E), label="exact")
|
||||||
|
scatter!(real.(extrapolated_E), imag.(extrapolated_E), label="extrapolated")
|
||||||
|
savefig("temp/EC-R2R-S.pdf")
|
||||||
Loading…
Reference in New Issue