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

Update to Julia 1.10 synthax #2

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
1,434 changes: 1,434 additions & 0 deletions Manifest.toml

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name = "Mbo"
uuid = "abb35812-7e48-465d-8fd2-5263f57cc2e0"
authors = ["Samuel Palato <>"]
version = "0.1.0"

[deps]
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Rsvg = "c4c386cf-5103-5370-be45-f3a111cca3b8"
Runner = "847b7089-1ebf-4e83-b33e-c3c97d2ccb04"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"

[compat]
julia = "1.10"

[workspace]
projects = ["test", "src"]
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,22 @@ tell me if it breaks!)
Once julia is installed, open `julia` and type:

```julia
julia> Pkg.clone("https://github.com/spalato/Mbo.jl")
julia> ]
```

Then
```julia
@v1.10 pkg> activate /path/to this repository/
```
Your terminal should then look like

```julia
Mbo.jl pkg>
```
Finally precompile the package with

```julia
Mbo.jl pkg> precompile
```

Documentation
Expand Down
4 changes: 0 additions & 4 deletions REQUIRE

This file was deleted.

28 changes: 14 additions & 14 deletions examples/aimd_full/linear_xcf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end
function run(args)
t0 = now()
cfgf = args[1]
info("Loading parameters from $(cfgf)")
@info("Loading parameters from $(cfgf)")
cfg = open(YAML.load, cfgf)
states_fn = cfg["states_fn"]
cf_fn = cfg["cf_fn"]
Expand All @@ -26,17 +26,17 @@ t2 = convert.(Float64, cfg["t2"])
t3 = convert.(Float64, cfg["t3"])
σ = cfg["sigma"]

info("Loading energies from $states_fn")
@info("Loading energies from $states_fn")
states = readdlm(states_fn)
energies = states[:,1]
tdm = states[:,2]
info("States count: $(size(states)[1])")
info("Loading CF from $cf_fn")
@info("States count: $(size(states)[1])")
@info("Loading CF from $cf_fn")
cfs = parse_cf(cf_fn)
info("CF count: $(length(cfs))")
@info("CF count: $(length(cfs))")

# build system
info("Building system...")
@info("Building system...")
t0_sys = now()
s = System("G")
#energy!(s, "G", 0)
Expand All @@ -57,33 +57,33 @@ for (i, j) in keys(cfs)
lut = LineshapeLUT(t->(GriddedCF(cfs[i,j], dt)(t)+g_inhomo(t, ev2angphz(σ))), lut_grid)
lineshape!(s, ti, tj, lut)
end
info(" Took $(now()-t0_sys)")
info("Number of order 1 Hilbert Paths: $(length(collect(hilbert_paths(s, 1))))")
info("Number of order 3 Hilbert Paths: $(length(collect(hilbert_paths(s, 3))))")
@info(" Took $(now()-t0_sys)")
@info("Number of order 1 Hilbert Paths: $(length(collect(hilbert_paths(s, 1))))")
@info("Number of order 3 Hilbert Paths: $(length(collect(hilbert_paths(s, 3))))")

grd_lin = TimeGrid(t1)

t0_calc = now()
out_root = cfg["rootname"]

# compute them separately
totlin = zeros(Complex128, size(grd_lin))
totlin = zeros(ComplexF64, size(grd_lin))
for p in hilbert_paths(s, 1)
rlin = linear(grd_lin, s, p)
#writedlm(out_root*"_lin_$(p.p[2]).txt", [grid(grd_lin)[1] real(rlin) imag(rlin)])
totlin += rlin
end
info("Saving to $(out_root)_rlin.txt")
@info("Saving to $(out_root)_rlin.txt")
writedlm("$(out_root)_rlin.txt", [grid(grd_lin)[1] real(totlin) imag(totlin)])

totlin[1] *= 0.5
s_lin = fftshift(ifft(totlin))
f_lin = fftshift(fftfreq(size(grd_lin)[1], 1/(grd_lin.times[1][2]-grd_lin.times[1][1])))
info("Saving linear spectrum to $(out_root)_slin.txt")
@info("Saving linear spectrum to $(out_root)_slin.txt")
writedlm("$(out_root)_slin.txt", [f_lin real(s_lin) imag(s_lin)])

info(" Took $(now()-t0_calc)")
info("Total runtime: $(now()-t0)")
@info(" Took $(now()-t0_calc)")
@info("Total runtime: $(now()-t0)")
end # run

