#include <ComputeLCPO.h>
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 () |
Protected Member Functions | |
virtual void | doForce () |
Protected Attributes | |
int | numAtoms [8] |
int | valid [8][8] |
int | invalidPatch [8] |
CompAtomExt * | posExt [8] |
CompAtom * | pos [8] |
Results * | force [8] |
int * | lcpoType [8] |
int | step |
Patch * | patch [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 |
SubmitReduction * | reduction |
Definition at line 100 of file ComputeLCPO.h.
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().
00039 : Compute(c), workArrays(_workArrays), 00040 minPart(minPartition), maxPart(maxPartition), 00041 strideIg(numPartitions), numParts(numPartitions), 00042 maxAtomRadius(1.9+1.4) 00043 { 00044 00045 reduction = ReductionMgr::Object()->willSubmit(REDUCTIONS_BASIC); 00046 00047 setNumPatches(8); 00048 SimParameters *simParams = Node::Object()->simParameters; 00049 surfTen = simParams->surface_tension; 00050 00051 for (int i=0; i<getNumPatches(); i++) { 00052 patchID[i] = p[i]; 00053 trans[i] = t[i]; 00054 patch[i] = NULL; 00055 positionBox[i] = NULL; 00056 forceBox[i] = NULL; 00057 lcpoTypeBox[i] = NULL; 00058 } // for all patches 00059 } // constructor
ComputeLCPO::~ComputeLCPO | ( | ) | [virtual] |
Definition at line 61 of file ComputeLCPO.C.
References Compute::cid, DebugM, forceBox, Compute::getNumPatches(), lcpoTypeBox, numAtoms, PatchMap::Object(), PatchMap::patch(), patch, patchID, positionBox, reduction, Patch::unregisterForceDeposit(), Patch::unregisterLcpoTypePickup(), and Patch::unregisterPositionPickup().
00061 { 00062 DebugM(4, "~ComputeLCPO("<<cid<<") numAtoms("<<patchID[0]<<") = " 00063 << numAtoms[0] 00064 << " numAtoms("<<patchID[1]<<") = " << numAtoms[1] << "\n" ); 00065 DebugM(4, "~ComputeLCPO("<<cid<<") addr("<<patchID[0]<<") = " 00066 << PatchMap::Object()->patch(patchID[0]) << " addr("<<patchID[1]<<") = " 00067 << PatchMap::Object()->patch(patchID[1]) << "\n"); 00068 00069 for (int i=0; i<getNumPatches(); i++) { 00070 if (positionBox[i] != NULL) { 00071 PatchMap::Object()->patch(patchID[i])->unregisterPositionPickup(this, 00072 &positionBox[i]); 00073 } 00074 if (forceBox[i] != NULL) { 00075 PatchMap::Object()->patch(patchID[i])->unregisterForceDeposit(this, 00076 &forceBox[i]); 00077 } 00078 if (lcpoTypeBox[i] != NULL) { 00079 PatchMap::Object()->patch(patchID[i])->unregisterLcpoTypePickup(this, 00080 &lcpoTypeBox[i]); 00081 } 00082 } 00083 delete reduction; 00084 } // destructor
void ComputeLCPO::atomUpdate | ( | void | ) | [virtual] |
Reimplemented from Compute.
Definition at line 193 of file ComputeLCPO.C.
References Patch::getNumAtoms(), numAtoms, and patch.
00193 { 00194 for (int i=0; i<8; i++) { 00195 numAtoms[i] = patch[i]->getNumAtoms(); 00196 } 00197 }
void ComputeLCPO::doForce | ( | ) | [protected, virtual] |
Definition at line 290 of file ComputeLCPO.C.
References calcOverlap(), Results::f, LCPOAtom::f, Patch::flags, FLOPS, force, CompAtom::hydrogenGroupSize, CompAtomExt::id, invalidPatch, SubmitReduction::item(), j, lcpoType, minPart, Results::nbond, LCPONeighborList::newlist(), Pairlists::newlist(), Pairlists::newsize(), LCPONeighborList::newsize(), LCPONeighborList::nextlist(), Pairlists::nextlist(), numAtoms, numParts, patch, PI, pos, posExt, CompAtom::position, LCPOAtom::r, reduction, REDUCTION_COMPUTE_CHECKSUM, REDUCTION_ELECT_ENERGY, LCPONeighborList::reset(), Pairlists::reset(), Flags::sequence, step, SubmitReduction::submit(), valid, LCPOAtom::x, Vector::x, LCPOAtom::y, Vector::y, LCPOAtom::z, and Vector::z.
Referenced by doWork().
00290 { 00291 //CkPrintf("ComputeLCPO::doForce\n"); 00292 step = patch[0]->flags.sequence; 00293 00294 Real probeRadius = 1.4f; 00295 Real cutMargin = 0.f;//regenerating pairlists every step 00296 00297 Position ngir, ngjr, ngkr; 00298 Real ri, rj, rk; 00299 BigReal dxij, dyij, dzij, r2ij; 00300 BigReal dxik, dyik, dzik, r2ik; 00301 BigReal dxjk, dyjk, dzjk, r2jk; 00302 00303 #ifdef COUNT_FLOPS 00304 int flops = 0; 00305 #endif 00306 00308 // Build Pairlists 00310 //generate pairlists every step since contain coordinates 00311 if ( true ) { 00312 double t_start = 1.0*clock()/CLOCKS_PER_SEC; 00313 00314 inAtomsPl.reset(); 00315 lcpoNeighborList.reset(); 00316 FLOPS(8); 00317 cut2 = 2*maxAtomRadius+cutMargin; cut2 *= cut2; 00318 maxAtomRadius = 0; 00319 //find in-bounds atoms in each patch 00320 for (int pI = 0; pI < 8; pI++) { 00321 if (invalidPatch[pI]) continue; 00322 if (numAtoms[pI] == 0) continue; 00323 00324 int minIg = 0; 00325 for (int s = 0; s < minPart; s++) { 00326 minIg += pos[pI][minIg].hydrogenGroupSize; 00327 FLOPS(1) 00328 } 00329 strideIg = numParts;//stride through partitions 00330 plint *inAtoms = inAtomsPl.newlist(numAtoms[pI]); 00331 int numAtomsInBounds = 0; 00332 00333 //iterate over heavy atoms only 00334 for ( int ngi = minIg; ngi < numAtoms[pI]; /* ngi */) { 00335 ngir = pos[pI][ngi].position; 00336 if ( isInBounds(ngir.x, ngir.y, ngir.z) && lcpoType[pI][ngi] > 0 ) { 00337 inAtoms[numAtomsInBounds++] = ngi; 00338 ri = probeRadius+lcpoParams[ lcpoType[pI][ngi] ][0]; 00339 maxAtomRadius = (ri > maxAtomRadius) ? ri : maxAtomRadius; 00340 FLOPS(1); 00341 00342 int maxAtoms = 0; 00343 for (int pJ = 0; pJ < 8; pJ++) { 00344 if (numAtoms[pJ] > 0) { 00345 maxAtoms += numAtoms[pJ]; 00346 } 00347 } 00348 LCPOAtom *lcpoNeighbors = lcpoNeighborList.newlist(maxAtoms); 00349 int numLcpoNeighbors = 0; 00350 00351 //find pairs of this inAtom from all 8 patches 00352 for (int pJ = 0; pJ < 8; pJ++) { 00353 if (invalidPatch[pJ]) continue; 00354 if (!valid[pI][pJ]) continue; 00355 00356 // j atom pairs 00357 for ( int ngj = 0; ngj < numAtoms[pJ]; /* ngj */) { 00358 FLOPS(1) 00359 ngjr = pos[pJ][ngj].position; 00360 dxij = ngir.x - ngjr.x; 00361 dyij = ngir.y - ngjr.y; 00362 dzij = ngir.z - ngjr.z; 00363 00364 // i-j coarse check if too far apart 00365 r2ij = dxij*dxij + dyij*dyij + dzij*dzij; 00366 FLOPS(8) 00367 if (r2ij < cut2 && r2ij > 0.01) { 00368 00369 // i-j precise check if too far apart 00370 rj = probeRadius+lcpoParams[ lcpoType[pJ][ngj] ][0]; 00371 FLOPS(5) 00372 BigReal rirjcutMargin2 = ri+rj+cutMargin; 00373 rirjcutMargin2 *= rirjcutMargin2; 00374 if (r2ij < rirjcutMargin2 && r2ij > 0.0001 && 00375 lcpoType[pJ][ngj] > 0) { 00376 lcpoNeighbors[numLcpoNeighbors].x = ngjr.x; 00377 lcpoNeighbors[numLcpoNeighbors].y = ngjr.y; 00378 lcpoNeighbors[numLcpoNeighbors].z = ngjr.z; 00379 lcpoNeighbors[numLcpoNeighbors].r = rj; 00380 lcpoNeighbors[numLcpoNeighbors].f = 00381 &force[pJ]->f[Results::nbond][ngj]; 00382 numLcpoNeighbors++; 00383 FLOPS(2) 00384 maxAtomRadius = (rj > maxAtomRadius) ? rj : maxAtomRadius; 00385 } // precise cutoff 00386 } // coarse cutoff 00387 //jump to next nonbonded group 00388 ngj += pos[pJ][ngj].hydrogenGroupSize; 00389 FLOPS(1) 00390 } // for j atoms 00391 } // for patches J 00392 lcpoNeighborList.newsize(numLcpoNeighbors); 00393 } // in bounds 00394 //jump to next nonbonded group for round-robin 00395 for (int s = 0; s < strideIg; s++) { 00396 ngi += pos[pI][ngi].hydrogenGroupSize; 00397 FLOPS(1) 00398 } 00399 } // for i atoms 00400 inAtomsPl.newsize(numAtomsInBounds); 00401 } // for patches I 00402 #ifdef COUNT_FLOPS 00403 double t_stop = 1.0*clock()/CLOCKS_PER_SEC; 00404 CkPrintf("LCPO_TIME_P %7.3f Gflops %9d @ %f\n", flops*1e-9/(t_stop-t_start),flops,(t_stop-t_start)); 00405 #endif 00406 } 00407 #ifdef COUNT_FLOPS 00408 double t_start = 1.0*clock()/CLOCKS_PER_SEC; 00409 flops = 0; 00410 #endif 00411 00412 //reset pairlists 00413 inAtomsPl.reset(); 00414 lcpoNeighborList.reset(); 00415 cut2 = maxAtomRadius*2; cut2 *= cut2; 00416 00417 //init values 00418 BigReal totalSurfaceArea = 0; 00419 00427 //for each patch in octet 00428 for (int pI = 0; pI < 8; pI++) { 00429 if (invalidPatch[pI]) continue; 00430 if (numAtoms[pI] == 0) continue; 00431 plint *inAtoms; 00432 int numInAtoms; 00433 inAtomsPl.nextlist( &inAtoms, &numInAtoms ); 00434 //for each inAtom in each patch 00435 for (int i = 0; i < numInAtoms; i++) { 00436 int iIndex = inAtoms[i]; 00437 int idi = posExt[pI][iIndex].id; 00438 Real xi = pos[pI][iIndex].position.x; 00439 Real yi = pos[pI][iIndex].position.y; 00440 Real zi = pos[pI][iIndex].position.z; 00441 const Real *lcpoParamI = lcpoParams[ lcpoType[pI][iIndex] ]; 00442 ri = probeRadius+lcpoParamI[0]; 00443 FLOPS(1) 00444 00445 Real P1 = lcpoParamI[1]; 00446 Real P2 = lcpoParamI[2]; 00447 Real P3 = lcpoParamI[3]; 00448 Real P4 = lcpoParamI[4]; 00449 00451 // S1 00453 BigReal S1 = 4.0*PI*ri*ri; // a 00454 FLOPS(3) 00455 00456 //for surface area calculation 00457 BigReal AijSum = 0; // b 00458 BigReal AjkSum = 0; // c 00459 BigReal AjkjSum = 0; // d' 00460 BigReal AijAjkSum = 0; // d 00461 00462 //for force calculation 00463 BigReal dAijdrijdxiSum = 0.0; 00464 BigReal dAijdrijdyiSum = 0.0; 00465 BigReal dAijdrijdziSum = 0.0; 00466 BigReal dAijdrijdxiAjkSum = 0.0; 00467 BigReal dAijdrijdyiAjkSum = 0.0; 00468 BigReal dAijdrijdziAjkSum = 0.0; 00469 00471 // for J Atoms 00473 LCPOAtom *lcpoNeighbors; 00474 int numLcpoNeighbors; 00475 lcpoNeighborList.nextlist( &lcpoNeighbors, &numLcpoNeighbors ); 00476 00477 for (int j = 0; j < numLcpoNeighbors; j++) { 00478 Real xj = lcpoNeighbors[j].x; 00479 Real yj = lcpoNeighbors[j].y; 00480 Real zj = lcpoNeighbors[j].z; 00481 Real rj = lcpoNeighbors[j].r; 00482 00483 // i-j coarse check if too far away 00484 dxij = xj-xi; 00485 dyij = yj-yi; 00486 dzij = zj-zi; 00487 r2ij = dxij*dxij + dyij*dyij + dzij*dzij; 00488 FLOPS(7); 00489 if (r2ij >= cut2 || r2ij < 0.01) { continue; } 00490 00491 // i-j precise check if too far away 00492 FLOPS(5) 00493 BigReal rirj2 = ri+rj; 00494 rirj2 *= rirj2; 00495 if ( r2ij >= rirj2 ) { continue; } 00496 00497 BigReal rij = sqrt(r2ij); 00498 BigReal rij_1 = 1.f / rij; 00499 00501 // S2 00503 BigReal Aij = calcOverlap(rij, ri, rj); 00504 AijSum += Aij; 00505 FLOPS(12) 00506 00507 //for dAi_drj force calculation 00508 BigReal dAijdrij = PI*ri*(rij_1*rij_1*(ri*ri-rj*rj)-1); 00509 BigReal dAijdrijdxj = dAijdrij*dxij*rij_1; // g k' i' l' 00510 BigReal dAijdrijdyj = dAijdrij*dyij*rij_1; 00511 BigReal dAijdrijdzj = dAijdrij*dzij*rij_1; 00512 FLOPS(14) 00513 00514 BigReal AjkjSum = 0; // i' l' 00515 BigReal dAjkdrjkdxjSum = 0.0; 00516 BigReal dAjkdrjkdyjSum = 0.0; 00517 BigReal dAjkdrjkdzjSum = 0.0; 00518 00520 // for K Atoms 00522 for (int k = 0; k < numLcpoNeighbors; k++) { 00523 Real xk = lcpoNeighbors[k].x; 00524 Real yk = lcpoNeighbors[k].y; 00525 Real zk = lcpoNeighbors[k].z; 00526 Real rk = lcpoNeighbors[k].r; 00527 00528 // i-k coarse check if too far away 00529 dxik = xk-xi; 00530 dyik = yk-yi; 00531 dzik = zk-zi; 00532 r2ik = dxik*dxik + dyik*dyik + dzik*dzik; 00533 FLOPS(8) 00534 if (r2ik >= cut2 || r2ik < 0.01) { continue; } 00535 00536 // j-k coarse check if too far away 00537 dxjk = xk-xj; 00538 dyjk = yk-yj; 00539 dzjk = zk-zj; 00540 r2jk = dxjk*dxjk + dyjk*dyjk + dzjk*dzjk; 00541 FLOPS(8) 00542 if (r2jk >= cut2 || r2jk < 0.01) { continue; } 00543 00544 // i-k precise check if too far away 00545 FLOPS(3) 00546 BigReal rirk2 = ri+rk; 00547 rirk2 *= rirk2; 00548 if ( r2ik >= rirk2 ) { continue; } 00549 00550 // j-k precise check if too far away 00551 FLOPS(2) 00552 BigReal rjrk2 = rj+rk; 00553 rjrk2 *= rjrk2; 00554 if ( r2jk >= rjrk2 ) { continue; } 00555 BigReal rjk = sqrt(r2jk); 00556 00558 // S3 00560 BigReal rjk_1 = 1.0/rjk; 00561 BigReal Ajk = calcOverlap(rjk, rj, rk); 00562 FLOPS(12) 00563 AjkSum += Ajk; 00564 AjkjSum += Ajk; // i' l' 00565 FLOPS(5) 00566 00568 // Force dAi_drk 00570 BigReal dAjkdrjk = PI*rj*rjk_1*(rjk_1*rjk_1*(rj*rj-rk*rk) - 1.f);//ef' 00571 BigReal dAjkdrjkdxj = -dAjkdrjk*dxjk; // e f h' 00572 BigReal dAjkdrjkdyj = -dAjkdrjk*dyjk; 00573 BigReal dAjkdrjkdzj = -dAjkdrjk*dzjk; 00574 lcpoNeighbors[k].f->x -= -dAjkdrjkdxj*(P3+P4*Aij)*surfTen; // e f 00575 lcpoNeighbors[k].f->y -= -dAjkdrjkdyj*(P3+P4*Aij)*surfTen; 00576 lcpoNeighbors[k].f->z -= -dAjkdrjkdzj*(P3+P4*Aij)*surfTen; 00577 00578 dAjkdrjkdxjSum += dAjkdrjkdxj; // h j' 00579 dAjkdrjkdyjSum += dAjkdrjkdyj; 00580 dAjkdrjkdzjSum += dAjkdrjkdzj; 00581 FLOPS(34) 00582 00583 } // k atoms 00585 // S4 00587 AijAjkSum += Aij*AjkjSum; 00588 00590 // Force dAi_drj 00592 BigReal lastxj = dAijdrijdxj*AjkjSum + Aij*dAjkdrjkdxjSum; // i j 00593 BigReal lastyj = dAijdrijdyj*AjkjSum + Aij*dAjkdrjkdyjSum; 00594 BigReal lastzj = dAijdrijdzj*AjkjSum + Aij*dAjkdrjkdzjSum; 00595 BigReal dAidxj = (P2*dAijdrijdxj + P3*dAjkdrjkdxjSum + P4*lastxj);//ghij 00596 BigReal dAidyj = (P2*dAijdrijdyj + P3*dAjkdrjkdyjSum + P4*lastyj); 00597 BigReal dAidzj = (P2*dAijdrijdzj + P3*dAjkdrjkdzjSum + P4*lastzj); 00598 lcpoNeighbors[j].f->x -= dAidxj*surfTen; 00599 lcpoNeighbors[j].f->y -= dAidyj*surfTen; 00600 lcpoNeighbors[j].f->z -= dAidzj*surfTen; 00601 00602 //for dAi_dri force calculation 00603 dAijdrijdxiSum -= dAijdrijdxj; // k 00604 dAijdrijdyiSum -= dAijdrijdyj; 00605 dAijdrijdziSum -= dAijdrijdzj; 00606 dAijdrijdxiAjkSum -= dAijdrijdxj*AjkjSum; // l 00607 dAijdrijdyiAjkSum -= dAijdrijdyj*AjkjSum; 00608 dAijdrijdziAjkSum -= dAijdrijdzj*AjkjSum; 00609 FLOPS(41) 00610 } // j atoms 00611 00613 // Force dAi_dri 00615 BigReal dAidxi = (P2*dAijdrijdxiSum + P4*dAijdrijdxiAjkSum); // k l 00616 BigReal dAidyi = (P2*dAijdrijdyiSum + P4*dAijdrijdyiAjkSum); 00617 BigReal dAidzi = (P2*dAijdrijdziSum + P4*dAijdrijdziAjkSum); 00618 force[pI]->f[Results::nbond][iIndex].x -= dAidxi*surfTen; 00619 force[pI]->f[Results::nbond][iIndex].y -= dAidyi*surfTen; 00620 force[pI]->f[Results::nbond][iIndex].z -= dAidzi*surfTen; 00621 00623 // Atom I Surface Area 00625 BigReal SAi = P1*S1 + P2*AijSum + P3*AjkSum + P4*AijAjkSum; 00626 //CkPrintf("SurfArea[%05d] = % 7.3f\n",idi,SAi); 00627 //SAi = (SAi > 0) ? SAi : 0; 00628 totalSurfaceArea += SAi; 00629 FLOPS(22) 00630 } // for inAtoms 00631 } // for patches I 00632 #ifdef COUNT_FLOPS 00633 double t_stop = 1.0*clock()/CLOCKS_PER_SEC; 00634 CkPrintf("LCPO_TIME_F %7.3f Gflops %9d @ %f\n", 1e-9*flops/(t_stop-t_start),flops, (t_stop-t_start)); 00635 #endif 00636 00638 // end calculation by submitting reduction 00640 00641 reduction->item(REDUCTION_COMPUTE_CHECKSUM) += 1.; 00642 reduction->item(REDUCTION_ELECT_ENERGY) += totalSurfaceArea * surfTen; 00643 reduction->submit(); 00644 00645 }//end do Force
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().
00202 { 00203 LdbCoordinator::Object()->startWork(ldObjHandle); 00204 for (int i=0; i<8; i++) { 00205 pos[i] = positionBox[i]->open(); 00206 force[i] = forceBox[i]->open(); 00207 posExt[i] = patch[i]->getCompAtomExtInfo(); 00208 lcpoType[i] = lcpoTypeBox[i]->open(); 00209 } 00210 00211 doForce(); 00212 00213 // Inform load balancer 00214 LdbCoordinator::Object()->endWork(ldObjHandle); 00215 00216 // Close up boxes 00217 for (int i=0; i<getNumPatches(); i++) { 00218 positionBox[i]->close(&pos[i]); 00219 forceBox[i]->close(&force[i]); 00220 lcpoTypeBox[i]->close(&lcpoType[i]); 00221 } 00222 } // doWork
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(), invalidPatch, lcpoTypeBox, PatchMap::max_a(), PatchMap::max_b(), PatchMap::max_c(), PatchMap::min_a(), PatchMap::min_b(), PatchMap::min_c(), numAtoms, PatchMap::Object(), PatchMap::patch(), patch, PATCH_PRIORITY, patchID, positionBox, PROXY_RESULTS_PRIORITY, Patch::registerForceDeposit(), Patch::registerLcpoTypePickup(), Patch::registerPositionPickup(), and valid.
00086 { 00087 Compute::initialize(); 00088 // How can we tell if BoxOwner has packed up and left? Need a mechanism 00089 // to handle this or do we assume the Boxes have been dumped? 00090 PatchMap *patchMap = PatchMap::Object(); 00091 //Check out Boxes 00092 for (int i=0; i<8; i++) { 00093 //invalid patch so don't even checkout boxes 00094 if (positionBox[i] == NULL) { // We have yet to get boxes 00095 patch[i] = PatchMap::Object()->patch(patchID[i]); 00096 if (!(patch[i] = PatchMap::Object()->patch(patchID[i]))) { 00097 DebugM(5,"invalid patch(" << patchID[i] 00098 << ") pointer!\n"); 00099 } 00100 positionBox[i] = patch[i]->registerPositionPickup(this); 00101 forceBox[i] = patch[i]->registerForceDeposit(this); 00102 lcpoTypeBox[i] = patch[i]->registerLcpoTypePickup(this); 00103 // will need to open a box full of lcpo parameters 00104 } 00105 numAtoms[i] = patch[i]->getNumAtoms(); 00106 } // for all patches 00107 00108 // set priority 00109 basePriority = PATCH_PRIORITY(patchID[0]) + PROXY_RESULTS_PRIORITY; 00110 00111 //get bounds of inner rectangular prism in octet 00112 bounds[0][0] = 0.5*(patchMap->min_a(patchID[0])+patchMap->max_a(patchID[0])); 00113 bounds[1][0] = 0.5*(patchMap->min_b(patchID[0])+patchMap->max_b(patchID[0])); 00114 bounds[2][0] = 0.5*(patchMap->min_c(patchID[0])+patchMap->max_c(patchID[0])); 00115 bounds[0][1] = 0.5*(patchMap->min_a(patchID[7])+patchMap->max_a(patchID[7])); 00116 bounds[1][1] = 0.5*(patchMap->min_b(patchID[7])+patchMap->max_b(patchID[7])); 00117 bounds[2][1] = 0.5*(patchMap->min_c(patchID[7])+patchMap->max_c(patchID[7])); 00118 00119 //if only 1 patch in a dimenion, invalidate those patches 00120 int gsa = patchMap->gridsize_a(); 00121 int gsb = patchMap->gridsize_b(); 00122 int gsc = patchMap->gridsize_c(); 00123 invalidPatch[0] = 0; 00124 invalidPatch[1] = 0; 00125 invalidPatch[2] = 0; 00126 invalidPatch[3] = 0; 00127 invalidPatch[4] = 0; 00128 invalidPatch[5] = 0; 00129 invalidPatch[6] = 0; 00130 invalidPatch[7] = 0; 00131 00132 if (gsa==1) { 00133 //CkPrintf("ONLY 1 PATCH in A DIMENSION!\n"); 00134 invalidPatch[1] = 1; 00135 invalidPatch[3] = 1; 00136 invalidPatch[5] = 1; 00137 invalidPatch[7] = 1; 00138 } 00139 if (gsb==1) { 00140 //CkPrintf("ONLY 1 PATCH in B DIMENSION!\n"); 00141 invalidPatch[2] = 1; 00142 invalidPatch[3] = 1; 00143 invalidPatch[6] = 1; 00144 invalidPatch[7] = 1; 00145 } 00146 if (gsc==1) { 00147 //CkPrintf("ONLY 1 PATCH in C DIMENSION!\n"); 00148 invalidPatch[4] = 1; 00149 invalidPatch[5] = 1; 00150 invalidPatch[6] = 1; 00151 invalidPatch[7] = 1; 00152 } 00153 //relative a,b,c index for 8 patches in ComputeLCPO 00154 int idx[8][3] = { 00155 { 0, 0, 0}, 00156 { 1, 0, 0}, 00157 { 0, 1, 0}, 00158 { 1, 1, 0}, 00159 { 0, 0, 1}, 00160 { 1, 0, 1}, 00161 { 0, 1, 1}, 00162 { 1, 1, 1} }; 00163 /* 00164 int i_a = patchMap->index_a(patchID[0]); 00165 int i_b = patchMap->index_b(patchID[0]); 00166 int i_c = patchMap->index_c(patchID[0]); 00167 CkPrintf("VALID[%d,%d,%d]=\n",i_a,i_b,i_c); 00168 */ 00169 for (int pI = 0; pI < 8; pI++) { 00170 int iia = patchMap->index_a(patchID[pI]); 00171 int iib = patchMap->index_b(patchID[pI]); 00172 int iic = patchMap->index_c(patchID[pI]); 00173 for (int pJ = 0; pJ < 8; pJ++) { 00174 int jia = patchMap->index_a(patchID[pJ]); 00175 int jib = patchMap->index_b(patchID[pJ]); 00176 int jic = patchMap->index_c(patchID[pJ]); 00177 if ( ( gsa==1 && (jia>iia) != (idx[pJ][0]>idx[pI][0]) ) || 00178 ( gsb==1 && (jib>iib) != (idx[pJ][1]>idx[pI][1]) ) || 00179 ( gsc==1 && (jic>iic) != (idx[pJ][2]>idx[pI][2]) ) || 00180 ( invalidPatch[pI] ) || 00181 ( invalidPatch[pJ] ) ) 00182 valid[pI][pJ] = 0; 00183 else 00184 valid[pI][pJ] = 1; 00185 //CkPrintf("%d ",valid[pI][pJ]); 00186 } 00187 //CkPrintf("\n"); 00188 } 00189 //CkPrintf("\n"); 00190 00191 } // initialize
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().
00225 { 00226 00227 if ( patch[0]->flags.doNonbonded) { 00228 return 0; // work to do, enqueue as usual 00229 } else { 00230 00231 // skip all boxes 00232 for (int i=0; i<8; i++) { 00233 positionBox[i]->skip(); 00234 forceBox[i]->skip(); 00235 lcpoTypeBox[i]->skip(); 00236 } 00237 00238 reduction->item(REDUCTION_COMPUTE_CHECKSUM) += 1.; 00239 reduction->submit(); 00240 LdbCoordinator::Object()->skipWork(ldObjHandle); 00241 00242 return 1; // no work to do, do not enqueue 00243 } 00244 return 0; 00245 } // noWork
Results* ComputeLCPO::force[8] [protected] |
Definition at line 121 of file ComputeLCPO.h.
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.
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.
CompAtomExt* ComputeLCPO::posExt[8] [protected] |
Definition at line 119 of file ComputeLCPO.h.
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.