GridforceFullSubGrid Class Reference

#include <GridForceGrid.h>

Inheritance diagram for GridforceFullSubGrid:
GridforceFullBaseGrid

List of all members.

Public Member Functions

 GridforceFullSubGrid (GridforceFullBaseGrid *parent_in)
void initialize (SimParameters *simParams, MGridforceParams *mgridParams)
int get_border (void) const
Tensor tensorMult (const Tensor &t1, const Tensor &t2)

Protected Member Functions

void pack (MOStream *msg) const
void unpack (MIStream *msg)
void compute_b (float *b, int *inds, Vector gapscale) const
void addToSubgridsFlat (void)

Protected Attributes

Tensor scale_dV
Tensor scale_d2V
float scale_d3V
GridforceFullBaseGridparent
int pmin [3]
int pmax [3]
GridforceFullMainGridmaingrid
int subgridIdx

Friends

class GridforceFullBaseGrid
class GridforceFullMainGrid

Detailed Description

Definition at line 242 of file GridForceGrid.h.


Constructor & Destructor Documentation

GridforceFullSubGrid::GridforceFullSubGrid ( GridforceFullBaseGrid parent_in  ) 

Definition at line 901 of file GridForceGrid.C.

References DebugM, endi(), GridforceFullBaseGrid::generation, maingrid, parent, and GridforceFullBaseGrid::poten_fp.

00901                                                                            {
00902     parent = parent_in;
00903     poten_fp = parent->poten_fp;
00904     generation = parent->generation + 1;
00905     GridforceFullBaseGrid *tmp = parent;
00906     while (tmp->generation > 0) {
00907         tmp = ((GridforceFullSubGrid *)tmp)->parent;
00908     }
00909     maingrid = (GridforceFullMainGrid *)tmp;
00910     DebugM(4, "generation = " << generation << "\n" << endi);
00911 }


Member Function Documentation

void GridforceFullSubGrid::addToSubgridsFlat ( void   )  [protected]

Definition at line 1151 of file GridForceGrid.C.

References addToSubgridsFlat(), DebugM, endi(), maingrid, GridforceFullBaseGrid::numSubgrids, subgridIdx, GridforceFullBaseGrid::subgrids, and GridforceFullMainGrid::subgrids_flat.

Referenced by addToSubgridsFlat(), and GridforceFullMainGrid::buildSubgridsFlat().

01152 {
01153     DebugM(4, "addToSubgridsFlat() called, subgridIdx = " << subgridIdx << ", maingrid->numSubgrids = " << maingrid->numSubgrids << "\n" << endi);
01154     maingrid->subgrids_flat[subgridIdx-1] = this;
01155     for (int i = 0; i < numSubgrids; i++) {
01156         subgrids[i]->addToSubgridsFlat();
01157     }
01158 }

void GridforceFullSubGrid::compute_b ( float *  b,
int *  inds,
Vector  gapscale 
) const [protected, virtual]

Implements GridforceFullBaseGrid.

Definition at line 1161 of file GridForceGrid.C.

References GridforceFullBaseGrid::compute_a(), GridforceFullBaseGrid::compute_b(), GridforceFullBaseGrid::compute_d2V(), GridforceFullBaseGrid::compute_d3V(), GridforceFullBaseGrid::compute_dV(), GridforceFullBaseGrid::compute_V(), GridforceFullBaseGrid::cont, DebugM, GridforceFullBaseGrid::e, endi(), GridforceFullBaseGrid::gap, GridforceFullBaseGrid::get_grid(), GridforceFullBaseGrid::get_grid_d(), GridforceFullBaseGrid::inv, j, GridforceFullBaseGrid::k, GridforceFullBaseGrid::offset, GridforceFullBaseGrid::origin, parent, scale_d2V, scale_d3V, scale_dV, Vector::x, Vector::y, and Vector::z.

01162 {
01163     for (int i0 = 0; i0 < 8; i0++) {
01164         int inds2[3];
01165         
01166         float voff = 0.0;
01167         int bit = 1;    // bit = 2^i1 in the below loop
01168         for (int i1 = 0; i1 < 3; i1++) {
01169             inds2[i1] = (inds[i1] + ((i0 & bit) ? 1 : 0)) % k[i1];
01170             
01171             // Deal with voltage offsets
01172             if (cont[i1] && inds[i1] == (k[i1]-1) && inds2[i1] == 0) {
01173                 voff += offset[i1];
01174                 DebugM(3, "offset[" << i1 << "] = " << offset[i1] << "\n" << endi);
01175             }
01176             
01177             bit <<= 1;  // i.e. multiply by 2
01178         }
01179         
01180         DebugM(3, "inds2 = " << inds2[0] << " " << inds2[1] << " " << inds2[2] << "\n" << endi);
01181         
01182         int d_hi[3] = {1, 1, 1}; 
01183         int d_lo[3] = {1, 1, 1};
01184         float voffs[3];
01185         float dscales[3] = {0.5, 0.5, 0.5};
01186         for (int i1 = 0; i1 < 3; i1++) {
01187             if (inds2[i1] == 0 && cont[i1]) {
01188                 d_lo[i1] = -(k[i1]-1);
01189                 voffs[i1] = offset[i1];
01190                 dscales[i1] = 1.0/(1.0 + gap[i1]) * 1.0/gapscale[i1];
01191             }
01192             else if (inds2[i1] == k[i1]-1 && cont[i1]) {
01193                 d_hi[i1] = -(k[i1]-1);
01194                 voffs[i1] = offset[i1];
01195                 dscales[i1] = 1.0/(1.0 + gap[i1]) * 1.0/gapscale[i1];
01196             }
01197             else {
01198                 voffs[i1] = 0.0;
01199             }
01200         }
01201         
01202         bool edge = false;
01203         for (int i1 = 0; i1 < 3; i1++) {
01204             if (!cont[i1] && (inds2[i1] == 0 || inds2[i1] == k[i1]-1)) {
01205                 edge = true;
01206             }
01207         }
01208         
01209         if (inds2[2] == 0) {
01210 //          DebugM(3, "cont = " << cont[0] << " " << cont[1] << " " << cont[2] << " d_hi = " << d_hi[0] << " " << d_hi[1] << " " << d_hi[2] << " d_lo = " << d_lo[0] << " " << d_lo[1] << " " << d_lo[2] << " dscales = " << dscales[0] << " " << dscales[1] << " " << dscales[2] << "\n" << endi);
01211             DebugM(3, "cont = " << cont[0] << " " << cont[1] << " " << cont[2] << "\n" << endi);
01212         }
01213         
01214         if (edge) {
01215             DebugM(2, "Edge!\n" << endi);
01216             
01217             // Must get derivatives from parent
01218             Position pos = e * Vector(inds2[0], inds2[1], inds2[2]) + origin;   // Gridpoint position in realspace
01219             Vector g = parent->inv * (pos - parent->origin);    // Gridpoint position in parent's gridspace
01220             Vector dg;
01221             int inds3[3];
01222             
01223             DebugM(2, "g = " << g << "\n" << endi);
01224             
01225             for (int i = 0; i < 3; i++) {
01226                 inds3[i] = (int)floor(g[i]);
01227                 dg[i] = g[i] - inds3[i];
01228             }
01229     
01230             float x[4], y[4], z[4];
01231             x[0] = 1; y[0] = 1; z[0] = 1;
01232             for (int j = 1; j < 4; j++) {
01233                 x[j] = x[j-1] * dg.x;
01234                 y[j] = y[j-1] * dg.y;
01235                 z[j] = z[j-1] * dg.z;
01236                 DebugM(1, "x[" << j << "] = " << x[j] << "\n");
01237                 DebugM(1, "y[" << j << "] = " << y[j] << "\n");
01238                 DebugM(1, "z[" << j << "] = " << z[j] << "\n" << endi);
01239             }
01240             
01241             // Compute parent matrices
01242             float b_parent[64];
01243             parent->compute_b(b_parent, inds3, gapscale);
01244             
01245             float a_parent[64];
01246             parent->compute_a(a_parent, b_parent);
01247             
01248             // Compute parent derivatives
01249             float V = parent->compute_V(a_parent, x, y, z);
01250             Vector dV = scale_dV * parent->compute_dV(a_parent, x, y, z);
01251             Vector d2V = scale_d2V * parent->compute_d2V(a_parent, x, y, z);
01252             float d3V = scale_d3V * parent->compute_d3V(a_parent, x, y, z);
01253             
01254             b[i0] = V;
01255             b[8+i0] = dV[0];
01256             b[16+i0] = dV[1];
01257             b[24+i0] = dV[2];
01258             b[32+i0] = d2V[0];
01259             b[40+i0] = d2V[1];
01260             b[48+i0] = d2V[2];
01261             b[56+i0] = d3V;
01262         } else {
01263             b[i0] = get_grid(inds2[0],inds2[1],inds2[2]) + voff;        // V
01264             
01265             b[8+i0]  = dscales[0] * (get_grid_d(inds2[0]+d_hi[0],inds2[1],inds2[2]) - get_grid_d(inds2[0]-d_lo[0],inds2[1],inds2[2]) + voffs[0]);       //  dV/dx
01266             b[16+i0] = dscales[1] * (get_grid_d(inds2[0],inds2[1]+d_hi[1],inds2[2]) - get_grid_d(inds2[0],inds2[1]-d_lo[1],inds2[2]) + voffs[1]);       //  dV/dy
01267             b[24+i0] = dscales[2] * (get_grid_d(inds2[0],inds2[1],inds2[2]+d_hi[2]) - get_grid_d(inds2[0],inds2[1],inds2[2]-d_lo[2]) + voffs[2]);       //  dV/dz
01268             b[32+i0] = dscales[0] * dscales[1]
01269                 * (get_grid_d(inds2[0]+d_hi[0],inds2[1]+d_hi[1],inds2[2]) - get_grid_d(inds2[0]-d_lo[0],inds2[1]+d_hi[1],inds2[2]) -
01270                    get_grid_d(inds2[0]+d_hi[0],inds2[1]-d_lo[1],inds2[2]) + get_grid_d(inds2[0]-d_lo[0],inds2[1]-d_lo[1],inds2[2]));    //  d2V/dxdy
01271             b[40+i0] = dscales[0] * dscales[2]
01272                 * (get_grid_d(inds2[0]+d_hi[0],inds2[1],inds2[2]+d_hi[2]) - get_grid_d(inds2[0]-d_lo[0],inds2[1],inds2[2]+d_hi[2]) -
01273                    get_grid_d(inds2[0]+d_hi[0],inds2[1],inds2[2]-d_lo[2]) + get_grid_d(inds2[0]-d_lo[0],inds2[1],inds2[2]-d_lo[2]));    //  d2V/dxdz
01274             b[48+i0] = dscales[1] * dscales[2]
01275                 * (get_grid_d(inds2[0],inds2[1]+d_hi[1],inds2[2]+d_hi[2]) - get_grid_d(inds2[0],inds2[1]-d_lo[1],inds2[2]+d_hi[2]) -
01276                    get_grid_d(inds2[0],inds2[1]+d_hi[1],inds2[2]-d_lo[2]) + get_grid_d(inds2[0],inds2[1]-d_lo[1],inds2[2]-d_lo[2]));    //  d2V/dydz
01277         
01278             b[56+i0] = dscales[0] * dscales[1] * dscales[2]                                     // d3V/dxdydz
01279                 * (get_grid_d(inds2[0]+d_hi[0],inds2[1]+d_hi[1],inds2[2]+d_hi[2]) - get_grid_d(inds2[0]+d_hi[0],inds2[1]+d_hi[1],inds2[2]-d_lo[2]) -
01280                    get_grid_d(inds2[0]+d_hi[0],inds2[1]-d_lo[1],inds2[2]+d_hi[2]) - get_grid_d(inds2[0]-d_lo[0],inds2[1]+d_hi[1],inds2[2]+d_hi[2]) +
01281                    get_grid_d(inds2[0]+d_hi[0],inds2[1]-d_lo[1],inds2[2]-d_lo[2]) + get_grid_d(inds2[0]-d_lo[0],inds2[1]+d_hi[1],inds2[2]-d_lo[2]) +
01282                    get_grid_d(inds2[0]-d_lo[0],inds2[1]-d_lo[1],inds2[2]+d_hi[2]) - get_grid_d(inds2[0]-d_lo[0],inds2[1]-d_lo[1],inds2[2]-d_lo[2]));
01283         }
01284         
01285         if (inds2[0] == 1 && inds2[1] == 1 && inds2[2] == 0) {
01286             DebugM(1, "Sub V = " << b[i0] << "\n");
01287         
01288             DebugM(1, "Sub dV/dx = " << b[8+i0] << "\n");
01289             DebugM(1, "Sub dV/dy = " << b[16+i0] << "\n");
01290             DebugM(1, "Sub dV/dz = " << b[24+i0] << "\n");
01291         
01292             DebugM(1, "Sub d2V/dxdy = " << b[32+i0] << "\n");
01293             DebugM(1, "Sub d2V/dxdz = " << b[40+i0] << "\n");
01294             DebugM(1, "Sub d2V/dydz = " << b[48+i0] << "\n");
01295         
01296             DebugM(1, "Sub d3V/dxdydz = " << b[56+i0] << "\n" << endi);
01297         }
01298     }
01299 }

