Octopus
poisson_fft_oct_m Module Reference

Data Types

type  poisson_fft_t
 

Functions/Subroutines

subroutine, public poisson_fft_init (this, namespace, space, cube, kernel, soft_coulb_param, fullcube)
 
subroutine, public poisson_fft_get_kernel (namespace, space, cube, coulb, kernel, soft_coulb_param, fullcube)
 
subroutine get_cutoff (namespace, default_r_c, r_c)
 
subroutine poisson_fft_build_3d_3d (cube, coulb)
 Compute the Coulomb kernel in reciprocal space, for a 3D FFT grid. More...
 
subroutine poisson_fft_build_3d_3d_hockney (cube, coulb, fullcube)
 Kernel for Hockneys algorithm that solves the poisson equation in a small box while respecting the periodicity of a larger box A. Damle, L. Lin, L. Ying, JCTC, 2015 DOI: 10.1021/ct500985f, supplementary info. More...
 
subroutine poisson_fft_build_3d_2d (namespace, cube, coulb)
 C. A. Rozzi et al., Phys. Rev. B 73, 205119 (2006), Table I. More...
 
subroutine poisson_fft_build_3d_1d (namespace, space, cube, coulb)
 C. A. Rozzi et al., Phys. Rev. B 73, 205119 (2006), Table I. More...
 
subroutine poisson_fft_build_3d_0d (namespace, cube, kernel, coulb, is_periodic)
 C. A. Rozzi et al., Phys. Rev. B 73, 205119 (2006), Table I. More...
 
subroutine poisson_fft_build_2d_0d (namespace, cube, coulb)
 A. Castro et al., Phys. Rev. B 80, 033102 (2009) More...
 
subroutine poisson_fft_build_2d_1d (namespace, cube, coulb)
 A. Castro et al., Phys. Rev. B 80, 033102 (2009) More...
 
subroutine poisson_fft_build_2d_2d (cube, coulb)
 A. Castro et al., Phys. Rev. B 80, 033102 (2009) More...
 
subroutine poisson_fft_build_1d_1d (cube, coulb, poisson_soft_coulomb_param)
 
subroutine poisson_fft_build_1d_0d (namespace, cube, coulb, poisson_soft_coulomb_param)
 
subroutine, public poisson_fft_end (this)
 
subroutine, public dpoisson_fft_solve (this, mesh, cube, pot, rho, mesh_cube_map, average_to_zero, kernel, sm)
 
subroutine, public dpoisson_fft_solve_batch (this, mesh, cube, pot, rho, mesh_cube_map, average_to_zero, kernel, sm, pot_buffer, rho_buffer, count)
 
subroutine, public zpoisson_fft_solve (this, mesh, cube, pot, rho, mesh_cube_map, average_to_zero, kernel, sm)
 
subroutine, public zpoisson_fft_solve_batch (this, mesh, cube, pot, rho, mesh_cube_map, average_to_zero, kernel, sm, pot_buffer, rho_buffer, count)
 

Variables

integer, parameter, public poisson_fft_kernel_none = -1
 
integer, parameter, public poisson_fft_kernel_sph = 0
 
integer, parameter, public poisson_fft_kernel_cyl = 1
 
integer, parameter, public poisson_fft_kernel_pla = 2
 
integer, parameter, public poisson_fft_kernel_nocut = 3
 
integer, parameter, public poisson_fft_kernel_corrected = 4
 
integer, parameter, public poisson_fft_kernel_hockney = 5
 
real(real64), parameter tol_vanishing_q = 1e-6_real64
 

Function/Subroutine Documentation

◆ poisson_fft_init()

subroutine, public poisson_fft_oct_m::poisson_fft_init ( type(poisson_fft_t), intent(out)  this,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(cube_t), intent(inout)  cube,
integer, intent(in)  kernel,
real(real64), intent(in), optional  soft_coulb_param,
type(cube_t), intent(in), optional  fullcube 
)
Parameters
[in]fullcubeneeded for Hockney kernel

Definition at line 172 of file poisson_fft.F90.

◆ poisson_fft_get_kernel()

subroutine, public poisson_fft_oct_m::poisson_fft_get_kernel ( type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb,
integer, intent(in)  kernel,
real(real64), intent(in), optional  soft_coulb_param,
type(cube_t), intent(in), optional  fullcube 
)
Parameters
[in]fullcubeneeded for Hockney kernel

Definition at line 199 of file poisson_fft.F90.

◆ get_cutoff()

subroutine poisson_fft_oct_m::get_cutoff ( type(namespace_t), intent(in)  namespace,
real(real64), intent(in)  default_r_c,
real(real64), intent(out)  r_c 
)
private

Definition at line 285 of file poisson_fft.F90.

◆ poisson_fft_build_3d_3d()

subroutine poisson_fft_oct_m::poisson_fft_build_3d_3d ( type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb 
)
private

Compute the Coulomb kernel in reciprocal space, for a 3D FFT grid.

Analytic evaluation of |G + q|^2 follows the logic: Define \( u = G + q \), in integer-mode coordinates. \( |u|^2 = u^T A u = \sum_{ij} u_i A_{ij} u_j\), where \( A \) is the metric tensor of the reciprocal-space grid basis. Expand \( |u|^2 \), and simplify noting that \( a_{ij} = a_{ji}\). Group terms in powers of \( u_x\), forming a quadratic equation:

\[ a_{11} u_x^2 + \beta u_x + g_{yz}, \quad \text{where} \quad \beta = 2(a_{12} u_y + a_{13} u_z), \quad g_{yz} = a_{22} u_y^2 + 2 a_{23} u_y u_z + a_{33} u_z^2. \]

Complete the square to give:

\[ a_{11}(u_x + \frac{\beta}{2 a_{11}})^2 + g_{yz} - \frac{\beta^2}{4 a_{11}}. \]

For any u_x, the squared term must be \( \ge 0 \), therefore:

\[ |u|^2 \ge g_{yz} - \frac{\beta^2}{4 a_{11}} \]

If this lower bound already exceeds the cutoff, no \( u_x \) on the \( (u_y, u_z) \) line can lie within the cutoff sphere, so the inner loop is skipped.

Definition at line 332 of file poisson_fft.F90.

◆ poisson_fft_build_3d_3d_hockney()

subroutine poisson_fft_oct_m::poisson_fft_build_3d_3d_hockney ( type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb,
type(cube_t), intent(in)  fullcube 
)
private

Kernel for Hockneys algorithm that solves the poisson equation in a small box while respecting the periodicity of a larger box A. Damle, L. Lin, L. Ying, JCTC, 2015 DOI: 10.1021/ct500985f, supplementary info.

Definition at line 456 of file poisson_fft.F90.

◆ poisson_fft_build_3d_2d()

subroutine poisson_fft_oct_m::poisson_fft_build_3d_2d ( type(namespace_t), intent(in)  namespace,
type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb 
)
private

C. A. Rozzi et al., Phys. Rev. B 73, 205119 (2006), Table I.

Definition at line 572 of file poisson_fft.F90.

◆ poisson_fft_build_3d_1d()

subroutine poisson_fft_oct_m::poisson_fft_build_3d_1d ( type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb 
)
private

C. A. Rozzi et al., Phys. Rev. B 73, 205119 (2006), Table I.

Definition at line 656 of file poisson_fft.F90.

◆ poisson_fft_build_3d_0d()

subroutine poisson_fft_oct_m::poisson_fft_build_3d_0d ( type(namespace_t), intent(in)  namespace,
type(cube_t), intent(in)  cube,
integer, intent(in)  kernel,
type(fourier_space_op_t), intent(inout)  coulb,
logical, intent(in)  is_periodic 
)
private

C. A. Rozzi et al., Phys. Rev. B 73, 205119 (2006), Table I.

Definition at line 783 of file poisson_fft.F90.

◆ poisson_fft_build_2d_0d()

subroutine poisson_fft_oct_m::poisson_fft_build_2d_0d ( type(namespace_t), intent(in)  namespace,
type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb 
)
private

A. Castro et al., Phys. Rev. B 80, 033102 (2009)

Definition at line 894 of file poisson_fft.F90.

◆ poisson_fft_build_2d_1d()

subroutine poisson_fft_oct_m::poisson_fft_build_2d_1d ( type(namespace_t), intent(in)  namespace,
type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb 
)
private

A. Castro et al., Phys. Rev. B 80, 033102 (2009)

Definition at line 966 of file poisson_fft.F90.

◆ poisson_fft_build_2d_2d()

subroutine poisson_fft_oct_m::poisson_fft_build_2d_2d ( type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb 
)
private

A. Castro et al., Phys. Rev. B 80, 033102 (2009)

Definition at line 1022 of file poisson_fft.F90.

◆ poisson_fft_build_1d_1d()

subroutine poisson_fft_oct_m::poisson_fft_build_1d_1d ( type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb,
real(real64), intent(in)  poisson_soft_coulomb_param 
)
private

Definition at line 1062 of file poisson_fft.F90.

◆ poisson_fft_build_1d_0d()

subroutine poisson_fft_oct_m::poisson_fft_build_1d_0d ( type(namespace_t), intent(in)  namespace,
type(cube_t), intent(in)  cube,
type(fourier_space_op_t), intent(inout)  coulb,
real(real64), intent(in)  poisson_soft_coulomb_param 
)
private

Definition at line 1101 of file poisson_fft.F90.

◆ poisson_fft_end()

subroutine, public poisson_fft_oct_m::poisson_fft_end ( type(poisson_fft_t), intent(inout)  this)

Definition at line 1143 of file poisson_fft.F90.

◆ dpoisson_fft_solve()

subroutine, public poisson_fft_oct_m::dpoisson_fft_solve ( type(poisson_fft_t), intent(in)  this,
type(mesh_t), intent(in)  mesh,
type(cube_t), intent(in)  cube,
real(real64), dimension(:), intent(out), contiguous  pot,
real(real64), dimension(:), intent(in), contiguous  rho,
type(mesh_cube_parallel_map_t), intent(in)  mesh_cube_map,
logical, intent(in), optional  average_to_zero,
type(fourier_space_op_t), intent(in), optional  kernel,
type(submesh_t), intent(in), optional  sm 
)
Parameters
[in]average_to_zerodefault is false

