| 57 |
|
nLocal_ = snap_->getNumberOfAtoms(); |
| 58 |
|
nGroups_ = snap_->getNumberOfCutoffGroups(); |
| 59 |
|
|
| 60 |
+ |
// gather the information for atomtype IDs (atids): |
| 61 |
+ |
vector<int> identsLocal = info_->getIdentArray(); |
| 62 |
+ |
AtomLocalToGlobal = info_->getGlobalAtomIndices(); |
| 63 |
+ |
cgLocalToGlobal = info_->getGlobalGroupIndices(); |
| 64 |
+ |
vector<int> globalGroupMembership = info_->getGlobalGroupMembership(); |
| 65 |
+ |
vector<RealType> massFactorsLocal = info_->getMassFactors(); |
| 66 |
+ |
vector<RealType> pot_local(N_INTERACTION_FAMILIES, 0.0); |
| 67 |
+ |
|
| 68 |
|
#ifdef IS_MPI |
| 69 |
|
|
| 70 |
|
AtomCommIntRow = new Communicator<Row,int>(nLocal_); |
| 101 |
|
vector<RealType> (nAtomsInRow_, 0.0)); |
| 102 |
|
vector<vector<RealType> > pot_col(N_INTERACTION_FAMILIES, |
| 103 |
|
vector<RealType> (nAtomsInCol_, 0.0)); |
| 96 |
– |
|
| 97 |
– |
|
| 98 |
– |
vector<RealType> pot_local(N_INTERACTION_FAMILIES, 0.0); |
| 104 |
|
|
| 100 |
– |
// gather the information for atomtype IDs (atids): |
| 101 |
– |
vector<int> identsLocal = info_->getIdentArray(); |
| 105 |
|
identsRow.reserve(nAtomsInRow_); |
| 106 |
|
identsCol.reserve(nAtomsInCol_); |
| 107 |
|
|
| 108 |
|
AtomCommIntRow->gather(identsLocal, identsRow); |
| 109 |
|
AtomCommIntColumn->gather(identsLocal, identsCol); |
| 110 |
|
|
| 108 |
– |
AtomLocalToGlobal = info_->getGlobalAtomIndices(); |
| 111 |
|
AtomCommIntRow->gather(AtomLocalToGlobal, AtomRowToGlobal); |
| 112 |
|
AtomCommIntColumn->gather(AtomLocalToGlobal, AtomColToGlobal); |
| 113 |
|
|
| 112 |
– |
cgLocalToGlobal = info_->getGlobalGroupIndices(); |
| 114 |
|
cgCommIntRow->gather(cgLocalToGlobal, cgRowToGlobal); |
| 115 |
|
cgCommIntColumn->gather(cgLocalToGlobal, cgColToGlobal); |
| 116 |
|
|
| 117 |
+ |
AtomCommRealRow->gather(massFactorsLocal, massFactorsRow); |
| 118 |
+ |
AtomCommRealColumn->gather(massFactorsLocal, massFactorsCol); |
| 119 |
+ |
|
| 120 |
+ |
groupListRow_.clear(); |
| 121 |
+ |
groupListRow_.reserve(nGroupsInRow_); |
| 122 |
+ |
for (int i = 0; i < nGroupsInRow_; i++) { |
| 123 |
+ |
int gid = cgRowToGlobal[i]; |
| 124 |
+ |
for (int j = 0; j < nAtomsInRow_; j++) { |
| 125 |
+ |
int aid = AtomRowToGlobal[j]; |
| 126 |
+ |
if (globalGroupMembership[aid] == gid) |
| 127 |
+ |
groupListRow_[i].push_back(j); |
| 128 |
+ |
} |
| 129 |
+ |
} |
| 130 |
+ |
|
| 131 |
+ |
groupListCol_.clear(); |
| 132 |
+ |
groupListCol_.reserve(nGroupsInCol_); |
| 133 |
+ |
for (int i = 0; i < nGroupsInCol_; i++) { |
| 134 |
+ |
int gid = cgColToGlobal[i]; |
| 135 |
+ |
for (int j = 0; j < nAtomsInCol_; j++) { |
| 136 |
+ |
int aid = AtomColToGlobal[j]; |
| 137 |
+ |
if (globalGroupMembership[aid] == gid) |
| 138 |
+ |
groupListCol_[i].push_back(j); |
| 139 |
+ |
} |
| 140 |
+ |
} |
| 141 |
+ |
|
| 142 |
+ |
#endif |
| 143 |
+ |
|
| 144 |
+ |
groupList_.clear(); |
| 145 |
+ |
groupList_.reserve(nGroups_); |
| 146 |
+ |
for (int i = 0; i < nGroups_; i++) { |
| 147 |
+ |
int gid = cgLocalToGlobal[i]; |
| 148 |
+ |
for (int j = 0; j < nLocal_; j++) { |
| 149 |
+ |
int aid = AtomLocalToGlobal[j]; |
| 150 |
+ |
if (globalGroupMembership[aid] == gid) |
| 151 |
+ |
groupList_[i].push_back(j); |
| 152 |
+ |
} |
| 153 |
+ |
} |
| 154 |
+ |
|
| 155 |
+ |
|
| 156 |
|
// still need: |
| 157 |
|
// topoDist |
| 158 |
|
// exclude |
| 159 |
< |
#endif |
| 159 |
> |
|
| 160 |
|
} |
| 161 |
|
|
| 162 |
|
|
| 284 |
|
#endif |
| 285 |
|
} |
| 286 |
|
|
| 287 |
+ |
/** |
| 288 |
+ |
* returns the list of atoms belonging to this group. |
| 289 |
+ |
*/ |
| 290 |
+ |
vector<int> ForceMatrixDecomposition::getAtomsInGroupRow(int cg1){ |
| 291 |
+ |
#ifdef IS_MPI |
| 292 |
+ |
return groupListRow_[cg1]; |
| 293 |
+ |
#else |
| 294 |
+ |
return groupList_[cg1]; |
| 295 |
+ |
#endif |
| 296 |
+ |
} |
| 297 |
+ |
|
| 298 |
+ |
vector<int> ForceMatrixDecomposition::getAtomsInGroupColumn(int cg2){ |
| 299 |
+ |
#ifdef IS_MPI |
| 300 |
+ |
return groupListCol_[cg2]; |
| 301 |
+ |
#else |
| 302 |
+ |
return groupList_[cg2]; |
| 303 |
+ |
#endif |
| 304 |
+ |
} |
| 305 |
|
|
| 306 |
|
Vector3d ForceMatrixDecomposition::getIntergroupVector(int cg1, int cg2){ |
| 307 |
|
Vector3d d; |
| 342 |
|
|
| 343 |
|
snap_->wrapVector(d); |
| 344 |
|
return d; |
| 345 |
+ |
} |
| 346 |
+ |
|
| 347 |
+ |
RealType ForceMatrixDecomposition::getMassFactorRow(int atom1) { |
| 348 |
+ |
#ifdef IS_MPI |
| 349 |
+ |
return massFactorsRow[atom1]; |
| 350 |
+ |
#else |
| 351 |
+ |
return massFactorsLocal[atom1]; |
| 352 |
+ |
#endif |
| 353 |
+ |
} |
| 354 |
+ |
|
| 355 |
+ |
RealType ForceMatrixDecomposition::getMassFactorColumn(int atom2) { |
| 356 |
+ |
#ifdef IS_MPI |
| 357 |
+ |
return massFactorsCol[atom2]; |
| 358 |
+ |
#else |
| 359 |
+ |
return massFactorsLocal[atom2]; |
| 360 |
+ |
#endif |
| 361 |
+ |
|
| 362 |
|
} |
| 363 |
|
|
| 364 |
|
Vector3d ForceMatrixDecomposition::getInteratomicVector(int atom1, int atom2){ |