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 interpolative_separable_density_fitting_vectors (namespace, mesh, st, centroids, 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 \(["@CMAKE_C_COMPILER@"^T]\). More...
 
subroutine, public interpolation_vector_gram_matrix (mesh, isdf_vectors, gram_matrix)
 Compute the Gram matrix for the ISDF interpolation vectors. More...
 
integer function local_number_of_states (st, max_state)
 Number of states contributing to the expansion, local to current process. More...
 
subroutine gather_psi_mu_over_states (st, psi_mu, psi_global)
 Gather state-distributed psi from multiple processes. More...
 
subroutine output_psi_mu_for_all_states (namespace, st, max_state, psi_mu)
 Output the gathered psi_mu for all states, such that the matrix is the same irregardless of state parallelism. 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...
 

Variables

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

Function/Subroutine Documentation

◆ interpolative_separable_density_fitting_vectors()

subroutine, public isdf_oct_m::interpolative_separable_density_fitting_vectors ( 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  isdf_vectors 
)

Top-level routine for computing ISDF vectors.

Parameters
[in]centroidsInstance of interpolation points
[out]isdf_vectorsISDF vectors

Definition at line 150 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 266 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 \(["@CMAKE_C_COMPILER@"^T]\).

\( "@CMAKE_C_COMPILER@"^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)\):

\[ "@CMAKE_C_COMPILER@"^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 324 of file isdf.F90.

◆ interpolation_vector_gram_matrix()

subroutine, public isdf_oct_m::interpolation_vector_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 373 of file isdf.F90.

◆ local_number_of_states()

integer function isdf_oct_m::local_number_of_states ( type(states_elec_t), intent(in)  st,
integer, intent(in)  max_state 
)
private

Number of states contributing to the expansion, local to current process.

Number of states between the first state of the block 1 on this process and the min of max_state and the last state of block N on this process. For processes where minst of the first block > max_state, return 0.

Parameters
[in]stStates instance
[in]max_stateIndex of final state to consider - Global state indexing

Definition at line 418 of file isdf.F90.

◆ gather_psi_mu_over_states()

subroutine isdf_oct_m::gather_psi_mu_over_states ( type(states_elec_t), intent(in)  st,
real(real64), dimension(:, :), intent(in), contiguous  psi_mu,
real(real64), dimension(:, :), intent(out), contiguous  psi_global 
)
private

Gather state-distributed psi from multiple processes.

For testing purposes only. Does not handle gathering of domains

Parameters
[in]psi_muState-distributed states array

Definition at line 442 of file isdf.F90.

◆ output_psi_mu_for_all_states()

subroutine isdf_oct_m::output_psi_mu_for_all_states ( type(namespace_t), intent(in)  namespace,
type(states_elec_t), intent(in)  st,
integer, intent(in)  max_state,
real(real64), dimension(:, :), intent(in), contiguous  psi_mu 
)
private

Output the gathered psi_mu for all states, such that the matrix is the same irregardless of state parallelism.

Parameters
[in]max_stateGlobal index of maximum state used in ISDF
[in]psi_muStated-distributed/DD \(\varphi_i(\mathbf{r}_\mu)\)

Definition at line 501 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 600 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 685 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 145 of file isdf.F90.