Definition at line 1220 of file poisson_fft.F90.

◆ dpoisson_fft_solve_batch()

subroutine, public poisson_fft_oct_m::dpoisson_fft_solve_batch ( type(poisson_fft_t), intent(in)  this,
type(mesh_t), intent(in)  mesh,
type(cube_t), intent(in)  cube,
real(real64), dimension(:, :), intent(out), optional, contiguous  pot,
real(real64), dimension(:, :), intent(in), optional, contiguous  rho,
type(mesh_cube_parallel_map_t), intent(in), optional  mesh_cube_map,
logical, intent(in), optional  average_to_zero,
type(fourier_space_op_t), intent(in), optional  kernel,
type(submesh_t), intent(in), optional  sm,
type(accel_mem_t), intent(inout), optional  pot_buffer,
type(accel_mem_t), intent(in), optional  rho_buffer,
integer, intent(in), optional  count 
)
Parameters
[out]potFFT result (host path)
[in]rhoQuantity to FFT (host path)
[in]average_to_zerodefault is false
[in,out]pot_bufferDevice-resident buffers for the GPU path. These are mutually exclusive with pot/rho.
[in]countnumber of functions on the device path (default 1)

Definition at line 1292 of file poisson_fft.F90.

◆ zpoisson_fft_solve()

subroutine, public poisson_fft_oct_m::zpoisson_fft_solve ( type(poisson_fft_t), intent(in)  this,
type(mesh_t), intent(in)  mesh,
type(cube_t), intent(in)  cube,
complex(real64), dimension(:), intent(out), contiguous  pot,
complex(real64), dimension(:), intent(in), contiguous  rho,
type(mesh_cube_parallel_map_t), intent(in)  mesh_cube_map,
logical, intent(in), optional  average_to_zero,
type(fourier_space_op_t), intent(in), optional  kernel,
type(submesh_t), intent(in), optional  sm 
)
Parameters
[in]average_to_zerodefault is false

Definition at line 1477 of file poisson_fft.F90.

◆ zpoisson_fft_solve_batch()

subroutine, public poisson_fft_oct_m::zpoisson_fft_solve_batch ( type(poisson_fft_t), intent(in)  this,
type(mesh_t), intent(in)  mesh,
type(cube_t), intent(in)  cube,
complex(real64), dimension(:, :), intent(out), optional, contiguous  pot,
complex(real64), dimension(:, :), intent(in), optional, contiguous  rho,
type(mesh_cube_parallel_map_t), intent(in), optional  mesh_cube_map,
logical, intent(in), optional  average_to_zero,
type(fourier_space_op_t), intent(in), optional  kernel,
type(submesh_t), intent(in), optional  sm,
type(accel_mem_t), intent(inout), optional  pot_buffer,
type(accel_mem_t), intent(in), optional  rho_buffer,
integer, intent(in), optional  count 
)
Parameters
[out]potFFT result (host path)
[in]rhoQuantity to FFT (host path)
[in]average_to_zerodefault is false
[in,out]pot_bufferDevice-resident buffers for the GPU path. These are mutually exclusive with pot/rho.
[in]countnumber of functions on the device path (default 1)

Definition at line 1549 of file poisson_fft.F90.

Variable Documentation

◆ poisson_fft_kernel_none

integer, parameter, public poisson_fft_oct_m::poisson_fft_kernel_none = -1

Definition at line 153 of file poisson_fft.F90.

◆ poisson_fft_kernel_sph

integer, parameter, public poisson_fft_oct_m::poisson_fft_kernel_sph = 0

Definition at line 153 of file poisson_fft.F90.

◆ poisson_fft_kernel_cyl

integer, parameter, public poisson_fft_oct_m::poisson_fft_kernel_cyl = 1

Definition at line 153 of file poisson_fft.F90.

◆ poisson_fft_kernel_pla

integer, parameter, public poisson_fft_oct_m::poisson_fft_kernel_pla = 2

Definition at line 153 of file poisson_fft.F90.

◆ poisson_fft_kernel_nocut

integer, parameter, public poisson_fft_oct_m::poisson_fft_kernel_nocut = 3

Definition at line 153 of file poisson_fft.F90.

◆ poisson_fft_kernel_corrected

integer, parameter, public poisson_fft_oct_m::poisson_fft_kernel_corrected = 4

Definition at line 153 of file poisson_fft.F90.

◆ poisson_fft_kernel_hockney

integer, parameter, public poisson_fft_oct_m::poisson_fft_kernel_hockney = 5

Definition at line 153 of file poisson_fft.F90.

◆ tol_vanishing_q

real(real64), parameter poisson_fft_oct_m::tol_vanishing_q = 1e-6_real64
private

Definition at line 169 of file poisson_fft.F90.