NAMD
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GridforceLiteGrid Class Reference

#include <GridForceGrid.h>

Inheritance diagram for GridforceLiteGrid:
GridforceGrid

Public Member Functions

 GridforceLiteGrid (int gridnum)
 
virtual ~GridforceLiteGrid ()
 
void initialize (char *potfilename, SimParameters *simParams, MGridforceParams *mgridParams)
 
void reinitialize (SimParameters *simParams, MGridforceParams *mgridParams)
 
Position get_center (void) const
 
Position get_origin (void) const
 
Tensor get_e (void) const
 
Tensor get_inv (void) const
 
Vector get_scale (void) const
 
Bool get_checksize (void) const
 
int get_k0 (void) const
 
int get_k1 (void) const
 
int get_k2 (void) const
 
int get_total_grids (void) const
 
void set_scale (Vector s)
 
float get_grid (int i0, int i1, int i2, int i3) const
 
double get_grid_d (int i0, int i1, int i2, int i3) const
 
void set_grid (int i0, int i1, int i2, int i3, float V)
 
long int get_all_gridvals (float **all_gridvals) const
 
void set_all_gridvals (float *all_gridvals, long int sz)
 
int compute_VdV (Position pos, float &V, Vector &dV) const
 
- Public Member Functions inherited from GridforceGrid
virtual ~GridforceGrid ()
 
Position wrap_position (const Position &pos, const Lattice &lattice)
 
bool fits_lattice (const Lattice &lattice)
 
int compute_VdV (Position pos, float &V, Vector &dV) const
 
GridforceGridType get_grid_type (void)
 

Protected Member Functions

void compute_derivative_grids (void)
 
void compute_wts (float *wts, const Vector &dg) const
 
int get_inds (Position pos, int *inds, Vector &dg) const
 
float linear_interpolate (int i0, int i1, int i2, int i3, const float *wts) const
 
void pack (MOStream *msg) const
 
void unpack (MIStream *msg)
 
long int grid_index (int i0, int i1, int i2, int i3) const
 
- Protected Member Functions inherited from GridforceGrid
Position get_corner (int idx)
 
 GridforceGrid ()
 

Protected Attributes

float * grid
 
int k [4]
 
long int size
 
long int dk [4]
 
Position origin
 
Position center
 
Tensor e
 
Tensor inv
 
Vector scale
 
Bool checksize
 
char filename [NAMD_FILENAME_BUFFER_SIZE]
 
- Protected Attributes inherited from GridforceGrid
GridforceGridType type
 
int mygridnum
 

Additional Inherited Members

- Public Types inherited from GridforceGrid
enum  GridforceGridType { GridforceGridTypeUndefined = 0, GridforceGridTypeFull, GridforceGridTypeLite }
 
- Static Public Member Functions inherited from GridforceGrid
static GridforceGridnew_grid (int gridnum, char *potfilename, SimParameters *simParams, MGridforceParams *mgridParams)
 
static void pack_grid (GridforceGrid *grid, MOStream *msg)
 
static GridforceGridunpack_grid (int gridnum, MIStream *msg)
 

Detailed Description

Definition at line 287 of file GridForceGrid.h.

Constructor & Destructor Documentation

GridforceLiteGrid::GridforceLiteGrid ( int  gridnum)
explicit

Definition at line 1306 of file GridForceGrid.C.

References grid, GridforceGrid::GridforceGridTypeLite, GridforceGrid::mygridnum, and GridforceGrid::type.

1307 {
1308  mygridnum = gridnum;
1309  grid = NULL;
1311 }
GridforceGridType type
Definition: GridForceGrid.h:74
GridforceLiteGrid::~GridforceLiteGrid ( )
virtual

Definition at line 1314 of file GridForceGrid.C.

References grid.

1315 {
1316  delete[] grid;
1317 }

Member Function Documentation

void GridforceLiteGrid::compute_derivative_grids ( void  )
protected

Definition at line 1370 of file GridForceGrid.C.

References DebugM, endi(), get_grid(), get_grid_d(), k, and set_grid().

Referenced by initialize().

1371 {
1372  // calculate derivative grids
1373  // separate loop so all V values have been set already
1374  for (int i0 = 0; i0 < k[0]; i0++) {
1375  for (int i1 = 0; i1 < k[1]; i1++) {
1376  for (int i2 = 0; i2 < k[2]; i2++) {
1377  float dx, dy, dz;
1378  if (i0 == 0 || i0 == k[0]-1 || i1 == 0 || i1 == k[1]-1 || i2 == 0 || i2 == k[2]-1) {
1379  // on edge, set ALL derivatives to zero (make up for lack of padding)
1380  dx = 0;
1381  dy = 0;
1382  dz = 0;
1383  } else {
1384  dx = 0.5 * (get_grid_d(i0+1,i1,i2,0) - get_grid_d(i0-1,i1,i2,0));
1385  dy = 0.5 * (get_grid_d(i0,i1+1,i2,0) - get_grid_d(i0,i1-1,i2,0));
1386  dz = 0.5 * (get_grid_d(i0,i1,i2+1,0) - get_grid_d(i0,i1,i2-1,0));
1387  }
1388  set_grid(i0, i1, i2, 1, dx);
1389  set_grid(i0, i1, i2, 2, dy);
1390  set_grid(i0, i1, i2, 3, dz);
1391  DebugM(1, "dx[" << i0 << "," << i1 << "," << i2 << "] = " << get_grid(i0, i1, i2, 1) << "(" << dx << ")\n" << endi);
1392  DebugM(1, "dy[" << i0 << "," << i1 << "," << i2 << "] = " << get_grid(i0, i1, i2, 2) << "(" << dy << ")\n" << endi);
1393  DebugM(1, "dz[" << i0 << "," << i1 << "," << i2 << "] = " << get_grid(i0, i1, i2, 3) << "(" << dz << ")\n" << endi);
1394  }
1395  }
1396  }
1397 }
double get_grid_d(int i0, int i1, int i2, int i3) const
#define DebugM(x, y)
Definition: Debug.h:59
float get_grid(int i0, int i1, int i2, int i3) const
void set_grid(int i0, int i1, int i2, int i3, float V)
infostream & endi(infostream &s)
Definition: InfoStream.C:38
int GridforceLiteGrid::compute_VdV ( Position  pos,
float &  V,
Vector dV 
) const
inline

Definition at line 66 of file GridForceGrid.inl.

References for(), get_inds(), inv, linear_interpolate(), Vector::x, Vector::y, and Vector::z.

67 {
68  int inds[3];
69  Vector g, dg;
70 
71  int err = get_inds(pos, inds, dg);
72  if (err) {
73  return -1;
74  }
75 
76  float wts[4][8];
77  float results[4];
78 
79  // compute_wts(wts, dg);
80  // wts[0][0] = (1-dg.x) * (1-dg.y) * (1-dg.z);
81  // wts[0][1] = (1-dg.x) * (1-dg.y) * dg.z;
82  // wts[0][2] = (1-dg.x) * dg.y * (1-dg.z);
83  // wts[0][3] = (1-dg.x) * dg.y * dg.z;
84  // wts[0][4] = dg.x * (1-dg.y) * (1-dg.z);
85  // wts[0][5] = dg.x * (1-dg.y) * dg.z;
86  // wts[0][6] = dg.x * dg.y * (1-dg.z);
87  // wts[0][7] = dg.x * dg.y * dg.z;
88 
89  int i = 1;
90  wts[i][0] = -(1-dg.y) * (1-dg.z);
91  wts[i][1] = -(1-dg.y) * dg.z;
92  wts[i][2] = - dg.y * (1-dg.z);
93  wts[i][3] = - dg.y * dg.z;
94  for (int j=0; j<4; j++) wts[i][j+4] = -wts[i][j];
95 
96  i = 2;
97  wts[i][0] = -(1-dg.x) * (1-dg.z);
98  wts[i][1] = -(1-dg.x) * dg.z;
99  wts[i][2] = -wts[i][0];
100  wts[i][3] = -wts[i][1];
101  wts[i][4] = - dg.x * (1-dg.z);
102  wts[i][5] = - dg.x * dg.z;
103  wts[i][6] = -wts[i][4];
104  wts[i][7] = -wts[i][5];
105 
106  i = 3;
107  wts[i][0] = - (1-dg.x) * (1-dg.y);
108  wts[i][1] = -wts[i][0];
109  wts[i][2] = - (1-dg.x) * dg.y ;
110  wts[i][3] = -wts[i][2];
111  wts[i][4] = - dg.x * (1-dg.y);
112  wts[i][5] = -wts[i][4];
113  wts[i][6] = - dg.x * dg.y ;
114  wts[i][7] = -wts[i][6];
115 
116  i = 0;
117  for (int j=0; j<4; j++) wts[i][j] = (1-dg.x) * wts[i+1][j+4];
118  for (int j=0; j<4; j++) wts[i][j+4] = dg.x * wts[i+1][j+4];
119 
120  for (i = 0; i < 4; i++) {
121  results[i] = linear_interpolate(inds[0], inds[1], inds[2], 0, wts[i]);
122  }
123 
124  V = results[0];
125  dV = Vector(results[1], results[2], results[3]) * inv;
126 
127  return 0;
128 }
int get_inds(Position pos, int *inds, Vector &dg) const
float linear_interpolate(int i0, int i1, int i2, int i3, const float *wts) const
Definition: Vector.h:64
BigReal z
Definition: Vector.h:66
BigReal x
Definition: Vector.h:66
BigReal y
Definition: Vector.h:66
for(int i=0;i< n1;++i)
void GridforceLiteGrid::compute_wts ( float *  wts,
const Vector dg 
) const
inlineprotected

Definition at line 400 of file GridForceGrid.inl.

References DebugM, endi(), Vector::x, Vector::y, and Vector::z.

401 {
402  wts[0] = (1-dg.x) * (1-dg.y) * (1-dg.z);
403  wts[1] = (1-dg.x) * (1-dg.y) * dg.z;
404  wts[2] = (1-dg.x) * dg.y * (1-dg.z);
405  wts[3] = (1-dg.x) * dg.y * dg.z;
406  wts[4] = dg.x * (1-dg.y) * (1-dg.z);
407  wts[5] = dg.x * (1-dg.y) * dg.z;
408  wts[6] = dg.x * dg.y * (1-dg.z);
409  wts[7] = dg.x * dg.y * dg.z;
410  DebugM(2, "dg = " << dg << "\n" << endi);
411 }
#define DebugM(x, y)
Definition: Debug.h:59
BigReal z
Definition: Vector.h:66
BigReal x
Definition: Vector.h:66
BigReal y
Definition: Vector.h:66
infostream & endi(infostream &s)
Definition: InfoStream.C:38
long int GridforceLiteGrid::get_all_gridvals ( float **  all_gridvals) const
virtual

Implements GridforceGrid.

Definition at line 1450 of file GridForceGrid.C.

References DebugM, endi(), grid, and size.

1451 {
1452  // Creates a flat array of all grid values and puts it in the
1453  // value pointed to by the 'all_gridvals' argument. Returns the
1454  // resulting array size. Caller is responsible for destroying the
1455  // array via 'delete[]'
1456 
1457  DebugM(4, "GridforceLiteGrid::get_all_gridvals called\n" << endi);
1458 
1459  long int sz = size;
1460  DebugM(4, "size = " << sz << "\n" << endi);
1461 
1462  float *grid_vals = new float[sz];
1463  long int idx = 0;
1464  for (long int i = 0; i < size; i++) {
1465  grid_vals[idx++] = grid[i];
1466  }
1467  CmiAssert(idx == sz);
1468 
1469  *all_gridvals = grid_vals;
1470 
1471  DebugM(4, "GridforceLiteGrid::get_all_gridvals finished\n" << endi);
1472 
1473  return sz;
1474 }
#define DebugM(x, y)
Definition: Debug.h:59
infostream & endi(infostream &s)
Definition: InfoStream.C:38
Position GridforceLiteGrid::get_center ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 295 of file GridForceGrid.h.

References center.

295 { return center; }
Bool GridforceLiteGrid::get_checksize ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 300 of file GridForceGrid.h.

References checksize.

300 { return checksize; }
Tensor GridforceLiteGrid::get_e ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 297 of file GridForceGrid.h.

References e.

297 { return e; }
float GridforceLiteGrid::get_grid ( int  i0,
int  i1,
int  i2,
int  i3 
) const
inline

Definition at line 307 of file GridForceGrid.h.

References grid, and grid_index().

Referenced by compute_derivative_grids(), initialize(), and linear_interpolate().

307  {
308  return grid[grid_index(i0, i1, i2, i3)];
309  }
long int grid_index(int i0, int i1, int i2, int i3) const
double GridforceLiteGrid::get_grid_d ( int  i0,
int  i1,
int  i2,
int  i3 
) const
inline

Definition at line 310 of file GridForceGrid.h.

References grid, and grid_index().

Referenced by compute_derivative_grids().

310  {
311  return double(grid[grid_index(i0, i1, i2, i3)]);
312  }
long int grid_index(int i0, int i1, int i2, int i3) const
int GridforceLiteGrid::get_inds ( Position  pos,
int *  inds,
Vector dg 
) const
inlineprotected

Definition at line 378 of file GridForceGrid.inl.

References inv, k, and origin.

Referenced by compute_VdV().

379 {
380  Vector p = pos - origin;
381  Vector g;
382 
383  g = inv * p;
384 
385  for (int i = 0; i < 3; i++) {
386  inds[i] = (int)floor(g[i]);
387  dg[i] = g[i] - inds[i];
388  }
389 
390  for (int i = 0; i < 3; i++) {
391  if (inds[i] < 0 || inds[i] >= k[i]-1) {
392  return -1; // Outside potential and grid is not continuous
393  }
394  }
395 
396  return 0;
397 }
Definition: Vector.h:64
Tensor GridforceLiteGrid::get_inv ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 298 of file GridForceGrid.h.

References inv.

298 { return inv; }
int GridforceLiteGrid::get_k0 ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 301 of file GridForceGrid.h.

References k.

301 { return k[0]; }
int GridforceLiteGrid::get_k1 ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 302 of file GridForceGrid.h.

References k.

302 { return k[1]; }
int GridforceLiteGrid::get_k2 ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 303 of file GridForceGrid.h.

References k.

303 { return k[2]; }
Position GridforceLiteGrid::get_origin ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 296 of file GridForceGrid.h.

References origin.

296 { return origin; }
Vector GridforceLiteGrid::get_scale ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 299 of file GridForceGrid.h.

References scale.

299 { return scale; }
int GridforceLiteGrid::get_total_grids ( void  ) const
inlinevirtual

Implements GridforceGrid.

Definition at line 304 of file GridForceGrid.h.

304 { return 1; }
long int GridforceLiteGrid::grid_index ( int  i0,
int  i1,
int  i2,
int  i3 
) const
inlineprotected

Definition at line 331 of file GridForceGrid.h.

References dk.

Referenced by get_grid(), get_grid_d(), and set_grid().

331  {
332  // 'i3' is an index for the grid itself (0=V, 1=dV/dx, 2=dV/dy, 3=dV/dz)
333  register int inds[4] = {i0, i1, i2, i3};
334  return inds[0]*dk[0] + inds[1]*dk[1] + inds[2]*dk[2] + inds[3]*dk[3];
335  }
void GridforceLiteGrid::initialize ( char *  potfilename,
SimParameters simParams,
MGridforceParams mgridParams 
)
virtual

Implements GridforceGrid.

Definition at line 1320 of file GridForceGrid.C.

References center, compute_derivative_grids(), DebugM, dk, e, endi(), filename, GridforceFullMainGrid::get_center(), GridforceFullMainGrid::get_e(), GridforceFullBaseGrid::get_grid(), get_grid(), GridforceFullMainGrid::get_inv(), GridforceFullMainGrid::get_k0(), GridforceFullMainGrid::get_k1(), GridforceFullMainGrid::get_k2(), GridforceFullMainGrid::get_origin(), GridforceFullMainGrid::get_scale(), GridforceFullMainGrid::get_total_grids(), grid, GridforceFullMainGrid::initialize(), inv, k, GridforceGrid::mygridnum, NAMD_die(), origin, scale, set_grid(), and size.

Referenced by reinitialize().

1321 {
1322  // cheat and use GridforceFullMainGrid to read the file
1324  tmp_grid->initialize(potfilename, simParams, mgridParams, 1);
1325 
1326  if (tmp_grid->get_total_grids() != 1) {
1327  NAMD_die("Cannot use gridforcelite option with multi-resolution grid!");
1328  }
1329 
1330  // save file name so that grid can be re-read via Tcl
1331  strcpy(filename, potfilename);
1332 
1333  // copy parameters
1334  k[0] = tmp_grid->get_k0();
1335  k[1] = tmp_grid->get_k1();
1336  k[2] = tmp_grid->get_k2();
1337  k[3] = 4; // for V, dV/dx, dV/dy, dV/dz grids
1338  origin = tmp_grid->get_origin();
1339  center = tmp_grid->get_center();
1340  e = tmp_grid->get_e();
1341  inv = tmp_grid->get_inv();
1342  scale = tmp_grid->get_scale();
1343 
1344  // calculate rest of parameters
1345  size = k[0] * k[1] * k[2] * k[3];
1346  dk[0] = k[1] * k[2] * k[3];
1347  dk[1] = k[2] * k[3];
1348  dk[2] = k[3];
1349  dk[3] = 1;
1350 
1351  // copy the potential grid
1352  delete[] grid;
1353  grid = new float[size];
1354  for (int i0 = 0; i0 < k[0]; i0++) {
1355  for (int i1 = 0; i1 < k[1]; i1++) {
1356  for (int i2 = 0; i2 < k[2]; i2++) {
1357  float V = tmp_grid->get_grid(i0, i1, i2);
1358  set_grid(i0, i1, i2, 0, V);
1359  DebugM(1, "V[" << i0 << "," << i1 << "," << i2 << "] = " << get_grid(i0, i1, i2, 0) << "(" << V << ")\n" << endi);
1360  }
1361  }
1362  }
1363 
1364  delete tmp_grid;
1365 
1367 }
float get_grid(int i0, int i1, int i2) const
void initialize(char *potfilename, SimParameters *simParams, MGridforceParams *mgridParams, int border)
#define DebugM(x, y)
Definition: Debug.h:59
Tensor get_e(void) const
int get_k1(void) const
int get_k0(void) const
float get_grid(int i0, int i1, int i2, int i3) const
void compute_derivative_grids(void)
void set_grid(int i0, int i1, int i2, int i3, float V)
void NAMD_die(const char *err_msg)
Definition: common.C:83
int get_k2(void) const
Position get_origin(void) const
char filename[NAMD_FILENAME_BUFFER_SIZE]
int get_total_grids(void) const
Tensor get_inv(void) const
Vector get_scale(void) const
infostream & endi(infostream &s)
Definition: InfoStream.C:38
Position get_center(void) const
float GridforceLiteGrid::linear_interpolate ( int  i0,
int  i1,
int  i2,
int  i3,
const float *  wts 
) const
inlineprotected

Definition at line 414 of file GridForceGrid.inl.

References DebugM, endi(), and get_grid().

Referenced by compute_VdV().

415 {
416 #ifdef DEBUGM
417  float vals[8];
418  vals[0] = get_grid(i0, i1, i2, i3);
419  vals[1] = get_grid(i0, i1, i2+1, i3);
420  vals[2] = get_grid(i0, i1+1, i2, i3);
421  vals[3] = get_grid(i0, i1+1, i2+1, i3);
422  vals[4] = get_grid(i0+1, i1, i2, i3);
423  vals[5] = get_grid(i0+1, i1, i2+1, i3);
424  vals[6] = get_grid(i0+1, i1+1, i2, i3);
425  vals[7] = get_grid(i0+1, i1+1, i2+1, i3);
426 
427  switch (i3) {
428  case 0:
429  DebugM(2, "V\n" << endi);
430  break;
431  case 1:
432  DebugM(2, "dV/dx\n" << endi);
433  break;
434  case 2:
435  DebugM(2, "dV/dy\n" << endi);
436  break;
437  case 3:
438  DebugM(2, "dV/dz\n" << endi);
439  break;
440  }
441 
442  for (int i = 0; i < 8; i++) {
443  DebugM(2, "vals[" << i << "] = " << vals[i] << " wts[" << i << "] = " << wts[i] << "\n" << endi);
444  }
445 #endif
446 
447  float result =
448  wts[0] * get_grid(i0, i1, i2, i3) +
449  wts[1] * get_grid(i0, i1, i2+1, i3) +
450  wts[2] * get_grid(i0, i1+1, i2, i3) +
451  wts[3] * get_grid(i0, i1+1, i2+1, i3) +
452  wts[4] * get_grid(i0+1, i1, i2, i3) +
453  wts[5] * get_grid(i0+1, i1, i2+1, i3) +
454  wts[6] * get_grid(i0+1, i1+1, i2, i3) +
455  wts[7] * get_grid(i0+1, i1+1, i2+1, i3);
456 
457  DebugM(2, "result = " << result << "\n" << endi);
458 
459  return result;
460 }
#define DebugM(x, y)
Definition: Debug.h:59
float get_grid(int i0, int i1, int i2, int i3) const
infostream & endi(infostream &s)
Definition: InfoStream.C:38
void GridforceLiteGrid::pack ( MOStream msg) const
protectedvirtual

Implements GridforceGrid.

Definition at line 1406 of file GridForceGrid.C.

References center, checksize, dk, e, filename, grid, inv, k, origin, MOStream::put(), scale, and size.

1407 {
1408  msg->put(4*sizeof(int), (char*)k);
1409  msg->put(size);
1410  msg->put(4*sizeof(long int), (char*)dk);
1411 
1412  msg->put(sizeof(Vector), (char*)&origin);
1413  msg->put(sizeof(Vector), (char*)&center);
1414  msg->put(sizeof(Tensor), (char*)&e);
1415  msg->put(sizeof(Tensor), (char*)&inv);
1416  msg->put(sizeof(Vector), (char*)&scale);
1417  msg->put(sizeof(Bool), (char*)&checksize);
1418 
1419  msg->put(129*sizeof(char), (char*)filename);
1420 
1421  msg->put(size*sizeof(float), (char*)grid);
1422 }
Definition: Vector.h:64
int Bool
Definition: common.h:133
char filename[NAMD_FILENAME_BUFFER_SIZE]
Definition: Tensor.h:15
MOStream * put(char data)
Definition: MStream.h:112
void GridforceLiteGrid::reinitialize ( SimParameters simParams,
MGridforceParams mgridParams 
)
virtual

Implements GridforceGrid.

Definition at line 1400 of file GridForceGrid.C.

References filename, and initialize().

1401 {
1402  initialize(filename, simParams, mgridParams);
1403 }
char filename[NAMD_FILENAME_BUFFER_SIZE]
void initialize(char *potfilename, SimParameters *simParams, MGridforceParams *mgridParams)
void GridforceLiteGrid::set_all_gridvals ( float *  all_gridvals,
long int  sz 
)
virtual

Implements GridforceGrid.

Definition at line 1477 of file GridForceGrid.C.

References DebugM, endi(), grid, and size.

1478 {
1479  DebugM(4, "GridforceLiteGrid::set_all_gridvals called\n" << endi);
1480 
1481  long int sz_calc = size;
1482  CmiAssert(sz == sz_calc);
1483 
1484  long int idx = 0;
1485  for (long int i = 0; i < size; i++) {
1486  grid[i] = all_gridvals[idx++];
1487  }
1488  CmiAssert(idx == sz);
1489 
1490  //compute_derivative_grids(); // not needed if we're sending all 4 grids
1491 
1492  DebugM(4, "GridforceLiteGrid::set_all_gridvals finished\n" << endi);
1493 }
#define DebugM(x, y)
Definition: Debug.h:59
infostream & endi(infostream &s)
Definition: InfoStream.C:38
void GridforceLiteGrid::set_grid ( int  i0,
int  i1,
int  i2,
int  i3,
float  V 
)
inline

Definition at line 313 of file GridForceGrid.h.

References grid, and grid_index().

Referenced by compute_derivative_grids(), and initialize().

313  {
314  grid[grid_index(i0, i1, i2, i3)] = V;
315  }
long int grid_index(int i0, int i1, int i2, int i3) const
void GridforceLiteGrid::set_scale ( Vector  s)
inlinevirtual

Implements GridforceGrid.

Definition at line 305 of file GridForceGrid.h.

References scale.

305 { scale = s; }
void GridforceLiteGrid::unpack ( MIStream msg)
protectedvirtual

Implements GridforceGrid.

Definition at line 1425 of file GridForceGrid.C.

References center, checksize, dk, e, filename, MIStream::get(), grid, inv, k, origin, scale, and size.

1426 {
1427  delete[] grid;
1428  grid = NULL;
1429 
1430  msg->get(4*sizeof(int), (char*)k);
1431  msg->get(size);
1432  msg->get(4*sizeof(long int), (char*)dk);
1433 
1434  msg->get(sizeof(Vector), (char*)&origin);
1435  msg->get(sizeof(Vector), (char*)&center);
1436  msg->get(sizeof(Tensor), (char*)&e);
1437  msg->get(sizeof(Tensor), (char*)&inv);
1438  msg->get(sizeof(Vector), (char*)&scale);
1439  msg->get(sizeof(Bool), (char*)&checksize);
1440 
1441  msg->get(129*sizeof(char), (char*)filename);
1442 
1443  if (size) {
1444  grid = new float[size];
1445  msg->get(size*sizeof(float), (char*)grid);
1446  }
1447 }
Definition: Vector.h:64
MIStream * get(char &data)
Definition: MStream.h:29
int Bool
Definition: common.h:133
char filename[NAMD_FILENAME_BUFFER_SIZE]
Definition: Tensor.h:15

Member Data Documentation

Position GridforceLiteGrid::center
protected

Definition at line 344 of file GridForceGrid.h.

Referenced by get_center(), initialize(), pack(), and unpack().

Bool GridforceLiteGrid::checksize
protected

Definition at line 349 of file GridForceGrid.h.

Referenced by get_checksize(), pack(), and unpack().

long int GridforceLiteGrid::dk[4]
protected

Definition at line 341 of file GridForceGrid.h.

Referenced by grid_index(), initialize(), pack(), and unpack().

Tensor GridforceLiteGrid::e
protected

Definition at line 345 of file GridForceGrid.h.

Referenced by get_e(), initialize(), pack(), and unpack().

char GridforceLiteGrid::filename[NAMD_FILENAME_BUFFER_SIZE]
protected

Definition at line 351 of file GridForceGrid.h.

Referenced by initialize(), pack(), reinitialize(), and unpack().

float* GridforceLiteGrid::grid
protected
Tensor GridforceLiteGrid::inv
protected

Definition at line 346 of file GridForceGrid.h.

Referenced by compute_VdV(), get_inds(), get_inv(), initialize(), pack(), and unpack().

int GridforceLiteGrid::k[4]
protected
Position GridforceLiteGrid::origin
protected

Definition at line 343 of file GridForceGrid.h.

Referenced by get_inds(), get_origin(), initialize(), pack(), and unpack().

Vector GridforceLiteGrid::scale
protected

Definition at line 348 of file GridForceGrid.h.

Referenced by get_scale(), initialize(), pack(), set_scale(), and unpack().

long int GridforceLiteGrid::size
protected

Definition at line 340 of file GridForceGrid.h.

Referenced by get_all_gridvals(), initialize(), pack(), set_all_gridvals(), and unpack().


The documentation for this class was generated from the following files: