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

#include <ComputeLCPO.h>

Inheritance diagram for ComputeLCPO:
Compute ComputeNonbondedUtil

Public Member Functions

 ComputeLCPO (ComputeID c, PatchID pid[], int t[], ComputeNonbondedWorkArrays *_workArrays, int minPartition, int maxPartition, int numPartitions, int numPatches)
 
virtual ~ComputeLCPO ()
 
virtual void initialize ()
 
virtual void atomUpdate ()
 
virtual void doWork ()
 
virtual int noWork ()
 
- Public Member Functions inherited from Compute
 Compute (ComputeID)
 
int type ()
 
virtual ~Compute ()
 
void setNumPatches (int n)
 
int getNumPatches ()
 
virtual void patchReady (PatchID, int doneMigration, int seq)
 
virtual void finishPatch (int)
 
int sequence (void)
 
int priority (void)
 
int getGBISPhase (void)
 
virtual void gbisP2PatchReady (PatchID, int seq)
 
virtual void gbisP3PatchReady (PatchID, int seq)
 

Protected Member Functions

virtual void doForce ()
 
- Protected Member Functions inherited from Compute
void enqueueWork ()
 

Protected Attributes

int numAtoms [8]
 
int valid [8][8]
 
int invalidPatch [8]
 
CompAtomExtposExt [8]
 
CompAtompos [8]
 
Resultsforce [8]
 
int * lcpoType [8]
 
int step
 
Patchpatch [8]
 
PatchID patchID [8]
 
int trans [8]
 
Box< Patch, CompAtom > * positionBox [8]
 
Box< Patch, Results > * forceBox [8]
 
Box< Patch, int > * lcpoTypeBox [8]
 
ComputeNonbondedWorkArrays *const workArrays
 
int minPart
 
int maxPart
 
int numParts
 
SubmitReductionreduction
 
- Protected Attributes inherited from Compute
int computeType
 
int basePriority
 
int gbisPhase
 
int gbisPhasePriority [3]
 

Additional Inherited Members

- Public Attributes inherited from Compute
const ComputeID cid
 
LDObjHandle ldObjHandle
 
LocalWorkMsg *const localWorkMsg
 

Detailed Description

Definition at line 100 of file ComputeLCPO.h.

Constructor & Destructor Documentation

ComputeLCPO::ComputeLCPO ( ComputeID  c,
PatchID  pid[],
int  t[],
ComputeNonbondedWorkArrays _workArrays,
int  minPartition,
int  maxPartition,
int  numPartitions,
int  numPatches 
)

Definition at line 36 of file ComputeLCPO.C.

References forceBox, Compute::getNumPatches(), lcpoTypeBox, Node::Object(), ReductionMgr::Object(), patch, patchID, positionBox, reduction, REDUCTIONS_BASIC, Compute::setNumPatches(), Node::simParameters, simParams, SimParameters::surface_tension, trans, and ReductionMgr::willSubmit().

39  : Compute(c), workArrays(_workArrays),
40  minPart(minPartition), maxPart(maxPartition),
41  strideIg(numPartitions), numParts(numPartitions),
42  maxAtomRadius(1.9+1.4)
43  {
44 
46 
47  setNumPatches(8);
49  surfTen = simParams->surface_tension;
50 
51  for (int i=0; i<getNumPatches(); i++) {
52  patchID[i] = p[i];
53  trans[i] = t[i];
54  patch[i] = NULL;
55  positionBox[i] = NULL;
56  forceBox[i] = NULL;
57  lcpoTypeBox[i] = NULL;
58  } // for all patches
59 } // constructor
static Node * Object()
Definition: Node.h:86
void setNumPatches(int n)
Definition: Compute.h:52
Box< Patch, int > * lcpoTypeBox[8]
Definition: ComputeLCPO.h:132
SimParameters * simParameters
Definition: Node.h:178
SubmitReduction * willSubmit(int setID, int size=-1)
Definition: ReductionMgr.C:365
static ReductionMgr * Object(void)
Definition: ReductionMgr.h:278
ComputeNonbondedWorkArrays *const workArrays
Definition: ComputeLCPO.h:134
Box< Patch, Results > * forceBox[8]
Definition: ComputeLCPO.h:131
BigReal surface_tension
PatchID patchID[8]
Definition: ComputeLCPO.h:128
Box< Patch, CompAtom > * positionBox[8]
Definition: ComputeLCPO.h:130
Patch * patch[8]
Definition: ComputeLCPO.h:126
#define simParams
Definition: Output.C:127
int getNumPatches()
Definition: Compute.h:53
int trans[8]
Definition: ComputeLCPO.h:129
Compute(ComputeID)
Definition: Compute.C:33
SubmitReduction * reduction
Definition: ComputeLCPO.h:137
ComputeLCPO::~ComputeLCPO ( )
virtual

Definition at line 61 of file ComputeLCPO.C.

References Compute::cid, DebugM, forceBox, Compute::getNumPatches(), lcpoTypeBox, numAtoms, PatchMap::Object(), patch, PatchMap::patch(), patchID, positionBox, reduction, Patch::unregisterForceDeposit(), Patch::unregisterLcpoTypePickup(), and Patch::unregisterPositionPickup().

61  {
62  DebugM(4, "~ComputeLCPO("<<cid<<") numAtoms("<<patchID[0]<<") = "
63  << numAtoms[0]
64  << " numAtoms("<<patchID[1]<<") = " << numAtoms[1] << "\n" );
65  DebugM(4, "~ComputeLCPO("<<cid<<") addr("<<patchID[0]<<") = "
66  << PatchMap::Object()->patch(patchID[0]) << " addr("<<patchID[1]<<") = "
67  << PatchMap::Object()->patch(patchID[1]) << "\n");
68 
69  for (int i=0; i<getNumPatches(); i++) {
70  if (positionBox[i] != NULL) {
72  &positionBox[i]);
73  }
74  if (forceBox[i] != NULL) {
76  &forceBox[i]);
77  }
78  if (lcpoTypeBox[i] != NULL) {
80  &lcpoTypeBox[i]);
81  }
82  }
83  delete reduction;
84 } // destructor
Box< Patch, int > * lcpoTypeBox[8]
Definition: ComputeLCPO.h:132
static PatchMap * Object()
Definition: PatchMap.h:27
#define DebugM(x, y)
Definition: Debug.h:59
void unregisterForceDeposit(Compute *cid, Box< Patch, Results > **const box)
Definition: Patch.C:239
Patch * patch(PatchID pid)
Definition: PatchMap.h:235
Box< Patch, Results > * forceBox[8]
Definition: ComputeLCPO.h:131
int numAtoms[8]
Definition: ComputeLCPO.h:115
PatchID patchID[8]
Definition: ComputeLCPO.h:128
Box< Patch, CompAtom > * positionBox[8]
Definition: ComputeLCPO.h:130
Patch * patch[8]
Definition: ComputeLCPO.h:126
void unregisterPositionPickup(Compute *cid, Box< Patch, CompAtom > **const box)
Definition: Patch.C:122
int getNumPatches()
Definition: Compute.h:53
SubmitReduction * reduction
Definition: ComputeLCPO.h:137
const ComputeID cid
Definition: Compute.h:43
void unregisterLcpoTypePickup(Compute *cid, Box< Patch, int > **const box)
Definition: Patch.C:191

Member Function Documentation

void ComputeLCPO::atomUpdate ( void  )
virtual

Reimplemented from Compute.

Definition at line 193 of file ComputeLCPO.C.

References Patch::getNumAtoms(), numAtoms, and patch.

193  {
194  for (int i=0; i<8; i++) {
195  numAtoms[i] = patch[i]->getNumAtoms();
196  }
197 }
int numAtoms[8]
Definition: ComputeLCPO.h:115
Patch * patch[8]
Definition: ComputeLCPO.h:126
int getNumAtoms()
Definition: Patch.h:105
void ComputeLCPO::doForce ( )
protectedvirtual

Definition at line 290 of file ComputeLCPO.C.

References calcOverlap(), LCPOAtom::f, Results::f, Patch::flags, FLOPS, force, CompAtom::hydrogenGroupSize, CompAtomExt::id, invalidPatch, SubmitReduction::item(), lcpoType, minPart, Results::nbond, Pairlists::newlist(), LCPONeighborList::newlist(), Pairlists::newsize(), LCPONeighborList::newsize(), Pairlists::nextlist(), LCPONeighborList::nextlist(), numAtoms, numParts, patch, PI, pos, posExt, CompAtom::position, LCPOAtom::r, reduction, REDUCTION_COMPUTE_CHECKSUM, REDUCTION_ELECT_ENERGY, Pairlists::reset(), LCPONeighborList::reset(), Flags::sequence, step, SubmitReduction::submit(), valid, LCPOAtom::x, Vector::x, LCPOAtom::y, Vector::y, LCPOAtom::z, and Vector::z.

Referenced by doWork().

