Octopus
nonlocal_pseudopotential_oct_m Module Reference

Data Types

type  nonlocal_pseudopotential_t
 nonlocal part of the pseudopotential More...
 
type  projection_t
 Class for projections of wave functions. More...
 

Functions/Subroutines

subroutine nonlocal_pseudopotential_init (this)
 initialize the nonlocal_pseudopotential_t object More...
 
subroutine, public nonlocal_pseudopotential_rebind_projectors (this, epot)
 Rebind projector matrix pointers (map, position) to a target epot. More...
 
subroutine nonlocal_pseudopotential_destroy_proj (this)
 Destroy the data of nonlocal_pseudopotential_t. More...
 
subroutine nonlocal_pseudopotential_build_proj (this, space, mesh, epot, ispin, overlap_operator, inverse_overlap_operator)
 build the projectors for the application of pseudo-potentials More...
 
integer function projector_beta_index (proj, ll, ic)
 
subroutine, public nonlocal_pseudopotential_accel_rebuild (this, space, mesh)
 Rebuild accelerator buffers after an intrinsic copy. More...
 
subroutine nonlocal_pseudopotential_detach_accel_buffers (this)
 Clear copied accelerator handles so they do not alias source buffers. More...
 
subroutine nonlocal_pseudopotential_build_accel_buffers (this, space, mesh)
 Build accelerator buffers for projectors from host-side projector matrices. More...
 
subroutine nonlocal_pseudopotential_build_projector_phase_accel_buffer (this)
 Rebuild projector phase accelerator buffer from host-side projector phases. More...
 
logical pure function nonlocal_pseudopotential_self_overlap (this)
 Returns .true. if the Hamiltonian contains projectors, which overlap with themself. More...
 
subroutine, public nonlocal_pseudopotential_update_dij (this, mesh, epot, veff, add_bare)
 Screen the ultrasoft nonlocal coupling matrix D_ij with the local potential. More...
 
subroutine nonlocal_pseudopotential_soc_build_zmix_cmplx (pmat, proj, use_qij)
 Build the spin-orbit 2x2 spin coupling (zmix) in the COMPLEX-Y_lm projector basis. More...
 
subroutine nonlocal_pseudopotential_soc_screen_cmplx (pmat, proj, mesh, veff)
 Add the screening int V^{ab}(r) Q_ij(r) to the complex-Y_lm SOC zmix. More...
 
subroutine, public nonlocal_pseudopotential_density_matrix_spinor (this, mesh, std, spiral_bnd, psib, weight, beta_density)
 Noncollinear (spinor) projector density matrix for the ultrasoft augmentation. More...
 
subroutine, public nonlocal_pseudopotential_density_matrix_spinor_cmplx (this, mesh, std, spiral_bnd, psib, weight, beta_density)
 Full COMPLEX spinor projector density matrix (fully-relativistic ultrasoft). More...
 
subroutine, public nonlocal_pseudopotential_soc_density_to_real (this, epot, rho_cmplx, beta_density)
 Rotate the complex-Y_lm projector density matrix to the real-Y_lm basis (SOC USPP). More...
 
complex(real64) function soc_recouple_a (ll, jplus, m, m_target, s, uu)
 A(l,jplus,m,m_l_target,s) = spinor_coeff(l,jplus,m,s) * conjg(uu(a, m_l+l+1)), with m_l = m + (s-1) required to equal the target m_l (pmatm). Returns 0 if out of range or if the spinor m_l does not match the requested target. More...
 
subroutine nonlocal_pseudopotential_soc_recoupling_matrix (pmat, proj, gmat)
 Build the mixed (l,j)->spin recoupling matrix G on composite (projector, spin) indices. More...
 
subroutine, public nonlocal_pseudopotential_force_uspp (this, mesh, epot, ndim, grad_pot, force_aug_weight, force)
 Ultrasoft augmentation contribution to the forces. More...
 
subroutine, public nonlocal_pseudopotential_aug_moment (this, mesh, epot, op, aug_op)
 Ultrasoft augmentation moments of a local operator A(r): int A(r) Q_ij(r-R_I) dr. More...
 
subroutine, public nonlocal_pseudopotential_aug_density (this, mesh, epot, force_aug_weight, aug_density)
 Accumulate the ultrasoft augmentation density n_aug(r) = sum_ij rho_ij Q_ij(r-R) (summed over all ultrasoft atoms) on the mesh, given the projector density matrix. More...
 
subroutine, public dnonlocal_pseudopotential_start (this, mesh, std, spiral_bnd, psib, projection, async)
 Start application of non-local potentials (stored in the Hamiltonian) to the wave functions. More...
 
subroutine dnonlocal_pseudopotential_finish (this, mesh, spiral_bnd, std, projection, vpsib)
 finish the application of non-local potentials. More...
 
subroutine, public dnonlocal_pseudopotential_apply_overlap (this, mesh, std, psib, spsib, phase, spiral_bnd, apply_phase)
 Apply the ultrasoft/PAW generalized overlap S = 1 + sum_ij |beta_i> q_ij <beta_j| (or, with another operator passed as this, S^{-1}) to a batch: spsib = S psib. More...
 
subroutine dnonlocal_pseudopotential_force (this, mesh, st, spiral_bnd, iqn, ndim, psi1b, psi2b, force)
 calculate contribution to forces, from non-local potentials More...
 
subroutine dnl_force_gather_projs (this, mesh, ndim, valb, gradb, projs)
 Gather the raw projector overlaps <beta|val> and <beta|grad val> on the sphere points. More...
 
subroutine dnonlocal_pseudopotential_force_overlap_cross (this, mesh, st, iqn, ndim, psib, gpsib, chib, gchib, force)
 Ultrasoft DFT+U force: the overlap-derivative (d_R S) term, as a cross density matrix. More...
 
subroutine dnonlocal_pseudopotential_position_commutator (this, mesh, std, spiral_bnd, psib, commpsib, async)
 apply the commutator between the non-local potential and the position to the wave functions. More...
 
subroutine dnonlocal_pseudopotential_r_vnlocal (this, mesh, std, spiral_bnd, psib, commpsib)
 Accumulates to commpsib the result of x V_{nl} | psib > More...
 
subroutine, public dnonlocal_pseudopotential_density_matrix (this, mesh, std, spiral_bnd, psib, weight, beta_density)
 Accumulate occupation-weighted beta-projector density matrices for USPP density. More...
 
subroutine, public znonlocal_pseudopotential_start (this, mesh, std, spiral_bnd, psib, projection, async)
 Start application of non-local potentials (stored in the Hamiltonian) to the wave functions. More...
 
subroutine znonlocal_pseudopotential_finish (this, mesh, spiral_bnd, std, projection, vpsib)
 finish the application of non-local potentials. More...
 
subroutine, public znonlocal_pseudopotential_apply_overlap (this, mesh, std, psib, spsib, phase, spiral_bnd, apply_phase)
 Apply the ultrasoft/PAW generalized overlap S = 1 + sum_ij |beta_i> q_ij <beta_j| (or, with another operator passed as this, S^{-1}) to a batch: spsib = S psib. More...
 
subroutine znonlocal_pseudopotential_force (this, mesh, st, spiral_bnd, iqn, ndim, psi1b, psi2b, force)
 calculate contribution to forces, from non-local potentials More...
 
subroutine znl_force_gather_projs (this, mesh, ndim, valb, gradb, projs)
 Gather the raw projector overlaps <beta|val> and <beta|grad val> on the sphere points. More...
 
subroutine znonlocal_pseudopotential_force_overlap_cross (this, mesh, st, iqn, ndim, psib, gpsib, chib, gchib, force)
 Ultrasoft DFT+U force: the overlap-derivative (d_R S) term, as a cross density matrix. More...
 
subroutine znonlocal_pseudopotential_position_commutator (this, mesh, std, spiral_bnd, psib, commpsib, async)
 apply the commutator between the non-local potential and the position to the wave functions. More...
 
subroutine znonlocal_pseudopotential_r_vnlocal (this, mesh, std, spiral_bnd, psib, commpsib)
 Accumulates to commpsib the result of x V_{nl} | psib > More...
 
subroutine, public znonlocal_pseudopotential_density_matrix (this, mesh, std, spiral_bnd, psib, weight, beta_density)
 Accumulate occupation-weighted beta-projector density matrices for USPP density. More...
 

Function/Subroutine Documentation

◆ nonlocal_pseudopotential_init()

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_init ( class(nonlocal_pseudopotential_t), intent(inout)  this)
private

initialize the nonlocal_pseudopotential_t object

Definition at line 247 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_rebind_projectors()

subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_rebind_projectors ( class(nonlocal_pseudopotential_t), intent(inout), target  this,
type(epot_t), intent(in), target  epot 
)

Rebind projector matrix pointers (map, position) to a target epot.

After intrinsic assignment, these pointer components still point to the source epot spheres and must be rebound to the snapshot epot.

Definition at line 266 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_destroy_proj()

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_destroy_proj ( class(nonlocal_pseudopotential_t), intent(inout)  this)
private

Destroy the data of nonlocal_pseudopotential_t.

Definition at line 310 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_build_proj()

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_build_proj ( class(nonlocal_pseudopotential_t), intent(inout), target  this,
class(space_t), intent(in)  space,
class(mesh_t), intent(in)  mesh,
type(epot_t), intent(in), target  epot,
integer, intent(in)  ispin,
logical, intent(in), optional  overlap_operator,
logical, intent(in), optional  inverse_overlap_operator 
)
private

build the projectors for the application of pseudo-potentials

This routine also determines the regions for the projectors and whether any projector overlaps with itself in a periodic system.

Parameters
[in]overlap_operatorbuild the overlap S (mix = q_ij)
[in]inverse_overlap_operatorbuild the inverse overlap S^{-1} (mix = -T_ij)

Definition at line 365 of file nonlocal_pseudopotential.F90.

◆ projector_beta_index()

