#include <WorkDistrib.h>
Inheritance diagram for WorkDistrib:

|
|
Definition at line 75 of file WorkDistrib.C. 00076 {
00077 CpvAccess(BOCclass_group).workDistrib = thisgroup;
00078 mapsArrived = false;
00079 awaitingMaps = false;
00080 }
|
|
|
Definition at line 83 of file WorkDistrib.C. 00084 { }
|
|
|
Definition at line 892 of file WorkDistrib.C. References Patch::getNumAtoms(), Node::molecule, NAMD_die(), PatchMap::node(), Molecule::numAtoms, Node::numNodes(), PatchMap::numPatches(), Node::Object(), PatchMap::Object(), and PatchMap::patch(). Referenced by Node::startup(). 00893 {
00894 int method=1;
00895
00896 PatchMap *patchMap = PatchMap::Object();
00897 int nNodes = Node::Object()->numNodes();
00898
00899 #if USE_TOPOMAP
00900 TopoManager tmgr;
00901 int nBGLNodes = tmgr.getDimNX() * tmgr.getDimNY() * tmgr.getDimNZ();
00902 if (nBGLNodes > patchMap->numPatches() && (assignPatchesTopoGridRecBisection() > 0)) {
00903 CkPrintf ("Blue Gene/L topology partitioner finished successfully \n");
00904 }
00905 else
00906 #endif
00907 if (nNodes > patchMap->numPatches())
00908 assignPatchesBitReversal();
00909 // else if (nNodes == patchMap->numPatches())
00910 // assignPatchesRoundRobin();
00911 else if (method==1)
00912 assignPatchesRecursiveBisection();
00913 else
00914 assignPatchesToLowestLoadNode();
00915
00916 int *nAtoms = new int[nNodes];
00917 int numAtoms=0;
00918 int i;
00919 for(i=0; i < nNodes; i++)
00920 nAtoms[i] = 0;
00921
00922 for(i=0; i < patchMap->numPatches(); i++)
00923 {
00924 // iout << iINFO << "Patch " << i << " has "
00925 // << patchMap->patch(i)->getNumAtoms() << " atoms and "
00926 // << patchMap->patch(i)->getNumAtoms() *
00927 // patchMap->patch(i)->getNumAtoms()
00928 // << " pairs.\n" << endi;
00929
00930 if (patchMap->patch(i)) {
00931 numAtoms += patchMap->patch(i)->getNumAtoms();
00932 nAtoms[patchMap->node(i)] += patchMap->patch(i)->getNumAtoms();
00933 }
00934 }
00935
00936 // for(i=0; i < nNodes; i++)
00937 // iout << iINFO
00938 // << nAtoms[i] << " atoms assigned to node " << i << "\n" << endi;
00939 if ( numAtoms != Node::Object()->molecule->numAtoms ) {
00940 NAMD_die("Incorrect atom count in WorkDistrib::assignNodeToPatch\n");
00941 }
00942
00943 delete [] nAtoms;
00944
00945 // PatchMap::Object()->printPatchMap();
00946 }
|
|
|
Definition at line 142 of file WorkDistrib.C. References PatchMap::assignToPatch(), PDB::get_position_for_atom(), PatchMap::getTmpPatchAtomsList(), Molecule::hydrogenGroup, SimParameters::lattice, Node::molecule, PDB::num_atoms(), PatchMap::numPatches(), PatchMap::Object(), Node::pdb, Position, Node::simParameters, and SimParameters::splitPatch. Referenced by preCreateHomePatches(). 00142 {
00143 StringList *current;
00144 int i;
00145 CProxy_Node nd(CpvAccess(BOCclass_group).node);
00146 Node *node = nd.ckLocalBranch();
00147 PatchMap *patchMap = PatchMap::Object();
00148 CProxy_PatchMgr pm(CpvAccess(BOCclass_group).patchMgr);
00149 PatchMgr *patchMgr = pm.ckLocalBranch();
00150 SimParameters *params = node->simParameters;
00151 Molecule *molecule = node->molecule;
00152 PDB *pdb = node->pdb;
00153
00154 int numPatches = patchMap->numPatches();
00155 int numAtoms = pdb->num_atoms();
00156
00157 vector<int> *eachPatchAtomList = patchMap->getTmpPatchAtomsList();
00158
00159 int *patchAtomCnt = new int[numPatches];
00160 memset(patchAtomCnt, 0, sizeof(int)*numPatches);
00161
00162 const Lattice lattice = params->lattice;
00163
00164 Position eachAtomPos;
00165 if (params->splitPatch == SPLIT_PATCH_HYDROGEN)
00166 {
00167 // split atoms into patched based on helix-group and position
00168 int aid, pid=0;
00169 for(i=0; i < numAtoms; i++)
00170 {
00171 // Assign atoms to patches without splitting hydrogen groups.
00172 // We know that the hydrogenGroup array is sorted with group parents
00173 // listed first. Thus, only change the pid if an atom is a group parent.
00174 aid = molecule->hydrogenGroup[i].atomID;
00175 pdb->get_position_for_atom(&eachAtomPos, aid);
00176 if (molecule->hydrogenGroup[i].isGP)
00177 pid = patchMap->assignToPatch(eachAtomPos,lattice);
00178 // else: don't change pid
00179 patchAtomCnt[pid]++;
00180 eachPatchAtomList[pid].push_back(aid);
00181 }
00182 }
00183 else
00184 {
00185 // split atoms into patched based on position
00186 for(i=0; i < numAtoms; i++)
00187 {
00188 pdb->get_position_for_atom(&eachAtomPos, i);
00189 int pid = patchMap->assignToPatch(eachAtomPos,lattice);
00190 patchAtomCnt[pid]++;
00191 eachPatchAtomList[pid].push_back(i);
00192 }
00193 }
00194
00195 return patchAtomCnt;
00196 }
|
|
|
Definition at line 201 of file WorkDistrib.C. References ResizeArray< Elem >::add(), Lattice::apply_transform(), PatchMap::assignToPatch(), Molecule::atomcharge(), CompAtom::atomFixed, Molecule::atommass(), Molecule::atomvdwtype(), ResizeArray< Elem >::begin(), Bool, CompAtom::charge, SimParameters::comMove, Node::configList, StringList::data, DebugM, SimParameters::fepOn, ConfigList::find(), FullAtom::fixedPosition, FullAtomList, PDB::get_all_positions(), Molecule::get_fep_type(), Molecule::get_groupSize(), CompAtom::groupFixed, Molecule::hydrogenGroup, CompAtom::hydrogenGroupSize, CompAtom::id, SimParameters::initialTemp, iout, Molecule::is_atom_fixed(), Molecule::is_hydrogenGroupParent(), SimParameters::lattice, SimParameters::lesOn, FullAtom::mass, PatchMap::max_a(), PatchMap::max_b(), PatchMap::max_c(), PatchMap::min_a(), PatchMap::min_b(), PatchMap::min_c(), Node::molecule, NAMD_bug(), Lattice::nearest(), CompAtom::nonbondedGroupIsAtom, PDB::num_atoms(), PatchMap::numPatches(), PatchMap::Object(), SimParameters::outputPatchDetails, SimParameters::pairInteractionOn, CompAtom::partition, Node::pdb, CompAtom::position, Position, SimParameters::pressureProfileAtomTypes, ScaledPosition, Node::simParameters, ResizeArray< Elem >::size(), SimParameters::splitPatch, SimParameters::thermInt, FullAtom::transform, FullAtom::velocity, and Velocity. Referenced by createHomePatches(), and reinitAtoms(). 00202 {
00203 int i;
00204 StringList *current; // Pointer used to retrieve configuration items
00205 CProxy_Node nd(CpvAccess(BOCclass_group).node);
00206 Node *node = nd.ckLocalBranch();
00207 PatchMap *patchMap = PatchMap::Object();
00208 CProxy_PatchMgr pm(CpvAccess(BOCclass_group).patchMgr);
00209 PatchMgr *patchMgr = pm.ckLocalBranch();
00210 SimParameters *params = node->simParameters;
00211 Molecule *molecule = node->molecule;
00212 PDB *pdb = node->pdb;
00213
00214 int numPatches = patchMap->numPatches();
00215 int numAtoms = pdb->num_atoms();
00216
00217 Vector *positions = new Position[numAtoms];
00218 pdb->get_all_positions(positions);
00219
00220 Vector *velocities = new Velocity[numAtoms];
00221
00222 if ( params->initialTemp < 0.0 ) {
00223 Bool binvels=FALSE;
00224
00225 // Reading the veolcities from a PDB
00226 current = node->configList->find("velocities");
00227
00228 if (current == NULL) {
00229 current = node->configList->find("binvelocities");
00230 binvels = TRUE;
00231 }
00232
00233 if (!binvels) {
00234 velocities_from_PDB(current->data, velocities, numAtoms);
00235 }
00236 else {
00237 velocities_from_binfile(current->data, velocities, numAtoms);
00238 }
00239 }
00240 else {
00241 // Random velocities for a given temperature
00242 random_velocities(params->initialTemp, molecule, velocities, numAtoms);
00243 }
00244
00245 // If COMMotion == no, remove center of mass motion
00246 if (!(params->comMove)) {
00247 remove_com_motion(velocities, molecule, numAtoms);
00248 }
00249
00250 FullAtomList *atoms = new FullAtomList[numPatches];
00251
00252 const Lattice lattice = params->lattice;
00253
00254 if (params->splitPatch == SPLIT_PATCH_HYDROGEN)
00255 {
00256 // split atoms into patched based on helix-group and position
00257 int aid, pid=0;
00258 for(i=0; i < numAtoms; i++)
00259 {
00260 if ( ! ( i % 1000 ) )
00261 {
00262 DebugM(3,"Assigned " << i << " atoms to patches so far.\n");
00263 }
00264 // Assign atoms to patches without splitting hydrogen groups.
00265 // We know that the hydrogenGroup array is sorted with group parents
00266 // listed first. Thus, only change the pid if an atom is a group parent.
00267 aid = molecule->hydrogenGroup[i].atomID;
00268 if (molecule->hydrogenGroup[i].isGP)
00269 pid = patchMap->assignToPatch(positions[aid],lattice);
00270 // else: don't change pid
00271 FullAtom a;
00272 a.id = aid;
00273 a.position = positions[aid];
00274 a.velocity = velocities[aid];
00275 #ifdef MEM_OPT_VERSION
00276 a.sigId = molecule->getAtomSigId(aid);
00277 a.exclId = molecule->getAtomExclSigId(aid);
00278 a.vdwType = molecule->atomvdwtype(aid);
00279 #endif
00280 atoms[pid].add(a);
00281 }
00282 }
00283 else
00284 {
00285 // split atoms into patched based on position
00286 for(i=0; i < numAtoms; i++)
00287 {
00288 if ( ! ( i % 1000 ) )
00289 {
00290 DebugM(3,"Assigned " << i << " atoms to patches so far.\n");
00291 }
00292 int pid = patchMap->assignToPatch(positions[i],lattice);
00293 FullAtom a;
00294 a.id = i;
00295 a.position = positions[i];
00296 a.velocity = velocities[i];
00297 #ifdef MEM_OPT_VERSION
00298 a.sigId = molecule->getAtomSigId(i);
00299 a.exclId = molecule->getAtomExclSigId(i);
00300 a.vdwType = molecule->atomvdwtype(i);
00301 #endif
00302 atoms[pid].add(a);
00303 }
00304 }
00305
00306 delete [] positions;
00307 delete [] velocities;
00308
00309 for(i=0; i < numPatches; i++)
00310 {
00311 ScaledPosition center(0.5*(patchMap->min_a(i)+patchMap->max_a(i)),
00312 0.5*(patchMap->min_b(i)+patchMap->max_b(i)),
00313 0.5*(patchMap->min_c(i)+patchMap->max_c(i)));
00314
00315 int n = atoms[i].size();
00316 FullAtom *a = atoms[i].begin();
00317 int j;
00318 //Modifications for alchemical fep
00319 //SD & CC, CNRS - LCTN, Nancy
00320 Bool fepOn = params->fepOn;
00321 Bool thermInt = params->thermInt;
00322 //fepe
00323 Bool lesOn = params->lesOn;
00324
00325 Bool pairInteractionOn = params->pairInteractionOn;
00326
00327 Bool pressureProfileTypes = (params->pressureProfileAtomTypes > 1);
00328
00329 Transform mother_transform;
00330 for(j=0; j < n; j++)
00331 {
00332 int aid = a[j].id;
00333
00334 if (params->splitPatch == SPLIT_PATCH_HYDROGEN) {
00335 if ( molecule->is_hydrogenGroupParent(aid) ) {
00336 a[j].hydrogenGroupSize = molecule->get_groupSize(aid);
00337 } else {
00338 a[j].hydrogenGroupSize = 0;
00339 }
00340 } else {
00341 a[j].hydrogenGroupSize = 1;
00342 }
00343
00344 a[j].nonbondedGroupIsAtom = 0;
00345
00346 a[j].atomFixed = molecule->is_atom_fixed(aid) ? 1 : 0;
00347 a[j].fixedPosition = a[j].position;
00348
00349 if ( a[j].hydrogenGroupSize ) {
00350 a[j].position = lattice.nearest(
00351 a[j].position, center, &(a[j].transform));
00352 mother_transform = a[j].transform;
00353 } else {
00354 a[j].position = lattice.apply_transform(a[j].position,mother_transform);
00355 a[j].transform = mother_transform;
00356 }
00357
00358 a[j].mass = molecule->atommass(aid);
00359 a[j].charge = molecule->atomcharge(aid);
00360
00361 //Modifications for alchemical fep
00362 //SD & CC, CNRS - LCTN, Nancy
00363 if ( fepOn || thermInt || lesOn || pairInteractionOn || pressureProfileTypes) {
00364 a[j].partition = molecule->get_fep_type(aid);
00365 }
00366 else {
00367 a[j].partition = 0;
00368 }
00369 //fepe
00370
00371 }
00372
00373 int size, allfixed, k;
00374 for(j=0; j < n; j+=size) {
00375 size = a[j].hydrogenGroupSize;
00376 if ( ! size ) {
00377 NAMD_bug("Mother atom with hydrogenGroupSize of 0!");
00378 }
00379 allfixed = 1;
00380 for ( k = 0; k < size; ++k ) {
00381 allfixed = ( allfixed && (a[j+k].atomFixed) );
00382 }
00383 for ( k = 0; k < size; ++k ) {
00384 a[j+k].groupFixed = allfixed ? 1 : 0;
00385 }
00386 }
00387
00388 if ( params->outputPatchDetails ) {
00389 int patchId = i;
00390 int numAtomsInPatch = n;
00391 int numFixedAtomsInPatch = 0;
00392 int numAtomsInFixedGroupsInPatch = 0;
00393 for(j=0; j < n; j++) {
00394 numFixedAtomsInPatch += ( a[j].atomFixed ? 1 : 0 );
00395 numAtomsInFixedGroupsInPatch += ( a[j].groupFixed ? 1 : 0 );
00396 }
00397 iout << "PATCH_DETAILS:"
00398 << " patch " << patchId
00399 << " atoms " << numAtomsInPatch
00400 << " fixed_atoms " << numFixedAtomsInPatch
00401 << " fixed_groups " << numAtomsInFixedGroupsInPatch
00402 << "\n" << endi;
00403 }
00404 }
00405
00406 return atoms;
00407
00408 }
|
|
|
Definition at line 452 of file WorkDistrib.C. References createAtomLists(), PatchMgr::createHomePatch(), DebugM, FullAtomList, iINFO(), iout, PatchMap::numPatches(), PatchMap::Object(), and ResizeArray< Elem >::size(). Referenced by Node::startup(). 00453 {
00454 int i;
00455 PatchMap *patchMap = PatchMap::Object();
00456 CProxy_PatchMgr pm(CpvAccess(BOCclass_group).patchMgr);
00457 PatchMgr *patchMgr = pm.ckLocalBranch();
00458
00459 int numPatches = patchMap->numPatches();
00460
00461 FullAtomList *atoms = createAtomLists();
00462
00463 #ifdef MEM_OPT_VERSION
00464 /* CProxy_Node nd(CpvAccess(BOCclass_group).node);
00465 Node *node = nd.ckLocalBranch();
00466 node->molecule->delEachAtomSigs();
00467 node->molecule->delMassChargeSpace();
00468 */
00469 #endif
00470
00471 int maxAtoms = -1;
00472 int maxPatch = -1;
00473 for(i=0; i < numPatches; i++) {
00474 int numAtoms = atoms[i].size();
00475 if ( numAtoms > maxAtoms ) { maxAtoms = numAtoms; maxPatch = i; }
00476 }
00477 iout << iINFO << "LARGEST PATCH (" << maxPatch <<
00478 ") HAS " << maxAtoms << " ATOMS\n" << endi;
00479
00480 for(i=0; i < numPatches; i++)
00481 {
00482 if ( ! ( i % 100 ) )
00483 {
00484 DebugM(3,"Created " << i << " patches so far.\n");
00485 }
00486
00487 patchMgr->createHomePatch(i,atoms[i]);
00488 }
00489
00490 delete [] atoms;
00491 }
|
|
|
Definition at line 696 of file WorkDistrib.C. References DebugM, PatchMgr::movePatch(), Node::myid(), PatchMap::node(), PatchMap::numPatches(), PatchMap::Object(), and PatchMgr::sendMovePatches(). Referenced by Node::startup(). 00696 {
00697 // ref BOC
00698 CProxy_Node nd(CpvAccess(BOCclass_group).node);
00699 Node *node = nd.ckLocalBranch();
00700 CProxy_PatchMgr pm(CpvAccess(BOCclass_group).patchMgr);
00701 PatchMgr *patchMgr = pm.ckLocalBranch();
00702 // ref singleton
00703 PatchMap *patchMap = PatchMap::Object();
00704
00705 // Move patches to the proper node
00706 for(int i=0;i < patchMap->numPatches(); i++)
00707 {
00708 if (patchMap->node(i) != node->myid() )
00709 {
00710 DebugM(3,"patchMgr->movePatch("
00711 << i << "," << patchMap->node(i) << ")\n");
00712 patchMgr->movePatch(i,patchMap->node(i));
00713 }
00714 }
00715 patchMgr->sendMovePatches();
00716 }
|
|
|
Definition at line 134 of file WorkDistrib.C. 00134 {
00135 if (!--saveComputeMapCount) {
00136 CkSendMsgBranch(saveComputeMapReturnEP, CkAllocMsg(0,0,0), 0, saveComputeMapReturnChareID);
00137 }
00138 }
|
|
|
Definition at line 1588 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01588 {
01589 msg->compute->doWork();
01590 if ( msg->compute->localWorkMsg != msg )
01591 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01592 }
|
|
|
Definition at line 1582 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01582 {
01583 msg->compute->doWork();
01584 if ( msg->compute->localWorkMsg != msg )
01585 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01586 }
|
|
|
Definition at line 1606 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01606 {
01607 msg->compute->doWork();
01608 if ( msg->compute->localWorkMsg != msg )
01609 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01610 }
|
|
|
Definition at line 1594 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01594 {
01595 msg->compute->doWork();
01596 if ( msg->compute->localWorkMsg != msg )
01597 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01598 }
|
|
|
Definition at line 1600 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01600 {
01601 msg->compute->doWork();
01602 if ( msg->compute->localWorkMsg != msg )
01603 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01604 }
|
|
|
Definition at line 1612 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01612 {
01613 msg->compute->doWork();
01614 if ( msg->compute->localWorkMsg != msg )
01615 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01616 }
|
|
|
Definition at line 1618 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01618 {
01619 msg->compute->doWork();
01620 if ( msg->compute->localWorkMsg != msg )
01621 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01622 }
|
|
|
Definition at line 1624 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01624 {
01625 msg->compute->doWork();
01626 if ( msg->compute->localWorkMsg != msg )
01627 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01628 }
|
|
|
Definition at line 1576 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01576 {
01577 msg->compute->doWork();
01578 if ( msg->compute->localWorkMsg != msg )
01579 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01580 }
|
|
|
Definition at line 1630 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01630 {
01631 msg->compute->doWork();
01632 if ( msg->compute->localWorkMsg != msg )
01633 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01634 }
|
|
|
Definition at line 1636 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01636 {
01637 msg->compute->doWork();
01638 if ( msg->compute->localWorkMsg != msg )
01639 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01640 }
|
|
|
Definition at line 1642 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01642 {
01643 msg->compute->doWork();
01644 if ( msg->compute->localWorkMsg != msg )
01645 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01646 }
|
|
||||||||||||||||
|
Definition at line 493 of file WorkDistrib.C. References ResizeArray< Elem >::add(), Lattice::apply_transform(), Molecule::atomcharge(), CompAtom::atomFixed, Molecule::atommass(), Molecule::atomvdwtype(), ResizeArray< Elem >::begin(), Bool, CompAtom::charge, SimParameters::fepOn, SimParameters::fixedAtomsOn, FullAtom::fixedPosition, FullAtomList, Molecule::get_fep_type(), Molecule::get_groupSize(), PDB::get_position_for_atom(), PatchMap::getTmpPatchAtomsList(), CompAtom::groupFixed, CompAtom::hydrogenGroupSize, CompAtom::id, iout, Molecule::is_atom_fixed(), Molecule::is_hydrogenGroupParent(), SimParameters::lattice, SimParameters::lesOn, FullAtom::mass, PatchMap::max_a(), PatchMap::max_b(), PatchMap::max_c(), PatchMap::min_a(), PatchMap::min_b(), PatchMap::min_c(), Node::molecule, NAMD_bug(), Lattice::nearest(), CompAtom::nonbondedGroupIsAtom, PatchMap::Object(), SimParameters::outputPatchDetails, SimParameters::pairInteractionOn, CompAtom::partition, Node::pdb, CompAtom::position, Position, SimParameters::pressureProfileAtomTypes, ScaledPosition, PatchMgr::setHomePatchFixedAtomNum(), Node::simParameters, ResizeArray< Elem >::size(), SimParameters::splitPatch, SimParameters::thermInt, FullAtom::transform, and FullAtom::velocity. Referenced by initAndSendHomePatch(). 00493 {
00494 // ref BOC
00495 CProxy_Node nd(CpvAccess(BOCclass_group).node);
00496 Node *node = nd.ckLocalBranch();
00497 PDB *pdb = node->pdb;
00498 SimParameters *params = node->simParameters;
00499 Molecule *molecule = node->molecule;
00500
00501 const Lattice lattice = params->lattice;
00502
00503 CProxy_PatchMgr pm(CpvAccess(BOCclass_group).patchMgr);
00504 PatchMgr *patchMgr = pm.ckLocalBranch();
00505 // ref singleton
00506 PatchMap *patchMap = PatchMap::Object();
00507
00508 vector<int> *eachPatchAtomsList = patchMap->getTmpPatchAtomsList();
00509 vector<int> *thisPatchAtomsList = &eachPatchAtomsList[patchId];
00510
00511 for(int i=0; i<thisPatchAtomsList->size(); i++){
00512 int aid = thisPatchAtomsList->at(i);
00513 FullAtom a;
00514 a.id = aid;
00515 Position pos;
00516 pdb->get_position_for_atom(&pos, aid);
00517 a.position = pos;
00518 a.velocity = velocities[aid];
00519 #ifdef MEM_OPT_VERSION
00520 a.sigId = molecule->getAtomSigId(aid);
00521 a.exclId = molecule->getAtomExclSigId(aid);
00522 a.vdwType = molecule->atomvdwtype(aid);
00523 #endif
00524 onePatchAtoms->add(a);
00525 }
00526
00527 ScaledPosition center(0.5*(patchMap->min_a(patchId)+patchMap->max_a(patchId)),
00528 0.5*(patchMap->min_b(patchId)+patchMap->max_b(patchId)),
00529 0.5*(patchMap->min_c(patchId)+patchMap->max_c(patchId)));
00530 int n = onePatchAtoms->size();
00531 FullAtom *a = onePatchAtoms->begin();
00532 int j;
00533 //Modifications for alchemical fep
00534 //SD & CC, CNRS - LCTN, Nancy
00535 Bool fepOn = params->fepOn;
00536 Bool thermInt = params->thermInt;
00537 //fepe
00538 Bool lesOn = params->lesOn;
00539
00540 Bool pairInteractionOn = params->pairInteractionOn;
00541
00542 Bool pressureProfileTypes = (params->pressureProfileAtomTypes > 1);
00543
00544 Transform mother_transform;
00545 for(j=0; j < n; j++)
00546 {
00547 int aid = a[j].id;
00548
00549 if (params->splitPatch == SPLIT_PATCH_HYDROGEN) {
00550 if ( molecule->is_hydrogenGroupParent(aid) ) {
00551 a[j].hydrogenGroupSize = molecule->get_groupSize(aid);
00552 } else {
00553 a[j].hydrogenGroupSize = 0;
00554 }
00555 } else {
00556 a[j].hydrogenGroupSize = 1;
00557 }
00558
00559 a[j].nonbondedGroupIsAtom = 0;
00560
00561 a[j].atomFixed = molecule->is_atom_fixed(aid) ? 1 : 0;
00562 a[j].fixedPosition = a[j].position;
00563
00564 if ( a[j].hydrogenGroupSize ) {
00565 a[j].position = lattice.nearest(
00566 a[j].position, center, &(a[j].transform));
00567 mother_transform = a[j].transform;
00568 } else {
00569 a[j].position = lattice.apply_transform(a[j].position,mother_transform);
00570 a[j].transform = mother_transform;
00571 }
00572
00573 a[j].mass = molecule->atommass(aid);
00574 a[j].charge = molecule->atomcharge(aid);
00575
00576 //Modifications for alchemical fep
00577 //SD & CC, CNRS - LCTN, Nancy
00578 if ( fepOn || thermInt || lesOn || pairInteractionOn || pressureProfileTypes) {
00579 a[j].partition = molecule->get_fep_type(aid);
00580 }
00581 else {
00582 a[j].partition = 0;
00583 }
00584 //fepe
00585 }
00586
00587 int size, allfixed, k;
00588 for(j=0; j < n; j+=size) {
00589 size = a[j].hydrogenGroupSize;
00590 if ( ! size ) {
00591 NAMD_bug("Mother atom with hydrogenGroupSize of 0!");
00592 }
00593 allfixed = 1;
00594 for ( k = 0; k < size; ++k ) {
00595 allfixed = ( allfixed && (a[j+k].atomFixed) );
00596 }
00597 for ( k = 0; k < size; ++k ) {
00598 a[j+k].groupFixed = allfixed ? 1 : 0;
00599 }
00600 }
00601
00602 if(params->fixedAtomsOn){
00603 int fixedCnt=0;
00604 for(j=0; j<n; j++)
00605 fixedCnt += (a[j].atomFixed ? 1:0);
00606 patchMgr->setHomePatchFixedAtomNum(patchId, fixedCnt);
00607 }
00608
00609 if ( params->outputPatchDetails ) {
00610 int numAtomsInPatch = n;
00611 int numFixedAtomsInPatch = 0;
00612 int numAtomsInFixedGroupsInPatch = 0;
00613 for(j=0; j < n; j++) {
00614 numFixedAtomsInPatch += ( a[j].atomFixed ? 1 : 0 );
00615 numAtomsInFixedGroupsInPatch += ( a[j].groupFixed ? 1 : 0 );
00616 }
00617 iout << "PATCH_DETAILS:"
00618 << " patch " << patchId
00619 << " atoms " << numAtomsInPatch
00620 << " fixed_atoms " << numFixedAtomsInPatch
00621 << " fixed_groups " << numAtomsInFixedGroupsInPatch
00622 << "\n" << endi;
00623 }
00624 }
|
|
|
Definition at line 627 of file WorkDistrib.C. References Bool, SimParameters::comMove, Node::configList, StringList::data, PatchMap::delTmpPatchAtomsList(), PatchMgr::fillHomePatchAtomList(), fillOnePatchAtoms(), ConfigList::find(), FullAtomList, SimParameters::initialTemp, Node::molecule, Node::myid(), PatchMap::node(), PDB::num_atoms(), PatchMap::numPatches(), PatchMap::Object(), Node::pdb, PatchMgr::sendOneHomePatch(), Node::simParameters, and Velocity. Referenced by Node::startup(). 00627 {
00628 StringList *current;
00629 // ref BOC
00630 CProxy_Node nd(CpvAccess(BOCclass_group).node);
00631 Node *node = nd.ckLocalBranch();
00632 Molecule *molecule = node->molecule;
00633 PDB *pdb = node->pdb;
00634 SimParameters *params = node->simParameters;
00635
00636 CProxy_PatchMgr pm(CpvAccess(BOCclass_group).patchMgr);
00637 PatchMgr *patchMgr = pm.ckLocalBranch();
00638 // ref singleton
00639 PatchMap *patchMap = PatchMap::Object();
00640
00641 int numAtoms = pdb->num_atoms();
00642
00643 //1. create atoms' velocities
00644 Vector *velocities = new Velocity[numAtoms];
00645 if ( params->initialTemp < 0.0 ) {
00646 Bool binvels=FALSE;
00647
00648 // Reading the veolcities from a PDB
00649 current = node->configList->find("velocities");
00650
00651 if (current == NULL) {
00652 current = node->configList->find("binvelocities");
00653 binvels = TRUE;
00654 }
00655
00656 if (!binvels) {
00657 velocities_from_PDB(current->data, velocities, numAtoms);
00658 }
00659 else {
00660 velocities_from_binfile(current->data, velocities, numAtoms);
00661 }
00662 }
00663 else {
00664 // Random velocities for a given temperature
00665 random_velocities(params->initialTemp, molecule, velocities, numAtoms);
00666 }
00667
00668 // If COMMotion == no, remove center of mass motion
00669 if (!(params->comMove)) {
00670 remove_com_motion(velocities, molecule, numAtoms);
00671 }
00672
00673
00674 for(int i=0; i<patchMap->numPatches(); i++){
00675 //2. fill each patch with actual atom data
00676 //the work flow should looks like the createAtomList
00677 FullAtomList *onePatchAtoms = new FullAtomList;
00678 fillOnePatchAtoms(i, onePatchAtoms, velocities);
00679
00680 patchMgr->fillHomePatchAtomList(i, onePatchAtoms);
00681
00682 delete onePatchAtoms;
00683
00684 //distribute this home patch
00685 if(patchMap->node(i) != node->myid()){
00686 //need to move to other nodes
00687 patchMgr->sendOneHomePatch(i, patchMap->node(i));
00688 }
00689
00690 }
00691
00692 delete [] velocities;
00693 patchMap->delTmpPatchAtomsList();
00694 }
|
|
|
Definition at line 1186 of file WorkDistrib.C. References ComputeMap::allocateCids(), computeAnglesType, computeBondsType, computeConsForceType, computeConsTorqueType, computeCrosstermsType, computeCylindricalBCType, computeDihedralsType, computeEFieldType, computeEwaldType, computeExtType, computeFullDirectType, computeGlobalType, computeGridForceType, computeImpropersType, computePmeType, computeRestraintsType, computeSelfAnglesType, computeSelfBondsType, computeSelfCrosstermsType, computeSelfDihedralsType, computeSelfImpropersType, computeSphericalBCType, computeStirType, computeTclBCType, SimParameters::consForceOn, SimParameters::consTorqueOn, SimParameters::constraintsOn, SimParameters::cylindricalBCOn, DebugM, SimParameters::eFieldOn, SimParameters::extForcesOn, SimParameters::FMAOn, SimParameters::fullDirectOn, SimParameters::globalForcesOn, SimParameters::gridforceOn, NAMD_die(), ComputeMap::Object(), PatchMap::Object(), SimParameters::pairInteractionOn, SimParameters::pairInteractionSelf, SimParameters::PMEOn, SimParameters::pressureProfileEwaldOn, Node::simParameters, SimParameters::sphericalBCOn, SimParameters::stirOn, SimParameters::tclBCOn, and SimParameters::useDPME. Referenced by Node::startup(). 01187 {
01188 PatchMap *patchMap = PatchMap::Object();
01189 ComputeMap *computeMap = ComputeMap::Object();
01190 CProxy_Node nd(CpvAccess(BOCclass_group).node);
01191 Node *node = nd.ckLocalBranch();
01192
01193 DebugM(3,"Mapping computes\n");
01194
01195 computeMap->allocateCids();
01196
01197 // Handle full electrostatics
01198 if ( node->simParameters->fullDirectOn )
01199 mapComputeHomePatches(computeFullDirectType);
01200 if ( node->simParameters->FMAOn )
01201 #ifdef DPMTA
01202 mapComputeHomePatches(computeDPMTAType);
01203 #else
01204 NAMD_die("This binary does not include DPMTA (FMA).");
01205 #endif
01206 if ( node->simParameters->PMEOn ) {
01207 #ifdef DPME
01208 if ( node->simParameters->useDPME )
01209 mapComputeHomePatches(computeDPMEType);
01210 else {
01211 mapComputeHomePatches(computePmeType);
01212 if ( node->simParameters->pressureProfileEwaldOn )
01213 mapComputeHomePatches(computeEwaldType);
01214 }
01215 #else
01216 mapComputeHomePatches(computePmeType);
01217 if ( node->simParameters->pressureProfileEwaldOn )
01218 mapComputeHomePatches(computeEwaldType);
01219 #endif
01220 }
01221
01222 if ( node->simParameters->globalForcesOn ) {
01223 DebugM(2,"adding ComputeGlobal\n");
01224 mapComputeHomePatches(computeGlobalType);
01225 }
01226
01227 if ( node->simParameters->extForcesOn )
01228 mapComputeHomePatches(computeExtType);
01229
01230 mapComputeNonbonded();
01231
01232 // If we're doing true pair interactions, no need for bonded terms.
01233 // But if we're doing within-group interactions, we do need them.
01234 if ( !node->simParameters->pairInteractionOn ||
01235 node->simParameters->pairInteractionSelf) {
01236 mapComputeHomeTuples(computeBondsType);
01237 mapComputeHomeTuples(computeAnglesType);
01238 mapComputeHomeTuples(computeDihedralsType);
01239 mapComputeHomeTuples(computeImpropersType);
01240 mapComputeHomeTuples(computeCrosstermsType);
01241 mapComputePatch(computeSelfBondsType);
01242 mapComputePatch(computeSelfAnglesType);
01243 mapComputePatch(computeSelfDihedralsType);
01244 mapComputePatch(computeSelfImpropersType);
01245 mapComputePatch(computeSelfCrosstermsType);
01246 }
01247
01248
01249 if ( node->simParameters->eFieldOn )
01250 mapComputePatch(computeEFieldType);
01251 /* BEGIN gf */
01252 if ( node->simParameters->gridforceOn )
01253 mapComputePatch(computeGridForceType);
01254 /* END gf */
01255 if ( node->simParameters->stirOn )
01256 mapComputePatch(computeStirType);
01257 if ( node->simParameters->sphericalBCOn )
01258 mapComputePatch(computeSphericalBCType);
01259 if ( node->simParameters->cylindricalBCOn )
01260 mapComputePatch(computeCylindricalBCType);
01261 if ( node->simParameters->tclBCOn ) {
01262 mapComputeHomePatches(computeTclBCType);
01263 }
01264 if ( node->simParameters->constraintsOn )
01265 mapComputePatch(computeRestraintsType);
01266 if ( node->simParameters->consForceOn )
01267 mapComputePatch(computeConsForceType);
01268 if ( node->simParameters->consTorqueOn )
01269 mapComputePatch(computeConsTorqueType);
01270 }
|
|
|
Definition at line 1454 of file WorkDistrib.C. References LocalWorkMsg::compute, computeAnglesType, computeBondsType, computeCrosstermsType, computeDihedralsType, computeImpropersType, computeNonbondedPairType, computeNonbondedSelfType, computePmeType, computeSelfAnglesType, computeSelfBondsType, computeSelfCrosstermsType, computeSelfDihedralsType, computeSelfImpropersType, Compute::doWork(), Compute::enqueueWork(), Compute::localWorkMsg, NAMD_bug(), Compute::priority(), Compute::sequence(), SET_PRIORITY, and Compute::type(). Referenced by Compute::enqueueWork(). 01454 {
01455 LocalWorkMsg *msg = compute->localWorkMsg;
01456 int seq = compute->sequence();
01457
01458 if ( seq < 0 ) {
01459 NAMD_bug("compute->sequence() < 0 in WorkDistrib::messageEnqueueWork");
01460 } else {
01461 SET_PRIORITY(msg,seq,compute->priority());
01462 }
01463
01464 msg->compute = compute; // pointer is valid since send is to local Pe
01465 int type = compute->type();
01466
01467 CProxy_WorkDistrib wdProxy(CpvAccess(BOCclass_group).workDistrib);
01468 switch ( type ) {
01469 case computeBondsType:
01470 case computeSelfBondsType:
01471 #if CHARM_VERSION > 050402
01472 wdProxy[CkMyPe()].enqueueBonds(msg);
01473 #else
01474 wdProxy.enqueueBonds(msg,CkMyPe());
01475 #endif
01476 break;
01477 case computeAnglesType:
01478 case computeSelfAnglesType:
01479 #if CHARM_VERSION > 050402
01480 wdProxy[CkMyPe()].enqueueAngles(msg);
01481 #else
01482 wdProxy.enqueueAngles(msg,CkMyPe());
01483 #endif
01484 break;
01485 case computeDihedralsType:
01486 case computeSelfDihedralsType:
01487 #if CHARM_VERSION > 050402
01488 wdProxy[CkMyPe()].enqueueDihedrals(msg);
01489 #else
01490 wdProxy.enqueueDihedrals(msg,CkMyPe());
01491 #endif
01492 break;
01493 case computeImpropersType:
01494 case computeSelfImpropersType:
01495 #if CHARM_VERSION > 050402
01496 wdProxy[CkMyPe()].enqueueImpropers(msg);
01497 #else
01498 wdProxy.enqueueImpropers(msg,CkMyPe());
01499 #endif
01500 break;
01501 case computeCrosstermsType:
01502 case computeSelfCrosstermsType:
01503 #if CHARM_VERSION > 050402
01504 wdProxy[CkMyPe()].enqueueCrossterms(msg);
01505 #else
01506 wdProxy.enqueueCrossterms(msg,CkMyPe());
01507 #endif
01508 break;
01509 case computeNonbondedSelfType:
01510 switch ( seq % 2 ) {
01511 case 0:
01512 #if CHARM_VERSION > 050402
01513 wdProxy[CkMyPe()].enqueueSelfA(msg);
01514 #else
01515 wdProxy.enqueueSelfA(msg,CkMyPe());
01516 #endif
01517 break;
01518 case 1:
01519 #if CHARM_VERSION > 050402
01520 wdProxy[CkMyPe()].enqueueSelfB(msg);
01521 #else
01522 wdProxy.enqueueSelfB(msg,CkMyPe());
01523 #endif
01524 break;
01525 default:
01526 NAMD_bug("WorkDistrib::messageEnqueueSelf case statement error!");
01527 }
01528 break;
01529 case computeNonbondedPairType:
01530 switch ( seq % 2 ) {
01531 case 0:
01532 #if CHARM_VERSION > 050402
01533 wdProxy[CkMyPe()].enqueueWorkA(msg);
01534 #else
01535 wdProxy.enqueueWorkA(msg,CkMyPe());
01536 #endif
01537 break;
01538 case 1:
01539 #if CHARM_VERSION > 050402
01540 wdProxy[CkMyPe()].enqueueWorkB(msg);
01541 #else
01542 wdProxy.enqueueWorkB(msg,CkMyPe());
01543 #endif
01544 break;
01545 case 2:
01546 #if CHARM_VERSION > 050402
01547 wdProxy[CkMyPe()].enqueueWorkC(msg);
01548 #else
01549 wdProxy.enqueueWorkC(msg,CkMyPe());
01550 #endif
01551 break;
01552 default:
01553 NAMD_bug("WorkDistrib::messageEnqueueWork case statement error!");
01554 }
01555 break;
01556 case computePmeType:
01557 #if 0
01558 #if CHARM_VERSION > 050402
01559 wdProxy[CkMyPe()].enqueuePme(msg);
01560 #else
01561 wdProxy.enqueuePme(msg,CkMyPe());
01562 #endif
01563 #else
01564 msg->compute->doWork();
01565 #endif
01566 break;
01567 default:
01568 #if CHARM_VERSION > 050402
01569 wdProxy[CkMyPe()].enqueueWork(msg);
01570 #else
01571 wdProxy.enqueueWork(msg,CkMyPe());
01572 #endif
01573 }
01574 }
|
|
|
Definition at line 817 of file WorkDistrib.C. References Lattice::a_r(), Lattice::b_r(), BigReal, Lattice::c_r(), DebugM, PDB::find_extremes(), SimParameters::FMAOn, SimParameters::lattice, PatchMap::makePatches(), SimParameters::minAtomsPerPatch, PDB::num_atoms(), PatchMap::Object(), Lattice::origin(), SimParameters::patchDimension, Node::pdb, ScaledPosition, Node::simParameters, PatchMap::sizeGrid(), SimParameters::twoAwayX, SimParameters::twoAwayY, SimParameters::twoAwayZ, Vector::x, Vector::y, and Vector::z. Referenced by Node::startup(). 00818 {
00819 PatchMap *patchMap = PatchMap::Object();
00820 CProxy_Node nd(CpvAccess(BOCclass_group).node);
00821 Node *node = nd.ckLocalBranch();
00822 SimParameters *params = node->simParameters;
00823 Lattice lattice = params->lattice;
00824
00825 BigReal patchSize = params->patchDimension;
00826
00827 ScaledPosition xmin, xmax;
00828 ScaledPosition sysDim, sysMin;
00829
00830 double maxNumPatches = 1000000; // need to adjust fractional values
00831 if ( params->minAtomsPerPatch > 0 )
00832 maxNumPatches = node->pdb->num_atoms() / params->minAtomsPerPatch;
00833
00834 DebugM(3,"Mapping patches\n");
00835 // Need to use full box for FMA to match NAMD 1.X results.
00836 if ( params->FMAOn ) {
00837 node->pdb->find_extremes(&(xmin.x),&(xmax.x),lattice.a_r());
00838 node->pdb->find_extremes(&(xmin.y),&(xmax.y),lattice.b_r( |