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

[WIP] Hybrid functionals #717

Closed
wants to merge 29 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4b9a614
Overhaul docs organisation (#684)
antoine-levitt Jul 25, 2022
69f534c
minor corrections in docs
antoine-levitt Jul 25, 2022
5081905
minor doc fix
antoine-levitt Jul 25, 2022
30fe9ea
Fix dual handling for parametrised functionals (#699)
mfherbst Jul 29, 2022
a3bc617
Typo in dos.jl (#702)
Aug 2, 2022
f28b9ec
fix spglib (#707)
mfherbst Aug 16, 2022
0684562
Bump version: 0.5.5 → 0.5.6
mfherbst Aug 16, 2022
06dbf3b
Add documentation about conducting a convergence study (#701)
killah-t-cell Aug 26, 2022
40fb53d
Fix some image links in documentation (#713)
mfherbst Aug 27, 2022
222ae6a
Bump version: 0.5.6 → 0.5.7
mfherbst Aug 29, 2022
77ef797
typo
antoine-levitt Aug 30, 2022
ce348a9
ForwardDiff: Return dual energies in scfres (#709)
niklasschmitz Aug 31, 2022
8279d37
Remove advertisement for summer school (#716)
mfherbst Sep 1, 2022
582d3ee
Merge remote-tracking branch 'upstream/master'
BKaperick Sep 6, 2022
4603777
Add fock_exchange term and energy for one kpoint
BKaperick Sep 1, 2022
ddf11cf
Add ExchangeOperator to fock_exchange with consistency test
BKaperick Sep 1, 2022
bf0e14b
WIP connecting to LibXc
BKaperick Sep 6, 2022
5627ec1
Copy-paste gga methods in DispatchFunctional for hyb_gga
BKaperick Sep 6, 2022
3426b5e
Add scaling_factor to fock_exchange term
BKaperick Sep 6, 2022
d008d40
Fix printing bug in other terms using scale_factor
BKaperick Sep 6, 2022
ada9b29
Reduce code duplication (with Union) and implement hybrid lda and mgga
BKaperick Sep 10, 2022
f770fde
Compute green coeffs only once, and set first term to 0
BKaperick Sep 10, 2022
b3d650c
Michael comments part 1
BKaperick Sep 23, 2022
cb791f9
Merge remote-tracking branch 'upstream/master'
BKaperick Mar 15, 2023
2ead1c5
Michael comments part 2
BKaperick Mar 15, 2023
81854cc
Clean term implementation
BKaperick Mar 15, 2023
b1a703d
Clean operator
BKaperick Mar 15, 2023
c69a914
Merge branch 'master' into hybrid_functionals
BKaperick Mar 18, 2023
91a5dda
Some progress
mfherbst Jun 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/external/atomsbase.jl
Original file line number Diff line number Diff line change
@@ -60,31 +60,6 @@ function parse_system(system::AbstractSystem{D}) where {D}
end


function _call_with_system(f, system::AbstractSystem, args...; kwargs...)
@assert !(:magnetic_moments in keys(kwargs))
parsed = parse_system(system)
f(parsed.lattice, parsed.atoms, parsed.positions, args...;
parsed.magnetic_moments, kwargs...)
end


"""
Model(system::AbstractSystem; kwargs...)

AtomsBase-compatible Model constructor. Sets structural information (`atoms`, `positions`,
`lattice`, `n_electrons` etc.) from the passed `system`.
"""
Model(system::AbstractSystem; kwargs...) = _call_with_system(Model, system; kwargs...)


# Generate equivalent functions for AtomsBase
for fun in (:model_atomic, :model_DFT, :model_LDA, :model_PBE, :model_SCAN, :model_PBE0)
@eval function $fun(system::AbstractSystem, args...; kwargs...)
_call_with_system($fun, system, args...; kwargs...)
end
end


# Extra methods to AtomsBase functions for DFTK data structures
"""
atomic_system(model::DFTK.Model, magnetic_moments=[])
12 changes: 12 additions & 0 deletions src/standard_models.jl
Original file line number Diff line number Diff line change
@@ -74,6 +74,7 @@ function model_SCAN(lattice::AbstractMatrix, atoms::Vector{<:Element},
model_DFT(lattice, atoms, positions, [:mgga_x_scan, :mgga_c_scan]; kwargs...)
end


"""
Build an PBE0 model from the specified atoms.
DOI:10.1103/PhysRevLett.77.3865
@@ -84,3 +85,14 @@ function model_PBE0(lattice::AbstractMatrix, atoms::Vector{<:Element},
model_DFT(lattice, atoms, positions, Xc([functional]),
extra_terms = [ExactExchange(; scaling_factor=0.25)]; kwargs...)
end


# Generate equivalent functions for AtomsBase
for fun in (:model_atomic, :model_DFT, :model_LDA, :model_PBE, :model_SCAN, :model_PBE0)
@eval function $fun(system::AbstractSystem, args...; kwargs...)
@assert !(:magnetic_moments in keys(kwargs))
parsed = parse_system(system)
$fun(parsed.lattice, parsed.atoms, parsed.positions, args...;
parsed.magnetic_moments, kwargs...)
end
end
5 changes: 3 additions & 2 deletions src/terms/kinetic.jl
Original file line number Diff line number Diff line change
@@ -8,8 +8,9 @@ end

(kin::Kinetic)(basis) = TermKinetic(basis, kin.scaling_factor, kin.blowup)
function Base.show(io::IO, kin::Kinetic)
fac = isone(kin.scaling_factor) ? "" : "scaling_factor=$(kin.scaling_factor)"
print(io, "Kinetic($fac)")
bup = kin.blowup isa BlowupIdentity ? "" : ", blowup=$(kin.blowup)"
fac = isone(kin.scaling_factor) ? "" : ", scaling_factor=$(kin.scaling_factor)"
print(io, "Kinetic($bup$fac)")
end

struct TermKinetic <: Term