NAMD
Classes | Macros | Functions
msm_defn.h File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <strings.h>
#include "msm.h"
#include "wkfutils.h"

Go to the source code of this file.

Classes

struct  NL_Msm_t
 

Macros

#define X   0
 
#define Y   1
 
#define Z   2
 
#define Q   3
 
#define NELEMS(arr)   (sizeof(arr)/sizeof(arr[0]))
 
#define GRID_TEMPLATE(TYPE)
 
#define GRID_INIT(_p)
 
#define GRID_DONE(_p)   free((_p)->buffer)
 
#define GRID_INDEX(_p, _i, _j, _k)   (((_k)*((_p)->nj) + (_j))*((_p)->ni) + (_i))
 
#define GRID_POINTER(_p, _i, _j, _k)   ((_p)->data + GRID_INDEX(_p, _i, _j, _k))
 
#define GRID_RESIZE(_p, TYPE, __i0, __ni, __j0, __nj, __k0, __nk)
 
#define GRID_ZERO(_p)   memset((_p)->buffer, 0, (_p)->numbytes) /* ; */
 
#define ASSERT(expr)
 
#define GRID_INDEX_CHECK(a, _i, _j, _k)
 
#define DEFAULT_GRIDSPACING   2.5
 
#define DEFAULT_APPROX   NL_MSM_APPROX_CUBIC
 
#define DEFAULT_SPLIT   NL_MSM_SPLIT_TAYLOR2
 
#define DEFAULT_NLEVELS   0 /* set number of levels as needed */
 
#define DEFAULT_DENSITY   0.1
 
#define DEFAULT_BINFILL   0.8
 
#define DEFAULT_NBINSLOTS   8
 
#define SPOLY(pg, pdg, ra, split)
 
#define SPOLY_SPREC(pg, pdg, ra, split)
 

Functions

 GRID_TEMPLATE (double)
 
 GRID_TEMPLATE (float)
 
void NL_msm_cleanup (NL_Msm *pm)
 
int NL_msm_compute_short_range (NL_Msm *pm)
 
int NL_msm_compute_long_range (NL_Msm *pm)
 
int NL_msm_compute_short_range_sprec (NL_Msm *pm)
 
int NL_msm_compute_long_range_sprec (NL_Msm *pm)
 

Macro Definition Documentation

#define ASSERT (   expr)

Definition at line 113 of file msm_defn.h.

#define DEFAULT_APPROX   NL_MSM_APPROX_CUBIC

Definition at line 120 of file msm_defn.h.

Referenced by NL_msm_create().

#define DEFAULT_BINFILL   0.8

Definition at line 125 of file msm_defn.h.

Referenced by NL_msm_create().

#define DEFAULT_DENSITY   0.1

Definition at line 124 of file msm_defn.h.

Referenced by NL_msm_create().

#define DEFAULT_GRIDSPACING   2.5

Default MSM parameters

Definition at line 119 of file msm_defn.h.

Referenced by NL_msm_create().

#define DEFAULT_NBINSLOTS   8

Definition at line 126 of file msm_defn.h.

Referenced by NL_msm_create().

#define DEFAULT_NLEVELS   0 /* set number of levels as needed */

Definition at line 122 of file msm_defn.h.

Referenced by NL_msm_create().

#define DEFAULT_SPLIT   NL_MSM_SPLIT_TAYLOR2

Definition at line 121 of file msm_defn.h.

Referenced by NL_msm_create().

#define GRID_DONE (   _p)    free((_p)->buffer)

Finished with grid, free its memory

Definition at line 61 of file msm_defn.h.

Referenced by NL_msm_cleanup().

#define GRID_INDEX (   _p,
  _i,
  _j,
  _k 
)    (((_k)*((_p)->nj) + (_j))*((_p)->ni) + (_i))

Determine the signed flattened index for 3D grid datum

Definition at line 66 of file msm_defn.h.

Referenced by anterpolation(), gridcutoff(), interpolation(), and setup_grids().

#define GRID_INDEX_CHECK (   a,
  _i,
  _j,
  _k 
)

Definition at line 114 of file msm_defn.h.

Referenced by anterpolation(), gridcutoff(), interpolation(), and setup_grids().