integer function nonlocal_pseudopotential_oct_m::projector_beta_index ( type(projector_t), intent(in)  proj,
integer, intent(in)  ll,
integer, intent(in)  ic 
)
private

Definition at line 1025 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_accel_rebuild()

subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_accel_rebuild ( class(nonlocal_pseudopotential_t), intent(inout), target  this,
class(space_t), intent(in)  space,
class(mesh_t), intent(in)  mesh 
)

Rebuild accelerator buffers after an intrinsic copy.

Definition at line 1048 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_detach_accel_buffers()

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_detach_accel_buffers ( class(nonlocal_pseudopotential_t), intent(inout)  this)
private

Clear copied accelerator handles so they do not alias source buffers.

Definition at line 1075 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_build_accel_buffers()

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_build_accel_buffers ( class(nonlocal_pseudopotential_t), intent(inout), target  this,
class(space_t), intent(in)  space,
class(mesh_t), intent(in)  mesh 
)
private

Build accelerator buffers for projectors from host-side projector matrices.

Definition at line 1098 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_build_projector_phase_accel_buffer()

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_build_projector_phase_accel_buffer ( class(nonlocal_pseudopotential_t), intent(inout)  this)
private

Rebuild projector phase accelerator buffer from host-side projector phases.

Definition at line 1283 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_self_overlap()

logical pure function nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_self_overlap ( class(nonlocal_pseudopotential_t), intent(in)  this)
private

Returns .true. if the Hamiltonian contains projectors, which overlap with themself.

Definition at line 1322 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_update_dij()

subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_update_dij ( class(nonlocal_pseudopotential_t), intent(inout), target  this,
class(mesh_t), intent(in)  mesh,
type(epot_t), intent(in), target  epot,
real(real64), dimension(:, :), intent(in)  veff,
logical, intent(in), optional  add_bare 
)

Screen the ultrasoft nonlocal coupling matrix D_ij with the local potential.

For ultrasoft/PAW the nonlocal coefficients are screened by the self-consistent local potential: D_ij = D_ij^(0) + \int V_eff(r) Q_ij(r) dr , where D_ij^(0) is the bare (descreened) matrix from the pseudopotential and Q_ij(r) the augmentation function. This must be recomputed whenever V_eff changes (every SCF step) so the augmentation enters the Hamiltonian self-consistently. The bare block-diagonal part is reconstructed from projuspp_dij; the screening integral is the adjoint of the real-space density augmentation (see density_calc_accumulate_uspp). With add_bare = .false. only the screening integral is stored, which is the augmentation part of an arbitrary local potential (e.g. the delta-kick potential).

Parameters
[in]vefflocal effective potential (1:meshnp, 1:nspin)
[in]add_bareadd the bare D_ij^(0) (default: .true.)

Definition at line 1341 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_soc_build_zmix_cmplx()

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_soc_build_zmix_cmplx ( type(projector_matrix_t), intent(inout), target  pmat,
type(projector_t), intent(in), target  proj,
logical, intent(in)  use_qij 
)
private

Build the spin-orbit 2x2 spin coupling (zmix) in the COMPLEX-Y_lm projector basis.

Direct closed-form Clebsch-Gordan coupling of the j-ordered channel matrix uspp_dij (Hamiltonian, use_qij=.false.) or uspp_qij (overlap, use_qij=.true.) onto the complex-Y_lm projectors, via soc_uspp_add_channel_coupling_cmplx. No complex->real transform (the projectors are already complex Y_lm). This is the fully-relativistic-ultrasoft analogue of dvan_so / qq_so.

Definition at line 1491 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_soc_screen_cmplx()

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_soc_screen_cmplx ( type(projector_matrix_t), intent(inout), target  pmat,
type(projector_t), intent(in), target  proj,
class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :), intent(in)  veff 
)
private

Add the screening int V^{ab}(r) Q_ij(r) to the complex-Y_lm SOC zmix.

octopus has no complex Gaunt, so the screening is first evaluated in the REAL-Y_lm basis (exactly the noncollinear-magnetism screening: D^r_{(m_i c_i)(m_j c_j)}^{ab} = sum_L real_gaunt int V^{ab} Y_LM Q^L) and then RECOUPLED (not just rotated) to the complex-Y_lm projector basis as the energy dual of the density recoupling: D^c = G^H D^r G, with G the mixed (l,j)->spin coefficient of soc_density_to_real. This guarantees Tr[rho^c D^c] = Tr[becsum D^r], i.e. the nonlocal screening energy is consistent with the augmentation density that generated V_eff.

Definition at line 1553 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_density_matrix_spinor()

subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_density_matrix_spinor ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
real(real64), dimension(:), intent(in)  weight,
real(real64), dimension(:, :, :, :), intent(inout), allocatable  beta_density 
)

Noncollinear (spinor) projector density matrix for the ultrasoft augmentation.

Builds the 2x2 spin-density matrix in projector space, rho_ij^{ab} = sum_n f_n <beta_i|psi_n^b>^* <beta_j|psi_n^a> , following the augmented-density operator n^{ab}(r) = sum_ij <psi^b|beta_i> Q_ij(r) <beta_j|psi^a> (Vanderbilt 1990). The four real slabs returned match the spinor density convention used by density_calc_accumulate (1 = up-up, 2 = down-down, 3 = Re(up-down), 4 = Im(up-down)); the caller scatters sum_ij Q_ij(r) rho_ij into density(:,1:4). Spinors are always complex, so only the complex projection path is needed. Companion of the collinear (d/z)density_matrix routines.

Parameters
[in,out]beta_density(max_nprojs, max_nprojs, nmat, 4)

Definition at line 1669 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_density_matrix_spinor_cmplx()

subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_density_matrix_spinor_cmplx ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
real(real64), dimension(:), intent(in)  weight,
complex(real64), dimension(:, :, :, :, :), intent(inout), allocatable  beta_density 
)

Full COMPLEX spinor projector density matrix (fully-relativistic ultrasoft).

Same accumulation as nonlocal_pseudopotential_density_matrix_spinor, but keeps every spin block complex: rho(i, j, imat, s1, s2) = sum_n f_n conjg(<beta_i|psi_n^{s1}>) <beta_j|psi_n^{s2}>. With complex-Y_lm projectors the spin-diagonal blocks are genuinely complex (Hermitian, not symmetric), and the (l,j)->spin recoupling (soc_density_to_real) needs the full matrix — the four-real-slab storage of the noncollinear routine would silently drop the antisymmetric imaginary parts and corrupt the recoupled augmentation (spurious magnetization).

Parameters
[in,out]beta_density(nprojs, nprojs, nmat, 2, 2)

Definition at line 1762 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_soc_density_to_real()

subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_soc_density_to_real ( class(nonlocal_pseudopotential_t), intent(in), target  this,
type(epot_t), intent(in), target  epot,
complex(real64), dimension(:, :, :, :, :), intent(in), allocatable  rho_cmplx,
real(real64), dimension(:, :, :, :), intent(inout), allocatable  beta_density 
)

Rotate the complex-Y_lm projector density matrix to the real-Y_lm basis (SOC USPP).

For fully-relativistic USPP with complex-Y_lm projectors, the projector density matrix rho^c is in the complex-Y_lm basis, but the augmentation scatter (real_gaunt + uspp_ylm) works in real Y_lm. So rotate rho^c -> rho^r with the unitary transform uu (Y^real_a = sum_m uu(a,m) Y^cmplx_m): rho^r_{(a c_i)(b c_j)} = sum_{m n} conjg(uu(a,m)) uu(b,n) rho^c_{(m c_i)(n c_j)} , per l, per channel pair, spin untouched. The four real slabs (uu, dd, Re du, Im du) are overwritten in place, so the existing real-Y_lm augmentation scatter then produces the correct n^{ab}(r).

Parameters
[in]rho_cmplxfull complex rho (i,j,imat,s1,s2)
[in,out]beta_densityrecoupled real slabs (out)

Definition at line 1836 of file nonlocal_pseudopotential.F90.

◆ soc_recouple_a()

complex(real64) function nonlocal_pseudopotential_oct_m::soc_recouple_a ( integer, intent(in)  ll,
logical, intent(in)  jplus,
integer, intent(in)  m,
integer, intent(in)  m_target,
integer, intent(in)  s,
complex(real64), dimension(:, :), intent(in)  uu 
)
private

A(l,jplus,m,m_l_target,s) = spinor_coeff(l,jplus,m,s) * conjg(uu(a, m_l+l+1)), with m_l = m + (s-1) required to equal the target m_l (pmatm). Returns 0 if out of range or if the spinor m_l does not match the requested target.

Parameters
[in]sm_target = real-Y_lm m value of the projector

Definition at line 1899 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_soc_recoupling_matrix()

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_soc_recoupling_matrix ( type(projector_matrix_t), intent(in)  pmat,
type(projector_t), intent(in)  proj,
complex(real64), dimension(:, :), intent(out)  gmat 
)
private

Build the mixed (l,j)->spin recoupling matrix G on composite (projector, spin) indices.

G relates the COMPLEX-Y_lm spinor basis of the fully-relativistic projectors (row: complex projector p, spin s) to the REAL-Y_lm (x) spin basis of the augmentation scatter (column: real projector a, spin alpha). With the composite index idx(p, s) = p + (s-1)*nprojs,

G(idx(p, s), idx(a, alpha)) = A(l, j; m_p - (s-1) -> m_a, alpha) C^{j m_j}_{l, m_p-(s-1), s} ,

i.e. a Clebsch-Gordan on the complex leg times the complex->real Y_lm rotation on the real leg (soc_recouple_A * soc_uspp_spinor_coeff), block-diagonal in the (l, radial channel) blocks. The two SOC recouplings are then plain matrix sandwiches with this single matrix: becsum = G^H rho^c G (density) D^c = conjg(G) D^r G^T (screening) — mutually the energy dual, Tr[rho^c D^c] = Tr[becsum D^r]. Because every projector pair appears in the flattened matrices, cross-l entries (coupled by the L>0 Gaunt terms of the scatter/screening) are recoupled too, each leg within its own (l, channel) block.

Parameters
[out]gmat(2*nprojs, 2*nprojs)

Definition at line 1933 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_force_uspp()

subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_force_uspp ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(epot_t), intent(in), target  epot,
integer, intent(in)  ndim,
real(real64), dimension(:, :, :), intent(in)  grad_pot,
real(real64), dimension(:, :, :, :), intent(in)  force_aug_weight,
real(real64), dimension(:, :), intent(inout)  force 
)

Ultrasoft augmentation contribution to the forces.

Laasonen et al., PRB 47, 10142 (1993), Eq. (29), augmentation (newd) term:

F^aug_a(I) = - sum_ij rho_ij int (d_a V)(r) Q_ij(r - R_I) dr ,

with rho_ij = sum_{n} f_n <psi_n|beta_i><beta_j|psi_n> (force_aug_weight) the projector density matrix. It arises because moving atom I rigidly shifts Q_ij(r-R_I), which couples to the self-consistent potential through the augmentation density n_aug = sum_ij rho_ij Q_ij; after an integration by parts d_R Q = -d_r Q the derivative falls on the potential.

V is the FULL effective potential V_eff = V_loc + V_Hxc (caller passes grad_pot = grad V_eff). This is QE`s addusforce; together with the local-potential force evaluated with the FULL density (rho_val + n_aug, i.e. grad_rho includes grad n_aug) it gives the complete augmentation force. In particular, the local potential of the OTHER atoms acting on this atoms augmentation charge (a real, O(Z*q_aug) contribution for semicore pseudos) enters through V_eff here; dropping V_loc from V would silently omit it. The atoms OWN V_loc gives zero net force (the integral int V_loc^I(r-R) Q(r-R) dr is translationally invariant); that self term cancels between this routine and the full-density local force in the continuum. Gradient analogue of nonlocal_pseudopotential_update_dij; same Gaunt / Y_LM / Q^L(r) machinery.

Parameters
[in]grad_potgrad V_eff, (1:meshnp, 1:ndim, 1:ncomp)
[in]force_aug_weightrho_ij, (max_nprojs, max_nprojs, nmat, 1:ncomp)
[in,out]force(1:ndim, 1:natoms)

Definition at line 2004 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_aug_moment()

subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_aug_moment ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(epot_t), intent(in), target  epot,
real(real64), dimension(:), intent(in)  op,
real(real64), dimension(:, :, :), intent(inout)  aug_op 
)

Ultrasoft augmentation moments of a local operator A(r): int A(r) Q_ij(r-R_I) dr.

For ultrasoft/PAW the all-electron matrix element of a multiplicative operator A(r) between two pseudo-states carries an augmentation term, exactly as the charge density does (the density is the A = delta case):

<psi_i|A|psi_a> = int conjg(psitilde_i) A psitilde_a dr

  • sum_{I,nm} <psitilde_i|beta^I_n> <beta^I_m|psitilde_a> int A(r) Q^I_{nm}(r-R_I) dr .

This routine returns the geometry-dependent moments aug_op(n,m,I) = int A(r) Q^I_{nm}(r-R_I) dr. Because A is gathered at the ABSOLUTE mesh coordinates, the dipole operator A = x_alpha gives both the intrinsic L=1 moment of Q and the atom-position*charge offset R_{I,alpha} q_nm, which is what is needed to make the matrix element translationally consistent with the smooth term. Same Gaunt / Y_LM / Q^L(r) machinery as nonlocal_pseudopotential_update_dij (which is the A = V_eff case); here we do not add the bare block-diagonal D^(0).

Refs: Vanderbilt, PRB 41, 7892 (1990); Laasonen et al., PRB 47, 10142 (1993), Eq. (10); Gajdos, Hummer, Kresse, Furthmueller, Bechstedt, PRB 73, 045112 (2006) (optical matrix elements in the augmented-wave methodology).

Parameters
[in]opoperator A(r) on the mesh (1:meshnp)
[in,out]aug_op(max_nprojs, max_nprojs, nmat)

Definition at line 2123 of file nonlocal_pseudopotential.F90.

◆ nonlocal_pseudopotential_aug_density()

subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_aug_density ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(epot_t), intent(in), target  epot,
real(real64), dimension(:, :, :), intent(in)  force_aug_weight,
real(real64), dimension(:), intent(inout)  aug_density 
)

Accumulate the ultrasoft augmentation density n_aug(r) = sum_ij rho_ij Q_ij(r-R) (summed over all ultrasoft atoms) on the mesh, given the projector density matrix.

Same scatter as density_calc_accumulate_uspp but driven by the total (occupation- and k-summed) force_aug_weight (= rho_ij). The forces use it to form the FULL density rho_val + n_aug, whose gradient enters the local-potential force; this is what supplies the V_loc shift acting on the augmentation charge (including the other atoms` local potential).

Parameters
[in]force_aug_weightrho_ij
[in,out]aug_density(1:meshnp_part), accumulated

