# | Line 308 | Line 308 | namespace OpenMD { | |
---|---|---|
308 | ||
309 | void ForceMatrixDecomposition::createGtypeCutoffMap() { | |
310 | ||
311 | + | GrCut.clear(); |
312 | + | GrCutSq.clear(); |
313 | + | GrlistSq.clear(); |
314 | + | |
315 | RealType tol = 1e-6; | |
316 | largestRcut_ = 0.0; | |
317 | int atid; | |
# | Line 418 | Line 422 | namespace OpenMD { | |
422 | #endif | |
423 | ||
424 | RealType tradRcut = groupMax; | |
425 | + | |
426 | + | GrCut.resize( gTypeCutoffs.size() ); |
427 | + | GrCutSq.resize( gTypeCutoffs.size() ); |
428 | + | GrlistSq.resize( gTypeCutoffs.size() ); |
429 | ||
430 | + | |
431 | for (unsigned int i = 0; i < gTypeCutoffs.size(); i++) { | |
432 | + | GrCut[i].resize( gTypeCutoffs.size() , 0.0); |
433 | + | GrCutSq[i].resize( gTypeCutoffs.size(), 0.0 ); |
434 | + | GrlistSq[i].resize( gTypeCutoffs.size(), 0.0 ); |
435 | + | |
436 | for (unsigned int j = 0; j < gTypeCutoffs.size(); j++) { | |
437 | RealType thisRcut; | |
438 | switch(cutoffPolicy_) { | |
# | Line 442 | Line 455 | namespace OpenMD { | |
455 | break; | |
456 | } | |
457 | ||
458 | < | pair<int,int> key = make_pair(i,j); |
446 | < | gTypeCutoffMap[key].first = thisRcut; |
458 | > | GrCut[i][j] = thisRcut; |
459 | if (thisRcut > largestRcut_) largestRcut_ = thisRcut; | |
460 | < | gTypeCutoffMap[key].second = thisRcut*thisRcut; |
461 | < | gTypeCutoffMap[key].third = pow(thisRcut + skinThickness_, 2); |
460 | > | GrCutSq[i][j] = thisRcut * thisRcut; |
461 | > | GrlistSq[i][j] = pow(thisRcut + skinThickness_, 2); |
462 | > | |
463 | > | // pair<int,int> key = make_pair(i,j); |
464 | > | // gTypeCutoffMap[key].first = thisRcut; |
465 | > | // gTypeCutoffMap[key].third = pow(thisRcut + skinThickness_, 2); |
466 | // sanity check | |
467 | ||
468 | if (userChoseCutoff_) { | |
469 | < | if (abs(gTypeCutoffMap[key].first - userCutoff_) > 0.0001) { |
469 | > | if (abs(GrCut[i][j] - userCutoff_) > 0.0001) { |
470 | sprintf(painCave.errMsg, | |
471 | "ForceMatrixDecomposition::createGtypeCutoffMap " | |
472 | "user-specified rCut (%lf) does not match computed group Cutoff\n", userCutoff_); | |
# | Line 463 | Line 479 | namespace OpenMD { | |
479 | } | |
480 | } | |
481 | ||
482 | < | groupCutoffs ForceMatrixDecomposition::getGroupCutoffs(int cg1, int cg2) { |
482 | > | void ForceMatrixDecomposition::getGroupCutoffs(int &cg1, int &cg2, RealType &rcut, RealType &rcutsq, RealType &rlistsq) { |
483 | int i, j; | |
484 | #ifdef IS_MPI | |
485 | i = groupRowToGtype[cg1]; | |
# | Line 472 | Line 488 | namespace OpenMD { | |
488 | i = groupToGtype[cg1]; | |
489 | j = groupToGtype[cg2]; | |
490 | #endif | |
491 | < | return gTypeCutoffMap[make_pair(i,j)]; |
491 | > | rcut = GrCut[i][j]; |
492 | > | rcutsq = GrCutSq[i][j]; |
493 | > | rlistsq = GrlistSq[i][j]; |
494 | > | return; |
495 | > | //return gTypeCutoffMap[make_pair(i,j)]; |
496 | } | |
497 | ||
498 | int ForceMatrixDecomposition::getTopologicalDistance(int atom1, int atom2) { | |
# | Line 1327 | Line 1347 | namespace OpenMD { | |
1347 | bool doAllPairs = false; | |
1348 | ||
1349 | RealType rList_ = (largestRcut_ + skinThickness_); | |
1350 | + | RealType rcut, rcutsq, rlistsq; |
1351 | Snapshot* snap_ = sman_->getCurrentSnapshot(); | |
1352 | Mat3x3d box; | |
1353 | Mat3x3d invBox; | |
# | Line 1510 | Line 1531 | namespace OpenMD { | |
1531 | if (usePeriodicBoundaryConditions_) { | |
1532 | snap_->wrapVector(dr); | |
1533 | } | |
1534 | < | cuts = getGroupCutoffs( (*j1), (*j2) ); |
1535 | < | if (dr.lengthSquare() < cuts.third) { |
1534 | > | getGroupCutoffs( (*j1), (*j2), rcut, rcutsq, rlistsq ); |
1535 | > | if (dr.lengthSquare() < rlistsq) { |
1536 | neighborList.push_back(make_pair((*j1), (*j2))); | |
1537 | } | |
1538 | } | |
# | Line 1537 | Line 1558 | namespace OpenMD { | |
1558 | if (usePeriodicBoundaryConditions_) { | |
1559 | snap_->wrapVector(dr); | |
1560 | } | |
1561 | < | cuts = getGroupCutoffs( (*j1), (*j2) ); |
1562 | < | if (dr.lengthSquare() < cuts.third) { |
1561 | > | getGroupCutoffs( (*j1), (*j2), rcut, rcutsq, rlistsq ); |
1562 | > | if (dr.lengthSquare() < rlistsq) { |
1563 | neighborList.push_back(make_pair((*j1), (*j2))); | |
1564 | } | |
1565 | } | |
# | Line 1558 | Line 1579 | namespace OpenMD { | |
1579 | if (usePeriodicBoundaryConditions_) { | |
1580 | snap_->wrapVector(dr); | |
1581 | } | |
1582 | < | cuts = getGroupCutoffs( j1, j2 ); |
1583 | < | if (dr.lengthSquare() < cuts.third) { |
1582 | > | getGroupCutoffs( j1, j2, rcut, rcutsq, rlistsq); |
1583 | > | if (dr.lengthSquare() < rlistsq) { |
1584 | neighborList.push_back(make_pair(j1, j2)); | |
1585 | } | |
1586 | } | |
# | Line 1573 | Line 1594 | namespace OpenMD { | |
1594 | if (usePeriodicBoundaryConditions_) { | |
1595 | snap_->wrapVector(dr); | |
1596 | } | |
1597 | < | cuts = getGroupCutoffs( j1, j2 ); |
1598 | < | if (dr.lengthSquare() < cuts.third) { |
1597 | > | getGroupCutoffs( j1, j2, rcut, rcutsq, rlistsq ); |
1598 | > | if (dr.lengthSquare() < rlistsq) { |
1599 | neighborList.push_back(make_pair(j1, j2)); | |
1600 | } | |
1601 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |