Octopus
fft_oct_m Module Reference

Fast Fourier Transform module. This module provides a single interface that works with different FFT implementations. More...

Detailed Description

Fast Fourier Transform module. This module provides a single interface that works with different FFT implementations.

Data Types

interface  dfft_backward
 
interface  dfft_forward
 
type  fft_t
 
interface  zfft_backward
 
interface  zfft_forward
 

Functions/Subroutines

subroutine, public fft_all_init (namespace)
 initialize the table More...
 
subroutine, public fft_all_end ()
 delete all plans More...
 
subroutine, public fft_init (this, nn, dim, type, library, optimize, optimize_parity, comm, mpi_grp, use_aligned)
 
subroutine, public fft_init_stage1 (this, namespace, XX, nn)
 Some fft-libraries (only NFFT for the moment) need an additional precomputation stage that depends on the spatial grid whose size may change after fft_init. More...
 
subroutine, public fft_end (this)
 
subroutine, public fft_copy (fft_i, fft_o)
 
subroutine, public fft_get_dims (fft, rs_n_global, fs_n_global, rs_n, fs_n, rs_istart, fs_istart)
 
pure integer function, public pad_feq (ii, nn, mode)
 convert between array index and G-vector More...
 
integer function fft_size (size, factors, parity)
 
subroutine get_exponents (num, nfactors, factors, exponents, nondiv)
 
subroutine fft_operation_count (fft)
 
subroutine, public fft_gg_transform (gg_in, temp, periodic_dim, latt, qq, gg, modg2)
 
real(real64) pure function, public fft_scaling_factor (fft)
 This function returns the factor required to normalize a function after a forward and backward transform. More...
 
real(real64) function, public fft_get_ecut_from_box (box_dim, fs_istart, latt, gspacing, periodic_dim, qq)
 Given an fft box (fixed by the real-space grid), it returns the cutoff energy of the sphere that fits inside the box. More...
 
subroutine dfft_forward_3d (fft, in, out, norm)
 
subroutine dfft_forward_accel (fft, in, out)
 
subroutine dfft_forward_1d (fft, in, out)
 
subroutine dfft_backward_3d (fft, in, out, norm)
 
subroutine dfft_backward_accel (fft, in, out)
 
subroutine dfft_backward_1d (fft, in, out)
 
subroutine zfft_forward_3d (fft, in, out, norm)
 
subroutine zfft_forward_accel (fft, in, out)
 
subroutine zfft_forward_1d (fft, in, out)
 
subroutine zfft_backward_3d (fft, in, out, norm)
 
subroutine zfft_backward_accel (fft, in, out)
 
subroutine zfft_backward_1d (fft, in, out)
 

Variables

integer, parameter, public fft_none = 0
 global constants More...
 
integer, parameter, public fft_real = 1
 
integer, parameter, public fft_complex = 2
 
integer, parameter, public fftlib_none = 0
 
integer, parameter, public fftlib_fftw = 1
 
integer, parameter, public fftlib_pfft = 2
 
integer, parameter, public fftlib_accel = 3
 
integer, parameter, public fftlib_nfft = 4
 
integer, parameter, public fftlib_pnfft = 5
 
integer, parameter fft_max = 10
 
integer, parameter fft_null = -1
 
logical, save, public fft_initialized = .false.
 
integer, dimension(fft_max), save fft_refs
 
type(fft_t), dimension(fft_max), save fft_array
 
logical fft_optimize
 
integer, save fft_prepare_plan
 
integer, public fft_default_lib = -1
 
type(nfft_t), save nfft_options
 
type(pnfft_t), save pnfft_options
 
integer, parameter cufft_r2c = int(z'2a')
 
integer, parameter cufft_c2r = int(z'2c')
 
integer, parameter cufft_c2c = int(z'29')
 
integer, parameter cufft_d2z = int(z'6a')
 
integer, parameter cufft_z2d = int(z'6c')
 
integer, parameter cufft_z2z = int(z'69')
 

Function/Subroutine Documentation

◆ fft_all_init()

subroutine, public fft_oct_m::fft_all_init ( type(namespace_t), intent(in)  namespace)

initialize the table

Definition at line 276 of file fft.F90.

◆ fft_all_end()

subroutine, public fft_oct_m::fft_all_end

delete all plans

Definition at line 389 of file fft.F90.

◆ fft_init()

subroutine, public fft_oct_m::fft_init ( type(fft_t), intent(inout)  this,
integer, dimension(3), intent(inout)  nn,
integer, intent(in)  dim,
integer, intent(in)  type,
integer, intent(in)  library,
logical, dimension(3), intent(in)  optimize,
integer, dimension(3), intent(in)  optimize_parity,
type(mpi_comm), intent(out), optional  comm,
type(mpi_grp_t), intent(in), optional  mpi_grp,
logical, optional  use_aligned 
)
Parameters
[in,out]thisFFT data type
[in,out]nnSize of the box
[in]dimDimensions of the box
[in]typeThe type of the FFT; real or complex
[in]libraryFFT library to be used. Can be overridden.
[in]optimizewhether we should optimize grid in each direction
[in]optimize_paritychoose optimized grid in each direction as even (0), odd (1), or whatever (negative).
[out]commMPI communicator
[in]mpi_grpthe mpi_group we want to use for the parallelization
use_alignedFor FFTW we can use aligned memory

Definition at line 416 of file fft.F90.

◆ fft_init_stage1()

subroutine, public fft_oct_m::fft_init_stage1 ( type(fft_t), intent(inout)  this,
type(namespace_t), intent(in)  namespace,
real(real64), dimension(:,:), intent(in)  XX,
integer, dimension(:), intent(in), optional  nn 
)

Some fft-libraries (only NFFT for the moment) need an additional precomputation stage that depends on the spatial grid whose size may change after fft_init.

Parameters
[in,out]thisFFT data type
[in]namespaceNFFT spatial nodes on x-axis XX(:,1), y-axis XX(:,2), and z-axis XX(:,3)

Definition at line 952 of file fft.F90.

◆ fft_end()

subroutine, public fft_oct_m::fft_end ( type(fft_t), intent(inout)  this)

Definition at line 994 of file fft.F90.

◆ fft_copy()

subroutine, public fft_oct_m::fft_copy ( type(fft_t), intent(in)  fft_i,
type(fft_t), intent(inout)  fft_o 
)

Definition at line 1059 of file fft.F90.

◆ fft_get_dims()

subroutine, public fft_oct_m::fft_get_dims ( type(fft_t), intent(in)  fft,
integer, dimension(1:3), intent(out)  rs_n_global,
integer, dimension(1:3), intent(out)  fs_n_global,
integer, dimension(1:3), intent(out)  rs_n,
integer, dimension(1:3), intent(out)  fs_n,
integer, dimension(1:3), intent(out)  rs_istart,
integer, dimension(1:3), intent(out)  fs_istart 
)

Definition at line 1078 of file fft.F90.

◆ pad_feq()

pure integer function, public fft_oct_m::pad_feq ( integer, intent(in)  ii,
integer, intent(in)  nn,
logical, intent(in)  mode 
)

convert between array index and G-vector

Definition at line 1104 of file fft.F90.

◆ fft_size()

integer function fft_oct_m::fft_size ( integer, intent(in)  size,
integer, dimension(:), intent(in)  factors,
integer, intent(in)  parity 
)
private

Definition at line 1129 of file fft.F90.

◆ get_exponents()

subroutine fft_oct_m::get_exponents ( integer, intent(in)  num,
integer, intent(in)  nfactors,
integer, dimension(:), intent(in)  factors,
integer, dimension(:), intent(out)  exponents,
integer, intent(out)  nondiv 
)
private

Definition at line 1158 of file fft.F90.

◆ fft_operation_count()

subroutine fft_oct_m::fft_operation_count ( type(fft_t), intent(in)  fft)
private

Definition at line 1185 of file fft.F90.

◆ fft_gg_transform()

subroutine, public fft_oct_m::fft_gg_transform ( integer, dimension(:), intent(in)  gg_in,
real(real64), dimension(:), intent(in)  temp,
integer, intent(in)  periodic_dim,
type(lattice_vectors_t), intent(in)  latt,
real(real64), dimension(:), intent(in)  qq,
real(real64), dimension(:), intent(inout)  gg,
real(real64), intent(out)  modg2 
)