run(ARGS)
8 changes: 4 additions & 4 deletions examples/aimd_full/spec_abs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ function run(cfgf, root, outf)
inf_n = root*"_sn.bin"
in_r = open(inf_r, "r+")
in_n = open(inf_n, "r+")
s_r = Mmap.mmap(in_r, Array{Complex128, 3}, sz)
s_n = Mmap.mmap(in_n, Array{Complex128, 3}, sz)
s_r = Mmap.mmap(in_r, Array{ComplexF64, 3}, sz)
s_n = Mmap.mmap(in_n, Array{ComplexF64, 3}, sz)
out = open(outf, "w+")
try
spec_abs = Mmap.mmap(out, Array{Complex128, 3}, sz)
spec_abs = Mmap.mmap(out, Array{ComplexF64, 3}, sz)
spec_abs[:] = copy(s_n)
spec_abs[2:end,:,:] += flipdim(s_r[2:end,:,:], 1)
spec_abs[2:end,:,:] += reverse(s_r[2:end,:,:], dims=1)
finally
close(out)
close(in_r)
Expand Down
4 changes: 2 additions & 2 deletions examples/aimd_full/spec_ft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ function run(cfgf, infn, outf)
cfg = open(YAML.load, cfgf)
sz = tuple(map(length, cfg["t$i"] for i=1:3)...)
inf = open(infn, "r+")
sig = Mmap.mmap(inf, Array{Complex128, 3}, sz)
sig = Mmap.mmap(inf, Array{ComplexF64, 3}, sz)
sig[1,:,:] *= 0.5
sig[:,:,1] *= 0.5
out = open(outf, "w+")
spec2d = Mmap.mmap(out, Array{Complex128, 3}, sz)
spec2d = Mmap.mmap(out, Array{ComplexF64, 3}, sz)
fill!(spec2d, 0)
spec2d[:] = fftshift(ifft(sig, (1,3)), (1,3))
close(out)
Expand Down
32 changes: 16 additions & 16 deletions examples/aimd_full/third_order_xcf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ end
function run(args)
t0 = now()
cfgf = args[1]
info("Loading parameters from $(cfgf)")
@info("Loading parameters from $(cfgf)")
cfg = open(YAML.load, cfgf)
root = cfg["rootname"]
states_fn = cfg["states_fn"]
Expand All @@ -26,17 +26,17 @@ t2 = convert.(Float64, cfg["t2"])
t3 = convert.(Float64, cfg["t3"])
σ = cfg["sigma"]

info("Loading energies from $states_fn")
@info("Loading energies from $states_fn")
states = readdlm(states_fn)
energies = states[:,1]
tdm = states[:,2]
info("States count: $(size(states)[1])")
info("Loading CF from $cf_fn")
@info("States count: $(size(states)[1])")
@info("Loading CF from $cf_fn")
cfs = parse_cf(cf_fn)
info("CF count: $(length(cfs))")
@info("CF count: $(length(cfs))")

# build system
info("Building system...")
@info("Building system...")
t0_sys = now()
s = System("G")
frame = ev2angphz(cfg["e_frame"])
Expand All @@ -53,24 +53,24 @@ for (i, j) in keys(cfs)
lut = LineshapeLUT(t->(GriddedCF(cfs[i,j], 1.0)(t)+g_inhomo(t, ev2angphz(σ))), lut_grid)
lineshape!(s, ti, tj, lut)
end
info(" Took $(now()-t0_sys)")
info("Number of order 1 Hilbert Paths: $(length(collect(hilbert_paths(s, 1))))")
info("Number of order 3 Hilbert Paths: $(length(collect(hilbert_paths(s, 3))))")
@info(" Took $(now()-t0_sys)")
@info("Number of order 1 Hilbert Paths: $(length(collect(hilbert_paths(s, 1))))")
@info("Number of order 3 Hilbert Paths: $(length(collect(hilbert_paths(s, 3))))")

info("Preparing calculation of third order response")
@info("Preparing calculation of third order response")
grd_trd = TimeGrid(t1, t2, t3)
info("Grid size: $(size(grd_trd))")
@info("Grid size: $(size(grd_trd))")

