diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0c707e7d26..1762e325aa 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.6.9 +current_version = 0.6.10 commit = True tag = False diff --git a/Project.toml b/Project.toml index 8157db35d3..5d45ddbf7c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DFTK" uuid = "acf6eb54-70d9-11e9-0013-234b7a5f5337" authors = ["Michael F. Herbst ", "Antoine Levitt "] -version = "0.6.9" +version = "0.6.10" [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c" diff --git a/examples/custom_potential.jl b/examples/custom_potential.jl index d2f504c9c9..7f8456a840 100644 --- a/examples/custom_potential.jl +++ b/examples/custom_potential.jl @@ -29,6 +29,10 @@ function DFTK.local_potential_fourier(el::CustomPotential, q::Real) -el.α * exp(- (q * el.L)^2 / 2) end +# !!! tip "Gaussian potentials and DFTK" +# DFTK already implements `CustomPotential` in form of the [`DFTK.ElementGaussian`](@ref), +# so this explicit re-implementation is only provided for demonstration purposes. + # We set up the lattice. For a 1D case we supply two zero lattice vectors a = 10 lattice = a .* [[1 0 0.]; [0 0 0]; [0 0 0]]; diff --git a/examples/pseudopotentials.jl b/examples/pseudopotentials.jl index cb0ff7f24d..8719dc985e 100644 --- a/examples/pseudopotentials.jl +++ b/examples/pseudopotentials.jl @@ -40,11 +40,15 @@ using LazyArtifacts import Main: @artifact_str # hide # Here, we will use a Perdew-Wang LDA PSP from [PseudoDojo](http://www.pseudo-dojo.org/), -# which is available in the JuliaMolSim -# [PseudoLibrary](https://github.com/JuliaMolSim/PseudoLibrary). +# which is available in the +# [JuliaMolSim PseudoLibrary](https://github.com/JuliaMolSim/PseudoLibrary). # Directories in PseudoLibrary correspond to artifacts that you can load using `artifact` # strings which evaluate to a filepath on your local machine where the artifact has been # downloaded. +# +# !!! note "Using the PseudoLibrary in your own calculations" +# Instructions for using the [PseudoLibrary](https://github.com/JuliaMolSim/PseudoLibrary) +# in your own calculations can be found in its documentation. # We load the HGH and UPF PSPs using `load_psp`, which determines the # file format using the file extension. The `artifact` string literal resolves to the diff --git a/src/eigen/diag.jl b/src/eigen/diag.jl index 245259b149..1446f5200a 100644 --- a/src/eigen/diag.jl +++ b/src/eigen/diag.jl @@ -53,8 +53,8 @@ function diagonalize_all_kblocks(eigensolver, ham::Hamiltonian, nev_per_kpoint:: @assert size(ψguessk) == (n_Gk, nev_per_kpoint) prec = nothing - !isnothing(prec_type) && (prec = prec_type(ham.basis, kpt)) - results[ik] = eigensolver(ham.blocks[ik], ψguessk; + !isnothing(prec_type) && (prec = prec_type(ham[ik])) + results[ik] = eigensolver(ham[ik], ψguessk; prec, tol, miniter, maxiter, n_conv_check) # Update progress bar if desired diff --git a/src/eigen/preconditioners.jl b/src/eigen/preconditioners.jl index 4eb8ef96be..834f53de15 100644 --- a/src/eigen/preconditioners.jl +++ b/src/eigen/preconditioners.jl @@ -17,7 +17,8 @@ precondprep!(P, X) = P # This API is also used in Optim.jl No preconditioning """ struct PreconditionerNone end -PreconditionerNone(basis, kpt) = I +PreconditionerNone(::PlaneWaveBasis, ::Kpoint) = I +PreconditionerNone(::HamiltonianBlock) = I """ (simplified version of) Tetter-Payne-Allan preconditioning @@ -41,6 +42,9 @@ function PreconditionerTPA(basis::PlaneWaveBasis{T}, kpt::Kpoint; default_shift= kin = kinetic_energy(kinetic_term, basis.Ecut, Gplusk_vectors_cart(basis, kpt)) PreconditionerTPA{T}(basis, kpt, kin, nothing, default_shift) end +function PreconditionerTPA(ham::HamiltonianBlock; kwargs...) + PreconditionerTPA(ham.basis, ham.kpoint) +end @views function ldiv!(Y, P::PreconditionerTPA, R) if P.mean_kin === nothing diff --git a/src/scf/nbands_algorithm.jl b/src/scf/nbands_algorithm.jl index c9a89dcca7..77139c07da 100644 --- a/src/scf/nbands_algorithm.jl +++ b/src/scf/nbands_algorithm.jl @@ -81,6 +81,7 @@ function determine_n_bands(bands::AdaptiveBands, occupation::AbstractVector, # Determine number of bands to be computed n_bands_compute_ε = maximum(eigenvalues) do εk + n_bands_converge > length(εk) && return length(εk) + 1 something(findlast(εnk -> εnk ≥ εk[n_bands_converge] + bands.gap_min, εk), length(εk) + 1) end