Definition at line 1199 of file fft.F90.

◆ fft_scaling_factor()

real(real64) pure function, public fft_oct_m::fft_scaling_factor ( type(fft_t), intent(in)  fft)

This function returns the factor required to normalize a function after a forward and backward transform.

Definition at line 1222 of file fft.F90.

◆ fft_get_ecut_from_box()

real(real64) function, public fft_oct_m::fft_get_ecut_from_box ( integer, dimension(:), intent(in)  box_dim,
integer, dimension(:), intent(in)  fs_istart,
type(lattice_vectors_t), intent(in)  latt,
real(real64), dimension(:), intent(in)  gspacing,
integer, intent(in)  periodic_dim,
real(real64), dimension(:), intent(in)  qq 
)

Given an fft box (fixed by the real-space grid), it returns the cutoff energy of the sphere that fits inside the box.

Definition at line 1244 of file fft.F90.

◆ dfft_forward_3d()

subroutine fft_oct_m::dfft_forward_3d ( type(fft_t), intent(in)  fft,
real(real64), dimension(:,:,:), intent(inout)  in,
complex(real64), dimension(:,:,:), intent(out)  out,
real(real64), intent(out), optional  norm 
)
private

Definition at line 1379 of file fft.F90.

◆ dfft_forward_accel()

subroutine fft_oct_m::dfft_forward_accel ( type(fft_t), intent(in)  fft,
type(accel_mem_t), intent(in)  in,
type(accel_mem_t), intent(inout)  out 
)
private

Definition at line 1487 of file fft.F90.

◆ dfft_forward_1d()

subroutine fft_oct_m::dfft_forward_1d ( type(fft_t), intent(in)  fft,
real(real64), dimension(:), intent(inout)  in,
complex(real64), dimension(:), intent(out)  out 
)
private

Definition at line 1552 of file fft.F90.

◆ dfft_backward_3d()

subroutine fft_oct_m::dfft_backward_3d ( type(fft_t), intent(in)  fft,
complex(real64), dimension(:,:,:), intent(inout)  in,
real(real64), dimension(:,:,:), intent(out)  out,
real(real64), intent(out), optional  norm 
)
private

Definition at line 1570 of file fft.F90.

◆ dfft_backward_accel()

subroutine fft_oct_m::dfft_backward_accel ( type(fft_t), intent(in)  fft,
type(accel_mem_t), intent(in)  in,
type(accel_mem_t), intent(inout)  out 
)
private

Definition at line 1684 of file fft.F90.

◆ dfft_backward_1d()

subroutine fft_oct_m::dfft_backward_1d ( type(fft_t), intent(in)  fft,
complex(real64), dimension(:), intent(inout)  in,
real(real64), dimension(:), intent(out), contiguous  out 
)
private

Definition at line 1747 of file fft.F90.

◆ zfft_forward_3d()

subroutine fft_oct_m::zfft_forward_3d ( type(fft_t), intent(in)  fft,
complex(real64), dimension(:,:,:), intent(inout)  in,
complex(real64), dimension(:,:,:), intent(out)  out,
real(real64), intent(out), optional  norm 
)
private

Definition at line 1844 of file fft.F90.

◆ zfft_forward_accel()

subroutine fft_oct_m::zfft_forward_accel ( type(fft_t), intent(in)  fft,
type(accel_mem_t), intent(in)  in,
type(accel_mem_t), intent(inout)  out 
)
private

Definition at line 1943 of file fft.F90.

◆ zfft_forward_1d()

subroutine fft_oct_m::zfft_forward_1d ( type(fft_t), intent(in)  fft,
complex(real64), dimension(:), intent(inout)  in,
complex(real64), dimension(:), intent(out)  out 
)
private

Definition at line 2008 of file fft.F90.

◆ zfft_backward_3d()

subroutine fft_oct_m::zfft_backward_3d ( type(fft_t), intent(in)  fft,
complex(real64), dimension(:,:,:), intent(inout)  in,
complex(real64), dimension(:,:,:), intent(out)  out,
real(real64), intent(out), optional  norm 
)
private