rr_fn = root*"_rr.bin"
rn_fn = root*"_rn.bin"
info("Saving rephasing to: $rr_fn")
info("Saving nonrephasing to: $rr_fn")
@info("Saving rephasing to: $rr_fn")
@info("Saving nonrephasing to: $rr_fn")
rr_out = open(rr_fn, "w+")
rn_out = open(rn_fn, "w+")
rr = Mmap.mmap(rr_out, Array{Complex128, 3}, size(grd_trd))
rn = Mmap.mmap(rn_out, Array{Complex128, 3}, size(grd_trd))
rr = Mmap.mmap(rr_out, Array{ComplexF64, 3}, size(grd_trd))
rn = Mmap.mmap(rn_out, Array{ComplexF64, 3}, size(grd_trd))
pm = Progress(4*length(collect(hilbert_paths(s, 3))))
info("Computing third order response")
@info("Computing third order response")
t0_third = now()
rr .+= R2(grd_trd, s, pm)
rr .+= R3(grd_trd, s, pm)
Expand Down
8 changes: 4 additions & 4 deletions examples/aimd_static/spec_abs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ function run(cfgf, root, outf)
inf_n = root*"_sn.bin"
in_r = open(inf_r, "r+")
in_n = open(inf_n, "r+")
s_r = Mmap.mmap(in_r, Array{Complex128, 3}, sz)
s_n = Mmap.mmap(in_n, Array{Complex128, 3}, sz)
s_r = Mmap.mmap(in_r, Array{ComplexF64, 3}, sz)
s_n = Mmap.mmap(in_n, Array{ComplexF64, 3}, sz)
out = open(outf, "w+")
try
spec_abs = Mmap.mmap(out, Array{Complex128, 3}, sz)
spec_abs = Mmap.mmap(out, Array{ComplexF64, 3}, sz)
spec_abs[:] = copy(s_n)
spec_abs[2:end,:,:] += flipdim(s_r[2:end,:,:], 1)
spec_abs[2:end,:,:] += reverse(s_r[2:end,:,:], dims=1)
finally
close(out)
close(in_r)
Expand Down
4 changes: 2 additions & 2 deletions examples/aimd_static/spec_ft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ function run(cfgf, infn, outf)
cfg = open(YAML.load, cfgf)
sz = tuple(map(length, cfg["t$i"] for i=1:3)...)
inf = open(infn, "r+")
sig = Mmap.mmap(inf, Array{Complex128, 3}, sz)
sig = Mmap.mmap(inf, Array{ComplexF64, 3}, sz)
sig[1,:,:] *= 0.5
sig[:,:,1] *= 0.5
out = open(outf, "w+")
spec2d = Mmap.mmap(out, Array{Complex128, 3}, sz)
spec2d = Mmap.mmap(out, Array{ComplexF64, 3}, sz)
fill!(spec2d, 0)
spec2d[:] = fftshift(ifft(sig, (1,3)), (1,3))
close(out)
Expand Down
32 changes: 16 additions & 16 deletions examples/aimd_static/third_order_xc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ end
function run(args)
t0 = now()
cfgf = args[1]
info("Loading parameters from $(cfgf)")
@info("Loading parameters from $(cfgf)")
cfg = open(YAML.load, cfgf)
states_fn = cfg["states_fn"]
cf_fn = cfg["xcorr_fn"]
Expand All @@ -20,17 +20,17 @@ t2 = convert.(Float64, cfg["t2"])
t3 = convert.(Float64, cfg["t3"])
sigma = cfg["sigma"]

info("Loading energies from $states_fn")
@info("Loading energies from $states_fn")
states = readdlm(states_fn)
energies = states[:,1]
tdm = states[:,2]
info("States count: $(size(states)[1])")
info("Loading correlation matrix from $cf_fn")
@info("States count: $(size(states)[1])")
@info("Loading correlation matrix from $cf_fn")
corrm = parse_corr(cf_fn)
info("Correlation count: $(length(corrm))")
@info("Correlation count: $(length(corrm))")

# build system
info("Building system...")
@info("Building system...")
t0_sys = now()
s = System("G")
frame = ev2angphz(cfg["e_frame"])
Expand All @@ -54,28 +54,28 @@ for i=1:size(corrm)[1], j=1:size(corrm)[2]
#end
lineshape!(s, ti, tj, lut)
end
info(" Took $(now()-t0_sys)")
info("Number of order 1 Hilbert Paths: $(length(collect(hilbert_paths(s, 1))))")
info("Number of order 3 Hilbert Paths: $(length(collect(hilbert_paths(s, 3))))")
@info(" Took $(now()-t0_sys)")
@info("Number of order 1 Hilbert Paths: $(length(collect(hilbert_paths(s, 1))))")
@info("Number of order 3 Hilbert Paths: $(length(collect(hilbert_paths(s, 3))))")

grd_lin = TimeGrid(t1)

info("Computing linear responses separately.")
@info("Computing linear responses separately.")
t0_calc = now()
out_root = "$(splitext(basename(states_fn))[1])_$(splitext(basename(cf_fn))[1])"

# compute them separately
totlin = zeros(Complex128, size(grd_lin))
totlin = zeros(ComplexF64, size(grd_lin))
for p in hilbert_paths(s, 1)
rlin = linear(grd_lin, s, p)
totlin += rlin
out_lin = out_root*"_lin_"*join(p.p[2:end-1], "-")*".txt"
info("Saving linear to: $out_lin")
@info("Saving linear to: $out_lin")
writedlm(out_lin, [grid(grd_lin)[1] real(rlin) imag(rlin)])
end
writedlm(out_root*"_lin_tot.txt", [grid(grd_lin)[1] real(totlin) imag(totlin)])
info(" Took $(now()-t0_calc)")
info("Preparing calculation of third order response")
@info(" Took $(now()-t0_calc)")
@info("Preparing calculation of third order response")
grd_trd = TimeGrid(t1, t2, t3)
info("Grid size: $(size(grd_trd))")

Expand All @@ -85,8 +85,8 @@ info("Saving rephasing to: $rr_fn")
info("Saving nonrephasing to: $rr_fn")
rr_out = open(rr_fn, "w+")
rn_out = open(rn_fn, "w+")
rr = Mmap.mmap(rr_out, Array{Complex128, 3}, size(grd_trd))
rn = Mmap.mmap(rn_out, Array{Complex128, 3}, size(grd_trd))
rr = Mmap.mmap(rr_out, Array{ComplexF64, 3}, size(grd_trd))
rn = Mmap.mmap(rn_out, Array{ComplexF64, 3}, size(grd_trd))
pm = Progress(4*length(collect(hilbert_paths(s, 3))))
info("Computing third order response")
t0_third = now()
Expand Down
Loading