#define GRID_INIT (   _p)
Value:
((_p)->buffer=NULL, (_p)->data=NULL, (_p)->numbytes=0, (_p)->maxbytes=0, \
(_p)->i0=0, (_p)->j0=0, (_p)->k0=0, (_p)->ni=0, (_p)->nj=0, (_p)->nk=0)

Initialize grid to empty

Definition at line 55 of file msm_defn.h.

Referenced by setup_grids().

#define GRID_POINTER (   _p,
  _i,
  _j,
  _k 
)    ((_p)->data + GRID_INDEX(_p, _i, _j, _k))

Obtain pointer to 3D grid datum

Definition at line 71 of file msm_defn.h.

#define GRID_RESIZE (   _p,
  TYPE,
  __i0,
  __ni,
  __j0,
  __nj,
  __k0,
  __nk 
)
Value:
do { \
int _i0=(__i0), _ni=(__ni); \
int _j0=(__j0), _nj=(__nj); \
int _k0=(__k0), _nk=(__nk); \
size_t _numbytes = (_nk * _nj) * (size_t) _ni * sizeof((_p)->buffer[0]); \
if ((_p)->maxbytes < _numbytes) { \
void *_t = realloc((_p)->buffer, _numbytes); \
if (NULL == _t) return NL_MSM_ERROR_MALLOC; \
(_p)->buffer = (TYPE *) _t; \
(_p)->maxbytes = _numbytes; \
} \
(_p)->numbytes = _numbytes; \
(_p)->i0 = _i0, (_p)->ni = _ni; \
(_p)->j0 = _j0, (_p)->nj = _nj; \
(_p)->k0 = _k0, (_p)->nk = _nk; \
(_p)->data = (_p)->buffer + GRID_INDEX((_p), -_i0, -_j0, -_k0); \
} while (0)
static __global__ void(const patch_pair *patch_pairs, const atom *atoms, const atom_param *atom_params, const int *vdw_types, unsigned int *plist, float4 *tmpforces, float4 *slow_tmpforces, float4 *forces, float4 *slow_forces, float *tmpvirials, float *slow_tmpvirials, float *virials, float *slow_virials, unsigned int *global_counters, int *force_ready_queue, const unsigned int *overflow_exclusions, const int npatches, const int block_begin, const int total_block_count, int *block_order, exclmask *exclmasks, const int lj_table_size, const float3 lata, const float3 latb, const float3 latc, const float cutoff2, const float plcutoff2, const int doSlow)
if(ComputeNonbondedUtil::goMethod==2)
#define GRID_INDEX(_p, _i, _j, _k)
Definition: msm_defn.h:66

Resize 3D grid buffer, setup its indexing. Grab more memory when needed (must be used within function returning int).

Definition at line 77 of file msm_defn.h.

Referenced by setup_grids().

#define GRID_TEMPLATE (   TYPE)
Value:
typedef struct NL_Msmgrid_##TYPE##_t { \
TYPE *buffer; /* raw buffer */ \
TYPE *data; /* data access offset from buffer */ \
size_t numbytes; /* number of bytes in use by buffer */ \
size_t maxbytes; /* actual allocation for buffer */ \
int i0, j0, k0; /* starting index value for each dimension */ \
int ni, nj, nk; /* number of elements in each dimension */ \
} NL_Msmgrid_##TYPE

Template to create a 3D grid to access data of given TYPE

Definition at line 43 of file msm_defn.h.

#define GRID_ZERO (   _p)    memset((_p)->buffer, 0, (_p)->numbytes) /* ; */

Definition at line 98 of file msm_defn.h.

Referenced by anterpolation().

#define NELEMS (   arr)    (sizeof(arr)/sizeof(arr[0]))

Return number of elements in static array

Definition at line 39 of file msm_defn.h.

Referenced by NL_msm_approx(), NL_msm_approx_name(), NL_msm_split(), and NL_msm_split_name().

#define Q   3

Definition at line 35 of file msm_defn.h.

Referenced by bin_evaluation_1away(), and bin_evaluation_k_away().

#define SPOLY (   pg,
  pdg,
  ra,
  split 
)

SPOLY() calculates the polynomial part of the normalized smoothing of 1/r.

Returns g(R), where R=r/a, and (d/dR)g(R).