290  {
291  //CkPrintf("ComputeLCPO::doForce\n");
292  step = patch[0]->flags.sequence;
293 
294  Real probeRadius = 1.4f;
295  Real cutMargin = 0.f;//regenerating pairlists every step
296 
297  Position ngir, ngjr, ngkr;
298  Real ri, rj, rk;
299  BigReal dxij, dyij, dzij, r2ij;
300  BigReal dxik, dyik, dzik, r2ik;
301  BigReal dxjk, dyjk, dzjk, r2jk;
302 
303 #ifdef COUNT_FLOPS
304  int flops = 0;
305 #endif
306 
308 // Build Pairlists
310 //generate pairlists every step since contain coordinates
311 if ( true ) {
312  double t_start = 1.0*clock()/CLOCKS_PER_SEC;
313 
314  inAtomsPl.reset();
315  lcpoNeighborList.reset();
316  FLOPS(8);
317  cut2 = 2*maxAtomRadius+cutMargin; cut2 *= cut2;
318  maxAtomRadius = 0;
319  //find in-bounds atoms in each patch
320  for (int pI = 0; pI < 8; pI++) {
321  if (invalidPatch[pI]) continue;
322  if (numAtoms[pI] == 0) continue;
323 
324  int minIg = 0;
325  for (int s = 0; s < minPart; s++) {
326  minIg += pos[pI][minIg].hydrogenGroupSize;
327  FLOPS(1)
328  }
329  strideIg = numParts;//stride through partitions
330  plint *inAtoms = inAtomsPl.newlist(numAtoms[pI]);
331  int numAtomsInBounds = 0;
332 
333  //iterate over heavy atoms only
334  for ( int ngi = minIg; ngi < numAtoms[pI]; /* ngi */) {
335  ngir = pos[pI][ngi].position;
336  if ( isInBounds(ngir.x, ngir.y, ngir.z) && lcpoType[pI][ngi] > 0 ) {
337  inAtoms[numAtomsInBounds++] = ngi;
338  ri = probeRadius+lcpoParams[ lcpoType[pI][ngi] ][0];
339  maxAtomRadius = (ri > maxAtomRadius) ? ri : maxAtomRadius;
340  FLOPS(1);
341 
342  int maxAtoms = 0;
343  for (int pJ = 0; pJ < 8; pJ++) {
344  if (numAtoms[pJ] > 0) {
345  maxAtoms += numAtoms[pJ];
346  }
347  }
348  LCPOAtom *lcpoNeighbors = lcpoNeighborList.newlist(maxAtoms);
349  int numLcpoNeighbors = 0;
350 
351  //find pairs of this inAtom from all 8 patches
352  for (int pJ = 0; pJ < 8; pJ++) {
353  if (invalidPatch[pJ]) continue;
354  if (!valid[pI][pJ]) continue;
355 
356  // j atom pairs
357  for ( int ngj = 0; ngj < numAtoms[pJ]; /* ngj */) {
358  FLOPS(1)
359  ngjr = pos[pJ][ngj].position;
360  dxij = ngir.x - ngjr.x;
361  dyij = ngir.y - ngjr.y;
362  dzij = ngir.z - ngjr.z;
363 
364  // i-j coarse check if too far apart
365  r2ij = dxij*dxij + dyij*dyij + dzij*dzij;
366  FLOPS(8)
367  if (r2ij < cut2 && r2ij > 0.01) {
368 
369  // i-j precise check if too far apart
370  rj = probeRadius+lcpoParams[ lcpoType[pJ][ngj] ][0];
371  FLOPS(5)
372  BigReal rirjcutMargin2 = ri+rj+cutMargin;
373  rirjcutMargin2 *= rirjcutMargin2;
374  if (r2ij < rirjcutMargin2 && r2ij > 0.0001 &&
375  lcpoType[pJ][ngj] > 0) {
376  lcpoNeighbors[numLcpoNeighbors].x = ngjr.x;
377  lcpoNeighbors[numLcpoNeighbors].y = ngjr.y;
378  lcpoNeighbors[numLcpoNeighbors].z = ngjr.z;
379  lcpoNeighbors[numLcpoNeighbors].r = rj;
380  lcpoNeighbors[numLcpoNeighbors].f =
381  &force[pJ]->f[Results::nbond][ngj];
382  numLcpoNeighbors++;
383  FLOPS(2)
384  maxAtomRadius = (rj > maxAtomRadius) ? rj : maxAtomRadius;
385  } // precise cutoff
386  } // coarse cutoff
387  //jump to next nonbonded group
388  ngj += pos[pJ][ngj].hydrogenGroupSize;
389  FLOPS(1)
390  } // for j atoms
391  } // for patches J
392  lcpoNeighborList.newsize(numLcpoNeighbors);
393  } // in bounds
394  //jump to next nonbonded group for round-robin
395  for (int s = 0; s < strideIg; s++) {
396  ngi += pos[pI][ngi].hydrogenGroupSize;
397  FLOPS(1)
398  }
399  } // for i atoms
400  inAtomsPl.newsize(numAtomsInBounds);
401  } // for patches I
402 #ifdef COUNT_FLOPS
403  double t_stop = 1.0*clock()/CLOCKS_PER_SEC;
404  CkPrintf("LCPO_TIME_P %7.3f Gflops %9d @ %f\n", flops*1e-9/(t_stop-t_start),flops,(t_stop-t_start));
405 #endif
406 }
407 #ifdef COUNT_FLOPS
408  double t_start = 1.0*clock()/CLOCKS_PER_SEC;
409  flops = 0;
410 #endif
411 
412  //reset pairlists
413  inAtomsPl.reset();
414  lcpoNeighborList.reset();
415  cut2 = maxAtomRadius*2; cut2 *= cut2;
416 
417  //init values
418  BigReal totalSurfaceArea = 0;
419 
427  //for each patch in octet
428  for (int pI = 0; pI < 8; pI++) {
429  if (invalidPatch[pI]) continue;
430  if (numAtoms[pI] == 0) continue;
431  plint *inAtoms;
432  int numInAtoms;
433  inAtomsPl.nextlist( &inAtoms, &numInAtoms );
434  //for each inAtom in each patch
435  for (int i = 0; i < numInAtoms; i++) {
436  int iIndex = inAtoms[i];
437  int idi = posExt[pI][iIndex].id;
438  Real xi = pos[pI][iIndex].position.x;
439  Real yi = pos[pI][iIndex].position.y;
440  Real zi = pos[pI][iIndex].position.z;
441  const Real *lcpoParamI = lcpoParams[ lcpoType[pI][iIndex] ];
442  ri = probeRadius+lcpoParamI[0];
443  FLOPS(1)
444 
445  Real P1 = lcpoParamI[1];
446  Real P2 = lcpoParamI[2];
447  Real P3 = lcpoParamI[3];
448  Real P4 = lcpoParamI[4];
449 
451 // S1
453  BigReal S1 = 4.0*PI*ri*ri; // a
454  FLOPS(3)
455 
456  //for surface area calculation
457  BigReal AijSum = 0; // b
458  BigReal AjkSum = 0; // c
459  BigReal AjkjSum = 0; // d'
460  BigReal AijAjkSum = 0; // d
461 
462  //for force calculation
463  BigReal dAijdrijdxiSum = 0.0;
464  BigReal dAijdrijdyiSum = 0.0;
465  BigReal dAijdrijdziSum = 0.0;
466  BigReal dAijdrijdxiAjkSum = 0.0;
467  BigReal dAijdrijdyiAjkSum = 0.0;
468  BigReal dAijdrijdziAjkSum = 0.0;
469 
471 // for J Atoms
473  LCPOAtom *lcpoNeighbors;
474  int numLcpoNeighbors;
475  lcpoNeighborList.nextlist( &lcpoNeighbors, &numLcpoNeighbors );
476 
477  for (int j = 0; j < numLcpoNeighbors; j++) {
478  Real xj = lcpoNeighbors[j].x;
479  Real yj = lcpoNeighbors[j].y;
480  Real zj = lcpoNeighbors[j].z;
481  Real rj = lcpoNeighbors[j].r;
482 
483  // i-j coarse check if too far away
484  dxij = xj-xi;
485  dyij = yj-yi;
486  dzij = zj-zi;
487  r2ij = dxij*dxij + dyij*dyij + dzij*dzij;
488  FLOPS(7);
489  if (r2ij >= cut2 || r2ij < 0.01) { continue; }
490 
491  // i-j precise check if too far away
492  FLOPS(5)
493  BigReal rirj2 = ri+rj;
494  rirj2 *= rirj2;
495  if ( r2ij >= rirj2 ) { continue; }
496 
497  BigReal rij = sqrt(r2ij);
498  BigReal rij_1 = 1.f / rij;
499 
501 // S2
503  BigReal Aij = calcOverlap(rij, ri, rj);
504  AijSum += Aij;
505  FLOPS(12)
506 
507  //for dAi_drj force calculation
508  BigReal dAijdrij = PI*ri*(rij_1*rij_1*(ri*ri-rj*rj)-1);
509  BigReal dAijdrijdxj = dAijdrij*dxij*rij_1; // g k' i' l'
510  BigReal dAijdrijdyj = dAijdrij*dyij*rij_1;
511  BigReal dAijdrijdzj = dAijdrij*dzij*rij_1;
512  FLOPS(14)
513 
514  BigReal AjkjSum = 0; // i' l'
515  BigReal dAjkdrjkdxjSum = 0.0;
516  BigReal dAjkdrjkdyjSum = 0.0;
517  BigReal dAjkdrjkdzjSum = 0.0;
518 
520 // for K Atoms
522  for (int k = 0; k < numLcpoNeighbors; k++) {
523  Real xk = lcpoNeighbors[k].x;
524  Real yk = lcpoNeighbors[k].y;
525  Real zk = lcpoNeighbors[k].z;
526  Real rk = lcpoNeighbors[k].r;
527 
528  // i-k coarse check if too far away
529  dxik = xk-xi;
530  dyik = yk-yi;
531  dzik = zk-zi;
532  r2ik = dxik*dxik + dyik*dyik + dzik*dzik;
533  FLOPS(8)
534  if (r2ik >= cut2 || r2ik < 0.01) { continue; }
535 
536  // j-k coarse check if too far away
537  dxjk = xk-xj;
538  dyjk = yk-yj;
539  dzjk = zk-zj;
540  r2jk = dxjk*dxjk + dyjk*dyjk + dzjk*dzjk;
541  FLOPS(8)
542  if (r2jk >= cut2 || r2jk < 0.01) { continue; }
543 
544  // i-k precise check if too far away
545  FLOPS(3)
546  BigReal rirk2 = ri+rk;
547  rirk2 *= rirk2;
548  if ( r2ik >= rirk2 ) { continue; }
549 
550  // j-k precise check if too far away
551  FLOPS(2)
552  BigReal rjrk2 = rj+rk;
553  rjrk2 *= rjrk2;
554  if ( r2jk >= rjrk2 ) { continue; }
555  BigReal rjk = sqrt(r2jk);
556 
558 // S3
560  BigReal rjk_1 = 1.0/rjk;
561  BigReal Ajk = calcOverlap(rjk, rj, rk);
562  FLOPS(12)
563  AjkSum += Ajk;
564  AjkjSum += Ajk; // i' l'
565  FLOPS(5)
566 
568 // Force dAi_drk
570  BigReal dAjkdrjk = PI*rj*rjk_1*(rjk_1*rjk_1*(rj*rj-rk*rk) - 1.f);//ef'
571  BigReal dAjkdrjkdxj = -dAjkdrjk*dxjk; // e f h'
572  BigReal dAjkdrjkdyj = -dAjkdrjk*dyjk;
573  BigReal dAjkdrjkdzj = -dAjkdrjk*dzjk;
574  lcpoNeighbors[k].f->x -= -dAjkdrjkdxj*(P3+P4*Aij)*surfTen; // e f
575  lcpoNeighbors[k].f->y -= -dAjkdrjkdyj*(P3+P4*Aij)*surfTen;
576  lcpoNeighbors[k].f->z -= -dAjkdrjkdzj*(P3+P4*Aij)*surfTen;
577 
578  dAjkdrjkdxjSum += dAjkdrjkdxj; // h j'
579  dAjkdrjkdyjSum += dAjkdrjkdyj;
580  dAjkdrjkdzjSum += dAjkdrjkdzj;
581  FLOPS(34)
582 
583  } // k atoms
585 // S4
587  AijAjkSum += Aij*AjkjSum;
588 
590 // Force dAi_drj
592  BigReal lastxj = dAijdrijdxj*AjkjSum + Aij*dAjkdrjkdxjSum; // i j
593  BigReal lastyj = dAijdrijdyj*AjkjSum + Aij*dAjkdrjkdyjSum;
594  BigReal lastzj = dAijdrijdzj*AjkjSum + Aij*dAjkdrjkdzjSum;
595  BigReal dAidxj = (P2*dAijdrijdxj + P3*dAjkdrjkdxjSum + P4*lastxj);//ghij
596  BigReal dAidyj = (P2*dAijdrijdyj + P3*dAjkdrjkdyjSum + P4*lastyj);
597  BigReal dAidzj = (P2*dAijdrijdzj + P3*dAjkdrjkdzjSum + P4*lastzj);
598  lcpoNeighbors[j].f->x -= dAidxj*surfTen;
599  lcpoNeighbors[j].f->y -= dAidyj*surfTen;
600  lcpoNeighbors[j].f->z -= dAidzj*surfTen;
601 
602  //for dAi_dri force calculation
603  dAijdrijdxiSum -= dAijdrijdxj; // k
604  dAijdrijdyiSum -= dAijdrijdyj;
605  dAijdrijdziSum -= dAijdrijdzj;
606  dAijdrijdxiAjkSum -= dAijdrijdxj*AjkjSum; // l
607  dAijdrijdyiAjkSum -= dAijdrijdyj*AjkjSum;
608  dAijdrijdziAjkSum -= dAijdrijdzj*AjkjSum;
609  FLOPS(41)
610  } // j atoms
611 
613 // Force dAi_dri
615  BigReal dAidxi = (P2*dAijdrijdxiSum + P4*dAijdrijdxiAjkSum); // k l
616  BigReal dAidyi = (P2*dAijdrijdyiSum + P4*dAijdrijdyiAjkSum);
617  BigReal dAidzi = (P2*dAijdrijdziSum + P4*dAijdrijdziAjkSum);
618  force[pI]->f[Results::nbond][iIndex].x -= dAidxi*surfTen;
619  force[pI]->f[Results::nbond][iIndex].y -= dAidyi*surfTen;
620  force[pI]->f[Results::nbond][iIndex].z -= dAidzi*surfTen;
621 
623 // Atom I Surface Area
625  BigReal SAi = P1*S1 + P2*AijSum + P3*AjkSum + P4*AijAjkSum;
626  //CkPrintf("SurfArea[%05d] = % 7.3f\n",idi,SAi);
627  //SAi = (SAi > 0) ? SAi : 0;
628  totalSurfaceArea += SAi;
629  FLOPS(22)
630  } // for inAtoms
631  } // for patches I
632 #ifdef COUNT_FLOPS
633  double t_stop = 1.0*clock()/CLOCKS_PER_SEC;
634  CkPrintf("LCPO_TIME_F %7.3f Gflops %9d @ %f\n", 1e-9*flops/(t_stop-t_start),flops, (t_stop-t_start));
635 #endif
636 
638 // end calculation by submitting reduction
640 
642  reduction->item(REDUCTION_ELECT_ENERGY) += totalSurfaceArea * surfTen;
643  reduction->submit();
644 
645 }//end do Force
float r
Definition: ComputeLCPO.h:23
unsigned int hydrogenGroupSize
Definition: NamdTypes.h:58
Definition: Vector.h:64
Vector * f
Definition: ComputeLCPO.h:24
float Real
Definition: common.h:107
BigReal & item(int i)
Definition: ReductionMgr.h:312
BigReal z
Definition: Vector.h:66
Results * force[8]
Definition: ComputeLCPO.h:121
Position position
Definition: NamdTypes.h:53
CompAtomExt * posExt[8]
Definition: ComputeLCPO.h:119
if(ComputeNonbondedUtil::goMethod==2)
#define FLOPS(X)
Definition: ComputeLCPO.C:30
int * lcpoType[8]
Definition: ComputeLCPO.h:122
Flags flags
Definition: Patch.h:127
float x
Definition: ComputeLCPO.h:23
#define PI
Definition: common.h:81
float z
Definition: ComputeLCPO.h:23
unsigned short plint
void nextlist(plint **list, int *list_size)
int valid[8][8]
Definition: ComputeLCPO.h:116
float y
Definition: ComputeLCPO.h:23
gridSize z
int numAtoms[8]
Definition: ComputeLCPO.h:115
Force * f[maxNumForces]
Definition: PatchTypes.h:67
BigReal x
Definition: Vector.h:66
int sequence
Definition: PatchTypes.h:18
LCPOAtom * newlist(int max_size)
Definition: ComputeLCPO.h:48
Patch * patch[8]
Definition: ComputeLCPO.h:126
CompAtom * pos[8]
Definition: ComputeLCPO.h:120
BigReal calcOverlap(BigReal r, Real ri, Real rj)
Definition: ComputeLCPO.C:281
BigReal y
Definition: Vector.h:66
void newsize(int list_size)
gridSize y
void submit(void)
Definition: ReductionMgr.h:323
int invalidPatch[8]
Definition: ComputeLCPO.h:118
gridSize x
plint * newlist(int max_size)
SubmitReduction * reduction
Definition: ComputeLCPO.h:137
double BigReal
Definition: common.h:112
for(int i=0;i< n1;++i)
void ComputeLCPO::doWork ( void  )
virtual

Reimplemented from Compute.

Definition at line 202 of file ComputeLCPO.C.

References Box< Owner, Data >::close(), doForce(), LdbCoordinator::endWork(), force, forceBox, Patch::getCompAtomExtInfo(), Compute::getNumPatches(), lcpoType, lcpoTypeBox, Compute::ldObjHandle, LdbCoordinator::Object(), Box< Owner, Data >::open(), patch, pos, posExt, positionBox, and LdbCoordinator::startWork().

202  {
204  for (int i=0; i<8; i++) {
205  pos[i] = positionBox[i]->open();
206  force[i] = forceBox[i]->open();
207  posExt[i] = patch[i]->getCompAtomExtInfo();
208  lcpoType[i] = lcpoTypeBox[i]->open();
209  }
210 
211  doForce();
212 
213  // Inform load balancer
215 
216  // Close up boxes
217  for (int i=0; i<getNumPatches(); i++) {
218  positionBox[i]->close(&pos[i]);
219  forceBox[i]->close(&force[i]);
220  lcpoTypeBox[i]->close(&lcpoType[i]);
221  }
222 } // doWork
Box< Patch, int > * lcpoTypeBox[8]
Definition: ComputeLCPO.h:132
void startWork(const LDObjHandle &handle)
Results * force[8]
Definition: ComputeLCPO.h:121
CompAtomExt * posExt[8]
Definition: ComputeLCPO.h:119
LDObjHandle ldObjHandle
Definition: Compute.h:44
int * lcpoType[8]
Definition: ComputeLCPO.h:122
Box< Patch, Results > * forceBox[8]
Definition: ComputeLCPO.h:131
Box< Patch, CompAtom > * positionBox[8]
Definition: ComputeLCPO.h:130
static LdbCoordinator * Object()
Patch * patch[8]
Definition: ComputeLCPO.h:126
void endWork(const LDObjHandle &handle)
CompAtom * pos[8]
Definition: ComputeLCPO.h:120
int getNumPatches()
Definition: Compute.h:53
virtual void doForce()
Definition: ComputeLCPO.C:290
Data * open(void)
Definition: Box.h:39
void close(Data **const t)
Definition: Box.h:49
CompAtomExt * getCompAtomExtInfo()
Definition: Patch.h:117
void ComputeLCPO::initialize ( void  )
virtual

Reimplemented from Compute.

Definition at line 86 of file ComputeLCPO.C.

References Compute::basePriority, DebugM, forceBox, Patch::getNumAtoms(), PatchMap::gridsize_a(), PatchMap::gridsize_b(), PatchMap::gridsize_c(), PatchMap::index_a(), PatchMap::index_b(), PatchMap::index_c(), Compute::initialize(), invalidPatch, lcpoTypeBox, PatchMap::max_a(), PatchMap::max_b(), PatchMap::max_c(), PatchMap::min_a(), PatchMap::min_b(), PatchMap::min_c(), numAtoms, PatchMap::Object(), patch, PatchMap::patch(), PATCH_PRIORITY, patchID, positionBox, PROXY_RESULTS_PRIORITY, Patch::registerForceDeposit(), Patch::registerLcpoTypePickup(), Patch::registerPositionPickup(), and valid.

86  {
88  // How can we tell if BoxOwner has packed up and left? Need a mechanism
89  // to handle this or do we assume the Boxes have been dumped?
90  PatchMap *patchMap = PatchMap::Object();
91  //Check out Boxes
92  for (int i=0; i<8; i++) {
93  //invalid patch so don't even checkout boxes
94  if (positionBox[i] == NULL) { // We have yet to get boxes
95  patch[i] = PatchMap::Object()->patch(patchID[i]);
96  if (!(patch[i] = PatchMap::Object()->patch(patchID[i]))) {
97  DebugM(5,"invalid patch(" << patchID[i]
98  << ") pointer!\n");
99  }
101  forceBox[i] = patch[i]->registerForceDeposit(this);
103  // will need to open a box full of lcpo parameters
104  }
105  numAtoms[i] = patch[i]->getNumAtoms();
106  } // for all patches
107 
108  // set priority
110 
111  //get bounds of inner rectangular prism in octet
112  bounds[0][0] = 0.5*(patchMap->min_a(patchID[0])+patchMap->max_a(patchID[0]));
113  bounds[1][0] = 0.5*(patchMap->min_b(patchID[0])+patchMap->max_b(patchID[0]));
114  bounds[2][0] = 0.5*(patchMap->min_c(patchID[0])+patchMap->max_c(patchID[0]));
115  bounds[0][1] = 0.5*(patchMap->min_a(patchID[7])+patchMap->max_a(patchID[7]));
116  bounds[1][1] = 0.5*(patchMap->min_b(patchID[7])+patchMap->max_b(patchID[7]));
117  bounds[2][1] = 0.5*(patchMap->min_c(patchID[7])+patchMap->max_c(patchID[7]));
118 
119  //if only 1 patch in a dimenion, invalidate those patches
120  int gsa = patchMap->gridsize_a();
121  int gsb = patchMap->gridsize_b();
122  int gsc = patchMap->gridsize_c();
123  invalidPatch[0] = 0;
124  invalidPatch[1] = 0;
125  invalidPatch[2] = 0;
126  invalidPatch[3] = 0;
127  invalidPatch[4] = 0;
128  invalidPatch[5] = 0;
129  invalidPatch[6] = 0;
130  invalidPatch[7] = 0;
131 
132  if (gsa==1) {
133  //CkPrintf("ONLY 1 PATCH in A DIMENSION!\n");
134  invalidPatch[1] = 1;
135  invalidPatch[3] = 1;
136  invalidPatch[5] = 1;
137  invalidPatch[7] = 1;
138  }
139  if (gsb==1) {
140  //CkPrintf("ONLY 1 PATCH in B DIMENSION!\n");
141  invalidPatch[2] = 1;
142  invalidPatch[3] = 1;
143  invalidPatch[6] = 1;
144  invalidPatch[7] = 1;
145  }
146  if (gsc==1) {
147  //CkPrintf("ONLY 1 PATCH in C DIMENSION!\n");
148  invalidPatch[4] = 1;
149  invalidPatch[5] = 1;
150  invalidPatch[6] = 1;
151  invalidPatch[7] = 1;
152  }
153  //relative a,b,c index for 8 patches in ComputeLCPO
154  int idx[8][3] = {
155  { 0, 0, 0},
156  { 1, 0, 0},
157  { 0, 1, 0},
158  { 1, 1, 0},
159  { 0, 0, 1},
160  { 1, 0, 1},
161  { 0, 1, 1},
162  { 1, 1, 1} };
163 /*
164  int i_a = patchMap->index_a(patchID[0]);
165  int i_b = patchMap->index_b(patchID[0]);
166  int i_c = patchMap->index_c(patchID[0]);
167  CkPrintf("VALID[%d,%d,%d]=\n",i_a,i_b,i_c);
168 */
169  for (int pI = 0; pI < 8; pI++) {
170  int iia = patchMap->index_a(patchID[pI]);
171  int iib = patchMap->index_b(patchID[pI]);
172  int iic = patchMap->index_c(patchID[pI]);
173  for (int pJ = 0; pJ < 8; pJ++) {
174  int jia = patchMap->index_a(patchID[pJ]);
175  int jib = patchMap->index_b(patchID[pJ]);
176  int jic = patchMap->index_c(patchID[pJ]);
177  if ( ( gsa==1 && (jia>iia) != (idx[pJ][0]>idx[pI][0]) ) ||
178  ( gsb==1 && (jib>iib) != (idx[pJ][1]>idx[pI][1]) ) ||
179  ( gsc==1 && (jic>iic) != (idx[pJ][2]>idx[pI][2]) ) ||
180  ( invalidPatch[pI] ) ||
181  ( invalidPatch[pJ] ) )
182  valid[pI][pJ] = 0;
183  else
184  valid[pI][pJ] = 1;
185  //CkPrintf("%d ",valid[pI][pJ]);
186  }
187  //CkPrintf("\n");
188  }
189  //CkPrintf("\n");
190 
191 } // initialize
#define PROXY_RESULTS_PRIORITY
Definition: Priorities.h:73
Box< Patch, int > * lcpoTypeBox[8]
Definition: ComputeLCPO.h:132
int gridsize_c(void) const
Definition: PatchMap.h:66
static PatchMap * Object()
Definition: PatchMap.h:27
BigReal max_c(int pid) const
Definition: PatchMap.h:96
BigReal min_a(int pid) const
Definition: PatchMap.h:91
int index_a(int pid) const
Definition: PatchMap.h:86
#define DebugM(x, y)
Definition: Debug.h:59
virtual void initialize()
Definition: Compute.h:56
Box< Patch, int > * registerLcpoTypePickup(Compute *cid)
Definition: Patch.C:188
Patch * patch(PatchID pid)
Definition: PatchMap.h:235
BigReal min_b(int pid) const
Definition: PatchMap.h:93
Box< Patch, Results > * forceBox[8]
Definition: ComputeLCPO.h:131
int gridsize_a(void) const
Definition: PatchMap.h:64
int valid[8][8]
Definition: ComputeLCPO.h:116
int numAtoms[8]
Definition: ComputeLCPO.h:115
int index_b(int pid) const
Definition: PatchMap.h:87
PatchID patchID[8]
Definition: ComputeLCPO.h:128
Box< Patch, CompAtom > * positionBox[8]
Definition: ComputeLCPO.h:130
BigReal max_b(int pid) const
Definition: PatchMap.h:94
int index_c(int pid) const
Definition: PatchMap.h:88
Patch * patch[8]
Definition: ComputeLCPO.h:126
BigReal max_a(int pid) const
Definition: PatchMap.h:92
int getNumAtoms()
Definition: Patch.h:105
int basePriority
Definition: Compute.h:37
BigReal min_c(int pid) const
Definition: PatchMap.h:95
int invalidPatch[8]
Definition: ComputeLCPO.h:118
int gridsize_b(void) const
Definition: PatchMap.h:65
Box< Patch, CompAtom > * registerPositionPickup(Compute *cid)
Definition: Patch.C:107
#define PATCH_PRIORITY(PID)
Definition: Priorities.h:25
Box< Patch, Results > * registerForceDeposit(Compute *cid)
Definition: Patch.C:228
int ComputeLCPO::noWork ( )
virtual

Reimplemented from Compute.

Definition at line 225 of file ComputeLCPO.C.

References forceBox, SubmitReduction::item(), lcpoTypeBox, Compute::ldObjHandle, LdbCoordinator::Object(), patch, positionBox, reduction, REDUCTION_COMPUTE_CHECKSUM, Box< Owner, Data >::skip(), LdbCoordinator::skipWork(), and SubmitReduction::submit().

225  {
226 
227  if ( patch[0]->flags.doNonbonded) {
228  return 0; // work to do, enqueue as usual
229  } else {
230 
231  // skip all boxes
232  for (int i=0; i<8; i++) {
233  positionBox[i]->skip();
234  forceBox[i]->skip();
235  lcpoTypeBox[i]->skip();
236  }
237 
239  reduction->submit();
241 
242  return 1; // no work to do, do not enqueue
243  }
244  return 0;
245 } // noWork
Box< Patch, int > * lcpoTypeBox[8]
Definition: ComputeLCPO.h:132
BigReal & item(int i)
Definition: ReductionMgr.h:312
LDObjHandle ldObjHandle
Definition: Compute.h:44
Box< Patch, Results > * forceBox[8]
Definition: ComputeLCPO.h:131
void skipWork(const LDObjHandle &handle)
Box< Patch, CompAtom > * positionBox[8]
Definition: ComputeLCPO.h:130
static LdbCoordinator * Object()
void skip(void)
Definition: Box.h:63
Patch * patch[8]
Definition: ComputeLCPO.h:126
void submit(void)
Definition: ReductionMgr.h:323
SubmitReduction * reduction
Definition: ComputeLCPO.h:137

Member Data Documentation

Results* ComputeLCPO::force[8]
protected

Definition at line 121 of file ComputeLCPO.h.

Referenced by doForce(), and doWork().

Box<Patch,Results>* ComputeLCPO::forceBox[8]
protected

Definition at line 131 of file ComputeLCPO.h.

Referenced by ComputeLCPO(), doWork(), initialize(), noWork(), and ~ComputeLCPO().

int ComputeLCPO::invalidPatch[8]
protected

Definition at line 118 of file ComputeLCPO.h.

Referenced by doForce(), and initialize().

int* ComputeLCPO::lcpoType[8]
protected

Definition at line 122 of file ComputeLCPO.h.

Referenced by doForce(), and doWork().

Box<Patch,int>* ComputeLCPO::lcpoTypeBox[8]
protected

Definition at line 132 of file ComputeLCPO.h.

Referenced by ComputeLCPO(), doWork(), initialize(), noWork(), and ~ComputeLCPO().

int ComputeLCPO::maxPart
protected

Definition at line 135 of file ComputeLCPO.h.

int ComputeLCPO::minPart
protected

Definition at line 135 of file ComputeLCPO.h.

Referenced by doForce().

int ComputeLCPO::numAtoms[8]
protected

Definition at line 115 of file ComputeLCPO.h.

Referenced by atomUpdate(), doForce(), initialize(), and ~ComputeLCPO().

int ComputeLCPO::numParts
protected

Definition at line 135 of file ComputeLCPO.h.

Referenced by doForce().

Patch* ComputeLCPO::patch[8]
protected

Definition at line 126 of file ComputeLCPO.h.

Referenced by atomUpdate(), ComputeLCPO(), doForce(), doWork(), initialize(), noWork(), and ~ComputeLCPO().

PatchID ComputeLCPO::patchID[8]
protected

Definition at line 128 of file ComputeLCPO.h.

Referenced by ComputeLCPO(), initialize(), and ~ComputeLCPO().

CompAtom* ComputeLCPO::pos[8]
protected

Definition at line 120 of file ComputeLCPO.h.

Referenced by doForce(), and doWork().

CompAtomExt* ComputeLCPO::posExt[8]
protected

Definition at line 119 of file ComputeLCPO.h.

Referenced by doForce(), and doWork().

Box<Patch,CompAtom>* ComputeLCPO::positionBox[8]
protected

Definition at line 130 of file ComputeLCPO.h.

Referenced by ComputeLCPO(), doWork(), initialize(), noWork(), and ~ComputeLCPO().

SubmitReduction* ComputeLCPO::reduction
protected

Definition at line 137 of file ComputeLCPO.h.

Referenced by ComputeLCPO(), doForce(), noWork(), and ~ComputeLCPO().

int ComputeLCPO::step
protected

Definition at line 123 of file ComputeLCPO.h.

Referenced by doForce().

int ComputeLCPO::trans[8]
protected

Definition at line 129 of file ComputeLCPO.h.

Referenced by ComputeLCPO().

int ComputeLCPO::valid[8][8]
protected

Definition at line 116 of file ComputeLCPO.h.

Referenced by doForce(), and initialize().

ComputeNonbondedWorkArrays* const ComputeLCPO::workArrays
protected

Definition at line 134 of file ComputeLCPO.h.


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