| 62 |
|
|
| 63 |
|
namespace oopse { |
| 64 |
|
|
| 65 |
< |
RNEMD::RNEMD(SimInfo* info) : info_(info), evaluator_(info), seleMan_(info) { |
| 65 |
> |
RNEMD::RNEMD(SimInfo* info) : info_(info), evaluator_(info), seleMan_(info), usePeriodicBoundaryConditions_(info->getSimParams()->getUsePeriodicBoundaryConditions()) { |
| 66 |
|
|
| 67 |
|
int seedValue; |
| 68 |
|
Globals * simParams = info->getSimParams(); |
| 123 |
|
Snapshot* currentSnap_ = info_->getSnapshotManager()->getCurrentSnapshot(); |
| 124 |
|
Mat3x3d hmat = currentSnap_->getHmat(); |
| 125 |
|
|
| 126 |
+ |
std::cerr << "hmat = " << hmat << "\n"; |
| 127 |
+ |
|
| 128 |
|
seleMan_.setSelectionSet(evaluator_.evaluate()); |
| 129 |
|
|
| 130 |
|
std::cerr << "selectionCount = " << seleMan_.getSelectionCount() << "\n\n"; |
| 131 |
|
|
| 132 |
< |
int i; |
| 132 |
> |
int selei; |
| 133 |
|
StuntDouble* sd; |
| 134 |
< |
int idx = sd->getLocalIndex(); |
| 134 |
> |
int idx; |
| 135 |
|
|
| 136 |
|
std::vector<tuple3<RealType, int, StuntDouble* > > endSlice; |
| 137 |
|
std::vector<tuple3<RealType, int, StuntDouble* > > midSlice; |
| 138 |
|
|
| 139 |
< |
for (sd = seleMan_.beginSelected(i); sd != NULL; |
| 140 |
< |
sd = seleMan_.nextSelected(i)) { |
| 139 |
> |
for (sd = seleMan_.beginSelected(selei); sd != NULL; |
| 140 |
> |
sd = seleMan_.nextSelected(selei)) { |
| 141 |
|
|
| 142 |
+ |
idx = sd->getLocalIndex(); |
| 143 |
+ |
|
| 144 |
|
Vector3d pos = sd->getPos(); |
| 145 |
|
|
| 146 |
|
// wrap the stuntdouble's position back into the box: |
| 149 |
|
currentSnap_->wrapVector(pos); |
| 150 |
|
|
| 151 |
|
// which bin is this stuntdouble in? |
| 152 |
+ |
// wrapped positions are in the range [-0.5*hmat(2,2), +0.5*hmat(2,2)] |
| 153 |
|
|
| 154 |
< |
int binNo = int(nBins_ * (pos.z()) / hmat(2,2)); |
| 154 |
> |
int binNo = midBin + int(nBins_ * (pos.z()) / hmat(2,2)); |
| 155 |
|
|
| 156 |
+ |
std::cerr << "pos.z() = " << pos.z() << " bin = " << binNo << "\n"; |
| 157 |
+ |
|
| 158 |
|
// if we're in bin 0 or the middleBin |
| 159 |
|
if (binNo == 0 || binNo == midBin) { |
| 160 |
|
|
| 206 |
|
if (binNo == midBin) |
| 207 |
|
midSlice.push_back( make_tuple3(value, idx, sd)); |
| 208 |
|
} |
| 202 |
– |
|
| 203 |
– |
// find smallest value in endSlice: |
| 204 |
– |
std::sort(endSlice.begin(), endSlice.end()); |
| 205 |
– |
RealType min_val = endSlice[0].first; |
| 206 |
– |
int min_idx = endSlice[0].second; |
| 207 |
– |
StuntDouble* min_sd = endSlice[0].third; |
| 208 |
– |
|
| 209 |
– |
std::cerr << "smallest value = " << min_val << " idx = " << min_idx << "\n"; |
| 210 |
– |
|
| 211 |
– |
// find largest value in midSlice: |
| 212 |
– |
std::sort(midSlice.rbegin(), midSlice.rend()); |
| 213 |
– |
RealType max_val = midSlice[0].first; |
| 214 |
– |
int max_idx = midSlice[0].second; |
| 215 |
– |
StuntDouble* max_sd = midSlice[0].third; |
| 216 |
– |
|
| 217 |
– |
std::cerr << "largest value = " << max_val << " idx = " << max_idx << "\n"; |
| 218 |
– |
|
| 209 |
|
} |
| 210 |
< |
} |
| 211 |
< |
} |
| 210 |
> |
|
| 211 |
> |
// find smallest value in endSlice: |
| 212 |
> |
std::sort(endSlice.begin(), endSlice.end()); |
| 213 |
> |
RealType min_val = endSlice[0].first; |
| 214 |
> |
int min_idx = endSlice[0].second; |
| 215 |
> |
StuntDouble* min_sd = endSlice[0].third; |
| 216 |
> |
|
| 217 |
> |
std::cerr << "smallest value = " << min_val << " idx = " << min_idx << "\n"; |
| 218 |
> |
|
| 219 |
> |
// find largest value in midSlice: |
| 220 |
> |
std::sort(midSlice.rbegin(), midSlice.rend()); |
| 221 |
> |
RealType max_val = midSlice[0].first; |
| 222 |
> |
int max_idx = midSlice[0].second; |
| 223 |
> |
StuntDouble* max_sd = midSlice[0].third; |
| 224 |
> |
|
| 225 |
> |
std::cerr << "largest value = " << max_val << " idx = " << max_idx << "\n"; |
| 226 |
> |
|
| 227 |
> |
} |
| 228 |
> |
} |