Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

msmpot_internal.h File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "msmpot.h"

Go to the source code of this file.

Compounds

struct  Msmpot_t

Defines

#define GRID_TEMPLATE(TYPE)
#define GRID_INIT(a)
#define GRID_DONE(a)   free((a)->buffer)
#define GRID_INDEX(a, _i, _j, _k)   (((_k)*((a)->nj) + (_j))*(IndexType)((a)->ni) + (_i))
#define GRID_POINTER(a, _i, _j, _k)   ((a)->data + GRID_INDEX(a, _i, _j, _k))
#define GRID_RESIZE(a, __i0, __ni, __j0, __nj, __k0, __nk)
#define GRID_ZERO(a)   memset((a)->buffer, 0, (a)->numbytes)
#define GRID_INDEX_CHECK(a, _i, _j, _k)
#define DEFAULT_HMIN   2.f
#define DEFAULT_CUTOFF   12.f
#define DEFAULT_INTERP   MSMPOT_INTERP_CUBIC
#define DEFAULT_SPLIT   MSMPOT_SPLIT_TAYLOR2
#define DEFAULT_BINLENMAX   4.f
#define DEFAULT_BINDEPTH   8
#define DEFAULT_BINFILL   0.75f
#define DEFAULT_DENSITY   0.1f
#define DEFAULT_OVER   20
#define DEFAULT_ERRTOL   5e-3
#define ATOM_SIZE   4
#define ATOM_X(i)   ((i)<<2)
#define ATOM_Y(i)   (((i)<<2)+1)
#define ATOM_Z(i)   (((i)<<2)+2)
#define ATOM_Q(i)   (((i)<<2)+3)
#define SET_X(flag)   ((flag) |= 0x01)
#define SET_Y(flag)   ((flag) |= 0x02)
#define SET_Z(flag)   ((flag) |= 0x04)
#define IS_SET_X(flag)   ((flag) & 0x01)
#define IS_SET_Y(flag)   ((flag) & 0x02)
#define IS_SET_Z(flag)   ((flag) & 0x04)
#define IS_SET_ANY(flag)   ((flag) & 0x07)
#define IS_SET_ALL(flag)   ((flag) == 0x07)
#define ERROR(err)   (err)
#define ERRMSG(err, msg)   (err)
#define ASSERT(expr)
#define REPORT(msg)
#define SPOLY(pg, s, split)

Typedefs

typedef int IndexType

Functions

 GRID_TEMPLATE (float)
void Msmpot_set_defaults (Msmpot *msm)
int Msmpot_check_params (Msmpot *msm, const float *epotmap, int mx, int my, int mz, float lx, float ly, float lz, float vx, float vy, float vz, const float *atom, int natoms)
int Msmpot_setup (Msmpot *msm)
void Msmpot_cleanup (Msmpot *msm)
int Msmpot_compute_shortrng_bins (Msmpot *msm)
int Msmpot_compute_shortrng_bin_neighborhood (Msmpot *msm, float rx, float ry, float rz)
int Msmpot_compute_shortrng_bin_hashing (Msmpot *msm)
int Msmpot_compute_shortrng_linklist (Msmpot *msm, const float *atom, int natoms)
int Msmpot_compute_longrng (Msmpot *msm)
int Msmpot_compute_longrng_cubic (Msmpot *msm)


Define Documentation

#define ASSERT expr   
 

Definition at line 387 of file msmpot_internal.h.

Referenced by anterpolation, interpolation, latticecutoff, Msmpot_compute_shortrng_bin_hashing, setup_bins, setup_domain, setup_hierarchy, setup_mapinterp, and setup_mapinterpcoef_1d.

#define ATOM_Q      (((i)<<2)+3)
 

Definition at line 129 of file msmpot_internal.h.

Referenced by linklist_evaluation, linklist_hashing, and Msmpot_compute_shortrng_bin_hashing.

#define ATOM_SIZE   4
 

Definition at line 124 of file msmpot_internal.h.

