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 (NL_Msm *msm) |
Variables | |
static const int | PolyDegree [NL_MSM_APPROX_END] |
static const double | 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 double | 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.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.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.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.c.
|
static |
Compute the long-range part of MSM forces.
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.c.
References NL_Msm_t::approx, ASSERT, NL_Msm_t::atom, GRID_INDEX, GRID_INDEX_CHECK, GRID_ZERO, NL_Msm_t::gx, NL_Msm_t::gy, NL_Msm_t::gz, NL_Msm_t::hx, NL_Msm_t::hy, NL_Msm_t::hz, MAX_POLY_DEGREE, NL_Msm_t::msmflags, NL_MSM_ERROR_RANGE, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, NL_Msm_t::numatoms, PolyDegree, NL_Msm_t::qh, and STENCIL_1D.
Referenced by NL_msm_compute_long_range().
|
static |
Definition at line 1677 of file msm_longrng.c.
References ASSERT, NL_Msm_t::eh, NL_Msm_t::gc, GRID_INDEX, GRID_INDEX_CHECK, NL_Msm_t::msmflags, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, and NL_Msm_t::qh.
Referenced by NL_msm_compute_long_range().
|
static |
Definition at line 960 of file msm_longrng.c.
References NL_Msm_t::approx, ASSERT, NL_Msm_t::atom, D_STENCIL_1D, NL_Msm_t::eh, NL_Msm_t::felec, GRID_INDEX, GRID_INDEX_CHECK, NL_Msm_t::gx, NL_Msm_t::gy, NL_Msm_t::gz, NL_Msm_t::gzero, NL_Msm_t::hx, NL_Msm_t::hy, NL_Msm_t::hz, MAX_POLY_DEGREE, NL_Msm_t::msmflags, NL_MSM_ERROR_RANGE, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, NL_Msm_t::numatoms, PolyDegree, NL_Msm_t::qh, and NL_Msm_t::uelec.
Referenced by NL_msm_compute_long_range().
int NL_msm_compute_long_range | ( | NL_Msm * | msm | ) |
Definition at line 52 of file msm_longrng.c.
References anterpolation(), gridcutoff(), interpolation(), NL_Msm_t::msmflags, NL_MSM_COMPUTE_CUDA_FALL_BACK, NL_MSM_COMPUTE_CUDA_GRID_CUTOFF, NL_MSM_COMPUTE_NONFACTORED, NL_MSM_ERROR_SUPPORT, NL_MSM_SUCCESS, NL_Msm_t::nlevels, prolongation(), prolongation_factored(), NL_Msm_t::report_timings, restriction(), restriction_factored(), NL_Msm_t::timer_longrng, wkf_timer_start(), wkf_timer_stop(), and wkf_timer_time().
Referenced by NL_msm_compute_force().
|
static |
Definition at line 1582 of file msm_longrng.c.
References NL_Msm_t::approx, NL_Msm_t::eh, IndexOffset, NL_Msm_t::msmflags, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, Nstencil, and PhiStencil.
Referenced by MsmBlock::addPotential(), MsmC1HermiteBlock::addPotential(), and NL_msm_compute_long_range().
|
static |
Definition at line 1340 of file msm_longrng.c.
References NL_Msm_t::approx, NL_Msm_t::eh, NL_Msm_t::lyzd, NL_Msm_t::lzd, NL_Msm_t::msmflags, 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().
|
static |
Definition at line 1485 of file msm_longrng.c.
References NL_Msm_t::approx, IndexOffset, NL_Msm_t::msmflags, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, Nstencil, PhiStencil, and NL_Msm_t::qh.
Referenced by MsmBlock::addCharge(), MsmC1HermiteBlock::addCharge(), and NL_msm_compute_long_range().
|
static |
Definition at line 1193 of file msm_longrng.c.
References NL_Msm_t::approx, NL_Msm_t::lyzd, NL_Msm_t::lzd, NL_Msm_t::msmflags, NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, NL_MSM_SUCCESS, PhiStencilFactored, PolyDegree, and NL_Msm_t::qh.
Referenced by NL_msm_compute_long_range().
|
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.c.
Referenced by prolongation(), and restriction().
|
static |
The stencil array lengths below.
Definition at line 208 of file msm_longrng.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.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.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.c.
Referenced by anterpolation(), interpolation(), prolongation_factored(), and restriction_factored().