Definition at line 2205 of file nonlocal_pseudopotential.F90.

◆ dnonlocal_pseudopotential_start()

subroutine, public nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_start ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
type(projection_t), intent(out)  projection,
logical, intent(in), optional  async 
)

Start application of non-local potentials (stored in the Hamiltonian) to the wave functions.

This routine is split into the *_start and *_finish parts, in order to allow for other operations during device transfer or communications.

TODO: add more details.

Parameters
[in]meshthe mesh
[in]stddimensions of the states
[in]spiral_bndflag for spiral boundary conditions
[in]psiboriginal wave functions
[out]projectionTODO: add description

Definition at line 2346 of file nonlocal_pseudopotential.F90.

◆ dnonlocal_pseudopotential_finish()

subroutine nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_finish ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
logical, intent(in)  spiral_bnd,
type(states_elec_dim_t), intent(in)  std,
type(projection_t), intent(inout), target  projection,
class(wfs_elec_t), intent(inout)  vpsib 
)
private

finish the application of non-local potentials.

Definition at line 2811 of file nonlocal_pseudopotential.F90.

◆ dnonlocal_pseudopotential_apply_overlap()

subroutine, public nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_apply_overlap ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
type(wfs_elec_t), intent(in), target  psib,
type(wfs_elec_t), intent(inout)  spsib,
type(phase_t), intent(in), optional  phase,
logical, intent(in), optional  spiral_bnd,
logical, intent(in), optional  apply_phase 
)

Apply the ultrasoft/PAW generalized overlap S = 1 + sum_ij |beta_i> q_ij <beta_j| (or, with another operator passed as this, S^{-1}) to a batch: spsib = S psib.

When a Bloch phase is supplied (and apply_phase is not .false.), the phase exp(ik.r) is applied before the augmentation projection and undone afterwards, so that spsib is returned in the same (periodic, phase-free) representation as psib. S is Hermitian, so <phi|S|psi> = <S phi|psi> = <phi|(S psi)>. The projector maps only address inner points (1:np), so the spiral boundary phase of the ghost/boundary points (phaseapply_phase_spiral) is not needed here.

This is the single S-application primitive: hamiltonian_elec_apply_overlap_batch delegates to it (adding the packing / S-vs-S^{-1} selection / norm-conserving short-circuit), and it is also called directly from src/states (states_elec_calc), a layer that cannot depend on hamiltonian_elec.

Note
spsib must already be a structural copy of psib (e.g. via psibcopy_to(spsib)); its data is overwritten here. The batch is not packed/unpacked here (the caller manages that).
Parameters
[in]psibonly read (no packing/mutation here)
[in]phaseBloch phase for S at k /= 0
[in]spiral_bndspiral boundary conditions (default .false.)
[in]apply_phaseoverride: skip the phase even if present (default .true.)

Definition at line 3161 of file nonlocal_pseudopotential.F90.

◆ dnonlocal_pseudopotential_force()

subroutine nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_force ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(in)  st,
logical, intent(in)  spiral_bnd,
integer, intent(in)  iqn,
integer, intent(in)  ndim,
type(wfs_elec_t), intent(in)  psi1b,
type(wfs_elec_t), dimension(:), intent(in)  psi2b,
real(real64), dimension(:, :), intent(inout)  force 
)
private

calculate contribution to forces, from non-local potentials

TODO: add more details

spiral BC ik should be the same for psi2b

Definition at line 3213 of file nonlocal_pseudopotential.F90.

◆ dnl_force_gather_projs()

subroutine nonlocal_pseudopotential_oct_m::dnl_force_gather_projs ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ndim,
type(wfs_elec_t), intent(in)  valb,
type(wfs_elec_t), dimension(:), intent(in)  gradb,
real(real64), dimension(0:, 1:, 1:), intent(out)  projs 
)
private

Gather the raw projector overlaps <beta|val> and <beta|grad val> on the sphere points.

Fills projs(0:ndim, nst_linear, full_projection_size): projs(0,...) = sum_p beta(p) val(p) (the raw, un-scaled <beta_i|val>), and projs(idir,...) = sum_p beta(p) d_idir val(p). The physical integral is recovered by multiplying by pmatscal. Used by the cross overlap-derivative force below; mirrors the gather in nonlocal_pseudopotential_force.

Definition at line 3533 of file nonlocal_pseudopotential.F90.

◆ dnonlocal_pseudopotential_force_overlap_cross()

subroutine nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_force_overlap_cross ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(in)  st,
integer, intent(in)  iqn,
integer, intent(in)  ndim,
type(wfs_elec_t), intent(in)  psib,
type(wfs_elec_t), dimension(:), intent(in)  gpsib,
type(wfs_elec_t), intent(in)  chib,
type(wfs_elec_t), dimension(:), intent(in)  gchib,
real(real64), dimension(:, :), intent(inout)  force 
)
private

Ultrasoft DFT+U force: the overlap-derivative (d_R S) term, as a cross density matrix.

Implements the contribution of the position dependence of the generalized overlap S to the +U force, F^B_a(J) = -2 sum_n f_n Re <psi~_n|(d_a S)|chi_n>, with chi_n the bare +U ket chi_n = sum_m |phi_m> sum_mp V_mmp <phi_mp|S|psi~_n> = P S psi~_n. With S = 1 + sum_ij q_ij |beta_i><beta_j| and d_{R_J} beta = -grad beta this is

F^B_a(J) = -2 sum_n f_n Re sum_ij q_ij [ <grad_a beta_i|psi~_n> <beta_j|chi_n>

  • <beta_i|psi~_n> <grad_a beta_j|chi_n> ] ,

the overlap charges q_ij = pmatqmix. See for instace Binci et al., PRB 108, 115157 (2023) for the formulas

Parameters
[in]psibpsi~ (phase-set)
[in]gpsibgrad psi~ (ndim batches)
[in]chibchi = P S psi~ (phase-set)
[in]gchibgrad chi (ndim batches)

Definition at line 3651 of file nonlocal_pseudopotential.F90.

◆ dnonlocal_pseudopotential_position_commutator()

subroutine nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_position_commutator ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
class(wfs_elec_t), dimension(:), intent(inout), target  commpsib,
logical, intent(in), optional  async 
)
private

apply the commutator between the non-local potential and the position to the wave functions.

TODO: add more details

Parameters
[in]meshthe mesh
[in]stdthe electronic states
[in]spiral_bndflag for spiral boundary conditions
[in]psiboriginal wave functions psi
[in,out]commpsibresulting [v_nl, r]*psi

Definition at line 3740 of file nonlocal_pseudopotential.F90.

◆ dnonlocal_pseudopotential_r_vnlocal()

subroutine nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_r_vnlocal ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
class(wfs_elec_t), dimension(1:3), intent(inout), target  commpsib 
)
private

Accumulates to commpsib the result of x V_{nl} | psib >

Definition at line 4147 of file nonlocal_pseudopotential.F90.

◆ dnonlocal_pseudopotential_density_matrix()

subroutine, public nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_density_matrix ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
real(real64), dimension(:), intent(in)  weight,
real(real64), dimension(:, :, :, :), intent(inout), allocatable  beta_density 
)

Accumulate occupation-weighted beta-projector density matrices for USPP density.

Parameters
[in,out]beta_densitySpin-resolved projector density matrix rho_ij^sigma

Definition at line 4535 of file nonlocal_pseudopotential.F90.

◆ znonlocal_pseudopotential_start()

subroutine, public nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_start ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
type(projection_t), intent(out)  projection,
logical, intent(in), optional  async 
)

Start application of non-local potentials (stored in the Hamiltonian) to the wave functions.

This routine is split into the *_start and *_finish parts, in order to allow for other operations during device transfer or communications.

TODO: add more details.

Parameters
[in]meshthe mesh
[in]stddimensions of the states
[in]spiral_bndflag for spiral boundary conditions
[in]psiboriginal wave functions
[out]projectionTODO: add description

Definition at line 4684 of file nonlocal_pseudopotential.F90.

◆ znonlocal_pseudopotential_finish()

subroutine nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_finish ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
logical, intent(in)  spiral_bnd,
type(states_elec_dim_t), intent(in)  std,
type(projection_t), intent(inout), target  projection,
class(wfs_elec_t), intent(inout)  vpsib 
)
private

finish the application of non-local potentials.

Definition at line 5232 of file nonlocal_pseudopotential.F90.

◆ znonlocal_pseudopotential_apply_overlap()

subroutine, public nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_apply_overlap ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
type(wfs_elec_t), intent(in), target  psib,
type(wfs_elec_t), intent(inout)  spsib,
type(phase_t), intent(in), optional  phase,
logical, intent(in), optional  spiral_bnd,
logical, intent(in), optional  apply_phase 
)

Apply the ultrasoft/PAW generalized overlap S = 1 + sum_ij |beta_i> q_ij <beta_j| (or, with another operator passed as this, S^{-1}) to a batch: spsib = S psib.

When a Bloch phase is supplied (and apply_phase is not .false.), the phase exp(ik.r) is applied before the augmentation projection and undone afterwards, so that spsib is returned in the same (periodic, phase-free) representation as psib. S is Hermitian, so <phi|S|psi> = <S phi|psi> = <phi|(S psi)>. The projector maps only address inner points (1:np), so the spiral boundary phase of the ghost/boundary points (phaseapply_phase_spiral) is not needed here.

This is the single S-application primitive: hamiltonian_elec_apply_overlap_batch delegates to it (adding the packing / S-vs-S^{-1} selection / norm-conserving short-circuit), and it is also called directly from src/states (states_elec_calc), a layer that cannot depend on hamiltonian_elec.

Note
spsib must already be a structural copy of psib (e.g. via psibcopy_to(spsib)); its data is overwritten here. The batch is not packed/unpacked here (the caller manages that).
Parameters
[in]psibonly read (no packing/mutation here)
[in]phaseBloch phase for S at k /= 0
[in]spiral_bndspiral boundary conditions (default .false.)
[in]apply_phaseoverride: skip the phase even if present (default .true.)

Definition at line 5702 of file nonlocal_pseudopotential.F90.

◆ znonlocal_pseudopotential_force()

subroutine nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_force ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(in)  st,
logical, intent(in)  spiral_bnd,
integer, intent(in)  iqn,
integer, intent(in)  ndim,
type(wfs_elec_t), intent(in)  psi1b,
type(wfs_elec_t), dimension(:), intent(in)  psi2b,
real(real64), dimension(:, :), intent(inout)  force 
)
private

calculate contribution to forces, from non-local potentials

TODO: add more details

spiral BC ik should be the same for psi2b

Definition at line 5754 of file nonlocal_pseudopotential.F90.

◆ znl_force_gather_projs()

subroutine nonlocal_pseudopotential_oct_m::znl_force_gather_projs ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ndim,
type(wfs_elec_t), intent(in)  valb,
type(wfs_elec_t), dimension(:), intent(in)  gradb,
complex(real64), dimension(0:, 1:, 1:), intent(out)  projs 
)
private

Gather the raw projector overlaps <beta|val> and <beta|grad val> on the sphere points.

Fills projs(0:ndim, nst_linear, full_projection_size): projs(0,...) = sum_p beta(p) val(p) (the raw, un-scaled <beta_i|val>), and projs(idir,...) = sum_p beta(p) d_idir val(p). The physical integral is recovered by multiplying by pmatscal. Used by the cross overlap-derivative force below; mirrors the gather in nonlocal_pseudopotential_force.

Definition at line 6155 of file nonlocal_pseudopotential.F90.

◆ znonlocal_pseudopotential_force_overlap_cross()

subroutine nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_force_overlap_cross ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(in)  st,
integer, intent(in)  iqn,
integer, intent(in)  ndim,
type(wfs_elec_t), intent(in)  psib,
type(wfs_elec_t), dimension(:), intent(in)  gpsib,
type(wfs_elec_t), intent(in)  chib,
type(wfs_elec_t), dimension(:), intent(in)  gchib,
real(real64), dimension(:, :), intent(inout)  force 
)
private

Ultrasoft DFT+U force: the overlap-derivative (d_R S) term, as a cross density matrix.

Implements the contribution of the position dependence of the generalized overlap S to the +U force, F^B_a(J) = -2 sum_n f_n Re <psi~_n|(d_a S)|chi_n>, with chi_n the bare +U ket chi_n = sum_m |phi_m> sum_mp V_mmp <phi_mp|S|psi~_n> = P S psi~_n. With S = 1 + sum_ij q_ij |beta_i><beta_j| and d_{R_J} beta = -grad beta this is

F^B_a(J) = -2 sum_n f_n Re sum_ij q_ij [ <grad_a beta_i|psi~_n> <beta_j|chi_n>

  • <beta_i|psi~_n> <grad_a beta_j|chi_n> ] ,

the overlap charges q_ij = pmatqmix. See for instace Binci et al., PRB 108, 115157 (2023) for the formulas

Parameters
[in]psibpsi~ (phase-set)
[in]gpsibgrad psi~ (ndim batches)
[in]chibchi = P S psi~ (phase-set)
[in]gchibgrad chi (ndim batches)

Definition at line 6306 of file nonlocal_pseudopotential.F90.

◆ znonlocal_pseudopotential_position_commutator()

subroutine nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_position_commutator ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
class(wfs_elec_t), dimension(:), intent(inout), target  commpsib,
logical, intent(in), optional  async 
)
private

apply the commutator between the non-local potential and the position to the wave functions.

TODO: add more details

Parameters
[in]meshthe mesh
[in]stdthe electronic states
[in]spiral_bndflag for spiral boundary conditions
[in]psiboriginal wave functions psi
[in,out]commpsibresulting [v_nl, r]*psi

Definition at line 6395 of file nonlocal_pseudopotential.F90.

◆ znonlocal_pseudopotential_r_vnlocal()

subroutine nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_r_vnlocal ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
class(wfs_elec_t), dimension(1:3), intent(inout), target  commpsib 
)
private

Accumulates to commpsib the result of x V_{nl} | psib >

Definition at line 6867 of file nonlocal_pseudopotential.F90.

◆ znonlocal_pseudopotential_density_matrix()

subroutine, public nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_density_matrix ( class(nonlocal_pseudopotential_t), intent(in), target  this,
class(mesh_t), intent(in)  mesh,
type(states_elec_dim_t), intent(in)  std,
logical, intent(in)  spiral_bnd,
type(wfs_elec_t), intent(in)  psib,
real(real64), dimension(:), intent(in)  weight,
real(real64), dimension(:, :, :, :), intent(inout), allocatable  beta_density 
)

Accumulate occupation-weighted beta-projector density matrices for USPP density.

Parameters
[in,out]beta_densitySpin-resolved projector density matrix rho_ij^sigma

Definition at line 7307 of file nonlocal_pseudopotential.F90.