int GridforceFullSubGrid::get_border ( void   )  const [inline, virtual]

Implements GridforceFullBaseGrid.

Definition at line 251 of file GridForceGrid.h.

00251 { return 0; }

void GridforceFullSubGrid::initialize ( SimParameters simParams,
MGridforceParams mgridParams 
)

Definition at line 914 of file GridForceGrid.C.

References GridforceFullBaseGrid::center, GridforceFullBaseGrid::checksize, GridforceFullBaseGrid::cont, DebugM, Tensor::diagonal(), GridforceFullBaseGrid::dk, GridforceFullBaseGrid::e, endi(), GridforceFullBaseGrid::factor, FALSE, GridforceFullBaseGrid::gap, GridforceFullBaseGrid::gapinv, GridforceFullBaseGrid::generation, GridforceFullBaseGrid::get_border(), GridforceFullBaseGrid::get_grid(), GridforceFullBaseGrid::grid, MGridforceParams::gridforceCheckSize, MGridforceParams::gridforceScale, MGridforceParams::gridforceVolts, initialize(), GridforceFullBaseGrid::inv, iout, GridforceFullBaseGrid::k, GridforceFullBaseGrid::k_nopad, NAMD_die(), GridforceFullBaseGrid::numSubgrids, GridforceFullBaseGrid::offset, GridforceFullBaseGrid::origin, parent, pmax, pmin, GridforceFullBaseGrid::poten_fp, GridforceFullBaseGrid::readHeader(), GridforceFullBaseGrid::scale, scale_d2V, scale_d3V, scale_dV, GridforceFullBaseGrid::set_grid(), GridforceFullBaseGrid::size, GridforceFullBaseGrid::size_nopad, GridforceFullBaseGrid::subgrids, tensorMult(), TRUE, Vector::x, Tensor::xx, Tensor::xy, Tensor::xz, Vector::y, Tensor::yx, Tensor::yy, Tensor::yz, Vector::z, Tensor::zx, Tensor::zy, and Tensor::zz.

Referenced by initialize(), and GridforceFullMainGrid::initialize().

00915 {
00916     int tmp;
00917     char line[256];
00918     long int poten_offset;
00919     
00920     // Skip 'attribute's
00921     DebugM(3, "Skipping 'attribute' keywords...\n" << endi);
00922     char str[256];
00923     do {
00924         poten_offset = ftell(poten_fp);
00925         fscanf(poten_fp, "%s", str);
00926         fgets(line, 256, poten_fp);
00927         DebugM(4, "Read line " << str << " " << line << endi);
00928     } while (strcmp(str, "attribute") == 0);
00929     fseek(poten_fp, poten_offset, SEEK_SET);
00930     
00931     // Skip 'field' object
00932     DebugM(3, "Skipping 'field' object\n" << endi);
00933     fscanf(poten_fp, "object");
00934     int n;
00935     n = fscanf(poten_fp, "\"%[^\"]\" class field\n", str);
00936     if (n == 0) {
00937         n = fscanf(poten_fp, "%d class field\n", &tmp);
00938     }
00939     
00940     if (n == 0) {
00941         NAMD_die("Error reading gridforce grid! Could not find field object!\n");
00942     }
00943     
00944     // Skip 'component's
00945     DebugM(3, "Skipping 'component' keywords\n" << endi);
00946     do {
00947         poten_offset = ftell(poten_fp);
00948         fscanf(poten_fp, "%s", str);
00949         fgets(line, 256, poten_fp);
00950     } while (strcmp(str, "component") == 0);
00951     fseek(poten_fp, poten_offset, SEEK_SET);
00952     
00953     // Read header
00954     readHeader(simParams, mgridParams);
00955     
00956     factor = 1.0;
00957     if (mgridParams->gridforceVolts)
00958     {
00959         factor /= 0.0434;  // convert V -> kcal/mol*e
00960     }
00961     scale = mgridParams->gridforceScale;
00962     checksize = mgridParams->gridforceCheckSize;
00963     
00964     for (int i = 0; i < 3; i++) {
00965         k[i] = k_nopad[i];      // subgrids aren't padded
00966     }
00967     
00968     // Make sure that each subgrid dimension is an integral
00969     // number of spanned supergrid cells. This is to ensure that no
00970     // supergrid nodes land in the middle of a subgrid, because in
00971     // this case forces could not be matched properly.
00972     for (int i = 0; i < 3; i++) {
00973         if ((k[i] - 1) % (pmax[i] - pmin[i] + 1) != 0) {
00974             iout << (k[i] - 1) << " % " << (pmax[i] - pmin[i] + 1) << " != 0\n" << endi;
00975             NAMD_die("Error reading gridforce grid! Subgrid dimensions must be an integral number spanned parent cells!");
00976         }
00977     }
00978     
00979     for (int i = 0; i < 3; i++) {
00980         if (parent->cont[i]) {
00981             cont[i] = (pmin[i] == 0 && pmax[i] == parent->k[i]-2) ? TRUE : FALSE;
00982             DebugM(3, "pmin[" << i << "] = " << pmin[i] << " pmax[" << i << "] = " << pmax[i] << " parent->k[" << i << "] = " << parent->k[i] << " cont[" << i << "] = " << cont[i] << "\n" << endi);
00983         } else {
00984             cont[i] = false;
00985             if (parent->generation == 0) {
00986                 // Add to pmin, pmax since parent got extra gridpoint layer(s) (maybe)
00987                 int brd = parent->get_border();
00988                 pmin[i] += brd;
00989                 pmax[i] += brd;
00990             }
00991         }               
00992     }
00993     
00994     DebugM(4, "pmin = " << pmin[0] << " " << pmin[1] << " " << pmin[2] << "\n");
00995     DebugM(4, "pmax = " << pmax[0] << " " << pmax[1] << " " << pmax[2] << "\n" << endi);
00996     
00997     Vector origin2 = parent->origin + parent->e * Position(pmin[0], pmin[1], pmin[2]);
00998     Vector escale, invscale;
00999     for (int i = 0; i < 3; i++) {
01000         escale[i] = double(pmax[i] - pmin[i] + 1)/(k[i]-1);
01001         invscale[i] = 1.0/escale[i];
01002         if (cont[i]) { pmax[i]++; }
01003     }
01004     Tensor e2 = tensorMult(parent->e, Tensor::diagonal(escale));
01005     
01006     // Check that lattice parameters agree with min and max numbers
01007     // from subgrid hierarchy.
01008     double TOL2 = 1e-4; // Totally arbitrary
01009     if (pow(origin2.x-origin.x, 2) > TOL2 ||
01010         pow(origin2.y-origin.y, 2) > TOL2 ||
01011         pow(origin2.z-origin.z, 2) > TOL2 ||
01012         pow(e2.xx-e.xx, 2) > TOL2 ||
01013         pow(e2.xy-e.xy, 2) > TOL2 ||
01014         pow(e2.xz-e.xz, 2) > TOL2 ||
01015         pow(e2.yx-e.yx, 2) > TOL2 ||
01016         pow(e2.yy-e.yy, 2) > TOL2 ||
01017         pow(e2.yz-e.yz, 2) > TOL2 ||
01018         pow(e2.zx-e.zx, 2) > TOL2 ||
01019         pow(e2.zy-e.zy, 2) > TOL2 ||
01020         pow(e2.zz-e.zz, 2) > TOL2)
01021     {
01022         NAMD_die("Error reading gridforce grid! Subgrid lattice does not match!");
01023     }
01024     
01025     // Overwrite what was read from the header
01026     origin = origin2;
01027     e = e2;
01028     
01029     inv = tensorMult(Tensor::diagonal(invscale), parent->inv);
01030     for (int i = 0; i < 3; i++) {
01031         gap[i] = escale[i] * parent->gap[i];
01032         gapinv[i] = invscale[i] * parent->gapinv[i];
01033         offset[i] = parent->offset[i];
01034     }
01035     center = origin + e * 0.5 * Position(k[0], k[1], k[2]);
01036     
01037     DebugM(4, "origin = " << origin << "\n");
01038     DebugM(4, "e = " << e << "\n");
01039     DebugM(4, "inv = " << inv << "\n");
01040     DebugM(4, "gap = " << gap[0] << " " << gap[2] << " " << gap[2] << " " << "\n");
01041     DebugM(4, "gapinv = " << gapinv[0] << " " << gapinv[2] << " " << gapinv[2] << " " << "\n");
01042     DebugM(4, "numSubgrids = " << numSubgrids << "\n");
01043     DebugM(4, "k = " << k[0] << " " << k[1] << " " << k[2] << "\n");
01044     DebugM(4, "escale = " << escale << "\n");
01045     DebugM(4, "invscale = " << invscale << "\n" << endi);
01046     
01047     /*** Set members ***/
01048     size = k[0] * k[1] * k[2];
01049     dk[0] = k[1] * k[2];
01050     dk[1] = k[2];
01051     dk[2] = 1;
01052     
01053     scale_dV = Tensor::diagonal(escale);
01054     scale_d2V = Tensor::diagonal(Vector(escale.x*escale.y, escale.x*escale.z, escale.y*escale.z));
01055     scale_d3V = escale.x * escale.y * escale.z;
01056     
01057     DebugM(4, "scale_dV = " << scale_dV << "\n");
01058     DebugM(4, "scale_d2V = " << scale_d2V << "\n");
01059     DebugM(4, "scale_d3V = " << scale_d3V << "\n" << endi);
01060     
01061     // Allocate storage for potential and read it
01062     float *grid_tmp = new float[size];
01063     
01064     float tmp2;
01065     DebugM(3, "size_nopad = " << size_nopad << "\n");
01066     for (long int count = 0; count < size_nopad; count++) {
01067 //      poten_offset = ftell(poten_fp);
01068 //      fscanf(poten_fp, "%s", str);
01069 //      fgets(line, 256, poten_fp);
01070 //      DebugM(4, "Read line " << str << " " << line << endi);
01071 //      fseek(poten_fp, poten_offset, SEEK_SET);
01072         
01073         int err = fscanf(poten_fp, "%f", &tmp2);
01074         if (err == EOF || err == 0) {
01075             NAMD_die("Grid force potential file incorrectly formatted");
01076         }
01077         grid_tmp[count] = tmp2 * factor;
01078     }
01079     fscanf(poten_fp, "\n");
01080     
01081     // Set real grid
01082     DebugM(3, "allocating grid\n" << endi);
01083     delete[] grid;
01084     grid = new float[size];
01085     for (int i0 = 0; i0 < k_nopad[0]; i0++) {
01086         for (int i1 = 0; i1 < k_nopad[1]; i1++) {
01087             for (int i2 = 0; i2 < k_nopad[2]; i2++) {
01088                 long int ind = i0*dk[0] + i1*dk[1] + i2*dk[2];
01089                 set_grid(i0, i1, i2, grid_tmp[ind]);
01090             }
01091         }
01092     }
01093     
01094     for (int i0 = 0; i0 < k[0]; i0++) {
01095         for (int i1 = 0; i1 < k[1]; i1++) {
01096             for (int i2 = 0; i2 < k[2]; i2++) {
01097                 DebugM(1, "grid[" << i0 << ", " << i1 << ", " << i2 << "] = " << get_grid(i0,i1,i2) << "\n" << endi);
01098             }
01099         }
01100     }
01101     
01102     // Clean up
01103     delete[] grid_tmp;
01104     
01105     // Call initialize for each subgrid
01106     for (int i = 0; i < numSubgrids; i++) {
01107         subgrids[i]->initialize(simParams, mgridParams);
01108     }
01109 }

void GridforceFullSubGrid::pack ( MOStream msg  )  const [protected, virtual]

Reimplemented from GridforceFullBaseGrid.

Definition at line 1112 of file GridForceGrid.C.

References DebugM, endi(), pmax, pmin, MOStream::put(), scale_d2V, scale_d3V, scale_dV, and subgridIdx.

Referenced by GridforceFullBaseGrid::pack().

01113 {
01114     DebugM(4, "Packing subgrid\n" << endi);
01115     
01116     msg->put(sizeof(Tensor), (char*)&scale_dV);
01117     msg->put(sizeof(Tensor), (char*)&scale_d2V);
01118     msg->put(sizeof(float), (char*)&scale_d3V);
01119     
01120     msg->put(3*sizeof(int), (char*)pmin);
01121     msg->put(3*sizeof(int), (char*)pmax);
01122     msg->put(subgridIdx);
01123     
01124     DebugM(3, "calling GridforceFullBaseGrid::pack\n" << endi);
01125     
01126     GridforceFullBaseGrid::pack(msg);
01127 }

Tensor GridforceFullSubGrid::tensorMult ( const Tensor t1,
const Tensor t2 
) [inline]

Definition at line 253 of file GridForceGrid.h.

References Tensor::xx, Tensor::xy, Tensor::xz, Tensor::yx, Tensor::yy, Tensor::yz, Tensor::zx, Tensor::zy, and Tensor::zz.

Referenced by initialize().

00253                                                                   {
00254         Tensor tmp;
00255         tmp.xx = t1.xx * t2.xx + t1.xy * t2.yx + t1.xz * t2.zx;
00256         tmp.xy = t1.xx * t2.xy + t1.xy * t2.yy + t1.xz * t2.zy;
00257         tmp.xz = t1.xx * t2.xz + t1.xy * t2.yz + t1.xz * t2.zz;
00258         tmp.yx = t1.yx * t2.xx + t1.yy * t2.yx + t1.yz * t2.zx;
00259         tmp.yy = t1.yx * t2.xy + t1.yy * t2.yy + t1.yz * t2.zy;
00260         tmp.yz = t1.yx * t2.xz + t1.yy * t2.yz + t1.yz * t2.zz;
00261         tmp.zx = t1.zx * t2.xx + t1.zy * t2.yx + t1.zz * t2.zx;
00262         tmp.zy = t1.zx * t2.xy + t1.zy * t2.yy + t1.zz * t2.zy;
00263         tmp.zz = t1.zx * t2.xz + t1.zy * t2.yz + t1.zz * t2.zz;
00264         return tmp;
00265     }

void GridforceFullSubGrid::unpack ( MIStream msg  )  [protected, virtual]

Reimplemented from GridforceFullBaseGrid.

Definition at line 1130 of file GridForceGrid.C.

References DebugM, endi(), GridforceFullBaseGrid::gapinv, GridforceFullBaseGrid::generation, MIStream::get(), GridforceFullBaseGrid::numSubgrids, pmax, pmin, scale_d2V, scale_d3V, scale_dV, GridforceFullBaseGrid::size, and subgridIdx.

Referenced by GridforceFullBaseGrid::unpack().

01131 {
01132     DebugM(4, "Unpacking subgrid\n" << endi);
01133     
01134     msg->get(sizeof(Tensor), (char*)&scale_dV);
01135     msg->get(sizeof(Tensor), (char*)&scale_d2V);
01136     msg->get(sizeof(float), (char*)&scale_d3V);
01137     
01138     msg->get(3*sizeof(int), (char*)pmin);
01139     msg->get(3*sizeof(int), (char*)pmax);
01140     msg->get(subgridIdx);
01141     
01142     GridforceFullBaseGrid::unpack(msg);
01143     
01144     DebugM(4, "size  = " << size << "\n");
01145     DebugM(4, "numSubgrids = " << numSubgrids << "\n");
01146     DebugM(4, "gapinv = " << gapinv[0] << " " << gapinv[2] << " " << gapinv[2] << " " << "\n");
01147     DebugM(4, "generation = " << generation << "\n" << endi);
01148 }


Friends And Related Function Documentation

friend class GridforceFullBaseGrid [friend]

Definition at line 243 of file GridForceGrid.h.

friend class GridforceFullMainGrid [friend]

Reimplemented from GridforceFullBaseGrid.

Definition at line 244 of file GridForceGrid.h.


Member Data Documentation

Definition at line 282 of file GridForceGrid.h.

Referenced by addToSubgridsFlat(), and GridforceFullSubGrid().

Definition at line 280 of file GridForceGrid.h.

Referenced by compute_b(), GridforceFullSubGrid(), and initialize().

int GridforceFullSubGrid::pmax[3] [protected]

Definition at line 281 of file GridForceGrid.h.

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

int GridforceFullSubGrid::pmin[3] [protected]

Definition at line 281 of file GridForceGrid.h.

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

Definition at line 277 of file GridForceGrid.h.

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

Definition at line 278 of file GridForceGrid.h.

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

Definition at line 276 of file GridForceGrid.h.

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

Definition at line 283 of file GridForceGrid.h.

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


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

Generated on 8 Dec 2019 for NAMD by  doxygen 1.6.1