From 6bf840cab3b217aad99bf69e16d095552f730c74 Mon Sep 17 00:00:00 2001 From: "pierre-francois.duc" Date: Tue, 23 Jul 2024 01:25:28 +0200 Subject: [PATCH] Update basic.jl to julia 1.10 - info replaced by @info https://github.com/JuliaLang/julia/pull/24490 -linspace has been deprecated in favor of range with stop and length keyword arguments (#25896). https://github.com/JuliaLang/julia/pull/25896 --- examples/basic/basic.jl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/basic/basic.jl b/examples/basic/basic.jl index b166a1c..8411f8a 100644 --- a/examples/basic/basic.jl +++ b/examples/basic/basic.jl @@ -9,7 +9,7 @@ import YAML # import requires adding the module name, ie: `YAML.load` function run(args) # Use a main 'run' function. This is not mandatory, but is required for performance. cfg_f = args[1] # index by 1, 1:2 translates to [1, 2], the first two elements -info("Loading parameters from $cfg_f") +@info("Loading parameters from $cfg_f") cfg = open(YAML.load, cfg_f) # load parameters # load parameters @@ -27,39 +27,39 @@ t2_max = cfg["t2_max"] t3_max = cfg["t3_max"] # setup system -info("Setting up system") +@info("Setting up system") s = System("g") energy!(s, "a", ω_a - ω_frame) # use a rotating frame dipole!(s, "g", "a", 1.0) lineshape!(s, "a", "a", t->g_homo(t, γ)+g_inhomo(t, σ)) # use an anonymous function for the lineshape tg = TimeGrid( - linspace(0, t1_max, t1_n), - linspace(0, t2_max, t2_n), - linspace(0, t3_max, t3_n), + range(0, stop=t1_max, length=t1_n), # TODO previously linspace + range(0, stop=t2_max, length=t2_n), + range(0, stop=t3_max, length=t3_n), ) -info("Computing linear response") +@info("Computing linear response") # compute linear r_lin = linear(tg, s) -info("Saving to $(root)_rlin.txt") +@info("Saving to $(root)_rlin.txt") writedlm("$(root)_rlin.txt", [tg.times[1] real(r_lin) imag(r_lin)]) r_lin[1] *= 0.5 # first interval is a half-interval s_lin = fftshift(ifft(r_lin)) f_lin = fftshift(fftfreq(size(tg)[1], 1/(tg.times[1][2]-tg.times[1][1]))) -info("Saving linear spectrum to $(root)_slin.txt") +@info("Saving linear spectrum to $(root)_slin.txt") writedlm("$(root)_slin.txt", [f_lin real(s_lin) imag(s_lin)]) # compute rephasing and non-rephasing separately: the spectra will overlap if # a fully rotating frame is used (ω_a == ω_frame) -info("Computing third order response") +@info("Computing third order response") rr = R2(tg, s) + R3(tg, s) rn = R1(tg, s) + R4(tg, s) # save multidimensional data in binary format. # Julia uses Fortran-contiguous arrays. -info("Saving to $(root)_rr.bin, $(root)_rn.bin") +@info("Saving to $(root)_rr.bin, $(root)_rn.bin") write("$(root)_rr.bin", rr) write("$(root)_rn.bin", rn) # first interval is a half-interval @@ -79,11 +79,11 @@ else sa += flipdim(sr, 1) end # if-else blocks terminated by 'end'. This is true of all code blocks. -info("Saving rephasing spectrum to $(root)_sr.bin") +@info("Saving rephasing spectrum to $(root)_sr.bin") write("$(root)_sr.bin", sr) -info("Saving non-rephasing spectrum to $(root)_sn.bin") +@info("Saving non-rephasing spectrum to $(root)_sn.bin") write("$(root)_sn.bin", sn) -info("Saving absorptive spectrum to $(root)_sa.bin") +@info("Saving absorptive spectrum to $(root)_sa.bin") write("$(root)_sa.bin", sa) end # terminating the `function run` code block