Octopus
double_grid.F90 File Reference

Go to the source code of this file.

Modules

module  double_grid_oct_m
 The Ono-Hirose double-grid technique [T. Ono and K. Hirose, Phys. Rev. Lett. 82, 5016 (1999); Phys. Rev. B 72, 085115 (2005)].
 

Data Types

type  double_grid_oct_m::dg_axis_kernel_t
 One-dimensional transpose-interpolation kernel along a single Cartesian axis. The full 3D tensor-product scatter weight factorizes as K1(c1,g1) K2(c2,g2) K3(c3,g3), so the scatter is done as three separable banded contractions instead of an (order+1)^3 tensor product per fine point. Fine index g = (ia - amin)*divisor + (o + nn) + 1 enumerates anchor ia and sub-offset o; each fine index scatters to at most order+1 coarse (submesh-box) points c in [1, nc]. More...
 
type  double_grid_oct_m::double_grid_cache_t
 Persistent, function-independent geometry of the double-grid transpose scatter for one submesh. Everything here depends only on the submesh geometry and the double-grid parameters (divisor, order, coordinate system), NOT on the functions being transformed, so it can be built once with double_grid_cache_init and reused by every double_grid_transform on that submesh. The integer keys are the periodicity/replica-correct rel_x-based keys (relative to the first LOCAL submesh point), so the cache is per-domain under domain decomposition, exactly like the on-the-fly path. More...
 
type  double_grid_oct_m::double_grid_t
 

Functions/Subroutines

subroutine, public double_grid_oct_m::double_grid_init (this, namespace, dim)
 
subroutine, public double_grid_oct_m::double_grid_end (this)
 
real(real64) function, public double_grid_oct_m::double_grid_margin (this, mesh)
 Submesh radius enlargement needed to contain the effective support of a transformed function: the tensor-product scatter reaches less than interp_max coarse points along each axis beyond the original support, i.e. at most interp_max times the longest cell diagonal. More...
 
subroutine, public double_grid_oct_m::double_grid_transform (this, sm, nf, spl, ll, mm, rcut, feff, cart_dir, cache)
 Evaluate a batch of localized functions f_jf(x) = spl_jf(r) * Y_{ll,mm}(x) (or a purely radial spl_jf(r) when ll(jf) == -1, e.g. local potentials and core densities) at the points of a submesh. When the double grid is disabled this is a plain evaluation at the submesh points; when enabled, the effective (interpolation-transpose folded) values are returned. The functions vanish for r > rcut(jf); the effective support then extends up to rcut(jf) + double_grid_margin, which the submesh radius must contain. If cart_dir(jf) > 0, the function is further multiplied by the Cartesian component cart_dir(jf) of the position relative to the center. More...
 
subroutine double_grid_oct_m::double_grid_transform_kernel (this, sm, nf, spl, ll, mm, rcut, cdir, feff, cache)
 The transpose-interpolation scatter. All arithmetic is done with integer grid keys relative to the first local submesh point: uniform meshes are integer lattices in the primitive (chi) coordinates, so key(ip) = nint(from_cartesian(rel_x(ip) - rel_x(1))/spacing) is exact, and is unique per (mesh point, periodic replica) within the submesh. The fine points are those of the anchor sites (the coarse sites of the key bounding box expanded by the stencil reach) and their offsets; their analytic values are folded onto the stencil sites, resolved back to submesh points by a dense key lookup. Scatter targets outside the local submesh are dropped (they belong to another domain or lie outside the box); the submesh radius includes double_grid_margin, so no target is lost at the sphere boundary. More...
 
subroutine, public double_grid_oct_m::double_grid_cache_init (cache, this, sm)
 Precompute the function-independent geometry of the double-grid transpose scatter for one submesh: the integer keys (relative to the first LOCAL submesh point, periodicity/replica correct), their bounding box and dense key->point map, the per-axis Cartesian cell steps, the fine offsets, and the interpolation-stencil targets/weights. None of this depends on the functions being transformed, so a cache built here is reused by every double_grid_transform on this submesh. Because the keys are built from the LOCAL submesh points, the cache is per-domain and matches the on-the-fly path exactly under domain decomposition. Must be rebuilt if the submesh geometry changes (e.g. the atom moves) or the double-grid parameters change. More...
 
subroutine build_axis_kernel (ax, kmn, kmx)
 Fill one axis kernel: for every fine index g = (ia,o), enumerate its coarse targets. More...
 
subroutine, public double_grid_oct_m::double_grid_cache_end (cache)
 

Function/Subroutine Documentation

◆ build_axis_kernel()

subroutine double_grid_cache_init::build_axis_kernel ( type(dg_axis_kernel_t), intent(inout)  ax,
integer, intent(in)  kmn,
integer, intent(in)  kmx 
)
private

Fill one axis kernel: for every fine index g = (ia,o), enumerate its coarse targets.

Definition at line 787 of file double_grid.F90.