pg - float*, points to variable to receive g(R) pdg - float*, points to variable to receive (d/dR)g(R) ra - (r/a), assumed to be between 0 and 1 split - identify the type of smoothing used to split the potential

Definition at line 140 of file msm_defn.h.

Referenced by bin_evaluation_1away(), bin_evaluation_k_away(), ComputeNonbondedUtil::select(), and setup_grids().

#define SPOLY_SPREC (   pg,
  pdg,
  ra,
  split 
)

SPOLY_SPREC() calculates the polynomial part of the normalized smoothing of 1/r. Single precision version.

Returns g(R), where R=r/a, and (d/dR)g(R).

pg - float*, points to variable to receive g(R) pdg - float*, points to variable to receive (d/dR)g(R) ra - (r/a), assumed to be between 0 and 1 split - identify the type of smoothing used to split the potential

Definition at line 351 of file msm_defn.h.

Referenced by bin_evaluation_1away(), and bin_evaluation_k_away().

#define X   0

Index vectors for x,y,z,q coordinates

Definition at line 29 of file msm_defn.h.

Referenced by bin_evaluation_1away(), bin_evaluation_k_away(), setup_bins_1away(), setup_bins_k_away(), setup_cell_vectors(), and spatial_hashing().

#define Y   1
#define Z   2

Function Documentation

GRID_TEMPLATE ( double  )
GRID_TEMPLATE ( float  )
void NL_msm_cleanup ( NL_Msm pm)

Definition at line 7 of file msm_setup.c.

References NL_Msm_t::eh, NL_Msm_t::eh_f, NL_Msm_t::gc, NL_Msm_t::gc_f, GRID_DONE, NL_Msm_t::lyzd, NL_Msm_t::lyzd_f, NL_Msm_t::lzd, NL_Msm_t::lzd_f, NL_Msm_t::maxlevels, NL_Msm_t::msmflags, NL_MSM_COMPUTE_CUDA_GRID_CUTOFF, NL_MSM_COMPUTE_SPREC, NL_Msm_t::qh, and NL_Msm_t::qh_f.

Referenced by NL_msm_destroy().

7  {
8  int i;
9 #ifdef NL_USE_CUDA
11  NL_msm_cuda_cleanup_gridcutoff(pm);
12  }
13 #endif /* NL_USE_CUDA */
14  if (pm->msmflags & NL_MSM_COMPUTE_SPREC) {
15  for (i = 0; i < pm->maxlevels; i++) {
16  GRID_DONE( &(pm->qh_f[i]) );
17  GRID_DONE( &(pm->eh_f[i]) );
18  GRID_DONE( &(pm->gc_f[i]) );
19  }
20  }
21  else {
22  for (i = 0; i < pm->maxlevels; i++) {
23  GRID_DONE( &(pm->qh[i]) );
24  GRID_DONE( &(pm->eh[i]) );
25  GRID_DONE( &(pm->gc[i]) );
26  }
27  }
28  free(pm->lzd);
29  free(pm->lyzd);
30  free(pm->lzd_f);
31  free(pm->lyzd_f);
32  free(pm->qh);
33  free(pm->eh);
34  free(pm->gc);
35  free(pm->qh_f);
36  free(pm->eh_f);
37  free(pm->gc_f);
38 }
int msmflags
Definition: msm_defn.h:590
NL_Msmgrid_double * eh
Definition: msm_defn.h:667
#define GRID_DONE(_p)
Definition: msm_defn.h:61
NL_Msmgrid_double * gc
Definition: msm_defn.h:668
double * lzd
Definition: msm_defn.h:677
float * lyzd_f
Definition: msm_defn.h:681
NL_Msmgrid_float * gc_f
Definition: msm_defn.h:672
double * lyzd
Definition: msm_defn.h:678
NL_Msmgrid_float * eh_f
Definition: msm_defn.h:671
NL_Msmgrid_double * qh
Definition: msm_defn.h:666
NL_Msmgrid_float * qh_f
Definition: msm_defn.h:670
int maxlevels
Definition: msm_defn.h:674
float * lzd_f
Definition: msm_defn.h:680
int NL_msm_compute_long_range ( NL_Msm pm)

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().

52  {
53  double time_delta;
54  int rc = 0;
55  int level;
56  int nlevels = msm->nlevels;
57  int use_cuda_gridcutoff = (msm->msmflags & NL_MSM_COMPUTE_CUDA_GRID_CUTOFF);
58  int fallback_cpu = (msm->msmflags & NL_MSM_COMPUTE_CUDA_FALL_BACK);
59  int use_nonfactored = (msm->msmflags & NL_MSM_COMPUTE_NONFACTORED);
60 
61  wkf_timer_start(msm->timer_longrng);
62  rc = anterpolation(msm);
63  if (rc) return rc;
64  wkf_timer_stop(msm->timer_longrng);
65  time_delta = wkf_timer_time(msm->timer_longrng);
66  if (msm->report_timings) {
67  printf("MSM anterpolation: %6.3f sec\n", time_delta);
68  }
69 
70  wkf_timer_start(msm->timer_longrng);
71  if (use_nonfactored) {
72  for (level = 0; level < nlevels - 1; level++) {
73  rc = restriction(msm, level);
74  if (rc) return rc;
75  }
76  }
77  else {
78  for (level = 0; level < nlevels - 1; level++) {
79  rc = restriction_factored(msm, level);
80  if (rc) return rc;
81  }
82  }
83  wkf_timer_stop(msm->timer_longrng);
84  time_delta = wkf_timer_time(msm->timer_longrng);
85  if (msm->report_timings) {
86  printf("MSM restriction: %6.3f sec\n", time_delta);
87  }
88 
89  wkf_timer_start(msm->timer_longrng);
90  if (use_cuda_gridcutoff && nlevels > 1) {
91 #ifdef NL_USE_CUDA
92  if ((rc = NL_msm_cuda_condense_qgrids(msm)) != NL_MSM_SUCCESS ||
93  (rc = NL_msm_cuda_compute_gridcutoff(msm)) != NL_MSM_SUCCESS ||
94  (rc = NL_msm_cuda_expand_egrids(msm)) != NL_MSM_SUCCESS) {
95  if (fallback_cpu) {
96  printf("Falling back on CPU for grid cutoff computation\n");
97  use_cuda_gridcutoff = 0;
98  }
99  else return rc;
100  }
101 #else
102  if (fallback_cpu) {
103  printf("Falling back on CPU for grid cutoff computation\n");
104  use_cuda_gridcutoff = 0;
105  }
106  else return NL_MSM_ERROR_SUPPORT;
107 #endif
108  }
109 
110  if ( ! use_cuda_gridcutoff ) {
111  for (level = 0; level < nlevels - 1; level++) {
112  rc = gridcutoff(msm, level);
113  if (rc) return rc;
114  }
115  }
116 
117  rc = gridcutoff(msm, level); /* top level */
118  if (rc) return rc;
119 
120  wkf_timer_stop(msm->timer_longrng);
121  time_delta = wkf_timer_time(msm->timer_longrng);
122  if (msm->report_timings) {
123  printf("MSM grid cutoff: %6.3f sec\n", time_delta);
124  }
125 
126  wkf_timer_start(msm->timer_longrng);
127  if (use_nonfactored) {
128  for (level--; level >= 0; level--) {
129  rc = prolongation(msm, level);
130  if (rc) return rc;
131  }
132  }
133  else {
134  for (level--; level >= 0; level--) {
135  rc = prolongation_factored(msm, level);
136  if (rc) return rc;
137  }
138  }
139  wkf_timer_stop(msm->timer_longrng);
140  time_delta = wkf_timer_time(msm->timer_longrng);
141  if (msm->report_timings) {
142  printf("MSM prolongation: %6.3f sec\n", time_delta);
143  }
144 
145  wkf_timer_start(msm->timer_longrng);
146  rc = interpolation(msm);
147  if (rc) return rc;
148  wkf_timer_stop(msm->timer_longrng);
149  time_delta = wkf_timer_time(msm->timer_longrng);
150  if (msm->report_timings) {
151  printf("MSM interpolation: %6.3f sec\n", time_delta);
152  }
153 
154  return 0;
155 }
double wkf_timer_time(wkf_timerhandle v)
Definition: wkfutils.c:134
static int prolongation_factored(NL_Msm *, int level)
Definition: msm_longrng.c:1340
static int restriction_factored(NL_Msm *, int level)
Definition: msm_longrng.c:1193
static int anterpolation(NL_Msm *)
Definition: msm_longrng.c:779
void wkf_timer_stop(wkf_timerhandle v)
Definition: wkfutils.c:129
static int restriction(NL_Msm *, int level)
Definition: msm_longrng.c:1485
static int interpolation(NL_Msm *)
Definition: msm_longrng.c:960
static int gridcutoff(NL_Msm *, int level)
Definition: msm_longrng.c:1677
void wkf_timer_start(wkf_timerhandle v)
Definition: wkfutils.c:124
static int prolongation(NL_Msm *, int level)
Definition: msm_longrng.c:1582
int NL_msm_compute_long_range_sprec ( NL_Msm pm)

Definition at line 52 of file msm_longrng_sprec.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_sprec().

52  {
53  double time_delta;
54  int rc = 0;
55  int level;
56  int nlevels = msm->nlevels;
57  int use_cuda_gridcutoff = (msm->msmflags & NL_MSM_COMPUTE_CUDA_GRID_CUTOFF);
58  int fallback_cpu = (msm->msmflags & NL_MSM_COMPUTE_CUDA_FALL_BACK);
59  int use_nonfactored = (msm->msmflags & NL_MSM_COMPUTE_NONFACTORED);
60 
61  wkf_timer_start(msm->timer_longrng);
62  rc = anterpolation(msm);
63  if (rc) return rc;
64  wkf_timer_stop(msm->timer_longrng);
65  time_delta = wkf_timer_time(msm->timer_longrng);
66  if (msm->report_timings) {
67  printf("MSM anterpolation: %6.3f sec\n", time_delta);
68  }
69 
70  wkf_timer_start(msm->timer_longrng);
71  if (use_nonfactored) {
72  for (level = 0; level < nlevels - 1; level++) {
73  rc = restriction(msm, level);
74  if (rc) return rc;
75  }
76  }
77  else {
78  for (level = 0; level < nlevels - 1; level++) {
79  rc = restriction_factored(msm, level);
80  if (rc) return rc;
81  }
82  }
83  wkf_timer_stop(msm->timer_longrng);
84  time_delta = wkf_timer_time(msm->timer_longrng);
85  if (msm->report_timings) {
86  printf("MSM restriction: %6.3f sec\n", time_delta);
87  }
88 
89  wkf_timer_start(msm->timer_longrng);
90  if (use_cuda_gridcutoff && nlevels > 1) {
91 #ifdef NL_USE_CUDA
92  if ((rc = NL_msm_cuda_condense_qgrids(msm)) != NL_MSM_SUCCESS ||
93  (rc = NL_msm_cuda_compute_gridcutoff(msm)) != NL_MSM_SUCCESS ||
94  (rc = NL_msm_cuda_expand_egrids(msm)) != NL_MSM_SUCCESS) {
95  if (fallback_cpu) {
96  printf("Falling back on CPU for grid cutoff computation\n");
97  use_cuda_gridcutoff = 0;
98  }
99  else return rc;
100  }
101 #else
102  if (fallback_cpu) {
103  printf("Falling back on CPU for grid cutoff computation\n");
104  use_cuda_gridcutoff = 0;
105  }
106  else return NL_MSM_ERROR_SUPPORT;
107 #endif
108  }
109 
110  if ( ! use_cuda_gridcutoff ) {
111  for (level = 0; level < nlevels - 1; level++) {
112  rc = gridcutoff(msm, level);
113  if (rc) return rc;
114  }
115  }
116 
117  rc = gridcutoff(msm, level); /* top level */
118  if (rc) return rc;
119 
120  wkf_timer_stop(msm->timer_longrng);
121  time_delta = wkf_timer_time(msm->timer_longrng);
122  if (msm->report_timings) {
123  printf("MSM grid cutoff: %6.3f sec\n", time_delta);
124  }
125 
126  wkf_timer_start(msm->timer_longrng);
127  if (use_nonfactored) {
128  for (level--; level >= 0; level--) {
129  rc = prolongation(msm, level);
130  if (rc) return rc;
131  }
132  }
133  else {
134  for (level--; level >= 0; level--) {
135  rc = prolongation_factored(msm, level);
136  if (rc) return rc;
137  }
138  }
139  wkf_timer_stop(msm->timer_longrng);
140  time_delta = wkf_timer_time(msm->timer_longrng);
141  if (msm->report_timings) {
142  printf("MSM prolongation: %6.3f sec\n", time_delta);
143  }
144 
145  wkf_timer_start(msm->timer_longrng);
146  rc = interpolation(msm);
147  if (rc) return rc;
148  wkf_timer_stop(msm->timer_longrng);
149  time_delta = wkf_timer_time(msm->timer_longrng);
150  if (msm->report_timings) {
151  printf("MSM interpolation: %6.3f sec\n", time_delta);
152  }
153 
154  return 0;
155 }
double wkf_timer_time(wkf_timerhandle v)
Definition: wkfutils.c:134
static int interpolation(NL_Msm *)
static int prolongation_factored(NL_Msm *, int level)
static int gridcutoff(NL_Msm *, int level)
static int prolongation(NL_Msm *, int level)
void wkf_timer_stop(wkf_timerhandle v)
Definition: wkfutils.c:129
static int anterpolation(NL_Msm *)
static int restriction(NL_Msm *, int level)
void wkf_timer_start(wkf_timerhandle v)
Definition: wkfutils.c:124
static int restriction_factored(NL_Msm *, int level)
int NL_msm_compute_short_range ( NL_Msm pm)

