ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/devel_omp/src/parallel/ForceMatrixDecomposition.cpp
(Generate patch)

Comparing branches/devel_omp/src/parallel/ForceMatrixDecomposition.cpp (file contents):
Revision 1608 by mciznick, Tue Aug 9 01:58:56 2011 UTC vs.
Revision 1614 by mciznick, Tue Aug 23 20:55:51 2011 UTC

# Line 989 | Line 989 | void ForceMatrixDecomposition::addForceToAtomRow(int a
989   #else
990          snap_->atomData.force[atom1] += fg;
991   #endif
992 }
993
994 void ForceMatrixDecomposition::addForceToAtomRowOMP(int atom1, Vector3d fg) {
995        #pragma omp critical
996        {
997                snap_->atomData.force[atom1] += fg;
998        }
992   }
993  
994   void ForceMatrixDecomposition::addForceToAtomColumn(int atom2, Vector3d fg) {
# Line 1006 | Line 999 | void ForceMatrixDecomposition::addForceToAtomColumn(in
999   #endif
1000   }
1001  
1009 void ForceMatrixDecomposition::addForceToAtomColumnOMP(int atom2, Vector3d fg) {
1010        #pragma omp critical
1011        {
1012                snap_->atomData.force[atom2] += fg;
1013        }
1014 }
1015
1002   // filling interaction blocks with pointers
1003   void ForceMatrixDecomposition::fillInteractionData(InteractionData &idat, int atom1, int atom2) {
1004  
# Line 1258 | Line 1244 | void ForceMatrixDecomposition::unpackInteractionDataOM
1244   }
1245  
1246   void ForceMatrixDecomposition::unpackInteractionDataOMP(InteractionDataPrv &idat, int atom1, int atom2) {
1261 #pragma omp critical
1262        {
1247                  pairwisePot += idat.pot;
1248  
1249                  snap_->atomData.force[atom1] += idat.f1;
1250                  snap_->atomData.force[atom2] -= idat.f1;
1267        }
1251   }
1252  
1253   void ForceMatrixDecomposition::reorderGroupCutoffs(vector<int> &order) {
# Line 1310 | Line 1293 | void ForceMatrixDecomposition::reorderPosition(vector<
1293                          cg->setLocalIndex(mapPos[cg->getLocalIndex()]);
1294                  }
1295          }
1313
1314        /*      if (info_->getNCutoffGroups() > 0)
1315         {
1316         for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi))
1317         {
1318         for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci))
1319         {
1320         printf("gbI:%d locI:%d x:%f y:%f z:%f\n", cg->getGlobalIndex(), cg->getLocalIndex(),
1321         cgConfig->position[cg->getLocalIndex()].x(), cgConfig->position[cg->getLocalIndex()].y(),
1322         cgConfig->position[cg->getLocalIndex()].z());
1323         }
1324         }
1325         } else
1326         {
1327         // center of mass of the group is the same as position of the atom
1328         // if cutoff group does not exist
1329         printf("ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
1330         //                     cgConfig->position = config->position;
1331         }*/
1296   }
1297  
1298   void ForceMatrixDecomposition::reorderGroupList(vector<int> &order) {
# Line 1347 | Line 1311 | void ForceMatrixDecomposition::reorderMemory(vector<ve
1311  
1312   void ForceMatrixDecomposition::reorderMemory(vector<vector<CutoffGroup *> > &H_c_l) {
1313          int n = 0;
1350        //      printf("Reorder memory time:%f!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",
1351        //                      info_->getSnapshotManager()->getCurrentSnapshot()->getTime());
1314  
1315          /* record the reordered atom indices */
1316          vector<int> k = vector<int> (nGroups_);
# Line 1369 | Line 1331 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1331   }
1332  
1333   vector<vector<CutoffGroup *> > ForceMatrixDecomposition::buildLayerBasedNeighborList() {
1372        //      printf("buildLayerBasedNeighborList; nGroups:%d\n", nGroups_);
1334          // Na = nGroups_
1335          /* cell occupancy counter */
1336          //      vector<int> k_c;
# Line 1461 | Line 1422 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1422          {
1423                  if (reorderFreqCounter == neighborListReorderFreq)
1424                  {
1464                        //printf("neighborListReorderFreq:%d\n", neighborListReorderFreq);
1425                          reorderMemory(H_c_l);
1426                          reorderFreqCounter = 1;
1427                  } else
# Line 1471 | Line 1431 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1431          }
1432  
1433          int m;
1434 <        /* the neighbor matrix */
1434 >        /* The neighbor matrix */
1435          vector<vector<CutoffGroup *> > neighborMatW = vector<vector<CutoffGroup *> > (nGroups_);
1436  
1437          groupCutoffs cuts;
1438          CutoffGroup *cg1;
1439  
1440 <        /* loops over objects(atoms, rigidBodies, cutoffGroups, etc.) */
1440 >        /* Loops over objects(atoms, rigidBodies, cutoffGroups, etc.) */
1441          for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi))
1442          {
1443                  for (cg1 = mol->beginCutoffGroup(ci); cg1 != NULL; cg1 = mol->nextCutoffGroup(ci))
# Line 1516 | Line 1476 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1476                                  }
1477  
1478                                  int c2 = Vlinear(c2v, nCells_);
1479 <                                /* loops over layers l to access the neighbor atoms */
1479 >                                /* Loops over layers l to access the neighbor atoms */
1480                                  for (vector<CutoffGroup *>::iterator cg2 = H_c_l[c2].begin(); cg2 != H_c_l[c2].end(); ++cg2)
1481                                  {
1482 <                                        //                              if i'' = 0 then break // doesn't apply to vector implementation of matrix
1482 >                                        //                              if i'' = 0 then break // doesn't apply to vector implementation of the matrix
1483                                          //                              if(i != *j)
1484                                          if (c2 != c1 || (*cg2)->getGlobalIndex() < cg1->getGlobalIndex())
1485                                          {
# Line 1528 | Line 1488 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1488                                                  cuts = getGroupCutoffs(cg1->getGlobalIndex(), (*cg2)->getGlobalIndex());
1489                                                  if (dr.lengthSquare() < cuts.third)
1490                                                  {
1491 <                                                        /* transposed version of Rapaport W mat, to occupy successive memory locations on CPU */
1491 >                                                        /* Transposed version of Rapaport W mat, to occupy successive memory locations on CPU */
1492                                                          neighborMatW[cg1->getGlobalIndex()].push_back((*cg2));
1493                                                  }
1494                                          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines