-
Notifications
You must be signed in to change notification settings - Fork 97
Add Hubbard corrections and DFT+U #1158
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
Merged
Merged
Changes from 45 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
bc0e2eb
Adding Hubbard
fsicignano d4dfa7b
Complex Spherical Harmonics have been removed
fsicignano 48a33f0
Correction to testcases.jl
fsicignano 6c77122
Added test for hubbard term
fsicignano 5540b22
Added explicit import of Hubbard in testcases.jl
fsicignano 9e894bf
Speed up of the hubbard test
fsicignano 4a1d0e2
Hubbard test now functional
fsicignano db7d948
Still errors in the consistency test
fsicignano e0a1002
Some comments have been resolved
fsicignano 7045a6d
Some comments have been resolved
fsicignano fab6fb5
Comments have been resolved
fsicignano ae13ba7
Comments have been resolved
fsicignano 5aefec2
Added nhubbard field to scfres in forwarddiff_rules.
fsicignano 0d69edd
Update to Wigner_sym, now wigner_d_matrix and relative test
fsicignano d0cf01a
Change in testing
fsicignano 16a3f6f
New example in examples/hubbard.jl
fsicignano c9d8328
use_nlcc=false for all mgga tests
fsicignano f905197
Most comments have been addressed
fsicignano 7ea2342
Several issues solved
fsicignano 3b72e16
Merge branch 'master' into hubbard-v2
fsicignano 42b5f85
Semplification in compute_nhubbard
fsicignano 5a95c9d
Simplification to the apply!(HubbardUOperator)
fsicignano 20b1370
Merge branch 'hubbard-v2' of https://github.com/fsicignano/DFTK.jl in…
fsicignano 914bbe6
Simplification to the apply!(HubbardUOperator)
fsicignano b31874d
New comments addressed
fsicignano d4cb53c
New comments addressed
fsicignano aeab561
Merge branch 'master' into hubbard-v2
fsicignano 1fad1c8
Issue solved with mpi
fsicignano efc83f5
ntermediate version
fsicignano 074f539
New simplified version
fsicignano 41bebad
New simplified version
fsicignano a431717
New simplified version
fsicignano 8a87487
Test issue solved
fsicignano 52a20d8
Merge branch 'master' into hubbard-v2
fsicignano 8de7498
Updating branch
fsicignano 8f636d7
Merge branch 'hubbard-v2' of https://github.com/fsicignano/DFTK.jl in…
fsicignano 75cc62c
Test hubbard.jl fixed for mpi case
fsicignano b2da690
New comments addressed
fsicignano 761ee8b
New comments have been addressed
fsicignano ea48cca
Update examples/hubbard.jl
fsicignano b7e90bb
New comments have been addressed
fsicignano 3cf787e
Merge branch 'master' into hubbard-v2
fsicignano 0e17b63
Merge branch 'hubbard-v2' of https://github.com/fsicignano/DFTK.jl in…
fsicignano 2fe39dc
Be more explicit
mfherbst 3c611b1
Cosmetic fixes to example
mfherbst aecf0bd
Announce feature
mfherbst 1d4d73c
Minor changes
fsicignano 15304e7
Modifications to the OrbitalManifold interface
fsicignano 253931d
Merge branch 'hubbard-v2' of https://github.com/fsicignano/DFTK.jl in…
fsicignano f649481
Name 'nhubbard' converted to 'hubbard_n'
fsicignano df51495
Merge branch 'master' into hubbard-v2
fsicignano 5c05a9f
New constructors added for OrbitalManifold. Testing
fsicignano a021e32
Various changes
Technici4n e2d97d6
Minor tweaks
Technici4n 2da2d03
Fix tests not testing anything
Technici4n 9f7dbcd
Reorder OrbitalManifold constructors
Technici4n ca16a44
Move hubbard_n computation down
Technici4n 7aab38e
Review comments
Technici4n 3533669
Minor typo in documentation
fsicignano 99bddba
Merge branch 'master' into hubbard-v2
fsicignano 872c29a
Reduce example running time, update manifold naming comment
Technici4n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # # Hubbard correction (DFT+U) | ||
| # In this example, we'll plot the DOS and projected DOS of Nickel Oxide | ||
| # with and without the Hubbard term correction. | ||
|
|
||
| using DFTK | ||
| using PseudoPotentialData | ||
| using Unitful | ||
| using UnitfulAtomic | ||
| using Plots | ||
|
|
||
| # Define the geometry and pseudopotential | ||
| a = 7.9 # Nickel Oxide lattice constant in Bohr | ||
| lattice = a * [[ 1.0 0.5 0.5]; | ||
| [ 0.5 1.0 0.5]; | ||
| [ 0.5 0.5 1.0]] | ||
| pseudopotentials = PseudoFamily("dojo.nc.sr.pbe.v0_4_1.standard.upf") | ||
| Ni = ElementPsp(:Ni, pseudopotentials) | ||
| O = ElementPsp(:O, pseudopotentials) | ||
| atoms = [Ni, O, Ni, O] | ||
| positions = [zeros(3), ones(3) / 4, ones(3) / 2, ones(3) * 3 / 4] | ||
| magnetic_moments = [2, 0, -1, 0] | ||
|
|
||
| # First, we run an SCF and band computation without the Hubbard term | ||
| model = model_DFT(lattice, atoms, positions; temperature=5e-3, functionals=PBE(), magnetic_moments) | ||
| basis = PlaneWaveBasis(model; Ecut=32, kgrid=[2, 2, 2]) | ||
| scfres = self_consistent_field(basis; tol=1e-10, ρ=guess_density(basis, magnetic_moments)) | ||
| bands = compute_bands(scfres, MonkhorstPack(4, 4, 4)) | ||
| lowest_unocc_band = findfirst(ε -> ε-bands.εF > 0, bands.eigenvalues[1]) | ||
| band_gap = bands.eigenvalues[1][lowest_unocc_band] - bands.eigenvalues[1][lowest_unocc_band-1] | ||
|
|
||
| # Then we plot the DOS and the PDOS for the relevant 3D (pseudo)atomic projector | ||
| εF = bands.εF | ||
| width = 5.0u"eV" | ||
| εrange = (εF - austrip(width), εF + austrip(width)) | ||
| p = plot_dos(bands; εrange, colors=[:red, :red]) | ||
| plot_pdos(bands; p, iatom=1, label="3D", colors=[:yellow, :orange], εrange) | ||
|
|
||
| # To perform and Hubbard computation, we have to define the Hubbard manifold and associated constant | ||
| U = 10u"eV" | ||
| manifold = OrbitalManifold(; species=:Ni, label="3D") | ||
|
|
||
| # Run SCF with a DFT+U setup, notice the `extra_terms` keyword argument, setting up the Hubbard +U term. | ||
| model = model_DFT(lattice, atoms, positions; extra_terms=[Hubbard(manifold, U)], | ||
| functionals=PBE(), temperature=5e-3, magnetic_moments) | ||
| basis = PlaneWaveBasis(model; Ecut=32, kgrid=[2, 2, 2] ) | ||
| scfres = self_consistent_field(basis; tol=1e-10, ρ=guess_density(basis, magnetic_moments)) | ||
|
|
||
| # Run band computation | ||
| bands_hub = compute_bands(scfres, MonkhorstPack(4, 4, 4)) | ||
| lowest_unocc_band = findfirst(ε -> ε-bands_hub.εF > 0, bands_hub.eigenvalues[1]) | ||
| band_gap = bands_hub.eigenvalues[1][lowest_unocc_band] - bands_hub.eigenvalues[1][lowest_unocc_band-1] | ||
|
|
||
| # With the electron localization introduced by the Hubbard term, the band gap has now opened, | ||
| # reflecting the experimental insulating behaviour of Nickel Oxide. | ||
| εF = bands_hub.εF | ||
| εrange = (εF - austrip(width), εF + austrip(width)) | ||
| p = plot_dos(bands_hub; p, colors=[:blue, :blue], εrange) | ||
| plot_pdos(bands_hub; p, iatom=1, label="3D", colors=[:green, :purple], εrange) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.