Definition at line 2026 of file fft.F90.

◆ zfft_backward_accel()

subroutine fft_oct_m::zfft_backward_accel ( type(fft_t), intent(in)  fft,
type(accel_mem_t), intent(in)  in,
type(accel_mem_t), intent(inout)  out 
)
private

Definition at line 2140 of file fft.F90.

◆ zfft_backward_1d()

subroutine fft_oct_m::zfft_backward_1d ( type(fft_t), intent(in)  fft,
complex(real64), dimension(:), intent(inout)  in,
complex(real64), dimension(:), intent(out), contiguous  out 
)
private

Definition at line 2203 of file fft.F90.

Variable Documentation

◆ fft_none

integer, parameter, public fft_oct_m::fft_none = 0

global constants

Definition at line 177 of file fft.F90.

◆ fft_real

integer, parameter, public fft_oct_m::fft_real = 1

Definition at line 177 of file fft.F90.

◆ fft_complex

integer, parameter, public fft_oct_m::fft_complex = 2

Definition at line 177 of file fft.F90.

◆ fftlib_none

integer, parameter, public fft_oct_m::fftlib_none = 0

Definition at line 182 of file fft.F90.

◆ fftlib_fftw

integer, parameter, public fft_oct_m::fftlib_fftw = 1

Definition at line 182 of file fft.F90.

◆ fftlib_pfft

integer, parameter, public fft_oct_m::fftlib_pfft = 2

Definition at line 182 of file fft.F90.

◆ fftlib_accel

integer, parameter, public fft_oct_m::fftlib_accel = 3

Definition at line 182 of file fft.F90.

◆ fftlib_nfft

integer, parameter, public fft_oct_m::fftlib_nfft = 4

Definition at line 182 of file fft.F90.

◆ fftlib_pnfft

integer, parameter, public fft_oct_m::fftlib_pnfft = 5

Definition at line 182 of file fft.F90.

◆ fft_max

integer, parameter fft_oct_m::fft_max = 10
private

Definition at line 190 of file fft.F90.

◆ fft_null

integer, parameter fft_oct_m::fft_null = -1
private

Definition at line 190 of file fft.F90.

◆ fft_initialized

logical, save, public fft_oct_m::fft_initialized = .false.

Definition at line 253 of file fft.F90.

◆ fft_refs

integer, dimension(fft_max), save fft_oct_m::fft_refs
private

Definition at line 254 of file fft.F90.

◆ fft_array

type(fft_t), dimension(fft_max), save fft_oct_m::fft_array
private

Definition at line 255 of file fft.F90.

◆ fft_optimize

logical fft_oct_m::fft_optimize
private

Definition at line 256 of file fft.F90.

◆ fft_prepare_plan

integer, save fft_oct_m::fft_prepare_plan
private

Definition at line 257 of file fft.F90.

◆ fft_default_lib

integer, public fft_oct_m::fft_default_lib = -1

Definition at line 258 of file fft.F90.

◆ nfft_options

type(nfft_t), save fft_oct_m::nfft_options
private

Definition at line 260 of file fft.F90.

◆ pnfft_options

type(pnfft_t), save fft_oct_m::pnfft_options
private

Definition at line 262 of file fft.F90.

◆ cufft_r2c

integer, parameter fft_oct_m::cufft_r2c = int(z'2a')
private

Definition at line 264 of file fft.F90.

◆ cufft_c2r

integer, parameter fft_oct_m::cufft_c2r = int(z'2c')
private

Definition at line 264 of file fft.F90.

◆ cufft_c2c

integer, parameter fft_oct_m::cufft_c2c = int(z'29')
private

Definition at line 264 of file fft.F90.

◆ cufft_d2z

integer, parameter fft_oct_m::cufft_d2z = int(z'6a')
private

Definition at line 264 of file fft.F90.

◆ cufft_z2d

integer, parameter fft_oct_m::cufft_z2d = int(z'6c')
private

Definition at line 264 of file fft.F90.

◆ cufft_z2z

integer, parameter fft_oct_m::cufft_z2z = int(z'69')
private

Definition at line 264 of file fft.F90.