Skip to content
master
 1using SacerDOS
 2using Distributed
 3using LinearAlgebra
 4using JLD2
 5using Dates
 6
 7if nworkers() == 1
 8    addprocs(5)
 9end
10
11@everywhere using SacerDOS
12
13function run_params(case::Symbol;
14                    n_bands_diag::Union{Nothing,Int}=30,
15                    xlims::Tuple{T,T}=(5.,20.)) where {T}
16    @show case
17    @show n_bands_diag
18
19    p = get_params(; case, xlims)
20    g_params = gaussian_parameters(p)
21    orders = [0, 1, 2]
22    outdir = isdir("../../_data") ? "../../_data" : "."
23
24    checkpoint_file = joinpath(outdir, "checkpoint_$(case)_nbands$(n_bands_diag).jld2")
25
26    @info "Starting computation for case: '$case' with n_bands_diag=$n_bands_diag"
27    @info "Using checkpoint file: '$checkpoint_file'"
28
29    terms = @time SacerDOS.dos_gaussian_distributed(p.lattice, p.atoms, p.positions,
30                                                     p.Ecut, p.kgrid, g_params, p.xs;
31                                                     disregistries=p.disregistries,
32                                                     orders, δ=p.δ, n_bands_diag,
33                                                     checkpoint_path=checkpoint_file,
34                                                     cleanup_checkpoint=false)
35
36    @show norm.(terms.doses)
37    tr0, tr1, tr2 = terms.doses
38
39    date_str = Dates.format(now(), "yyyymmdd_HH_MM_SS")
40    output_file = joinpath(outdir, "computed_$(case)_nbands$(n_bands_diag)_$(date_str).jld2")
41
42    @info "Saving final results to $output_file"
43    jldsave(output_file;
44            tr0, tr1, tr2, p.δ, p.ε, p.kpoints, p.Ecut, p.xlims, p.xs, p.gaussian_factor, n_bands_diag)
45
46    @info "Calculation complete."
47end