Referenced by bin_evaluation, Msmpot_compute_shortrng_bin_hashing, and setup_bins.

#define ATOM_X      ((i)<<2)
 

Definition at line 126 of file msmpot_internal.h.

Referenced by linklist_evaluation, linklist_hashing, Msmpot_compute_shortrng_bin_hashing, and setup_domain.

#define ATOM_Y      (((i)<<2)+1)
 

Definition at line 127 of file msmpot_internal.h.

Referenced by linklist_evaluation, linklist_hashing, Msmpot_compute_shortrng_bin_hashing, and setup_domain.

#define ATOM_Z      (((i)<<2)+2)
 

Definition at line 128 of file msmpot_internal.h.

Referenced by linklist_evaluation, linklist_hashing, Msmpot_compute_shortrng_bin_hashing, and setup_domain.

#define DEFAULT_BINDEPTH   8
 

Definition at line 116 of file msmpot_internal.h.

Referenced by Msmpot_set_defaults.

#define DEFAULT_BINFILL   0.75f
 

Definition at line 117 of file msmpot_internal.h.

Referenced by Msmpot_configure, and Msmpot_set_defaults.

#define DEFAULT_BINLENMAX   4.f
 

Definition at line 114 of file msmpot_internal.h.

#define DEFAULT_CUTOFF   12.f
 

Definition at line 110 of file msmpot_internal.h.

Referenced by Msmpot_configure, and Msmpot_set_defaults.

#define DEFAULT_DENSITY   0.1f
 

Definition at line 118 of file msmpot_internal.h.

Referenced by Msmpot_configure, and Msmpot_set_defaults.

#define DEFAULT_ERRTOL   5e-3
 

Definition at line 122 of file msmpot_internal.h.

Referenced by Msmpot_configure, and Msmpot_set_defaults.

#define DEFAULT_HMIN   2.f
 

Definition at line 109 of file msmpot_internal.h.

Referenced by Msmpot_configure, and Msmpot_set_defaults.

#define DEFAULT_INTERP   MSMPOT_INTERP_CUBIC
 

Definition at line 111 of file msmpot_internal.h.

Referenced by Msmpot_set_defaults.

#define DEFAULT_OVER   20
 

Definition at line 120 of file msmpot_internal.h.

Referenced by setup_bins.

#define DEFAULT_SPLIT   MSMPOT_SPLIT_TAYLOR2
 

Definition at line 112 of file msmpot_internal.h.

Referenced by Msmpot_set_defaults.

#define ERRMSG err,
msg       (err)
 

Definition at line 376 of file msmpot_internal.h.

Referenced by Msmpot_check_params, Msmpot_compute_longrng, Msmpot_cuda_setup, Msmpot_use_cuda, setup_mapinterp, setup_mapinterpcoef_1d, and setup_periodic_hlevelparams_1d.

#define ERROR err       (err)
 

Definition at line 375 of file msmpot_internal.h.

Referenced by Msmpot_compute, Msmpot_compute_longrng, Msmpot_compute_longrng_cubic, Msmpot_compute_shortrng_bin_hashing, Msmpot_compute_shortrng_bin_neighborhood, Msmpot_compute_shortrng_bins, Msmpot_compute_shortrng_linklist, Msmpot_configure, Msmpot_cuda_compute_latcut, Msmpot_cuda_compute_shortrng, Msmpot_cuda_setup, Msmpot_cuda_setup_latcut, Msmpot_cuda_setup_shortrng, Msmpot_setup, Msmpot_use_cuda, set_device, setup_bins, setup_hierarchy, setup_mapinterp, and setup_mapinterpcoef_1d.

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

Definition at line 57 of file msmpot_internal.h.

Referenced by Msmpot_cleanup.

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

Definition at line 61 of file msmpot_internal.h.

Referenced by anterpolation, interpolation, latticecutoff, and setup_hierarchy.

#define GRID_INDEX_CHECK a,
_i,
_j,
_k   
 

Definition at line 104 of file msmpot_internal.h.

