#include <GridForceGrid.h>
Inheritance diagram for GridforceGrid:

Public Types | |
| enum | GridforceGridType { GridforceGridTypeUndefined = 0, GridforceGridTypeFull, GridforceGridTypeLite } |
Public Member Functions | |
| virtual void | initialize (char *potfilename, SimParameters *simParams, MGridforceParams *mgridParams)=0 |
| virtual void | reinitialize (SimParameters *simParams, MGridforceParams *mgridParams)=0 |
| virtual Position | get_center (void) const =0 |
| virtual Position | get_origin (void) const =0 |
| virtual Tensor | get_e (void) const =0 |
| virtual Tensor | get_inv (void) const =0 |
| virtual Vector | get_scale (void) const =0 |
| virtual int | get_k0 (void) const =0 |
| virtual int | get_k1 (void) const =0 |
| virtual int | get_k2 (void) const =0 |
| virtual int | get_total_grids (void) const =0 |
| virtual int | get_all_gridvals (float **all_gridvals) const =0 |
| virtual void | set_all_gridvals (float *all_gridvals, int sz)=0 |
| 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) |
Static Public Member Functions | |
| GridforceGrid * | new_grid (int gridnum, char *potfilename, SimParameters *simParams, MGridforceParams *mgridParams) |
| void | pack_grid (GridforceGrid *grid, MOStream *msg) |
| GridforceGrid * | unpack_grid (int gridnum, MIStream *msg) |
Protected Member Functions | |
| virtual void | pack (MOStream *msg) const =0 |
| virtual void | unpack (MIStream *msg)=0 |
| Position | get_corner (int idx) |
Protected Attributes | |
| GridforceGridType | type |
| int | mygridnum |
|
|
Definition at line 56 of file GridForceGrid.h. 00056 {
00057 GridforceGridTypeUndefined = 0,
00058 GridforceGridTypeFull,
00059 GridforceGridTypeLite
00060 } GridforceGridType;
|
|
||||||||||||||||
|
Reimplemented in GridforceFullMainGrid, and GridforceLiteGrid. Definition at line 51 of file GridForceGrid.h. References Position. 00051 { return -1; }
|
|
|
Definition at line 82 of file GridForceGrid.C. References DebugM, endi(), get_center(), get_corner(), Position, and wrap_position(). Referenced by ComputeGridForce::doForce(), and GridforceFullMainGrid::initialize(). 00083 {
00084 // Idea: Go through each grid corner and wrap it to the grid center;
00085 // if the position moves, then the grid is too big and we return false
00086 DebugM(4, "Checking whether grid fits periodic cell\n");
00087 Position center = get_center();
00088 for (int i = 0; i < 8; i++) {
00089 Position pos = get_corner(i);
00090 Position pos_wrapped = wrap_position(pos, lattice);
00091 if ((pos - pos_wrapped).length() > 1.) {
00092 DebugM(5, "(" << pos << ") != (" << pos_wrapped << ")\n" << endi);
00093 return false;
00094 }
00095 }
00096 return true;
00097 }
|
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. |
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by ComputeGridForce::doForce(), fits_lattice(), and wrap_position(). |
|
|
Definition at line 99 of file GridForceGrid.C. References DebugM, endi(), get_e(), get_k0(), get_k1(), get_k2(), get_origin(), and Position. Referenced by fits_lattice(). 00100 {
00101 // idx -> (x,y,z) (cell basis coordinates)
00102 // 0 -> (0,0,0)
00103 // 1 -> (1,0,0)
00104 // 2 -> (0,1,0)
00105 // 3 -> (1,1,0)
00106 // 4 -> (0,0,1)
00107 // 5 -> (1,0,1)
00108 // 6 -> (0,1,1)
00109 // 7 -> (1,1,1)
00110 Position pos;
00111 if (idx >= 8 || idx < 0) {
00112 // invalid index
00113 pos = Vector(); // default value of Vector() is strange enough to be a decent "undefined" value (-99999, -99999, -999999)
00114 } else if (corners[idx] != Vector()) {
00115 // use cached value if possible
00116 pos = corners[idx];
00117 } else {
00118 // must calculate
00119 Tensor e = get_e();
00120 pos = get_origin();
00121 if (idx & (1 << 0)) pos += e * Vector(get_k0()-1, 0, 0);
00122 if (idx & (1 << 1)) pos += e * Vector(0, get_k1()-1, 0);
00123 if (idx & (1 << 2)) pos += e * Vector(0, 0, get_k2()-1);
00124 corners[idx] = pos; // cache for future use
00125 DebugM(4, "corner " << idx << " = " << pos << "\n" << endi);
00126 }
00127 return pos;
00128 }
|
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by ComputeGridForce::doForce(), and get_corner(). |
|
|
Definition at line 62 of file GridForceGrid.h. Referenced by ComputeGridForce::doForce(), and pack_grid(). 00062 { return type; }
|
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. |
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by get_corner(). |
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by get_corner(). |
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by get_corner(). |
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by get_corner(). |
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. |
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by Molecule::build_gridforce_params(), and Molecule::receive_Molecule(). |
|
||||||||||||||||
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by new_grid(). |
|
||||||||||||||||||||
|
Definition at line 34 of file GridForceGrid.C. References MGridforceParams::gridforceLite, initialize(), and simParams. Referenced by Molecule::build_gridforce_params(). 00035 {
00036 GridforceGrid *grid = NULL;
00037 if (mgridParams->gridforceLite) {
00038 grid = new GridforceLiteGrid(gridnum);
00039 } else {
00040 grid = new GridforceFullMainGrid(gridnum);
00041 }
00042
00043 grid->initialize(potfilename, simParams, mgridParams);
00044
00045 return grid;
00046 }
|
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by pack_grid(). |
|
||||||||||||
|
Definition at line 48 of file GridForceGrid.C. References get_grid_type(), pack(), and MOStream::put(). Referenced by Node::reloadGridforceGrid(), and Molecule::send_Molecule(). 00049 {
00050 // Abstract interface for packing a grid into a message. This
00051 // could easily be a non-static function as it was before, but is
00052 // static to make it similar to unpack_grid below, which does need
00053 // to be static since it creates a GridforceGrid object.
00054 msg->put(grid->get_grid_type());
00055 grid->pack(msg);
00056 }
|
|
||||||||||||
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by Node::reloadGridforceGrid(). |
|
||||||||||||
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. |
|
|
Implemented in GridforceFullMainGrid, and GridforceLiteGrid. Referenced by unpack_grid(). |
|
||||||||||||
|
Definition at line 58 of file GridForceGrid.C. References MIStream::get(), GridforceGridTypeFull, GridforceGridTypeLite, NAMD_bug(), and unpack(). Referenced by Molecule::receive_Molecule(), and Node::reloadGridforceGrid(). 00059 {
00060 // Abstract interface for unpacking a grid from a message.
00061 GridforceGrid *grid = NULL;
00062 int type;
00063
00064 msg->get(type);
00065
00066 switch (type) {
00067 case GridforceGridTypeFull:
00068 grid = new GridforceFullMainGrid(gridnum);
00069 break;
00070 case GridforceGridTypeLite:
00071 grid = new GridforceLiteGrid(gridnum);
00072 break;
00073 default:
00074 NAMD_bug("GridforceGrid::unpack_grid called with unknown grid type!");
00075 }
00076
00077 grid->unpack(msg);
00078
00079 return grid;
00080 }
|
|
||||||||||||
|
Definition at line 423 of file GridForceGrid.inl. References get_center(), Lattice::origin(), Position, and Lattice::wrap_delta(). Referenced by fits_lattice(). 00424 {
00425 // Wrap 'pos' about grid center, using periodic cell information in 'lattice'
00426 // Position pos_wrapped = pos;
00427 // Position center = get_center();
00428 // pos_wrapped += lattice.wrap_delta(pos);
00429 // pos_wrapped += lattice.delta(pos_wrapped, center) - (pos_wrapped - center);
00430
00431 Position pos_wrapped = pos + lattice.wrap_delta(pos - get_center() + lattice.origin());
00432
00433 return pos_wrapped;
00434 }
|
|
|
Definition at line 71 of file GridForceGrid.h. |
|
|
Definition at line 70 of file GridForceGrid.h. |
1.3.9.1