Octopus
isdf_oct_m Module Reference

Interoperable Separable Density Fitting (ISDF) molecular implementation. More...

Detailed Description

Interoperable Separable Density Fitting (ISDF) molecular implementation.

Functions/Subroutines

subroutine, public isdf_ace_compute_potentials (exxop, namespace, space, mesh, st, Vx_on_st, kpoints)
 ISDF wrapper computing interpolation points and vectors, which are used to build the potential \(W_j=\left(V_x\left[\left\{\varphi_i\right\}\right] \psi_j\right)(\mathbf{r})\) used in adaptively-compressed exchange. More...
 
subroutine, public isdf_interpolation_vectors (isdf, namespace, mesh, st, centroids, psi_mu, P_r_mu, isdf_vectors)
 Top-level routine for computing ISDF vectors. More...
 
subroutine pair_product_coefficient_matrix (p_phi, zct, p_psi)
 Construct the matrix-matrix product \(Z C^T\). More...
 
subroutine coefficient_product_matrix (p_phi, cct, p_psi)
 Construct the coefficient product matrix \([CC^T]\). More...
 
subroutine, public isdf_gram_matrix (mesh, isdf_vectors, gram_matrix)
 Compute the Gram matrix for the ISDF interpolation vectors. More...
 
subroutine dphi_at_interpolation_points (mesh, st, centroids, max_state, psi_mu)
 Construct a 2D array of states, defined only at a specific subset of grid points. More...
 
subroutine dquasi_density_matrix_at_mesh_centroid_points (st, max_state, psi_mu, p_r_mu)
 Compute the quasi-density matrix where one spatial coordinate is defined at grid points and the is defined at interpolation points. More...
 
subroutine disdf_ace_apply_exchange_op (exxop, namespace, mesh, st, psi_mu, P_r_mu, isdf_vectors, Vx_on_st)
 Compute the action of the exchange potential on KS states for adaptively-compressed exchange. More...
 

Variables

integer, parameter, private ik = 1
 All molecular calculations performed at the Gamma-point. More...
 

Function/Subroutine Documentation

◆ isdf_ace_compute_potentials()

subroutine, public isdf_oct_m::isdf_ace_compute_potentials ( type(exchange_operator_t), intent(in)  exxop,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(in)  st,
type(states_elec_t), intent(out)  Vx_on_st,
type(kpoints_t), intent(in)  kpoints 
)

ISDF wrapper computing interpolation points and vectors, which are used to build the potential \(W_j=\left(V_x\left[\left\{\varphi_i\right\}\right] \psi_j\right)(\mathbf{r})\) used in adaptively-compressed exchange.

Parameters
[in]exxopExchange instance, containing Poisson solver settings,
[in]meshReal-space grid
[in]stCurrent Kohn-Sham states
[out]vx_on_stV_X operating on all states (W in ACE)

Definition at line 161 of file isdf.F90.

◆ isdf_interpolation_vectors()

subroutine, public isdf_oct_m::isdf_interpolation_vectors ( type(isdf_options_t), intent(in)  isdf,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(in)  st,
type(centroids_t), intent(in)  centroids,
real(real64), dimension(:, :), intent(out), allocatable  psi_mu,
real(real64), dimension(:, :), intent(out), allocatable  P_r_mu,
real(real64), dimension(:, :), intent(out), allocatable  isdf_vectors 
)

Top-level routine for computing ISDF vectors.

Parameters
[in]centroidsInstance of interpolation points
[out]psi_muBatched array of wave functions
[out]p_r_muQuasi-density matrix,
[out]isdf_vectorsISDF vectors

Definition at line 196 of file isdf.F90.

◆ pair_product_coefficient_matrix()

subroutine isdf_oct_m::pair_product_coefficient_matrix ( real(real64), dimension(:, :), intent(in), target, contiguous  p_phi,
real(real64), dimension(:, :), intent(out), contiguous  zct,
real(real64), dimension(:, :), intent(in), optional, target, contiguous  p_psi 
)
private

Construct the matrix-matrix product \(Z C^T\).

\[ Z C^T = P^{\varphi}_{\mathbf{r}, \mu} \cdot P^{\psi}_{\mathbf{r}, \mu} \]

which simplifies to:

\[ Z C^T = P^{\varphi}_{\mathbf{r}, \mu} \cdot P^{\varphi}_{\mathbf{r}, \mu} \]

if only one set of KS states is supplied.

Parameters
[in]p_phiQuasi-density matrix,
[in]p_psiQuasi-density matrix,
[out]zctArray should be allocated by the caller

Definition at line 334 of file isdf.F90.

◆ coefficient_product_matrix()

subroutine isdf_oct_m::coefficient_product_matrix ( real(real64), dimension(:, :), intent(in), target, contiguous  p_phi,
real(real64), dimension(:, :), intent(out), contiguous  cct,
real(real64), dimension(:, :), intent(in), optional, target, contiguous  p_psi 
)
private

Construct the coefficient product matrix \([CC^T]\).

\( CC^T \) is defined as the element-wise product of \(P^{\varphi}(\mathbf{r}_\mu, \mathbf{r}_\nu)\) and \( P^{\psi}(\mathbf{r}_\mu, \mathbf{r}_\nu)\):

\[ CC^T = P^{\varphi} \circ P^{\psi} \]

If only one set of KS wave functions is used, this reduces to the element-wise squaring of f$P^{\varphi}(\mathbf{r}_\mu, \mathbf{r}_\nu)

Parameters
[in]p_phiQuasi-density matrix,
[in]p_psiQuasi-density matrix,
[out]cctcoefficient products

Definition at line 392 of file isdf.F90.

◆ isdf_gram_matrix()

subroutine, public isdf_oct_m::isdf_gram_matrix ( class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :), intent(in), contiguous  isdf_vectors,
real(real64), dimension(:, :), intent(out), contiguous  gram_matrix 
)

Compute the Gram matrix for the ISDF interpolation vectors.

\[ g_{\mu, \nu} = \int_{\mathbf{r} \zeta_{\mu}(\mathbf{r}) \zeta_{\nu}(\mathbf{r}) d \mathbf{r} \]

Parameters
[in]isdf_vectorsShape(np, n_int)

Definition at line 441 of file isdf.F90.

◆ dphi_at_interpolation_points()

subroutine isdf_oct_m::dphi_at_interpolation_points ( class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(in)  st,
type(centroids_t), intent(in)  centroids,
integer, intent(in)  max_state,
real(real64), dimension(:, :), intent(out), allocatable  psi_mu 
)
private

Construct a 2D array of states, defined only at a specific subset of grid points.

\( \{ \varphi_i(\mathbf{r}_\mu) \} \).

Implementation Details

State index of psi_mu is defined as a contiguous index over all states in batches [stgroupblock_start, stgroupblock_end]. This is MPI-distributed, and can stay distributed as the states index is only ever reduced in this implementation .

The inner loop over centroids will only touch interpolation point indices defined in this domain, but psi_mu is initialised to zero and indexed over all interpolation points (all domains), allowing allreduce to gather the contributions. Hence the need for a mapping from a domain-local centroid index to a global centroid index.

Parameters
[in]stStates
[in]centroidsCentroids container
[in]max_stateGlobal index of highest state to include in the expansion
[out]psi_mu\(\varphi_i(\mathbf{r}_\mu)\)

Definition at line 533 of file isdf.F90.

◆ dquasi_density_matrix_at_mesh_centroid_points()

subroutine isdf_oct_m::dquasi_density_matrix_at_mesh_centroid_points ( type(states_elec_t), intent(in)  st,
integer, intent(in)  max_state,
real(real64), dimension(:, :), intent(in), contiguous  psi_mu,
real(real64), dimension(:, :), intent(out), contiguous  p_r_mu 
)
private

Compute the quasi-density matrix where one spatial coordinate is defined at grid points and the is defined at interpolation points.

The quasi-density matrix is defined as:

\[ P^{\varphi}(\mathbf{r}, \mathbf{r}_\mu) = \sum_i^m \varphi_i(\mathbf{r}) \varphi_i(\mathbf{r}_\mu) \]

where \( \varphi_i(\mathbf{r}) \) is a KS state, and \((\mu, \nu) \) are interpolation point indices.

Parameters
[in]stStates
[in]max_stateGlobal index of highest state to include in the expansion
[in]psi_muStates sampled at interpolation points,
[out]p_r_muQuasi-density matrix, with expected shape(np, n_int)

Definition at line 618 of file isdf.F90.

◆ disdf_ace_apply_exchange_op()

subroutine isdf_oct_m::disdf_ace_apply_exchange_op ( type(exchange_operator_t), intent(in)  exxop,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(in)  st,
real(real64), dimension(:, :), intent(in)  psi_mu,
real(real64), dimension(:, :), intent(in)  P_r_mu,
real(real64), dimension(:, :), intent(in)  isdf_vectors,
type(states_elec_t), intent(inout)  Vx_on_st 
)
private

Compute the action of the exchange potential on KS states for adaptively-compressed exchange.

\[ W_j(\mathbf{r}) = - \alpha_{CAM} \sum_{\mu} f_{j} P_{\mathbf{r}, \mu} V_{\mathbf{r}, \mu} \phi_j(\mathbf{r}_\mu). \]

where \( \alpha_{CAM} \) defines the Couloumb-attenuated method alpha parameter and \( f_{j} \) defines the state occupations. All weights and prefactors are absorbed into this expression. The KS states defined at interpolation points, \( \psi_i(\mathbf{r}_\mu) \), and the quasi-density matrix,

Parameters
[in]exxopExchange instance, containing Poisson solver settings,
[in]meshReal-space grid
[in]stCurrent Kohn-Sham states
[in]psi_muBatched array of wave functions
[in]p_r_muQuasi-density matrix,
[in]isdf_vectorsISDF vectors
[in,out]vx_on_stV_X operating on all states (W in ACE)

Definition at line 704 of file isdf.F90.

Variable Documentation

◆ ik

integer, parameter, private isdf_oct_m::ik = 1
private

All molecular calculations performed at the Gamma-point.

Definition at line 154 of file isdf.F90.