Referenced by anterpolation, interpolation, latticecutoff, and setup_hierarchy.

#define GRID_INIT  
 

Value:

((a)->buffer=NULL, (a)->data=NULL, (a)->numbytes=0, (a)->maxbytes=0, \
   (a)->i0=0, (a)->j0=0, (a)->k0=0, (a)->ni=0, (a)->nj=0, (a)->nk=0)

Definition at line 52 of file msmpot_internal.h.

Referenced by setup_hierarchy.

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

Definition at line 65 of file msmpot_internal.h.

#define GRID_RESIZE a,
__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((a)->buffer[0]); \
    if ((a)->maxbytes < _numbytes) { \
      void *_t = realloc((a)->buffer, _numbytes); \
      if (NULL == _t) return ERROR(MSMPOT_ERROR_MALLOC); \
      (a)->buffer = (float *) _t; \
      (a)->maxbytes = _numbytes; \
    } \
    (a)->numbytes = _numbytes; \
    (a)->i0 = _i0, (a)->ni = _ni; \
    (a)->j0 = _j0, (a)->nj = _nj; \
    (a)->k0 = _k0, (a)->nk = _nk; \
    (a)->data = (a)->buffer + GRID_INDEX((a), -_i0, -_j0, -_k0); \
  } while (0)

Definition at line 71 of file msmpot_internal.h.

Referenced by setup_hierarchy.

#define GRID_TEMPLATE TYPE   
 

Value:

typedef struct TYPE##Grid_t { \
    TYPE *buffer;         \
    TYPE *data;           \
    size_t numbytes;      \
    size_t maxbytes;      \
    int i0, j0, k0;       \
    int ni, nj, nk;       \
  } TYPE##Grid

Definition at line 41 of file msmpot_internal.h.

#define GRID_ZERO      memset((a)->buffer, 0, (a)->numbytes)
 

Definition at line 91 of file msmpot_internal.h.

Referenced by anterpolation.

#define IS_SET_ALL flag       ((flag) == 0x07)
 

Definition at line 138 of file msmpot_internal.h.

#define IS_SET_ANY flag       ((flag) & 0x07)
 

Definition at line 137 of file msmpot_internal.h.

Referenced by anterpolation, interpolation, and setup_hierarchy.

#define IS_SET_X flag       ((flag) & 0x01)
 

Definition at line 134 of file msmpot_internal.h.

Referenced by bin_evaluation, cuda_shortrange, interpolation_factored, latticecutoff, linklist_evaluation, linklist_hashing, Msmpot_compute_shortrng_bin_hashing, Msmpot_cuda_condense_qgrids, prolongation, restriction, setup_domain, setup_hierarchy, and setup_origin.

#define IS_SET_Y flag       ((flag) & 0x02)
 

Definition at line 135 of file msmpot_internal.h.

Referenced by bin_evaluation, cuda_shortrange, interpolation_factored, latticecutoff, linklist_evaluation, linklist_hashing, Msmpot_compute_shortrng_bin_hashing, Msmpot_cuda_condense_qgrids, prolongation, restriction, setup_domain, setup_hierarchy, and setup_origin.

#define IS_SET_Z flag       ((flag) & 0x04)
 

Definition at line 136 of file msmpot_internal.h.

Referenced by bin_evaluation, cuda_shortrange, interpolation_factored, latticecutoff, linklist_evaluation, linklist_hashing, Msmpot_compute_shortrng_bin_hashing, Msmpot_cuda_condense_qgrids, prolongation, restriction, setup_domain, setup_hierarchy, and setup_origin.

#define REPORT msg   
 

Definition at line 407 of file msmpot_internal.h.

Referenced by Msmpot_compute, Msmpot_compute_longrng_cubic, Msmpot_compute_shortrng_bins, Msmpot_compute_shortrng_linklist, Msmpot_cuda_cleanup, Msmpot_cuda_compute_shortrng, Msmpot_cuda_setup, Msmpot_cuda_setup_shortrng, and Msmpot_setup.

#define SET_X flag       ((flag) |= 0x01)
 

Definition at line 131 of file msmpot_internal.h.

Referenced by Msmpot_compute, and setup_origin.

#define SET_Y flag       ((flag) |= 0x02)
 

Definition at line 132 of file msmpot_internal.h.

Referenced by Msmpot_compute, and setup_origin.

#define SET_Z flag       ((flag) |= 0x04)
 

Definition at line 133 of file msmpot_internal.h.

Referenced by Msmpot_compute, and setup_origin.

#define SPOLY pg,
s,
split   
 

Value:

do { \
    float _s = s;    \
    float _g = 0; \
    ASSERT(0 <= _s && _s <= 1); \
    switch (split) { \
      case MSMPOT_SPLIT_TAYLOR2: \
        _g = 1 + (_s-1)*(-1.f/2 + (_s-1)*(3.f/8)); \
        break; \
      case MSMPOT_SPLIT_TAYLOR3: \
        _g = 1 + (_s-1)*(-1.f/2 + (_s-1)*(3.f/8 + (_s-1)*(-5.f/16))); \
        break; \
      case MSMPOT_SPLIT_TAYLOR4: \
        _g = 1 + (_s-1)*(-1.f/2 + (_s-1)*(3.f/8 + (_s-1)*(-5.f/16 \
                + (_s-1)*(35.f/128)))); \
        break; \
      default: \
        return ERRMSG(MSMPOT_ERROR_SUPPORT, \
            "splitting function not implemented"); \
    } \
    *(pg) = _g; \
  } while (0)

Definition at line 420 of file msmpot_internal.h.

Referenced by bin_evaluation, linklist_evaluation, Msmpot_cuda_setup_latcut, and setup_hierarchy.


Typedef Documentation

typedef int IndexType
 

Definition at line 36 of file msmpot_internal.h.


Function Documentation

GRID_TEMPLATE float   
 

int Msmpot_check_params Msmpot   msm,
const float *    epotmap,
int    mx,
int    my,
int    mz,
float    lx,
float    ly,
float    lz,
float    vx,
float    vy,
float    vz,
const float *    atom,
int    natoms
 

Definition at line 21 of file msmpot_setup.c.

void Msmpot_cleanup Msmpot   msm
 

Definition at line 132 of file msmpot_setup.c.

int Msmpot_compute_longrng Msmpot   msm
 

Definition at line 139 of file msmpot_compute.c.

Referenced by Msmpot_compute.

int Msmpot_compute_longrng_cubic Msmpot   msm
 

Definition at line 54 of file msmpot_cubic.c.

Referenced by Msmpot_compute_longrng.

int Msmpot_compute_shortrng_bin_hashing Msmpot   msm
 

Definition at line 351 of file msmpot_compute.c.

Referenced by Msmpot_compute_shortrng_bins, and Msmpot_cuda_compute_shortrng.

int Msmpot_compute_shortrng_bin_neighborhood Msmpot   msm,
float    rx,
float    ry,
float    rz
 

Definition at line 218 of file msmpot_compute.c.

Referenced by Msmpot_compute_shortrng_bins, and Msmpot_cuda_setup_shortrng.

int Msmpot_compute_shortrng_bins Msmpot   msm
 

Definition at line 167 of file msmpot_compute.c.

References Msmpot_t::dx, Msmpot_t::dy, and Msmpot_t::dz.

Referenced by Msmpot_compute.

int Msmpot_compute_shortrng_linklist Msmpot   msm,
const float *    atom,
int    natoms
 

Definition at line 608 of file msmpot_compute.c.

Referenced by Msmpot_compute, Msmpot_compute_shortrng_bins, and Msmpot_cuda_compute_shortrng.

void Msmpot_set_defaults Msmpot   msm
 

Definition at line 56 of file msmpot_setup.c.

int Msmpot_setup Msmpot   msm
 

Definition at line 205 of file msmpot_setup.c.

References Msmpot_t::islongcutoff.


Generated on Fri Apr 19 02:45:53 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002