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

Conversation

BKaperick
Copy link

@BKaperick BKaperick commented Sep 3, 2022

Started work at the DFTK Summer School with @rashidrafeek and @ChRickert in response to issue #530.

  • Initialize fock exchange term and operator
  • Compute energy for 1 kpoint
  • Compute Hamiltonian
  • Extend LibXc and DftFunctionals interface to allow hybrid families
  • Add standard models like PBE0 and add test case
  • Generalize to fractional occupations
  • Make energy term work with arbitrary number of kpoints
  • Generalize SCF to mix orbitals
  • Implement ACE method for SCF for better performance

@antoine-levitt
Copy link
Member

Looks super, great work!

Extend energy code to work for arbitrary number of kpoints

Should be OK to do: when i = (n,k) and j = (n',k'), rho_ij = psi_i^* psi_j is exp(i(k'-k)x) u_nk*(x) u_mk(x), so V_ij can be computed in Fourier space just as you do now but with a |k'-k+G|^2 instead of G^2. That should possibly be the only change needed, except for normalizations maybe.

For testing, we should be able to compare hartree-fock against eg abinit.

additional TODOs (not necessarily in the scope of this PR, I'm just adding for future reference) is to generalize SCF to mix orbitals, and to implement the ACE method for performance.

@antoine-levitt
Copy link
Member

also as a TODO: generalize to fractional occupations

Copy link
Member

@mfherbst mfherbst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution! A very solid start.

I would in fact vote for rather not going all the way and merging this into DFTK asap (i.e. maybe only with the version for one k-Point and without temperature as it is implemented right now).

But please add the TODOs @antoine-levitt mentioned as well as the things you still have on your checkbox list above.

src/DispatchFunctional.jl Outdated Show resolved Hide resolved
src/DispatchFunctional.jl Outdated Show resolved Hide resolved
src/DispatchFunctional.jl Outdated Show resolved Hide resolved
src/standard_models.jl Show resolved Hide resolved
examples/silicon.jl Outdated Show resolved Hide resolved
src/terms/fock_exchange.jl Outdated Show resolved Hide resolved
src/terms/fock_exchange.jl Outdated Show resolved Hide resolved
src/terms/fock_exchange.jl Outdated Show resolved Hide resolved
src/terms/fock_exchange.jl Outdated Show resolved Hide resolved
src/terms/fock_exchange.jl Outdated Show resolved Hide resolved
src/terms/xc.jl Outdated Show resolved Hide resolved
src/DispatchFunctional.jl Show resolved Hide resolved
src/DispatchFunctional.jl Outdated Show resolved Hide resolved
src/standard_models.jl Outdated Show resolved Hide resolved
src/standard_models.jl Outdated Show resolved Hide resolved
src/terms/exact_exchange.jl Outdated Show resolved Hide resolved
src/terms/exact_exchange.jl Show resolved Hide resolved
src/terms/exact_exchange.jl Outdated Show resolved Hide resolved
src/terms/exact_exchange.jl Outdated Show resolved Hide resolved

# Solving poisson equation to obtain potential corresponding to
# ϕ_i(r')ϕ_j(r) / |r - r'|
vij_fourier = rho_ij_four_conj .* term.poisson_green_coeffs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be rho_ij_four ? Also it replaces \int ϕ_i^*(r) ϕ_j(r) / |r - r'| dr

src/terms/fock_exchange.jl Outdated Show resolved Hide resolved
@antoine-levitt
Copy link
Member

Note that the BZ integral is singular and needs to be regularized, either by short-ranging the Coulomb (this is what abinit does, apparently) or by a correction technique, see eg https://journals.aps.org/prb/pdf/10.1103/PhysRevB.34.4405 (this is what QE does by default). There's also https://journals.aps.org/prb/pdf/10.1103/PhysRevB.73.205119 which I haven't read yet, and probably more.

@antoine-levitt
Copy link
Member

@zhubonan
Copy link
Contributor

Hi @antoine-levitt @mfherbst,

I am interested in implementing the hybrid functional with k-point sampling. Actually have tried a bit, but there are quite a few things to be done such as getting the coulomb singularity correction computed and generating the q point set and corresponding wave functions. I am wondering if this is already being actively worked on and what is the best way to contribute.

@antoine-levitt
Copy link
Member

Hi,

As far as I know nobody's working on it actively, feel free to pick it up (the simplest is probably to start another PR; unless @BKaperick objects I think it's fine to use some of the code in this PR if you want, with proper attribution in a commit message). Getting this to work would be awesome!

Regarding the Coulomb the simplest solution to get something working is probably to just do a damped Coulomb.

For the set of q points, I'm not sure a specific set needs to be computed, can't you just use the existing kpoint grid? Or do you mean in the presence of symmetries? Note also that phonons are being actively worked on (cc @epolack), they might share some of the technology?

Feel free to get in touch (here, by email or on zulip)

@zhubonan
Copy link
Contributor

Thanks for the reply! I will try to pick it up and extend the functionality to multiple k points.

For the set of q points, I'm not sure a specific set needs to be computed, can't you just use the existing kpoint grid? Or do you mean in the presence of symmetries?

Yes, the existing grid can be used, but if the actual kpoints are reduced by symmetry only those in the irreducible BZ are calculated. However, the double summation requires the full grid to be used for the q points. So for each q we need to get its wave function from the symmetry related k point. This requires some transformation of the wave function (see https://docs.abinit.org/theory/wavefunctions/#symmetry-properties).

Note also that phonons are being actively worked on (cc @epolack), they might share some of the technology?

Good call, I will take a look there.

@antoine-levitt
Copy link
Member

I have not looked closely if symmetries can be used for exchange computations, presumably they can and then the symmetric structure can be used? We use things like apply_symop (in symmetries.jl) to convert when needed. If they can't (or as a first step before tackling the symmetries), it's reasonable to just do a fully non-symmetry-adapted calculation (symmetries=false in Model()). See also unfold_bz(scfres) in symmetry.jl.

@BKaperick
Copy link
Author

Hi,

As far as I know nobody's working on it actively, feel free to pick it up (the simplest is probably to start another PR; unless @BKaperick objects I think it's fine to use some of the code in this PR if you want, with proper attribution in a commit message). Getting this to work would be awesome!

Regarding the Coulomb the simplest solution to get something working is probably to just do a damped Coulomb.

For the set of q points, I'm not sure a specific set needs to be computed, can't you just use the existing kpoint grid? Or do you mean in the presence of symmetries? Note also that phonons are being actively worked on (cc @epolack), they might share some of the technology?

Feel free to get in touch (here, by email or on zulip)

Yes, sorry for letting this drag on @mfherbst and @antoine-levitt , I just could not find the time to get it working. Thank you for taking over the topic, @zhubonan. And of course you can use whatever code is useful from this PR.

@mfherbst
Copy link
Member

mfherbst commented Jan 4, 2024

Superseeded by #942.

@mfherbst mfherbst closed this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants