SIRIUS 7.5.0
Electronic structure library and applications
Public Member Functions | Private Member Functions | Private Attributes | List of all members
sirius::Potential Class Reference

Generate effective potential from charge density and magnetization. More...

#include <potential.hpp>

Inherits sirius::Field4D.

Public Member Functions

 Potential (Simulation_context &ctx__)
 Constructor. More...
 
void update ()
 Recompute some variables that depend on atomic positions or the muffin-tin radius. More...
 
template<bool free_atom, typename T >
std::vector< T > poisson_vmt (Atom const &atom__, Spheric_function< function_domain_t::spectral, T > const &rho_mt__, Spheric_function< function_domain_t::spectral, T > &vha_mt__) const
 Solve Poisson equation for a single atom. More...
 
void poisson (Periodic_function< double > const &rho)
 Poisson solver. More...
 
template<bool add_pseudo_core__ = false>
void xc (Density const &rho__)
 Generate XC potential and energy density. More...
 
void generate (Density const &density__, bool use_sym__, bool transform_to_rg__)
 Generate effective potential and magnetic field from charge density and magnetization. More...
 
void save (std::string name__)
 
void load (std::string name__)
 
void update_atomic_potential ()
 
template<sddk::device_t pu>
void add_mt_contribution_to_pw ()
 
void generate_pw_coefs ()
 Generate plane-wave coefficients of the potential in the interstitial region. More...
 
void generate_D_operator_matrix ()
 Calculate D operator from potential and augmentation charge. More...
 
void generate_PAW_effective_potential (Density const &density)
 
double PAW_xc_total_energy (Density const &density__) const
 
double PAW_total_energy (Density const &density__) const
 
double PAW_one_elec_energy (Density const &density__) const
 
void check_potential_continuity_at_mt ()
 
auto & effective_potential ()
 
auto const & effective_potential () const
 
auto & local_potential ()
 
auto const & local_potential () const
 
auto & dveff ()
 
auto const & effective_potential_mt (atom_index_t::local ialoc) const
 
auto & effective_magnetic_field (int i)
 
auto & effective_magnetic_field (int i) const
 
auto & hartree_potential ()
 
auto const & hartree_potential_mt (atom_index_t::local ialoc) const
 
auto & xc_potential ()
 
auto const & xc_potential () const
 
auto & xc_energy_density ()
 
auto const & xc_energy_density () const
 
auto vh_el (int ia) const
 
auto energy_vha () const
 
auto const & veff_pw (int ig__) const
 
void set_veff_pw (std::complex< double > const *veff_pw__)
 
auto const & rm_inv_pw (int ig__) const
 
void set_rm_inv_pw (std::complex< double > const *rm_inv_pw__)
 
auto const & rm2_inv_pw (int ig__) const
 
void set_rm2_inv_pw (std::complex< double > const *rm2_inv_pw__)
 
auto energy_vxc (Density const &density__) const
 Integral of \( \rho({\bf r}) V^{XC}({\bf r}) \). More...
 
auto energy_vxc_core (Density const &density__) const
 Integral of \( \rho_{c}({\bf r}) V^{XC}({\bf r}) \). More...
 
auto energy_exc (Density const &density__) const
 Integral of \( \rho({\bf r}) \epsilon^{XC}({\bf r}) \). More...
 
bool is_gradient_correction () const
 
auto & vsigma (int idx__)
 
void add_delta_rho_xc (double d__)
 
void add_delta_mag_xc (double d__)
 
auto & U () const
 
auto & hubbard_potential ()
 
auto const & hubbard_potential () const
 
- Public Member Functions inherited from sirius::Field4D
 Field4D (Simulation_context &ctx__, lmax_t lmax__, std::array< periodic_function_ptr_t< double > const *, 4 > ptr__={nullptr, nullptr, nullptr, nullptr})
 Constructor. More...
 
auto & scalar ()
 Return scalar part of the field. More...
 
auto const & scalar () const
 Return scalar part of the field. More...
 
auto & vector (int i)
 Return component of the vector part of the field. More...
 
auto const & vector (int i) const
 Return component of the vector part of the field. More...
 
auto & component (int i)
 
auto & component_raise (int i)
 Throws error in case of invalid access. More...
 
auto const & component (int i) const
 
void zero ()
 
void fft_transform (int direction__)
 
auto & ctx ()
 
auto const & ctx () const
 
auto mt_components ()
 
auto pw_components ()
 

Private Member Functions

void init_PAW ()
 
double calc_PAW_local_potential (typename atom_index_t::global ia__, std::vector< Flm const * > ae_density, std::vector< Flm const * > ps_density)
 Calculate PAW potential for a given atom. More...
 
void calc_PAW_local_Dij (typename atom_index_t::global ia__, sddk::mdarray< double, 3 > &paw_dij__)
 
double calc_PAW_hartree_potential (Atom &atom, Flm const &full_density, Flm &full_potential)
 
double calc_PAW_one_elec_energy (Atom const &atom__, sddk::mdarray< double, 2 > const &density_matrix__, sddk::mdarray< double, 3 > const &paw_dij__) const
 
auto poisson_vmt (Periodic_function< double > const &rho__) const
 Compute MT part of the potential and MT multipole moments. More...
 
void poisson_add_pseudo_pw (sddk::mdarray< std::complex< double >, 2 > &qmt__, sddk::mdarray< std::complex< double >, 2 > &qit__, std::complex< double > *rho_pw__)
 Add contribution from the pseudocharge to the plane-wave expansion. More...
 
void generate_local_potential ()
 Generate local part of pseudo potential. More...
 
void xc_mt (Density const &density__)
 Generate XC potential in the muffin-tins. More...
 
template<bool add_pseudo_core__>
void xc_rg_nonmagnetic (Density const &density__)
 Generate non-magnetic XC potential on the regular real-space grid. More...
 
template<bool add_pseudo_core__>
void xc_rg_magnetic (Density const &density__)
 Generate magnetic XC potential on the regular real-space grid. More...
 

Private Attributes

Unit_cellunit_cell_
 Alias to unit cell. More...
 
mpi::Communicator const & comm_
 Communicator of the simulation. More...
 
std::unique_ptr< Periodic_function< double > > hartree_potential_
 Hartree potential. More...
 
std::unique_ptr< Periodic_function< double > > xc_potential_
 XC potential. More...
 
std::unique_ptr< Periodic_function< double > > xc_energy_density_
 XC energy per unit particle. More...
 
std::unique_ptr< Smooth_periodic_function< double > > local_potential_
 Local part of pseudopotential. More...
 
std::array< std::unique_ptr< Smooth_periodic_function< double > >, 3 > vsigma_
 Derivative \( \partial \epsilon^{XC} / \partial \sigma_{\alpha} \). More...
 
std::unique_ptr< Smooth_periodic_function< double > > dveff_
 Used to compute SCF correction to forces. More...
 
sddk::mdarray< double, 3 > sbessel_mom_
 Moments of the spherical Bessel functions. More...
 
sddk::mdarray< double, 3 > sbessel_mt_
 
sddk::mdarray< double, 2 > gamma_factors_R_
 
std::unique_ptr< SHTsht_
 
int pseudo_density_order_ {9}
 
std::vector< std::complex< double > > zil_
 
std::vector< std::complex< double > > zilm_
 
std::vector< int > l_by_lm_
 
sddk::mdarray< std::complex< double >, 2 > gvec_ylm_
 
double energy_vha_ {0}
 
sddk::mdarray< double, 1 > vh_el_
 Electronic part of Hartree potential. More...
 
std::vector< XC_functionalxc_func_
 
sddk::mdarray< std::complex< double >, 1 > veff_pw_
 Plane-wave coefficients of the effective potential weighted by the unit step-function. More...
 
sddk::mdarray< std::complex< double >, 1 > rm_inv_pw_
 Plane-wave coefficients of the inverse relativistic mass weighted by the unit step-function. More...
 
sddk::mdarray< std::complex< double >, 1 > rm2_inv_pw_
 Plane-wave coefficients of the squared inverse relativistic mass weighted by the unit step-function. More...
 
double paw_hartree_total_energy_ {0.0}
 Hartree contribution to total energy from PAW atoms. More...
 
std::unique_ptr< PAW_field4D< double > > paw_potential_
 All-electron and pseudopotential parts of PAW potential. More...
 
std::unique_ptr< Spheric_function_set< double, paw_atom_index_t > > paw_ps_exc_
 Exchange-correlation energy density of PAW atoms pseudodensity. More...
 
std::unique_ptr< Spheric_function_set< double, paw_atom_index_t > > paw_ae_exc_
 Exchange-correlation energy density of PAW atoms all-electron density. More...
 
std::vector< sddk::mdarray< double, 3 > > paw_dij_
 Contribution to D-operator matrix from the PAW atoms. More...
 
sddk::mdarray< double, 2 > aux_bf_
 
std::unique_ptr< HubbardU_
 Hubbard potential correction operator. More...
 
Hubbard_matrix hubbard_potential_
 Hubbard potential correction matrix. More...
 
double add_delta_rho_xc_ {0}
 Add extra charge to the density. More...
 
double add_delta_mag_xc_ {0}
 Add extra charge to the density. More...
 

Additional Inherited Members

- Protected Attributes inherited from sirius::Field4D
Simulation_contextctx_
 

Detailed Description

Generate effective potential from charge density and magnetization.

Note
At some point we need to update the atomic potential with the new MT potential. This is simple if the effective potential is a global function. Otherwise we need to pass the effective potential between MPI ranks. This is also simple, but requires some time. It is also easier to mix the global functions.

Definition at line 45 of file potential.hpp.

Constructor & Destructor Documentation

◆ Potential()

sirius::Potential::Potential ( Simulation_context ctx__)

Constructor.

Definition at line 33 of file potential.cpp.

Member Function Documentation

◆ init_PAW()

void sirius::Potential::init_PAW ( )
private

Definition at line 30 of file paw_potential.cpp.

◆ calc_PAW_local_potential()

double sirius::Potential::calc_PAW_local_potential ( typename atom_index_t::global  ia__,
std::vector< Flm const * >  ae_density,
std::vector< Flm const * >  ps_density 
)
private

Calculate PAW potential for a given atom.

Returns
Hartree energy contribution.

Definition at line 185 of file paw_potential.cpp.

◆ calc_PAW_local_Dij()

void sirius::Potential::calc_PAW_local_Dij ( typename atom_index_t::global  ia__,
sddk::mdarray< double, 3 > &  paw_dij__ 
)
private

Definition at line 218 of file paw_potential.cpp.

◆ calc_PAW_hartree_potential()

double sirius::Potential::calc_PAW_hartree_potential ( Atom atom,
Flm const &  full_density,
Flm full_potential 
)
private

Definition at line 166 of file paw_potential.cpp.

◆ calc_PAW_one_elec_energy()

double sirius::Potential::calc_PAW_one_elec_energy ( Atom const &  atom__,
sddk::mdarray< double, 2 > const &  density_matrix__,
sddk::mdarray< double, 3 > const &  paw_dij__ 
) const
private

Definition at line 308 of file paw_potential.cpp.

◆ poisson_vmt() [1/2]

auto sirius::Potential::poisson_vmt ( Periodic_function< double > const &  rho__) const
inlineprivate

Compute MT part of the potential and MT multipole moments.

Definition at line 160 of file potential.hpp.

◆ poisson_add_pseudo_pw()

void sirius::Potential::poisson_add_pseudo_pw ( sddk::mdarray< std::complex< double >, 2 > &  qmt__,
sddk::mdarray< std::complex< double >, 2 > &  qit__,
std::complex< double > *  rho_pw__ 
)
private

Add contribution from the pseudocharge to the plane-wave expansion.

Definition at line 49 of file poisson.cpp.

◆ generate_local_potential()

void sirius::Potential::generate_local_potential ( )
inlineprivate

Generate local part of pseudo potential.

Total local potential is a lattice sum:

\[ V({\bf r}) = \sum_{{\bf T},\alpha} V_{\alpha}({\bf r} - {\bf T} - {\bf \tau}_{\alpha}) \]

We want to compute it's plane-wave expansion coefficients:

\[ V({\bf G}) = \frac{1}{V} \int e^{-i{\bf Gr}} V({\bf r}) d{\bf r} = \frac{1}{V} \sum_{{\bf T},\alpha} \int e^{-i{\bf Gr}}V_{\alpha}({\bf r} - {\bf T} - {\bf \tau}_{\alpha})d{\bf r} \]

Standard change of variables: \( {\bf r}' = {\bf r} - {\bf T} - {\bf \tau}_{\alpha},\; {\bf r} = {\bf r}' + {\bf T} + {\bf \tau}_{\alpha} \) leads to:

\[ V({\bf G}) = \frac{1}{V} \sum_{{\bf T},\alpha} \int e^{-i{\bf G}({\bf r}' + {\bf T} + {\bf \tau}_{\alpha})}V_{\alpha}({\bf r}')d{\bf r'} = \frac{N}{V} \sum_{\alpha} \int e^{-i{\bf G}({\bf r}' + {\bf \tau}_{\alpha})}V_{\alpha}({\bf r}')d{\bf r'} = \frac{1}{\Omega} \sum_{\alpha} e^{-i {\bf G} {\bf \tau}_{\alpha} } \int e^{-i{\bf G}{\bf r}}V_{\alpha}({\bf r})d{\bf r} \]

Using the well-known expansion of a plane wave in terms of spherical Bessel functions:

\[ e^{i{\bf G}{\bf r}}=4\pi \sum_{\ell m} i^\ell j_{\ell}(Gr)Y_{\ell m}^{*}({\bf \hat G})Y_{\ell m}({\bf \hat r}) \]

and remembering that for \( \ell = 0 \) (potential is sphericla) \( j_{0}(x) = \sin(x) / x \) we have:

\[ V_{\alpha}({\bf G}) = \int V_{\alpha}(r) 4\pi \frac{\sin(Gr)}{Gr} Y^{*}_{00} Y_{00} r^2 \sin(\theta) dr d \phi d\theta = 4\pi \int V_{\alpha}(r) \frac{\sin(Gr)}{Gr} r^2 dr \]

The tricky part comes next: \( V_{\alpha}({\bf r}) \) is a long-range potential – it decays slowly as \( -Z_{\alpha}^{p}/r \) and the straightforward integration with sperical Bessel function is numerically unstable. For \( {\bf G} = 0 \) an extra term \( Z_{\alpha}^p/r \), corresponding to the potential of pseudo-ion, is added to and removed from the local part of the atomic pseudopotential \( V_{\alpha}({\bf r}) \):

\[ V_{\alpha}({\bf G} = 0) = \int V_{\alpha}({\bf r})d{\bf r} \Rightarrow 4\pi \int \Big( V_{\alpha}(r) + \frac{Z_{\alpha}^p}{r} \Big) r^2 dr - 4\pi \int \Big( \frac{Z_{\alpha}^p}{r} \Big) r^2 dr \]

Second term corresponds to the average electrostatic potential of ions and it is ignored (like the \( {\bf G} = 0 \) term in the Hartree potential of electrons). For \( G \ne 0 \) the following trick is done: \( Z_{\alpha}^p {\rm erf}(r) / r \) is added to and removed from \( V_{\alpha}(r) \). The idea is to make potential decay quickly and then take the extra contribution analytically. We have:

\[ V_{\alpha}({\bf G}) = 4\pi \int \Big(V_{\alpha}(r) + Z_{\alpha}^p \frac{{\rm erf}(r)} {r} - Z_{\alpha}^p \frac{{\rm erf}(r)}{r}\Big) \frac{\sin(Gr)}{Gr} r^2 dr \]

Analytical contribution from the error function is computed using the 1D Fourier transform in complex plane:

\[ \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{\infty} {\rm erf}(t) e^{i\omega t} dt = \frac{i e^{-\frac{\omega ^2}{4}} \sqrt{\frac{2}{\pi }}}{\omega } \]

from which we immediately get

\[ \int_{0}^{\infty} \frac{{\rm erf}(r)}{r} \frac{\sin(Gr)}{Gr} r^2 dr = \frac{e^{-\frac{G^2}{4}}}{G^2} \]

The final expression for the local potential radial integrals for \( G \ne 0 \) take the following form:

\[ 4\pi \int \Big(V_{\alpha}(r) r + Z_{\alpha}^p {\rm erf}(r) \Big) \frac{\sin(Gr)}{G} dr - Z_{\alpha}^p \frac{e^{-\frac{G^2}{4}}}{G^2} \]

Definition at line 248 of file potential.hpp.

◆ xc_mt()

void sirius::Potential::xc_mt ( Density const &  density__)
private

Generate XC potential in the muffin-tins.

Definition at line 314 of file xc_mt.cpp.

◆ xc_rg_nonmagnetic()

template<bool add_pseudo_core__>
template void sirius::Potential::xc_rg_nonmagnetic< false > ( Density const &  density__)
private

Generate non-magnetic XC potential on the regular real-space grid.

  • this is the same expression between gga and vdw corrections.

Definition at line 36 of file xc.cpp.

◆ xc_rg_magnetic()

template<bool add_pseudo_core__>
template void sirius::Potential::xc_rg_magnetic< false > ( Density const &  density__)
private

Generate magnetic XC potential on the regular real-space grid.

Definition at line 247 of file xc.cpp.

◆ update()

void sirius::Potential::update ( )

Recompute some variables that depend on atomic positions or the muffin-tin radius.

Definition at line 152 of file potential.cpp.

◆ poisson_vmt() [2/2]

template<bool free_atom, typename T >
std::vector< T > sirius::Potential::poisson_vmt ( Atom const &  atom__,
Spheric_function< function_domain_t::spectral, T > const &  rho_mt__,
Spheric_function< function_domain_t::spectral, T > &  vha_mt__ 
) const
inline

Solve Poisson equation for a single atom.

Definition at line 293 of file potential.hpp.

◆ poisson()

void sirius::Potential::poisson ( Periodic_function< double > const &  rho)

Poisson solver.

Detailed explanation is available in:

  • Weinert, M. (1981). Solution of Poisson's equation: beyond Ewald-type methods. Journal of Mathematical Physics, 22(11), 2433–2439. doi:10.1063/1.524800
  • Classical Electrodynamics Third Edition by J. D. Jackson.

Solution of Poisson's equation for the muffin-tin geometry is carried out in several steps:

  • True multipole moments \( q_{\ell m}^{\alpha} \) of the muffin-tin charge density are computed.
  • Pseudocharge density is introduced. Pseudocharge density coincides with the true charge density in the interstitial region and it's multipole moments inside muffin-tin spheres coincide with the true multipole moments.
  • Poisson's equation for the pseudocharge density is solved in the plane-wave domain. It gives the correct interstitial potential and correct muffin-tin boundary values.
  • Finally, muffin-tin part of potential is found by solving Poisson's equation in spherical coordinates with Dirichlet boundary conditions.

We start by computing true multipole moments of the charge density inside the muffin-tin spheres:

\[ q_{\ell m}^{\alpha} = \int Y_{\ell m}^{*}(\hat {\bf r}) r^{\ell} \rho({\bf r}) d {\bf r} = \int \rho_{\ell m}^{\alpha}(r) r^{\ell + 2} dr \]

and for the nucleus with charge density \( \rho(r, \theta, \phi) = -\frac{Z \delta(r)}{4 \pi r^2} \):

\[ q_{00}^{\alpha} = \int Y_{0 0} \frac{-Z_{\alpha} \delta(r)}{4 \pi r^2} r^2 \sin \theta dr d\phi d\theta = -Z_{\alpha} Y_{00} \]

Now we need to get the multipole moments of the interstitial charge density \( \rho^{I}({\bf r}) \) inside muffin-tin spheres. We need this in order to estimate the amount of pseudocharge to be added to \( \rho^{I}({\bf r}) \) to get the pseudocharge multipole moments equal to the true multipole moments. We want to compute

\[ q_{\ell m}^{I,\alpha} = \int Y_{\ell m}^{*}(\hat {\bf r}) r^{\ell} \rho^{I}({\bf r}) d {\bf r} \]

where

\[ \rho^{I}({\bf r}) = \sum_{\bf G}e^{i{\bf Gr}} \rho({\bf G}) \]

Recall the spherical plane wave expansion:

\[ e^{i{\bf G r}}=4\pi e^{i{\bf G r}_{\alpha}} \sum_{\ell m} i^\ell j_{\ell}(G|{\bf r}-{\bf r}_{\alpha}|) Y_{\ell m}^{*}({\bf \hat G}) Y_{\ell m}(\widehat{{\bf r}-{\bf r}_{\alpha}}) \]

Multipole moments of each plane-wave are computed as:

\[ q_{\ell m}^{\alpha}({\bf G}) = 4 \pi e^{i{\bf G r}_{\alpha}} Y_{\ell m}^{*}({\bf \hat G}) i^{\ell} \int_{0}^{R} j_{\ell}(Gr) r^{\ell + 2} dr = 4 \pi e^{i{\bf G r}_{\alpha}} Y_{\ell m}^{*}({\bf \hat G}) i^{\ell} \left\{\begin{array}{ll} \frac{R^{\ell + 2} j_{\ell + 1}(GR)}{G} & G \ne 0 \\ \frac{R^3}{3} \delta_{\ell 0} & G = 0 \end{array} \right. \]

Final expression for the muffin-tin multipole moments of the interstitial charge density:

\[ q_{\ell m}^{I,\alpha} = \sum_{\bf G}\rho({\bf G}) q_{\ell m}^{\alpha}({\bf G}) \]

Now we are going to modify interstitial charge density inside the muffin-tin region in order to get the true multipole moments. We will add a pseudodensity of the form:

\[ P({\bf r}) = \sum_{\ell m} p_{\ell m}^{\alpha} Y_{\ell m}(\hat {\bf r}) r^{\ell} \left(1-\frac{r^2}{R^2}\right)^n \]

Radial functions of the pseudodensity are chosen in a special way. First, they produce a confined and smooth functions inside muffin-tins and second (most important) plane-wave coefficients of the pseudodensity can be computed analytically. Let's find the relation between \( p_{\ell m}^{\alpha} \) coefficients and true and interstitial multipole moments first. We are searching for the pseudodensity which restores the true multipole moments:

\[ \int Y_{\ell m}^{*}(\hat {\bf r}) r^{\ell} \Big(\rho^{I}({\bf r}) + P({\bf r})\Big) d {\bf r} = q_{\ell m}^{\alpha} \]

Then

\[ p_{\ell m}^{\alpha} = \frac{q_{\ell m}^{\alpha} - q_{\ell m}^{I,\alpha}} {\int r^{2 \ell + 2} \left(1-\frac{r^2}{R^2}\right)^n dr} = (q_{\ell m}^{\alpha} - q_{\ell m}^{I,\alpha}) \frac{2 \Gamma(5/2 + \ell + n)}{R^{2\ell + 3}\Gamma(3/2 + \ell) \Gamma(n + 1)} \]

Now let's find the plane-wave coefficients of \( P({\bf r}) \) inside each muffin-tin:

\[ P^{\alpha}({\bf G}) = \frac{4\pi e^{-i{\bf G r}_{\alpha}}}{\Omega} \sum_{\ell m} (-i)^{\ell} Y_{\ell m}({\bf \hat G}) p_{\ell m}^{\alpha} \int_{0}^{R} j_{\ell}(G r) r^{\ell} \left(1-\frac{r^2}{R^2}\right)^n r^2 dr \]

Integral of the spherical Bessel function with the radial pseudodensity component is taken analytically:

\[ \int_{0}^{R} j_{\ell}(G r) r^{\ell} \left(1-\frac{r^2}{R^2}\right)^n r^2 dr = 2^n R^{\ell + 3} (GR)^{-n - 1} \Gamma(n + 1) j_{n + \ell + 1}(GR) \]

The final expression for the pseudodensity plane-wave component is:

\[ P^{\alpha}({\bf G}) = \frac{4\pi e^{-i{\bf G r}_{\alpha}}}{\Omega} \sum_{\ell m} (-i)^{\ell} Y_{\ell m}({\bf \hat G}) (q_{\ell m}^{\alpha} - q_{\ell m}^{I,\alpha}) \Big( \frac{2}{GR} \Big)^{n+1} \frac{ \Gamma(5/2 + n + \ell) } {R^{\ell} \Gamma(3/2+\ell)} j_{n + \ell + 1}(GR) \]

For \( G=0 \) only \( \ell = 0 \) contribution survives:

\[ P^{\alpha}({\bf G}=0) = \frac{4\pi}{\Omega} Y_{00} (q_{00}^{\alpha} - q_{00}^{I,\alpha}) \]

We can now sum the contributions from all muffin-tin spheres and obtain a modified charge density, which is equal to the exact charge density in the interstitial region and which has correct multipole moments inside muffin-tin spheres:

\[ \tilde \rho({\bf G}) = \rho({\bf G}) + \sum_{\alpha} P^{\alpha}({\bf G}) \]

This density is used to solve the Poisson's equation in the plane-wave domain:

\[ V_{H}({\bf G}) = \frac{4 \pi \tilde \rho({\bf G})}{G^2} \]

The potential is correct in the interstitial region and also on the muffin-tin surface. We will use it to find the boundary conditions for the potential inside the muffin-tins. Using spherical plane-wave expansion we get:

\[ V^{\alpha}_{\ell m}(R) = \sum_{\bf G} V_{H}({\bf G}) 4\pi e^{i{\bf G r}_{\alpha}} i^\ell j_{\ell}^{\alpha}(GR) Y_{\ell m}^{*}({\bf \hat G}) \]

As soon as the muffin-tin boundary conditions for the potential are known, we can find the potential inside spheres using Dirichlet Green's function:

\[ V({\bf x}) = \int \rho({\bf x'})G_D({\bf x},{\bf x'}) d{\bf x'} - \frac{1}{4 \pi} \int_{S} V({\bf x'}) \frac{\partial G_D}{\partial n'} d{\bf S'} \]

where Dirichlet Green's function for the sphere is defined as:

\[ G_D({\bf x},{\bf x'}) = 4\pi \sum_{\ell m} \frac{Y_{\ell m}^{*}({\bf \hat x'}) Y_{\ell m}(\hat {\bf x})}{2\ell + 1} \frac{r_{<}^{\ell}}{r_{>}^{\ell+1}}\Biggl(1 - \Big( \frac{r_{>}}{R} \Big)^{2\ell + 1} \Biggr) \]

and it's normal derivative at the surface is equal to:

\[ \frac{\partial G_D}{\partial n'} = -\frac{4 \pi}{R^2} \sum_{\ell m} \Big( \frac{r}{R} \Big)^{\ell} Y_{\ell m}^{*}({\bf \hat x'}) Y_{\ell m}(\hat {\bf x}) \]

Definition at line 158 of file poisson.cpp.

◆ xc()

template<bool add_pseudo_core__>
template void sirius::Potential::xc< false > ( Density const &  rho__)

Generate XC potential and energy density.

In case of spin-unpolarized GGA the XC potential has the following expression:

\[ V_{XC}({\bf r}) = \frac{\partial}{\partial \rho} \varepsilon_{xc}(\rho, \nabla \rho) - \nabla \frac{\partial}{\partial (\nabla \rho)} \varepsilon_{xc}(\rho, \nabla \rho) = \frac{\partial}{\partial \rho} \varepsilon_{xc}(\rho, \nabla \rho) - \sum_{\alpha} \frac{\partial}{\partial r_{\alpha}} \frac{\partial \varepsilon_{xc}(\rho, \nabla \rho) }{\partial g_{\alpha}} \]

where \( {\bf g}({\bf r}) = \nabla \rho({\bf r}) \).

LibXC packs the gradient information into the so-called sigma array:

\[ \sigma = \nabla \rho \nabla \rho = \sum_{\alpha} g_{\alpha}^2({\bf r}) \]

The derivative of \( \sigma \) with respect to the gradient of density is simply

\[ \frac{\partial \sigma}{\partial g_{\alpha}} = 2 g_{\alpha} \]

Changing variables in \( V_{XC} \) expression gives:

\begin{eqnarray*} V_{XC}({\bf r}) &=& \frac{\partial}{\partial \rho} \varepsilon_{xc}(\rho, \sigma) - \nabla \frac{\partial \varepsilon_{xc}(\rho, \sigma)}{\partial \sigma} \frac{\partial \sigma}{ \partial (\nabla \rho)} \\ &=& \frac{\partial}{\partial \rho} \varepsilon_{xc}(\rho, \sigma) - 2 \nabla \frac{\partial \varepsilon_{xc}(\rho, \sigma)}{\partial \sigma} \nabla \rho - 2 \frac{\partial \varepsilon_{xc}(\rho, \sigma)}{\partial \sigma} \nabla^2 \rho \end{eqnarray*}

Alternative expression can be derived for the XC potential if we leave the gradient:

\[ V_{XC}({\bf r}) = \frac{\partial}{\partial \rho} \varepsilon_{xc}(\rho, \sigma) - \sum_{\alpha} \frac{\partial}{\partial r_{\alpha}} \Big( \frac{\partial \varepsilon_{xc}(\rho, \sigma)}{\partial \sigma} 2 g_{\alpha} \Big) = \frac{\partial}{\partial \rho} \varepsilon_{xc}(\rho, \sigma) - 2 \nabla \Big( \frac{\partial \varepsilon_{xc}(\rho, \sigma)}{\partial \sigma} {\bf g}({\bf r}) \Big) \]

The following sequence of functions must be computed:

  • density on the real space grid
  • gradient of density (in spectral representation)
  • gradient of density on the real space grid
  • laplacian of density (in spectral representation)
  • laplacian of density on the real space grid
  • sigma array
  • a call to Libxc must be performed sigma derivatives must be obtained
  • \( \frac{\partial \varepsilon_{xc}(\rho, \sigma)}{\partial \sigma} \) in spectral representation
  • gradient of \( \frac{\partial \varepsilon_{xc}(\rho, \sigma)}{\partial \sigma} \) in spectral representation
  • gradient of \( \frac{\partial \varepsilon_{xc}(\rho, \sigma)}{\partial \sigma} \) on the real space grid

Expression for spin-polarized potential has a bit more complicated form:

\begin{eqnarray*} V_{XC}^{\gamma} &=& \frac{\partial \varepsilon_{xc}}{\partial \rho_{\gamma}} - \nabla \Big( 2 \frac{\partial \varepsilon_{xc}}{\partial \sigma_{\gamma \gamma}} \nabla \rho_{\gamma} + \frac{\partial \varepsilon_{xc}}{\partial \sigma_{\gamma \delta}} \nabla \rho_{\delta} \Big) \\ &=& \frac{\partial \varepsilon_{xc}}{\partial \rho_{\gamma}} -2 \nabla \frac{\partial \varepsilon_{xc}}{\partial \sigma_{\gamma \gamma}} \nabla \rho_{\gamma} -2 \frac{\partial \varepsilon_{xc}}{\partial \sigma_{\gamma \gamma}} \nabla^2 \rho_{\gamma} - \nabla \frac{\partial \varepsilon_{xc}}{\partial \sigma_{\gamma \delta}} \nabla \rho_{\delta} - \frac{\partial \varepsilon_{xc}}{\partial \sigma_{\gamma \delta}} \nabla^2 \rho_{\delta} \end{eqnarray*}

In magnetic case the "up" and "dn" density and potential decomposition is used. Using the fact that the effective magnetic field is parallel to magnetization at each point in space, we can write the coupling of density and magnetization with XC potential and XC magentic field as:

\[ V_{xc}({\bf r}) \rho({\bf r}) + {\bf B}_{xc}({\bf r}){\bf m}({\bf r}) = V_{xc}({\bf r}) \rho({\bf r}) + {\rm B}_{xc}({\bf r}) {\rm m}({\bf r}) = V^{\uparrow}({\bf r})\rho^{\uparrow}({\bf r}) + V^{\downarrow}({\bf r})\rho^{\downarrow}({\bf r}) \]

where

\begin{eqnarray*} \rho^{\uparrow}({\bf r}) &=& \frac{1}{2}\Big( \rho({\bf r}) + {\rm m}({\bf r}) \Big) \\ \rho^{\downarrow}({\bf r}) &=& \frac{1}{2}\Big( \rho({\bf r}) - {\rm m}({\bf r}) \Big) \end{eqnarray*}

and

\begin{eqnarray*} V^{\uparrow}({\bf r}) &=& V_{xc}({\bf r}) + {\rm B}_{xc}({\bf r}) \\ V^{\downarrow}({\bf r}) &=& V_{xc}({\bf r}) - {\rm B}_{xc}({\bf r}) \end{eqnarray*}

Definition at line 435 of file xc.cpp.

◆ generate()

void sirius::Potential::generate ( Density const &  density__,
bool  use_sym__,
bool  transform_to_rg__ 
)

Generate effective potential and magnetic field from charge density and magnetization.

Definition at line 241 of file potential.cpp.

◆ save()

void sirius::Potential::save ( std::string  name__)

Definition at line 380 of file potential.cpp.

◆ load()

void sirius::Potential::load ( std::string  name__)

Definition at line 397 of file potential.cpp.

◆ update_atomic_potential()

void sirius::Potential::update_atomic_potential ( )

Definition at line 426 of file potential.cpp.

◆ generate_pw_coefs()

void sirius::Potential::generate_pw_coefs ( )

Generate plane-wave coefficients of the potential in the interstitial region.

Definition at line 29 of file generate_pw_coeffs.cpp.

◆ generate_D_operator_matrix()

void sirius::Potential::generate_D_operator_matrix ( )

Calculate D operator from potential and augmentation charge.

The following real symmetric matrix is computed:

\[ D_{\xi \xi'}^{\alpha} = \int V({\bf r}) Q_{\xi \xi'}^{\alpha}({\bf r}) d{\bf r} \]

In the plane-wave domain this integrals transform into sum over Fourier components:

\[ D_{\xi \xi'}^{\alpha} = \sum_{\bf G} \langle V |{\bf G}\rangle \langle{\bf G}|Q_{\xi \xi'}^{\alpha} \rangle = \sum_{\bf G} V^{*}({\bf G}) e^{-i{\bf r}_{\alpha}{\bf G}} Q_{\xi \xi'}^{A}({\bf G}) = \sum_{\bf G} Q_{\xi \xi'}^{A}({\bf G}) \tilde V_{\alpha}^{*}({\bf G}) \]

where \( \alpha \) is the atom, \( A \) is the atom type and

\[ \tilde V_{\alpha}({\bf G}) = e^{i{\bf r}_{\alpha}{\bf G}} V({\bf G}) \]

Both \( V({\bf r}) \) and \( Q({\bf r}) \) functions are real and the following condition is fulfilled:

\[ \tilde V_{\alpha}({\bf G}) = \tilde V_{\alpha}^{*}(-{\bf G}) \]

\[ Q_{\xi \xi'}({\bf G}) = Q_{\xi \xi'}^{*}(-{\bf G}) \]

In the sum over plane-wave coefficients the \( {\bf G} \) and \( -{\bf G} \) contributions will give:

\[ Q_{\xi \xi'}^{A}({\bf G}) \tilde V_{\alpha}^{*}({\bf G}) + Q_{\xi \xi'}^{A}(-{\bf G}) \tilde V_{\alpha}^{*}(-{\bf G}) = 2 \Re \Big( Q_{\xi \xi'}^{A}({\bf G}) \Big) \Re \Big( \tilde V_{\alpha}({\bf G}) \Big) + 2 \Im \Big( Q_{\xi \xi'}^{A}({\bf G}) \Big) \Im \Big( \tilde V_{\alpha}({\bf G}) \Big) \]

This allows the use of a dgemm instead of a zgemm when \( D_{\xi \xi'}^{\alpha} \) matrix is calculated for all atoms of the same type.

Definition at line 42 of file generate_d_operator_matrix.cpp.

◆ generate_PAW_effective_potential()

void sirius::Potential::generate_PAW_effective_potential ( Density const &  density)

Definition at line 54 of file paw_potential.cpp.

◆ PAW_xc_total_energy()

double sirius::Potential::PAW_xc_total_energy ( Density const &  density__) const
inline

Definition at line 654 of file potential.hpp.

◆ PAW_total_energy()

double sirius::Potential::PAW_total_energy ( Density const &  density__) const
inline

Definition at line 686 of file potential.hpp.

◆ PAW_one_elec_energy()

double sirius::Potential::PAW_one_elec_energy ( Density const &  density__) const
inline

Definition at line 691 of file potential.hpp.

◆ effective_potential() [1/2]

auto & sirius::Potential::effective_potential ( )
inline

Definition at line 706 of file potential.hpp.

◆ effective_potential() [2/2]

auto const & sirius::Potential::effective_potential ( ) const
inline

Definition at line 711 of file potential.hpp.

◆ local_potential() [1/2]

auto & sirius::Potential::local_potential ( )
inline

Definition at line 716 of file potential.hpp.

◆ local_potential() [2/2]

auto const & sirius::Potential::local_potential ( ) const
inline

Definition at line 721 of file potential.hpp.

◆ dveff()

auto & sirius::Potential::dveff ( )
inline

Definition at line 726 of file potential.hpp.

◆ effective_potential_mt()

auto const & sirius::Potential::effective_potential_mt ( atom_index_t::local  ialoc) const
inline

Definition at line 731 of file potential.hpp.

◆ effective_magnetic_field() [1/2]

auto & sirius::Potential::effective_magnetic_field ( int  i)
inline

Definition at line 737 of file potential.hpp.

◆ effective_magnetic_field() [2/2]

auto & sirius::Potential::effective_magnetic_field ( int  i) const
inline

Definition at line 742 of file potential.hpp.

◆ hartree_potential()

auto & sirius::Potential::hartree_potential ( )
inline

Definition at line 747 of file potential.hpp.

◆ hartree_potential_mt()

auto const & sirius::Potential::hartree_potential_mt ( atom_index_t::local  ialoc) const
inline

Definition at line 752 of file potential.hpp.

◆ xc_potential() [1/2]

auto & sirius::Potential::xc_potential ( )
inline

Definition at line 758 of file potential.hpp.

◆ xc_potential() [2/2]

auto const & sirius::Potential::xc_potential ( ) const
inline

Definition at line 763 of file potential.hpp.

◆ xc_energy_density() [1/2]

auto & sirius::Potential::xc_energy_density ( )
inline

Definition at line 768 of file potential.hpp.

◆ xc_energy_density() [2/2]

auto const & sirius::Potential::xc_energy_density ( ) const
inline

Definition at line 773 of file potential.hpp.

◆ vh_el()

auto sirius::Potential::vh_el ( int  ia) const
inline

Definition at line 778 of file potential.hpp.

◆ energy_vha()

auto sirius::Potential::energy_vha ( ) const
inline

Definition at line 783 of file potential.hpp.

◆ veff_pw()

auto const & sirius::Potential::veff_pw ( int  ig__) const
inline

Definition at line 788 of file potential.hpp.

◆ set_veff_pw()

void sirius::Potential::set_veff_pw ( std::complex< double > const *  veff_pw__)
inline

Definition at line 793 of file potential.hpp.

◆ rm_inv_pw()

auto const & sirius::Potential::rm_inv_pw ( int  ig__) const
inline

Definition at line 798 of file potential.hpp.

◆ set_rm_inv_pw()

void sirius::Potential::set_rm_inv_pw ( std::complex< double > const *  rm_inv_pw__)
inline

Definition at line 803 of file potential.hpp.

◆ rm2_inv_pw()

auto const & sirius::Potential::rm2_inv_pw ( int  ig__) const
inline

Definition at line 808 of file potential.hpp.

◆ set_rm2_inv_pw()

void sirius::Potential::set_rm2_inv_pw ( std::complex< double > const *  rm2_inv_pw__)
inline

Definition at line 813 of file potential.hpp.

◆ energy_vxc()

auto sirius::Potential::energy_vxc ( Density const &  density__) const
inline

Integral of \( \rho({\bf r}) V^{XC}({\bf r}) \).

Definition at line 819 of file potential.hpp.

◆ energy_vxc_core()

auto sirius::Potential::energy_vxc_core ( Density const &  density__) const
inline

Integral of \( \rho_{c}({\bf r}) V^{XC}({\bf r}) \).

Definition at line 825 of file potential.hpp.

◆ energy_exc()

auto sirius::Potential::energy_exc ( Density const &  density__) const
inline

Integral of \( \rho({\bf r}) \epsilon^{XC}({\bf r}) \).

Definition at line 831 of file potential.hpp.

◆ is_gradient_correction()

bool sirius::Potential::is_gradient_correction ( ) const

Definition at line 230 of file potential.cpp.

◆ vsigma()

auto & sirius::Potential::vsigma ( int  idx__)
inline

Definition at line 842 of file potential.hpp.

◆ add_delta_rho_xc()

void sirius::Potential::add_delta_rho_xc ( double  d__)
inline

Definition at line 848 of file potential.hpp.

◆ add_delta_mag_xc()

void sirius::Potential::add_delta_mag_xc ( double  d__)
inline

Definition at line 853 of file potential.hpp.

◆ U()

auto & sirius::Potential::U ( ) const
inline

Definition at line 858 of file potential.hpp.

◆ hubbard_potential() [1/2]

auto & sirius::Potential::hubbard_potential ( )
inline

Definition at line 863 of file potential.hpp.

◆ hubbard_potential() [2/2]

auto const & sirius::Potential::hubbard_potential ( ) const
inline

Definition at line 868 of file potential.hpp.

Member Data Documentation

◆ unit_cell_

Unit_cell& sirius::Potential::unit_cell_
private

Alias to unit cell.

Definition at line 49 of file potential.hpp.

◆ comm_

mpi::Communicator const& sirius::Potential::comm_
private

Communicator of the simulation.

Definition at line 52 of file potential.hpp.

◆ hartree_potential_

std::unique_ptr<Periodic_function<double> > sirius::Potential::hartree_potential_
private

Hartree potential.

Definition at line 55 of file potential.hpp.

◆ xc_potential_

std::unique_ptr<Periodic_function<double> > sirius::Potential::xc_potential_
private

XC potential.

Definition at line 58 of file potential.hpp.

◆ xc_energy_density_

std::unique_ptr<Periodic_function<double> > sirius::Potential::xc_energy_density_
private

XC energy per unit particle.

Definition at line 61 of file potential.hpp.

◆ local_potential_

std::unique_ptr<Smooth_periodic_function<double> > sirius::Potential::local_potential_
private

Local part of pseudopotential.

Definition at line 64 of file potential.hpp.

◆ vsigma_

std::array<std::unique_ptr<Smooth_periodic_function<double> >, 3> sirius::Potential::vsigma_
private

Derivative \( \partial \epsilon^{XC} / \partial \sigma_{\alpha} \).

\( \epsilon^{XC} \) is the exchange-correlation energy per unit volume and \( \sigma \) is one of \( \nabla \rho_{\uparrow} \nabla \rho_{\uparrow} \), \( \nabla \rho_{\uparrow} \nabla \rho_{\downarrow}\) or \( \nabla \rho_{\downarrow} \nabla \rho_{\downarrow} \). This quantity is required to compute the GGA contribution to the XC stress tensor.

Definition at line 72 of file potential.hpp.

◆ dveff_

std::unique_ptr<Smooth_periodic_function<double> > sirius::Potential::dveff_
private

Used to compute SCF correction to forces.

This function is set by PW code and is not computed here.

Definition at line 76 of file potential.hpp.

◆ sbessel_mom_

sddk::mdarray<double, 3> sirius::Potential::sbessel_mom_
private

Moments of the spherical Bessel functions.

Definition at line 79 of file potential.hpp.

◆ sbessel_mt_

sddk::mdarray<double, 3> sirius::Potential::sbessel_mt_
private

Definition at line 81 of file potential.hpp.

◆ gamma_factors_R_

sddk::mdarray<double, 2> sirius::Potential::gamma_factors_R_
private

Definition at line 83 of file potential.hpp.

◆ sht_

std::unique_ptr<SHT> sirius::Potential::sht_
private

Definition at line 85 of file potential.hpp.

◆ pseudo_density_order_

int sirius::Potential::pseudo_density_order_ {9}
private

Definition at line 87 of file potential.hpp.

◆ zil_

std::vector<std::complex<double> > sirius::Potential::zil_
private

Definition at line 89 of file potential.hpp.

◆ zilm_

std::vector<std::complex<double> > sirius::Potential::zilm_
private

Definition at line 91 of file potential.hpp.

◆ l_by_lm_

std::vector<int> sirius::Potential::l_by_lm_
private

Definition at line 93 of file potential.hpp.

◆ gvec_ylm_

sddk::mdarray<std::complex<double>, 2> sirius::Potential::gvec_ylm_
private

Definition at line 95 of file potential.hpp.

◆ energy_vha_

double sirius::Potential::energy_vha_ {0}
private

Definition at line 97 of file potential.hpp.

◆ vh_el_

sddk::mdarray<double, 1> sirius::Potential::vh_el_
private

Electronic part of Hartree potential.

Used to compute electron-nuclear contribution to the total energy

Definition at line 101 of file potential.hpp.

◆ xc_func_

std::vector<XC_functional> sirius::Potential::xc_func_
private

Definition at line 103 of file potential.hpp.

◆ veff_pw_

sddk::mdarray<std::complex<double>, 1> sirius::Potential::veff_pw_
private

Plane-wave coefficients of the effective potential weighted by the unit step-function.

Definition at line 106 of file potential.hpp.

◆ rm_inv_pw_

sddk::mdarray<std::complex<double>, 1> sirius::Potential::rm_inv_pw_
private

Plane-wave coefficients of the inverse relativistic mass weighted by the unit step-function.

Definition at line 109 of file potential.hpp.

◆ rm2_inv_pw_

sddk::mdarray<std::complex<double>, 1> sirius::Potential::rm2_inv_pw_
private

Plane-wave coefficients of the squared inverse relativistic mass weighted by the unit step-function.

Definition at line 112 of file potential.hpp.

◆ paw_hartree_total_energy_

double sirius::Potential::paw_hartree_total_energy_ {0.0}
private

Hartree contribution to total energy from PAW atoms.

Definition at line 115 of file potential.hpp.

◆ paw_potential_

std::unique_ptr<PAW_field4D<double> > sirius::Potential::paw_potential_
private

All-electron and pseudopotential parts of PAW potential.

Definition at line 118 of file potential.hpp.

◆ paw_ps_exc_

std::unique_ptr<Spheric_function_set<double, paw_atom_index_t> > sirius::Potential::paw_ps_exc_
private

Exchange-correlation energy density of PAW atoms pseudodensity.

Definition at line 121 of file potential.hpp.

◆ paw_ae_exc_

std::unique_ptr<Spheric_function_set<double, paw_atom_index_t> > sirius::Potential::paw_ae_exc_
private

Exchange-correlation energy density of PAW atoms all-electron density.

Definition at line 124 of file potential.hpp.

◆ paw_dij_

std::vector<sddk::mdarray<double, 3> > sirius::Potential::paw_dij_
private

Contribution to D-operator matrix from the PAW atoms.

Definition at line 127 of file potential.hpp.

◆ aux_bf_

sddk::mdarray<double, 2> sirius::Potential::aux_bf_
private

Definition at line 129 of file potential.hpp.

◆ U_

std::unique_ptr<Hubbard> sirius::Potential::U_
private

Hubbard potential correction operator.

Definition at line 132 of file potential.hpp.

◆ hubbard_potential_

Hubbard_matrix sirius::Potential::hubbard_potential_
private

Hubbard potential correction matrix.

Definition at line 135 of file potential.hpp.

◆ add_delta_rho_xc_

double sirius::Potential::add_delta_rho_xc_ {0}
private

Add extra charge to the density.

This is used to verify the variational derivative of Exc w.r.t. density rho

Definition at line 139 of file potential.hpp.

◆ add_delta_mag_xc_

double sirius::Potential::add_delta_mag_xc_ {0}
private

Add extra charge to the density.

This is used to verify the variational derivative of Exc w.r.t. magnetisation mag

Definition at line 143 of file potential.hpp.


The documentation for this class was generated from the following files: