Octopus
nonlocal_pseudopotential.F90 File Reference

Go to the source code of this file.

Modules

module  nonlocal_pseudopotential_oct_m
 

Data Types

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

Functions/Subroutines

subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_init (this)
 initialize the nonlocal_pseudopotential_t object More...
 
subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_rebind_projectors (this, epot)
 Rebind projector matrix pointers (map, position) to a target epot. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_share_projector_data (this, donor)
 Alias the heavy per-point projector data of a donor instance. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_detach_copy (this, donor)
 Detach the projector data of an instance obtained by intrinsic assignment. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_destroy_proj (this)
 Destroy the data of nonlocal_pseudopotential_t. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_build_proj (this, space, mesh, epot, ispin, overlap_operator, inverse_overlap_operator)
 build the projectors for the application of pseudo-potentials More...
 
logical function projector_counted (proj)
 
subroutine build_inverse_overlap_sim_grid (pmat, mesh)
 Rebuild the inverse-overlap mix matrix (mix = -T, with T = q (1 + M q)^{-1}) using the projector overlap M_ij = <beta_i|beta_j> evaluated on the SIMULATION grid. With the apply convention <beta_j|psi> = scal_j sum_p B(p,j) psi(p) (scal = vol) and the ket scattered with B, this makes S^{-1} = 1 - B T (vol B^H) the exact inverse of the discretized S = 1 + B q (vol B^H) for an isolated atom. The spin-independent q matrix is stored in pmatqmix; the spin-coupled (fully-relativistic) one in pmatzmix. The latter is overwritten here by -T, so a copy is kept in pmatzqmix for the exact cluster inverse (overlapping spheres, see nonlocal_overlap_matrix_oct_m). More...
 
integer function nonlocal_pseudopotential_oct_m::projector_beta_index (proj, ll, ic)
 
subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_accel_rebuild (this, space, mesh)
 Rebuild accelerator buffers after an intrinsic copy. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_detach_accel_buffers (this)
 Clear copied accelerator handles so they do not alias source buffers. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_build_accel_buffers (this, space, mesh)
 Build accelerator buffers for projectors from host-side projector matrices. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_build_projector_phase_accel_buffer (this)
 Rebuild projector phase accelerator buffer from host-side projector phases. More...
 
logical pure function nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_self_overlap (this)
 Returns .true. if the Hamiltonian contains projectors, which overlap with themself. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_update_dij (this, mesh, epot, veff, add_bare, onsite_density_matrix)
 Screen the ultrasoft nonlocal coupling matrix D_ij with the local potential. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_ghost_check (this, mesh, epot)
 Warn about augmentation ghost channels: a near-singular direction of the channel-block overlap metric combined with an attractive screened coupling. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_paw_onsite (this, epot, n_paw, paw_imat, onsite_density_matrix, dij_buf)
 Compute the PAW one-center Hamiltonian coupling of every PAW atom and accumulate the energy correction. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_build_paw_symm (this, epot, space, gr, ions)
 Build the crystal-symmetry data used to symmetrize the PAW one-center density matrix. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_symmetrize_onsite (this)
 Symmetrize the PAW one-center density matrix rho_ij over the crystal symmetries. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_qij_to_pairs (proj, pmat, np, ncomp, field, pairm)
 Integrate a mesh field against the augmentation charges Q_ij over one augmentation sphere: pairm_ij^c = sum_is field(is,c) Q_ij(r_is). More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_soc_build_zmix_cmplx (pmat, proj, use_qij, so_strength)
 Build the spin-orbit 2x2 spin coupling (zmix) in the COMPLEX-Y_lm projector basis. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_soc_screen_cmplx (pmat, proj, mesh, veff, dij_onsite)
 Add the screening int V^{ab}(r) Q_ij(r) to the complex-Y_lm SOC zmix. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_density_matrix_spinor (this, mesh, std, spiral_bnd, psib, weight, beta_density, beta_current)
 Noncollinear (spinor) projector density matrix for the ultrasoft augmentation. More...
 
subroutine nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_spinor_current_slabs (nprojs, rho_uu, rho_dd, rho_ud, cur)
 Accumulate the four one-center current slabs of a spinor projector density matrix. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::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_oct_m::nonlocal_pseudopotential_soc_density_to_real (this, epot, rho_cmplx, beta_density, beta_current)
 Rotate the complex-Y_lm projector density matrix to the real-Y_lm basis (SOC USPP). More...
 
complex(real64) function nonlocal_pseudopotential_oct_m::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_oct_m::nonlocal_pseudopotential_soc_recoupling_matrix (pmat, proj, gmat)
 Build the mixed (l,j)->spin recoupling matrix G on composite (projector, spin) indices. More...
 
real(real64) function nonlocal_pseudopotential_oct_m::nonlocal_pseudopotential_aug_contract (proj, pmat, np, ncomp, vweight, wij, cw, volume_element)
 Integrate a gathered per-sphere-point field against the augmentation charges and contract with the component-weighted density-matrix weights: result = sum_ij sum_c cw(c) w_ij(c) [int field_c(r) Q_ij(r-R) dr]. This is the common tail of the augmentation force and stress accumulations; only the gathered field (and the sign and target of the result) differ between them. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::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_oct_m::nonlocal_pseudopotential_stress_uspp (this, mesh, epot, periodic_dim, grad_pot, aug_weight, stress_aug)
 Ultrasoft augmentation contribution to the stress tensor. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::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_oct_m::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 nonlocal_pseudopotential_oct_m::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 bra_accel_fused ()
 The GPU projector bra: one gather, a GEMM per matrix, one scatter. More...
 
subroutine bra_cpu ()
 The CPU projector bra: gather, GEMM and scaling per matrix. More...
 
integer(int64) function bra_matrix_offset (imat)
 Elements of buff_matrices before matrix imat. More...
 
integer(int64) function bra_point_offset (imat)
 Projector points before matrix imat. More...
 
integer(int64) function bra_proj_offset (imat)
 Projectors before matrix imat. More...
 
subroutine bra_fused_grid (ker, n, gx, gy, gz, bx, by)
 Grid for a fused bra kernel: states in x, and n spread over dimensions 2 and 3 so that a large supercell fits. More...
 
subroutine nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_finish (this, mesh, spiral_bnd, std, projection, vpsib)
 finish the application of non-local potentials. More...
 
subroutine finish_accel ()
 
subroutine, public nonlocal_pseudopotential_oct_m::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, public nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_add_overlap_inplace (this, mesh, std, xb, phase, spiral_bnd, apply_phase)
 In-place version of the generalized overlap: xb := S xb (or S^{-1} xb, depending on this). Avoids the identity copy of the out-of-place version (and lets the caller skip a scratch batch): the augmentation is accumulated directly onto the input. More...
 
subroutine nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_force (this, mesh, st, spiral_bnd, iqn, ndim, psi1b, psi2b, force)
 calculate contribution to forces, from non-local potentials More...
 
subroutine nonlocal_pseudopotential_oct_m::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 nonlocal_pseudopotential_oct_m::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 nonlocal_pseudopotential_oct_m::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 dcommutator_accel ()
 
subroutine nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_r_vnlocal (this, mesh, std, spiral_bnd, psib, commpsib, eigenval, only_qmix)
 Accumulates to commpsib the result of x V_{nl} | psib > More...
 
subroutine, public nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_density_matrix (this, mesh, std, spiral_bnd, psib, weight, beta_density, weight2, beta_density2, beta_current)
 Accumulate occupation-weighted beta-projector density matrices for USPP density. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::dnonlocal_pseudopotential_reconstruct_paw_wfs (this, epot, mesh, ik, psi)
 Add the PAW one-center correction to a single smooth wavefunction, reconstructing the all-electron wavefunction. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::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 nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_finish (this, mesh, spiral_bnd, std, projection, vpsib)
 finish the application of non-local potentials. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::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, public nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_add_overlap_inplace (this, mesh, std, xb, phase, spiral_bnd, apply_phase)
 In-place version of the generalized overlap: xb := S xb (or S^{-1} xb, depending on this). Avoids the identity copy of the out-of-place version (and lets the caller skip a scratch batch): the augmentation is accumulated directly onto the input. More...
 
subroutine nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_force (this, mesh, st, spiral_bnd, iqn, ndim, psi1b, psi2b, force)
 calculate contribution to forces, from non-local potentials More...
 
subroutine nonlocal_pseudopotential_oct_m::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 nonlocal_pseudopotential_oct_m::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 nonlocal_pseudopotential_oct_m::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 zcommutator_accel ()
 
subroutine nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_r_vnlocal (this, mesh, std, spiral_bnd, psib, commpsib, eigenval, only_qmix)
 Accumulates to commpsib the result of x V_{nl} | psib > More...
 
subroutine, public nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_density_matrix (this, mesh, std, spiral_bnd, psib, weight, beta_density, weight2, beta_density2, beta_current)
 Accumulate occupation-weighted beta-projector density matrices for USPP density. More...
 
subroutine, public nonlocal_pseudopotential_oct_m::znonlocal_pseudopotential_reconstruct_paw_wfs (this, epot, mesh, ik, psi)
 Add the PAW one-center correction to a single smooth wavefunction, reconstructing the all-electron wavefunction. More...
 

Function/Subroutine Documentation

◆ projector_counted()

logical function nonlocal_pseudopotential_build_proj::projector_counted ( type(projector_t), intent(in)  proj)
private

Definition at line 1071 of file nonlocal_pseudopotential.F90.

◆ build_inverse_overlap_sim_grid()

subroutine nonlocal_pseudopotential_build_proj::build_inverse_overlap_sim_grid ( type(projector_matrix_t), intent(inout)  pmat,
class(mesh_t), intent(in)  mesh 
)
private

Rebuild the inverse-overlap mix matrix (mix = -T, with T = q (1 + M q)^{-1}) using the projector overlap M_ij = <beta_i|beta_j> evaluated on the SIMULATION grid. With the apply convention <beta_j|psi> = scal_j sum_p B(p,j) psi(p) (scal = vol) and the ket scattered with B, this makes S^{-1} = 1 - B T (vol B^H) the exact inverse of the discretized S = 1 + B q (vol B^H) for an isolated atom. The spin-independent q matrix is stored in pmatqmix; the spin-coupled (fully-relativistic) one in pmatzmix. The latter is overwritten here by -T, so a copy is kept in pmatzqmix for the exact cluster inverse (overlapping spheres, see nonlocal_overlap_matrix_oct_m).

Definition at line 1090 of file nonlocal_pseudopotential.F90.

◆ bra_accel_fused()

subroutine bra_accel_fused
private

The GPU projector bra: one gather, a GEMM per matrix, one scatter.

Definition at line 3443 of file nonlocal_pseudopotential.F90.

◆ bra_cpu()

subroutine bra_cpu
private

The CPU projector bra: gather, GEMM and scaling per matrix.

Definition at line 3579 of file nonlocal_pseudopotential.F90.

◆ bra_matrix_offset()

integer(int64) function dnonlocal_pseudopotential_start::bra_matrix_offset ( integer, intent(in)  imat)
private

Elements of buff_matrices before matrix imat.

Definition at line 3649 of file nonlocal_pseudopotential.F90.

◆ bra_point_offset()

integer(int64) function dnonlocal_pseudopotential_start::bra_point_offset ( integer, intent(in)  imat)
private

Projector points before matrix imat.

Definition at line 3659 of file nonlocal_pseudopotential.F90.

◆ bra_proj_offset()

integer(int64) function dnonlocal_pseudopotential_start::bra_proj_offset ( integer, intent(in)  imat)
private

Projectors before matrix imat.

Definition at line 3669 of file nonlocal_pseudopotential.F90.

◆ bra_fused_grid()

subroutine bra_fused_grid ( type(accel_kernel_t), intent(inout)  ker,
integer(int64), intent(in)  n,
integer(int64), intent(out)  gx,
integer(int64), intent(out)  gy,
integer(int64), intent(out)  gz,
integer(int64), intent(out)  bx,
integer(int64), intent(out)  by 
)
private

Grid for a fused bra kernel: states in x, and n spread over dimensions 2 and 3 so that a large supercell fits.

Definition at line 3680 of file nonlocal_pseudopotential.F90.

◆ finish_accel()

subroutine finish_accel
private

Definition at line 3900 of file nonlocal_pseudopotential.F90.

◆ dcommutator_accel()

subroutine dcommutator_accel
private

Definition at line 4898 of file nonlocal_pseudopotential.F90.

◆ zcommutator_accel()

subroutine zcommutator_accel
private

Definition at line 7854 of file nonlocal_pseudopotential.F90.