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 1598 by mciznick, Wed Jul 27 14:26:53 2011 UTC vs.
Revision 1599 by mciznick, Fri Jul 29 19:03:36 2011 UTC

# Line 50 | Line 50 | ForceMatrixDecomposition::ForceMatrixDecomposition(Sim
50  
51   ForceMatrixDecomposition::ForceMatrixDecomposition(SimInfo* info, InteractionManager* iMan) :
52          ForceDecomposition(info, iMan) {
53
53          // In a parallel computation, row and colum scans must visit all
54          // surrounding cells (not just the 14 upper triangular blocks that
55          // are used when the processor can see all pairs)
# Line 323 | Line 322 | void ForceMatrixDecomposition::distributeInitialData()
322                                  }
323                          }
324                  }
325 +        }
326 +
327 +        Globals* simParams_ = info_->getSimParams();
328 +        if (simParams_->haveNeighborListReorderFreq())
329 +        {
330 +                neighborListReorderFreq = simParams_->getNeighborListReorderFreq();
331 +        } else
332 +        {
333 +                neighborListReorderFreq = 0;
334          }
335 +        reorderFreqCounter = 1;
336  
337          createGtypeCutoffMap();
338  
# Line 796 | Line 805 | void ForceMatrixDecomposition::collectData() {
805          pairwisePot += pot_temp[ii];
806   #endif
807  
808 <        cerr << "pairwisePot = " << pairwisePot << "\n";
808 >        //      cerr << "pairwisePot = " << pairwisePot << "\n";
809   }
810  
811   int ForceMatrixDecomposition::getNAtomsInRow() {
# Line 847 | Line 856 | Vector3d ForceMatrixDecomposition::getIntergroupVector
856          Vector3d d;
857  
858          d = snap_->cgData.position[cg2->getLocalIndex()] - snap_->cgData.position[cg1->getLocalIndex()];
859 < /*      cerr << "cg1_gid = " << cg1->getGlobalIndex() << "\tcg1_lid = " << cg1->getLocalIndex() << "\tcg1p = "
860 <                        << snap_->cgData.position[cg1->getLocalIndex()] << "\n";
861 <        cerr << "cg2_gid = " << cg2->getGlobalIndex() << "\tcg2_lid = " << cg2->getLocalIndex() << "\tcg2p = "
862 <                        << snap_->cgData.position[cg2->getLocalIndex()] << "\n";*/
859 >        /*      cerr << "cg1_gid = " << cg1->getGlobalIndex() << "\tcg1_lid = " << cg1->getLocalIndex() << "\tcg1p = "
860 >         << snap_->cgData.position[cg1->getLocalIndex()] << "\n";
861 >         cerr << "cg2_gid = " << cg2->getGlobalIndex() << "\tcg2_lid = " << cg2->getLocalIndex() << "\tcg2p = "
862 >         << snap_->cgData.position[cg2->getLocalIndex()] << "\n";*/
863  
864          snap_->wrapVector(d);
865          return d;
# Line 924 | Line 933 | bool ForceMatrixDecomposition::skipAtomPair(int atom1,
933   bool ForceMatrixDecomposition::skipAtomPair(int atom1, int atom2) {
934          int unique_id_1, unique_id_2;
935  
936 < //      cerr << "sap with atom1, atom2 =\t" << atom1 << "\t" << atom2 << "\n";
936 >        //      cerr << "sap with atom1, atom2 =\t" << atom1 << "\t" << atom2 << "\n";
937   #ifdef IS_MPI
938          // in MPI, we have to look up the unique IDs for each atom
939          unique_id_1 = AtomRowToGlobal[atom1];
# Line 1144 | Line 1153 | void ForceMatrixDecomposition::reorderPosition(vector<
1153                  tmp[i] = snap_->cgData.position[i];
1154          }
1155  
1156 <        vector<int> mapPos = vector<int>(nGroups_);
1156 >        vector<int> mapPos = vector<int> (nGroups_);
1157          for (int i = 0; i < nGroups_; ++i)
1158          {
1159                  snap_->cgData.position[i] = tmp[order[i]];
# Line 1164 | Line 1173 | void ForceMatrixDecomposition::reorderPosition(vector<
1173                  }
1174          }
1175  
1176 < /*      if (info_->getNCutoffGroups() > 0)
1177 <        {
1178 <                for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi))
1179 <                {
1180 <                        for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci))
1181 <                        {
1182 <                                printf("gbI:%d locI:%d x:%f y:%f z:%f\n", cg->getGlobalIndex(), cg->getLocalIndex(),
1183 <                                                cgConfig->position[cg->getLocalIndex()].x(), cgConfig->position[cg->getLocalIndex()].y(),
1184 <                                                cgConfig->position[cg->getLocalIndex()].z());
1185 <                        }
1186 <                }
1187 <        } else
1188 <        {
1189 <                // center of mass of the group is the same as position of the atom
1190 <                // if cutoff group does not exist
1191 <                printf("ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
1192 <                //                      cgConfig->position = config->position;
1193 <        }*/
1176 >        /*      if (info_->getNCutoffGroups() > 0)
1177 >         {
1178 >         for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi))
1179 >         {
1180 >         for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci))
1181 >         {
1182 >         printf("gbI:%d locI:%d x:%f y:%f z:%f\n", cg->getGlobalIndex(), cg->getLocalIndex(),
1183 >         cgConfig->position[cg->getLocalIndex()].x(), cgConfig->position[cg->getLocalIndex()].y(),
1184 >         cgConfig->position[cg->getLocalIndex()].z());
1185 >         }
1186 >         }
1187 >         } else
1188 >         {
1189 >         // center of mass of the group is the same as position of the atom
1190 >         // if cutoff group does not exist
1191 >         printf("ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
1192 >         //                     cgConfig->position = config->position;
1193 >         }*/
1194   }
1195  
1196   void ForceMatrixDecomposition::reorderGroupList(vector<int> &order) {
# Line 1200 | Line 1209 | void ForceMatrixDecomposition::reorderMemory(vector<ve
1209  
1210   void ForceMatrixDecomposition::reorderMemory(vector<vector<CutoffGroup *> > &H_c_l) {
1211          int n = 0;
1212 < //      printf("Reorder memory time:%f!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",
1213 < //                      info_->getSnapshotManager()->getCurrentSnapshot()->getTime());
1212 >        //      printf("Reorder memory time:%f!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",
1213 >        //                      info_->getSnapshotManager()->getCurrentSnapshot()->getTime());
1214  
1215          /* record the reordered atom indices */
1216          vector<int> k = vector<int> (nGroups_);
# Line 1222 | Line 1231 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1231   }
1232  
1233   vector<vector<CutoffGroup *> > ForceMatrixDecomposition::buildLayerBasedNeighborList() {
1234 < //      printf("buildLayerBasedNeighborList; nGroups:%d\n", nGroups_);
1234 >        //      printf("buildLayerBasedNeighborList; nGroups:%d\n", nGroups_);
1235          // Na = nGroups_
1236          /* cell occupancy counter */
1237 < //      vector<int> k_c;
1237 >        //      vector<int> k_c;
1238          /* c_i - has cell containing atom i (size Na) */
1239          vector<int> c = vector<int> (nGroups_);
1240          /* l_i - layer containing atom i (size Na) */
1241 < //      vector<int> l;
1241 >        //      vector<int> l;
1242  
1243          RealType rList_ = (largestRcut_ + skinThickness_);
1244          Snapshot* snap_ = sman_->getCurrentSnapshot();
# Line 1248 | Line 1257 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1257          int cellIndex;
1258          int nCtot = nCells_.x() * nCells_.y() * nCells_.z();
1259  
1260 < //      k_c = vector<int> (nCtot, 0);
1260 >        //      k_c = vector<int> (nCtot, 0);
1261  
1262          SimInfo::MoleculeIterator mi;
1263          Molecule* mol;
# Line 1277 | Line 1286 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1286                          whichCell.y() = nCells_.y() * scaled.y();
1287                          whichCell.z() = nCells_.z() * scaled.z();
1288  
1289 < //                      printf("pos x:%f y:%f z:%f cell x:%d y:%d z:%d\n", rs.x(), rs.y(), rs.z(), whichCell.x(), whichCell.y(),
1290 < //                                      whichCell.z());
1289 >                        //                      printf("pos x:%f y:%f z:%f cell x:%d y:%d z:%d\n", rs.x(), rs.y(), rs.z(), whichCell.x(), whichCell.y(),
1290 >                        //                                      whichCell.z());
1291  
1292                          // find single index of this cell:
1293                          cellIndex = Vlinear(whichCell, nCells_);
# Line 1287 | Line 1296 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1296                  }
1297          }
1298  
1299 < //      int k_c_curr;
1300 < //      int k_c_max = 0;
1299 >        //      int k_c_curr;
1300 >        //      int k_c_max = 0;
1301          /* the cell-layer occupancy matrix */
1302          vector<vector<CutoffGroup *> > H_c_l = vector<vector<CutoffGroup *> > (nCtot);
1303  
# Line 1305 | Line 1314 | vector<vector<CutoffGroup *> > ForceMatrixDecompositio
1314                          //                      {
1315                          //                              k_c_max = k_c_curr;
1316                          //                      }
1308
1317                          H_c_l[c[cg->getGlobalIndex()]].push_back(/*l[*/cg/*]*/);
1318                  }
1319          }
1320  
1321 <        reorderMemory(H_c_l);
1321 >        /* Frequency of reordering the memory */
1322 >        if (neighborListReorderFreq != 0)
1323 >        {
1324 >                if (reorderFreqCounter == neighborListReorderFreq)
1325 >                {
1326 >                        //printf("neighborListReorderFreq:%d\n", neighborListReorderFreq);
1327 >                        reorderMemory(H_c_l);
1328 >                        reorderFreqCounter = 1;
1329 >                } else
1330 >                {
1331 >                        reorderFreqCounter++;
1332 >                }
1333 >        }
1334  
1335          int m;
1336          /* the neighbor matrix */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines