NAMD
|
#include "msm_defn.h"
Go to the source code of this file.
Macros | |
#define | STENCIL_1D(_phi, _delta, _approx) |
#define | D_STENCIL_1D(_dphi, _phi, _h_1, _delta, _approx) |
Enumerations | |
enum | { MAX_POLY_DEGREE = 9 } |
enum | { MAX_NSTENCIL = 11 } |
Functions | |
static int | anterpolation (NL_Msm *) |
static int | interpolation (NL_Msm *) |
static int | restriction (NL_Msm *, int level) |
static int | prolongation (NL_Msm *, int level) |
static int | restriction_factored (NL_Msm *, int level) |
static int | prolongation_factored (NL_Msm *, int level) |
static int | gridcutoff (NL_Msm *, int level) |
int | NL_msm_compute_long_range_sprec (NL_Msm *msm) |
Variables | |
static const int | PolyDegree [NL_MSM_APPROX_END] |
static const float | PhiStencilFactored [NL_MSM_APPROX_END][2 *MAX_POLY_DEGREE+1] |
static const int | Nstencil [NL_MSM_APPROX_END] |
static const int | IndexOffset [NL_MSM_APPROX_END][MAX_NSTENCIL] |
static const float | PhiStencil [NL_MSM_APPROX_END][MAX_NSTENCIL] |
#define D_STENCIL_1D | ( | _dphi, | |
_phi, | |||
_h_1, | |||
_delta, | |||
_approx | |||
) |
Calculate the stencil of basis function and derivatives of (1/h)Phi. dphi - stencil array (up to size MAX_POLY_DEGREE+1) phi - stencil array (up to size MAX_POLY_DEGREE+1) h_1 - 1/h, h is the grid spacing delta - normalized distance of atom from lowest grid point in stencil approx - APPROX enum value from msm.h
Definition at line 468 of file msm_longrng_sprec.c.
Referenced by interpolation().
#define STENCIL_1D | ( | _phi, | |
_delta, | |||
_approx | |||
) |
Calculate the stencil of basis function values of Phi. phi - stencil array (up to size MAX_POLY_DEGREE+1) delta - normalized distance of atom from lowest grid point in stencil approx - APPROX enum value from msm.h
Definition at line 280 of file msm_longrng_sprec.c.
Referenced by anterpolation().
anonymous enum |
Approximation formulaes are up to degree 9 polynomials.
Enumerator | |
---|---|
MAX_POLY_DEGREE |
Definition at line 159 of file msm_longrng_sprec.c.
anonymous enum |
Max stencil length is basically PolyDegree+2 for those approximations that interpolate. (We skip over zero in the complete stencils above.)
Enumerator | |
---|---|
MAX_NSTENCIL |
Definition at line 205 of file msm_longrng_sprec.c.
|
static |
Compute the long-range part of MSM forces, using single precision.
The entire procedure can be depicted as an inverse V-cycle with bars across each level to represent the short-range gridded calculations.
The algorithm first performs anterpolation of the charge to the finest level grid. Each intermediate grid level, below the coarsest level at the top, calculates a more slowly varying long-range part of the interaction by restricting the charges to a grid with twice the spacing. Each grid level also has a short-range cutoff part between charges that contributes to the potentials. Also summed to the potentials at each intermediate grid level are the long-range contributions prolongated from a grid with twice the spacing. Finally, the forces are interpolated (or approximated if the basis functions do not interpolate) from the finest level grid of potentials. The steps of the algorithm are detailed in section 2.3 of the thesis.
The restriction and prolongation operations use the factored approach having a work constant which is linear in the degree of the polynomial, i.e. O(pM), where p is the degree and M is the number of grid points.
The algorithm below uses stencil widths expressed as a function of the degree of the basis function polynomial Phi. The constants for restriction and prolongation stencils are stored in an array indexed by the APPROX enum defined in msm.h header. Calculations of the grid stencils of the 1D Phi and its derivative, needed for interpolation and anterpolation, are expressed as macros that use the APPROX enum to select the polynomial pieces from a switch statement. Periodic boundaries are handled by wrapping around the edges of the grid, as discussed in section 6.2 of the thesis.
XXX The short-range gridded calculations contribute to the virial, but it is not calculated.
XXX The factored restriction and prolongation procedures are not suitable for parallel and GPU computation due to the sequential dependence along each dimension of the grid.
Definition at line 779 of file msm_longrng_sprec.c.
References ASSERT, GRID_INDEX, GRID_INDEX_CHECK, GRID_ZERO, MAX_POLY_DEGREE, NL_MSM_ERROR_RANGE, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, PolyDegree, and STENCIL_1D.
Referenced by NL_msm_compute_long_range_sprec().
|
static |
Definition at line 1690 of file msm_longrng_sprec.c.
References ASSERT, GRID_INDEX, GRID_INDEX_CHECK, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, and NL_MSM_SUCCESS.
Referenced by NL_msm_compute_long_range_sprec().
|
static |
Definition at line 960 of file msm_longrng_sprec.c.
References ASSERT, D_STENCIL_1D, GRID_INDEX, GRID_INDEX_CHECK, MAX_POLY_DEGREE, NL_MSM_ERROR_RANGE, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, and PolyDegree.
Referenced by NL_msm_compute_long_range_sprec().
int NL_msm_compute_long_range_sprec | ( | NL_Msm * | msm | ) |
Definition at line 52 of file msm_longrng_sprec.c.
References anterpolation(), gridcutoff(), interpolation(), NL_MSM_COMPUTE_CUDA_FALL_BACK, NL_MSM_COMPUTE_CUDA_GRID_CUTOFF, NL_MSM_COMPUTE_NONFACTORED, NL_MSM_ERROR_SUPPORT, NL_MSM_SUCCESS, prolongation(), prolongation_factored(), restriction(), restriction_factored(), wkf_timer_start(), wkf_timer_stop(), and wkf_timer_time().
Referenced by NL_msm_compute_force_sprec().
|
static |
Definition at line 1595 of file msm_longrng_sprec.c.
References IndexOffset, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, Nstencil, and PhiStencil.
Referenced by NL_msm_compute_long_range_sprec().
|
static |
Definition at line 1353 of file msm_longrng_sprec.c.
References NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, PhiStencilFactored, and PolyDegree.
Referenced by NL_msm_compute_long_range_sprec().
|
static |
Definition at line 1498 of file msm_longrng_sprec.c.
References IndexOffset, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, Nstencil, and PhiStencil.
Referenced by NL_msm_compute_long_range_sprec().
|
static |
Definition at line 1206 of file msm_longrng_sprec.c.
References NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, PhiStencilFactored, and PolyDegree.
Referenced by NL_msm_compute_long_range_sprec().
|
static |
Index offsets from the stencil-centered grid element, to get to the correct contributing grid element.
Definition at line 214 of file msm_longrng_sprec.c.
Referenced by prolongation(), and restriction().
|
static |
The stencil array lengths below.
Definition at line 208 of file msm_longrng_sprec.c.
Referenced by prolongation(), and restriction().
|
static |
The grid transfer stencils for the non-factored restriction and prolongation procedures.
Definition at line 242 of file msm_longrng_sprec.c.
Referenced by prolongation(), and restriction().
|
static |
The grid transfer stencils for factored restriction and prolongation. Must be listed in same order as APPROX enum from msm.h
Definition at line 170 of file msm_longrng_sprec.c.
Referenced by prolongation_factored(), and restriction_factored().
|
static |
Degree of polynomial basis function Phi. Must be listed in same order as APPROX enum from msm.h
Definition at line 163 of file msm_longrng_sprec.c.
Referenced by anterpolation(), interpolation(), prolongation_factored(), and restriction_factored().