diff --git a/docs/make.jl b/docs/make.jl index 476f816d2d..4dbc85b25a 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -107,7 +107,7 @@ DFTKREPO = DFTKGH * ".git" # Setup julia dependencies for docs generation if not yet done Pkg.activate(@__DIR__) if !isfile(joinpath(@__DIR__, "Manifest.toml")) - Pkg.develop(Pkg.PackageSpec(path=ROOTPATH)) + Pkg.develop(Pkg.PackageSpec(; path=ROOTPATH)) Pkg.instantiate() end @@ -152,9 +152,9 @@ end # The examples go to docs/literate_build/examples, the .jl files stay where they are literate_files = map(filter!(endswith(".jl"), extract_paths(PAGES))) do file if startswith(file, "examples/") - (src=joinpath(ROOTPATH, file), dest=joinpath(SRCPATH, "examples"), example=true) + (; src=joinpath(ROOTPATH, file), dest=joinpath(SRCPATH, "examples"), example=true) else - (src=joinpath(SRCPATH, file), dest=joinpath(SRCPATH, dirname(file)), example=false) + (; src=joinpath(SRCPATH, file), dest=joinpath(SRCPATH, dirname(file)), example=false) end end diff --git a/docs/src/assets/0_pregenerate.jl b/docs/src/assets/0_pregenerate.jl index 9810a9f7c8..082d73dda8 100644 --- a/docs/src/assets/0_pregenerate.jl +++ b/docs/src/assets/0_pregenerate.jl @@ -1,7 +1,7 @@ using MKL using DFTK using LinearAlgebra -setup_threading(n_blas=2) +setup_threading(; n_blas=2) let include("../../../../examples/convergence_study.jl") @@ -61,7 +61,7 @@ let conv_hgh = converge_Ecut(Ecuts, psp_hgh, tol) println("HGH: $(conv_hgh.Ecut_conv)") - plt = plot(yaxis=:log10, xlabel="Ecut [Eh]", ylabel="Error [Eh]") + plt = plot(; yaxis=:log10, xlabel="Ecut [Eh]", ylabel="Error [Eh]") plot!(plt, conv_hgh.Ecuts, conv_hgh.errors, label="HGH", markers=true, linewidth=3) plot!(plt, conv_upf.Ecuts, conv_upf.errors, label="PseudoDojo NC SR LDA UPF", diff --git a/examples/geometry_optimization.jl b/examples/geometry_optimization.jl index 0820d6912b..8f27b6464b 100644 --- a/examples/geometry_optimization.jl +++ b/examples/geometry_optimization.jl @@ -68,7 +68,7 @@ end; x0 = vcat(lattice \ [0., 0., 0.], lattice \ [1.4, 0., 0.]) xres = optimize(Optim.only_fg!(fg!), x0, LBFGS(), - Optim.Options(show_trace=true, f_tol=tol)) + Optim.Options(; show_trace=true, f_tol=tol)) xmin = Optim.minimizer(xres) dmin = norm(lattice*xmin[1:3] - lattice*xmin[4:6]) @printf "\nOptimal bond length for Ecut=%.2f: %.3f Bohr\n" Ecut dmin diff --git a/examples/scf_callbacks.jl b/examples/scf_callbacks.jl index 78129825f7..d7c1e194d5 100644 --- a/examples/scf_callbacks.jl +++ b/examples/scf_callbacks.jl @@ -39,7 +39,7 @@ basis = PlaneWaveBasis(model; Ecut=5, kgrid=[3, 3, 3]); # has finished. For this we first define the empty plot canvas # and an empty container for all the density differences: using Plots -p = plot(yaxis=:log) +p = plot(; yaxis=:log) density_differences = Float64[]; # The callback function itself gets passed a named tuple diff --git a/src/common/threading.jl b/src/common/threading.jl index f52a6b0a8e..b052affc3a 100644 --- a/src/common/threading.jl +++ b/src/common/threading.jl @@ -1,7 +1,7 @@ import FFTW using LinearAlgebra -function setup_threading(;n_fft=1, n_blas=Threads.nthreads()) +function setup_threading(; n_fft=1, n_blas=Threads.nthreads()) n_julia = Threads.nthreads() FFTW.set_num_threads(n_fft) BLAS.set_num_threads(n_blas) diff --git a/src/elements.jl b/src/elements.jl index 839ad131e2..1e2728088f 100644 --- a/src/elements.jl +++ b/src/elements.jl @@ -142,17 +142,17 @@ or an element name (e.g. `"silicon"`) function ElementCohenBergstresser(key; lattice_constant=nothing) # Form factors from Cohen-Bergstresser paper Table 2 # Lattice constants from Table 1 - data = Dict(:Si => (form_factors=Dict( 3 => -0.21u"Ry", - 8 => 0.04u"Ry", - 11 => 0.08u"Ry"), + data = Dict(:Si => (; form_factors=Dict( 3 => -0.21u"Ry", + 8 => 0.04u"Ry", + 11 => 0.08u"Ry"), lattice_constant=5.43u"Å"), - :Ge => (form_factors=Dict( 3 => -0.23u"Ry", - 8 => 0.01u"Ry", - 11 => 0.06u"Ry"), + :Ge => (; form_factors=Dict( 3 => -0.23u"Ry", + 8 => 0.01u"Ry", + 11 => 0.06u"Ry"), lattice_constant=5.66u"Å"), - :Sn => (form_factors=Dict( 3 => -0.20u"Ry", - 8 => 0.00u"Ry", - 11 => 0.04u"Ry"), + :Sn => (; form_factors=Dict( 3 => -0.20u"Ry", + 8 => 0.00u"Ry", + 11 => 0.04u"Ry"), lattice_constant=6.49u"Å"), ) diff --git a/src/external/wannier90.jl b/src/external/wannier90.jl index 40defa3020..54fd57156a 100644 --- a/src/external/wannier90.jl +++ b/src/external/wannier90.jl @@ -97,7 +97,7 @@ function read_w90_nnkp(fileprefix::String) # 1st: Index of k-point # 2nd: Index of periodic image of k+b k-point # 3rd: Shift vector to get k-point of ikpb to the actual k+b point required - (ik=splitted[1], ikpb=splitted[2], G_shift=splitted[3:5]) + (; ik=splitted[1], ikpb=splitted[2], G_shift=splitted[3:5]) end (; nntot, nnkpts) end diff --git a/src/plotting.jl b/src/plotting.jl index a58b95be92..9368389f1b 100644 --- a/src/plotting.jl +++ b/src/plotting.jl @@ -1,14 +1,14 @@ # This is needed to flag that the plots-dependent code has been loaded const PLOTS_LOADED = true -function ScfPlotTrace(plt=Plots.plot(yaxis=:log); kwargs...) +function ScfPlotTrace(plt=Plots.plot(; yaxis=:log); kwargs...) energies = nothing function callback(info) if info.stage == :finalize minenergy = minimum(energies[max(1, end-5):end]) error = abs.(energies .- minenergy) error[error .== 0] .= NaN - extra = ifelse(:mark in keys(kwargs), (), (mark=:x, )) + extra = ifelse(:mark in keys(kwargs), (), (; mark=:x)) Plots.plot!(plt, error; extra..., kwargs...) display(plt) elseif info.n_iter == 1 @@ -42,7 +42,7 @@ function plot_band_data(kpath::KPathInterpolant, band_data; to_unit = ustrip(auconvert(unit, 1.0)) # Plot all bands, spins and errors - p = Plots.plot(xlabel="wave vector") + p = Plots.plot(; xlabel="wave vector") margs = length(kpath) < 70 ? (; markersize=2, markershape=:circle) : (; ) for σ in 1:data.n_spin, iband = 1:data.n_bands, branch in data.kbranches yerror = nothing diff --git a/src/postprocess/band_structure.jl b/src/postprocess/band_structure.jl index 550a7af272..da4a7b0744 100644 --- a/src/postprocess/band_structure.jl +++ b/src/postprocess/band_structure.jl @@ -133,7 +133,7 @@ function kdistances_and_ticks(kcoords, klabels::Dict, kbranches) end end end - ticks = (distances=tick_distances, labels=tick_labels) + ticks = (; distances=tick_distances, labels=tick_labels) (; kdistances, ticks) end diff --git a/src/pseudo/list_psp.jl b/src/pseudo/list_psp.jl index 8b1553d2d6..ede35cf724 100644 --- a/src/pseudo/list_psp.jl +++ b/src/pseudo/list_psp.jl @@ -8,11 +8,11 @@ to restrict the displayed files. # Examples ```julia-repl -julia> list_psp(family="hgh") +julia> list_psp(; family="hgh") ``` will list all HGH-type pseudopotentials and ```julia-repl -julia> list_psp(family="hgh", functional="lda") +julia> list_psp(; family="hgh", functional="lda") ``` will only list those for LDA (also known as Pade in this context) and @@ -47,7 +47,7 @@ function list_psp(element=nothing; family=nothing, functional=nothing, core=noth f_identifier = joinpath(root, file) Sys.iswindows() && (f_identifier = replace(f_identifier, "\\" => "/")) - push!(psplist, (identifier=f_identifier, family=f_family, + push!(psplist, (; identifier=f_identifier, family=f_family, functional=f_functional, element=f_element, n_elec_valence=parse(Int, f_nvalence[2:end]), path=joinpath(datadir_psp(), root, file))) @@ -59,10 +59,10 @@ function list_psp(element=nothing; family=nothing, functional=nothing, core=noth psp_per_element = map(per_elem) do elgroup @assert length(elgroup) > 0 if length(elgroup) == 1 - cores = [(core=:fullcore, )] + cores = [(; core=:fullcore)] else - cores = append!(fill((core=:other, ), length(elgroup) - 2), - [(core=:fullcore, ), (core=:semicore, )]) + cores = append!(fill((; core=:other), length(elgroup) - 2), + [(; core=:fullcore), (; core=:semicore)]) end merge.(sort(elgroup, by=psp -> psp.n_elec_valence), cores) end diff --git a/src/scf/mixing.jl b/src/scf/mixing.jl index 845065dd55..b2b9f08f8b 100644 --- a/src/scf/mixing.jl +++ b/src/scf/mixing.jl @@ -163,7 +163,7 @@ Important `kwargs` passed on to [`χ0Mixing`](@ref) - `verbose`: Run the GMRES in verbose mode. - `reltol`: Relative tolerance for GMRES """ -function HybridMixing(;εr=1.0, kTF=0.8, localization=identity, +function HybridMixing(; εr=1.0, kTF=0.8, localization=identity, adjust_temperature=IncreaseMixingTemperature(), kwargs...) χ0terms = [DielectricModel(; εr, kTF, localization), LdosModel(;adjust_temperature)] diff --git a/src/scf/scf_solvers.jl b/src/scf/scf_solvers.jl index 534df8a517..26de2d7029 100644 --- a/src/scf/scf_solvers.jl +++ b/src/scf/scf_solvers.jl @@ -71,7 +71,7 @@ function CROP(f, x0, m::Int, max_iter::Int, tol::Real, warming=0) # Cheat support for multidimensional arrays if length(size(x0)) != 1 x, conv= CROP(x -> vec(f(reshape(x, size(x0)...))), vec(x0), m, max_iter, tol, warming) - return (fixpoint=reshape(x, size(x0)...), converged=conv) + return (; fixpoint=reshape(x, size(x0)...), converged=conv) end N = size(x0,1) T = eltype(x0) @@ -110,6 +110,6 @@ function CROP(f, x0, m::Int, max_iter::Int, tol::Real, warming=0) fs[:,1] = ftnp1 # fs[:,1] = f(xs[:,1]) end - (fixpoint=xs[:, 1], converged=err < tol) + (; fixpoint=xs[:, 1], converged=err < tol) end scf_CROP_solver(m=10) = (f, x0, max_iter; tol=1e-6) -> CROP(x -> f(x) - x, x0, m, max_iter, tol) diff --git a/src/scf/self_consistent_field.jl b/src/scf/self_consistent_field.jl index 17d52447da..fcd1990ee3 100644 --- a/src/scf/self_consistent_field.jl +++ b/src/scf/self_consistent_field.jl @@ -128,7 +128,7 @@ Overview of parameters: # Diagonalize `ham` to get the new state nextstate = next_density(ham, nbandsalg, fermialg; eigensolver, ψ, eigenvalues, occupation, miniter=1, tol=determine_diagtol(info)) - ψ, eigenvalues, occupation, εF, ρout = nextstate + (; ψ, eigenvalues, occupation, εF, ρout) = nextstate # Update info with results gathered so far info = (; ham, basis, converged, stage=:iterate, algorithm="SCF", diff --git a/src/terms/Hamiltonian.jl b/src/terms/Hamiltonian.jl index 67aa9ee356..3bebf05e15 100644 --- a/src/terms/Hamiltonian.jl +++ b/src/terms/Hamiltonian.jl @@ -104,9 +104,9 @@ Base.:*(H::Hamiltonian, ψ) = mul!(deepcopy(ψ), H, ψ) ifft!(ψ_real, H.basis, H.kpoint, ψ[:, iband]) for op in H.optimized_operators @timing "$(nameof(typeof(op)))" begin - apply!((fourier=Hψ_fourier, real=Hψ_real), + apply!((; fourier=Hψ_fourier, real=Hψ_real), op, - (fourier=ψ[:, iband], real=ψ_real)) + (; fourier=ψ[:, iband], real=ψ_real)) end end Hψ[:, iband] .= Hψ_fourier @@ -144,9 +144,9 @@ end if have_divAgrad @timeit to "divAgrad" begin - apply!((fourier=Hψ[:, iband], real=nothing), + apply!((; fourier=Hψ[:, iband], real=nothing), H.divAgrad_op, - (fourier=ψ[:, iband], real=nothing), + (; fourier=ψ[:, iband], real=nothing), ψ_real) # ψ_real used as scratch end end @@ -162,7 +162,9 @@ end # Apply the nonlocal operator if !isnothing(H.nonlocal_op) @timing "nonlocal" begin - apply!((fourier=Hψ, real=nothing), H.nonlocal_op, (fourier=ψ, real=nothing)) + apply!((; fourier=Hψ, real=nothing), + H.nonlocal_op, + (; fourier=ψ, real=nothing)) end end diff --git a/src/terms/operators.jl b/src/terms/operators.jl index f552ed333b..f77abc3197 100644 --- a/src/terms/operators.jl +++ b/src/terms/operators.jl @@ -18,7 +18,9 @@ function LinearAlgebra.mul!(Hψ::AbstractVector, op::RealFourierOperator, ψ::Ab Hψ_real = similar(ψ_real) Hψ_fourier .= 0 Hψ_real .= 0 - apply!((real=Hψ_real, fourier=Hψ_fourier), op, (real=ψ_real, fourier=ψ)) + apply!((; real=Hψ_real, fourier=Hψ_fourier), + op, + (; real=ψ_real, fourier=ψ)) Hψ .= Hψ_fourier .+ fft(op.basis, op.kpoint, Hψ_real) Hψ end diff --git a/src/terms/pairwise.jl b/src/terms/pairwise.jl index fd34e04725..556c92ba0a 100644 --- a/src/terms/pairwise.jl +++ b/src/terms/pairwise.jl @@ -34,7 +34,7 @@ struct TermPairwisePotential{TV, Tparams, T} <:Term end function ene_ops(term::TermPairwisePotential, basis::PlaneWaveBasis, ψ, occupation; kwargs...) - (E=term.energy, ops=[NoopOperator(basis, kpt) for kpt in basis.kpoints]) + (; E=term.energy, ops=[NoopOperator(basis, kpt) for kpt in basis.kpoints]) end compute_forces(term::TermPairwisePotential, ::PlaneWaveBasis, ψ, occ; kwargs...) = term.forces diff --git a/src/terms/psp_correction.jl b/src/terms/psp_correction.jl index 2c0e30903b..b3d029f21a 100644 --- a/src/terms/psp_correction.jl +++ b/src/terms/psp_correction.jl @@ -16,7 +16,7 @@ function TermPspCorrection(basis::PlaneWaveBasis) end function ene_ops(term::TermPspCorrection, basis::PlaneWaveBasis, ψ, occupation; kwargs...) - (E=term.energy, ops=[NoopOperator(basis, kpt) for kpt in basis.kpoints]) + (; E=term.energy, ops=[NoopOperator(basis, kpt) for kpt in basis.kpoints]) end """ diff --git a/src/terms/terms.jl b/src/terms/terms.jl index 70eb920002..b4bf7e4c52 100644 --- a/src/terms/terms.jl +++ b/src/terms/terms.jl @@ -1,11 +1,11 @@ include("operators.jl") ### Terms -# - A Term is something that, given a state, returns a named tuple (E, hams) with an energy +# - A Term is something that, given a state, returns a named tuple (; E, hams) with an energy # and a list of RealFourierOperator (for each kpoint). # - Each term must overload # `ene_ops(term, basis, ψ, occupation; kwargs...)` -# -> (E::Real, ops::Vector{RealFourierOperator}). +# -> (; E::Real, ops::Vector{RealFourierOperator}). # - Note that terms are allowed to hold on to references to ψ (eg Fock term), # so ψ should not mutated after ene_ops @@ -27,7 +27,7 @@ A term with a constant zero energy. """ struct TermNoop <: Term end function ene_ops(term::TermNoop, basis::PlaneWaveBasis{T}, ψ, occupation; kwargs...) where {T} - (E=zero(eltype(T)), ops=[NoopOperator(basis, kpt) for kpt in basis.kpoints]) + (; E=zero(eltype(T)), ops=[NoopOperator(basis, kpt) for kpt in basis.kpoints]) end include("Hamiltonian.jl") diff --git a/test/PspUpf.jl b/test/PspUpf.jl index 5a8d4371ea..0de03df9f9 100644 --- a/test/PspUpf.jl +++ b/test/PspUpf.jl @@ -17,8 +17,8 @@ upf_pseudos = Dict( :Cr => load_psp(artifact"pd_nc_sr_pbe_standard_0.4.1_upf", "Cu.upf"; rcut=12.0) ) hgh_pseudos = [ - (hgh=load_psp("hgh/pbe/si-q4.hgh"), upf=upf_pseudos[:Si]), - (hgh=load_psp("hgh/pbe/tl-q13.hgh"), upf=upf_pseudos[:Tl]) + (; hgh=load_psp("hgh/pbe/si-q4.hgh"), upf=upf_pseudos[:Si]), + (; hgh=load_psp("hgh/pbe/tl-q13.hgh"), upf=upf_pseudos[:Tl]) ] end diff --git a/test/aqua.jl b/test/aqua.jl index 5b6d6c1d3b..0447f970e3 100644 --- a/test/aqua.jl +++ b/test/aqua.jl @@ -7,6 +7,6 @@ Aqua.test_all(DFTK; ambiguities=false, piracies=false, - deps_compat=(check_extras=false, ), - stale_deps=(ignore=[:Primes, ], )) + deps_compat=(; check_extras=false), + stale_deps=(; ignore=[:Primes, ])) end diff --git a/test/bzmesh_symmetry.jl b/test/bzmesh_symmetry.jl index ea38b4df0c..ac224e3428 100644 --- a/test/bzmesh_symmetry.jl +++ b/test/bzmesh_symmetry.jl @@ -4,11 +4,11 @@ using LinearAlgebra testcase = TestCases.silicon - args = ((kgrid=[2, 2, 2], kshift=[1/2, 0, 0]), - (kgrid=[2, 2, 2], kshift=[1/2, 1/2, 0]), - (kgrid=[2, 2, 2], kshift=[0, 0, 0]), - (kgrid=[3, 2, 3], kshift=[0, 0, 0]), - (kgrid=[3, 2, 3], kshift=[0, 1/2, 1/2])) + args = ((; kgrid=[2, 2, 2], kshift=[1/2, 0, 0]), + (; kgrid=[2, 2, 2], kshift=[1/2, 1/2, 0]), + (; kgrid=[2, 2, 2], kshift=[0, 0, 0]), + (; kgrid=[3, 2, 3], kshift=[0, 0, 0]), + (; kgrid=[3, 2, 3], kshift=[0, 1/2, 1/2])) for case in args model_nosym = model_LDA(testcase.lattice, testcase.atoms, testcase.positions; symmetries=false) diff --git a/test/chi0.jl b/test/chi0.jl index 5284990a51..b558696757 100644 --- a/test/chi0.jl +++ b/test/chi0.jl @@ -38,7 +38,7 @@ function test_chi0(testcase; symmetries=false, temperature=0, spin_polarization= ham0 = energy_hamiltonian(basis, nothing, nothing; ρ=ρ0).ham nbandsalg = is_εF_fixed ? FixedBands(; n_bands_converge=6) : AdaptiveBands(model) res = DFTK.next_density(ham0, nbandsalg; tol, eigensolver) - scfres = (ham=ham0, res...) + scfres = (; ham=ham0, res...) # create external small perturbation εδV n_spin = model.n_spin_components diff --git a/test/compute_density.jl b/test/compute_density.jl index 10929dfc59..a7c7b24cbf 100644 --- a/test/compute_density.jl +++ b/test/compute_density.jl @@ -14,7 +14,7 @@ kwargs = () n_bands = div(testcase.n_electrons, 2, RoundUp) if testcase.temperature !== nothing - kwargs = (temperature=testcase.temperature, smearing=DFTK.Smearing.FermiDirac()) + kwargs = (; testcase.temperature, smearing=DFTK.Smearing.FermiDirac()) n_bands = div(testcase.n_electrons, 2, RoundUp) + 4 end diff --git a/test/forwarddiff.jl b/test/forwarddiff.jl index 4bcdb22c8e..95fb1a7887 100644 --- a/test/forwarddiff.jl +++ b/test/forwarddiff.jl @@ -17,7 +17,7 @@ end basis = PlaneWaveBasis(model; Ecut=5, kgrid=[2, 2, 2], kshift=[0, 0, 0]) - response = ResponseOptions(verbose=true) + response = ResponseOptions(; verbose=true) is_converged = DFTK.ScfConvergenceForce(tol) scfres = self_consistent_field(basis; is_converged, response) compute_forces_cart(scfres) @@ -78,7 +78,7 @@ end is_converged = DFTK.ScfConvergenceDensity(1e-10) scfres = self_consistent_field(basis; is_converged, mixing=KerkerMixing(), nbandsalg=FixedBands(; n_bands_converge=10), - damping=0.6, response=ResponseOptions(verbose=true)) + damping=0.6, response=ResponseOptions(; verbose=true)) ComponentArray( eigenvalues=hcat([ev[1:10] for ev in scfres.eigenvalues]...), @@ -116,7 +116,7 @@ end is_converged = DFTK.ScfConvergenceDensity(1e-10) scfres = self_consistent_field(basis; is_converged, - response=ResponseOptions(verbose=true)) + response=ResponseOptions(; verbose=true)) compute_forces_cart(scfres) end @@ -161,7 +161,7 @@ end ρ = zeros(Float64, basis.fft_size..., 1) is_converged = DFTK.ScfConvergenceDensity(1e-10) scfres = self_consistent_field(basis; ρ, is_converged, - response=ResponseOptions(verbose=true)) + response=ResponseOptions(; verbose=true)) compute_forces_cart(scfres) end derivative_ε = let ε = 1e-5 diff --git a/test/helium_all_electron.jl b/test/helium_all_electron.jl index fa4a9c01f3..ff85aa9602 100644 --- a/test/helium_all_electron.jl +++ b/test/helium_all_electron.jl @@ -13,7 +13,7 @@ scfres.energies.total, DFTK.compute_forces(scfres) end - E, forces = energy_forces(Ecut=5, tol=1e-10) + E, forces = energy_forces(; Ecut=5, tol=1e-10) @test E ≈ -1.5869009433016852 atol=1e-12 @test norm(forces) < 1e-7 end diff --git a/test/scf_compare.jl b/test/scf_compare.jl index bae623368c..a81a75f7c9 100644 --- a/test/scf_compare.jl +++ b/test/scf_compare.jl @@ -118,8 +118,8 @@ end ρ0 = guess_density(basis) ρ_ref = self_consistent_field(basis; ρ=ρ0, tol).ρ - for mixing_str in ("KerkerDosMixing()", "HybridMixing(RPA=true)", - "LdosMixing(RPA=false)", "HybridMixing(εr=10, RPA=true)") + for mixing_str in ("KerkerDosMixing()", "HybridMixing(; RPA=true)", + "LdosMixing(; RPA=false)", "HybridMixing(; εr=10, RPA=true)") @testset "Testing $mixing_str" begin mixing = eval(Meta.parse(mixing_str)) ρ_mix = self_consistent_field(basis; ρ=ρ0, mixing, tol, damping=0.8).ρ @@ -148,8 +148,8 @@ end scfres = self_consistent_field(basis; ρ=ρ0, tol) ρ_ref = scfres.ρ - for mixing_str in ("KerkerMixing()", "KerkerDosMixing()", "DielectricMixing(εr=10)", - "HybridMixing(εr=10)", "χ0Mixing(; χ0terms=[Applyχ0Model()], RPA=false)") + for mixing_str in ("KerkerMixing()", "KerkerDosMixing()", "DielectricMixing(; εr=10)", + "HybridMixing(; εr=10)", "χ0Mixing(; χ0terms=[Applyχ0Model()], RPA=false)") @testset "Testing $mixing_str" begin mixing = eval(Meta.parse(mixing_str)) scfres = self_consistent_field(basis; ρ=ρ0, mixing, tol, damping=0.8) diff --git a/test/stresses.jl b/test/stresses.jl index 988e5a12a0..7ac7678700 100644 --- a/test/stresses.jl +++ b/test/stresses.jl @@ -17,14 +17,14 @@ function recompute_energy(lattice, symmetries, element) basis = make_basis(lattice, symmetries, element) scfres = self_consistent_field(basis; is_converged=DFTK.ScfConvergenceDensity(1e-13)) - energies, H = energy_hamiltonian(basis, scfres.ψ, scfres.occupation; ρ=scfres.ρ) + (; energies) = energy_hamiltonian(basis, scfres.ψ, scfres.occupation; ρ=scfres.ρ) energies.total end function hellmann_feynman_energy(scfres, lattice, symmetries, element) basis = make_basis(lattice, symmetries, element) ρ = DFTK.compute_density(basis, scfres.ψ, scfres.occupation) - energies, H = energy_hamiltonian(basis, scfres.ψ, scfres.occupation; ρ) + (; energies) = energy_hamiltonian(basis, scfres.ψ, scfres.occupation; ρ) energies.total end