Definition at line 37 of file msm_shortrng.c.

References bin_evaluation_1away(), bin_evaluation_k_away(), NL_Msm_t::maxatoms, NL_Msm_t::msmflags, NL_MSM_COMPUTE_1AWAY, NL_MSM_SUCCESS, NL_Msm_t::numatoms, setup_bin_data(), and spatial_hashing().

Referenced by NL_msm_compute_force().

37  {
38  int rc = 0; /* return code */
39 
40  if (pm->maxatoms < pm->numatoms) {
41  rc = setup_bin_data(pm);
42  if (rc) return rc;
43  }
44  rc = spatial_hashing(pm);
45  if (rc) return rc;
46  if (pm->msmflags & NL_MSM_COMPUTE_1AWAY) {
47  rc = bin_evaluation_1away(pm);
48  }
49  else {
50  rc = bin_evaluation_k_away(pm);
51  }
52  if (rc) return rc;
53  return NL_MSM_SUCCESS;
54 }
int msmflags
Definition: msm_defn.h:590
int numatoms
Definition: msm_defn.h:599
static int spatial_hashing(NL_Msm *pm)
Definition: msm_shortrng.c:69
static int setup_bin_data(NL_Msm *pm)
Definition: msm_shortrng.c:57
static int bin_evaluation_k_away(NL_Msm *pm)
Definition: msm_shortrng.c:273
static int bin_evaluation_1away(NL_Msm *pm)
Definition: msm_shortrng.c:117
int maxatoms
Definition: msm_defn.h:600
int NL_msm_compute_short_range_sprec ( NL_Msm pm)

Definition at line 37 of file msm_shortrng_sprec.c.

References bin_evaluation_1away(), bin_evaluation_k_away(), NL_Msm_t::maxatoms, NL_Msm_t::msmflags, NL_MSM_COMPUTE_1AWAY, NL_MSM_SUCCESS, NL_Msm_t::numatoms, setup_bin_data(), and spatial_hashing().

Referenced by NL_msm_compute_force_sprec().

37  {
38  int rc = 0; /* return code */
39 
40  if (pm->maxatoms < pm->numatoms) {
41  rc = setup_bin_data(pm);
42  if (rc) return rc;
43  }
44  rc = spatial_hashing(pm);
45  if (rc) return rc;
46  if (pm->msmflags & NL_MSM_COMPUTE_1AWAY) {
47  rc = bin_evaluation_1away(pm);
48  }
49  else {
50  rc = bin_evaluation_k_away(pm);
51  }
52  if (rc) return rc;
53  return NL_MSM_SUCCESS;
54 }
int msmflags
Definition: msm_defn.h:590
int numatoms
Definition: msm_defn.h:599
static int bin_evaluation_1away(NL_Msm *pm)
static int setup_bin_data(NL_Msm *pm)
static int bin_evaluation_k_away(NL_Msm *pm)
int maxatoms
Definition: msm_defn.h:600
static int spatial_hashing(NL_Msm *pm)