406 |
|
|
407 |
|
} |
408 |
|
|
409 |
– |
SelfData ForceMatrixDecomposition::fillSelfData(int atom1) { |
410 |
– |
SelfData sdat; |
411 |
– |
// Still Missing atype, skippedCharge, potVec pot, |
412 |
– |
if (storageLayout_ & DataStorage::dslElectroFrame) { |
413 |
– |
sdat.eFrame = &(snap_->atomData.electroFrame[atom1]); |
414 |
– |
} |
415 |
– |
|
416 |
– |
if (storageLayout_ & DataStorage::dslTorque) { |
417 |
– |
sdat.t = &(snap_->atomData.torque[atom1]); |
418 |
– |
} |
419 |
– |
|
420 |
– |
if (storageLayout_ & DataStorage::dslDensity) { |
421 |
– |
sdat.rho = &(snap_->atomData.density[atom1]); |
422 |
– |
} |
423 |
– |
|
424 |
– |
if (storageLayout_ & DataStorage::dslFunctional) { |
425 |
– |
sdat.frho = &(snap_->atomData.functional[atom1]); |
426 |
– |
} |
427 |
– |
|
428 |
– |
if (storageLayout_ & DataStorage::dslFunctionalDerivative) { |
429 |
– |
sdat.dfrhodrho = &(snap_->atomData.functionalDerivative[atom1]); |
430 |
– |
} |
409 |
|
|
432 |
– |
return sdat; |
433 |
– |
} |
410 |
|
|
411 |
|
|
436 |
– |
|
412 |
|
/* |
413 |
|
* buildNeighborList |
414 |
|
* |
419 |
|
|
420 |
|
vector<pair<int, int> > neighborList; |
421 |
|
#ifdef IS_MPI |
422 |
< |
CellListRow.clear(); |
423 |
< |
CellListCol.clear(); |
422 |
> |
cellListRow_.clear(); |
423 |
> |
cellListCol_.clear(); |
424 |
|
#else |
425 |
< |
CellList.clear(); |
425 |
> |
cellList_.clear(); |
426 |
|
#endif |
427 |
|
|
428 |
|
// dangerous to not do error checking. |
454 |
– |
RealType skinThickness_ = info_->getSimParams()->getSkinThickness(); |
429 |
|
RealType rCut_; |
430 |
|
|
431 |
|
RealType rList_ = (rCut_ + skinThickness_); |
435 |
|
Vector3d Hx = Hmat.getColumn(0); |
436 |
|
Vector3d Hy = Hmat.getColumn(1); |
437 |
|
Vector3d Hz = Hmat.getColumn(2); |
464 |
– |
Vector3i nCells; |
438 |
|
|
439 |
< |
nCells.x() = (int) ( Hx.length() )/ rList_; |
440 |
< |
nCells.y() = (int) ( Hy.length() )/ rList_; |
441 |
< |
nCells.z() = (int) ( Hz.length() )/ rList_; |
439 |
> |
nCells_.x() = (int) ( Hx.length() )/ rList_; |
440 |
> |
nCells_.y() = (int) ( Hy.length() )/ rList_; |
441 |
> |
nCells_.z() = (int) ( Hz.length() )/ rList_; |
442 |
|
|
443 |
|
Mat3x3d invHmat = snap_->getInvHmat(); |
444 |
|
Vector3d rs, scaled, dr; |
456 |
|
scaled[j] -= roundMe(scaled[j]); |
457 |
|
|
458 |
|
// find xyz-indices of cell that cutoffGroup is in. |
459 |
< |
whichCell.x() = nCells.x() * scaled.x(); |
460 |
< |
whichCell.y() = nCells.y() * scaled.y(); |
461 |
< |
whichCell.z() = nCells.z() * scaled.z(); |
459 |
> |
whichCell.x() = nCells_.x() * scaled.x(); |
460 |
> |
whichCell.y() = nCells_.y() * scaled.y(); |
461 |
> |
whichCell.z() = nCells_.z() * scaled.z(); |
462 |
|
|
463 |
|
// find single index of this cell: |
464 |
< |
cellIndex = Vlinear(whichCell, nCells); |
464 |
> |
cellIndex = Vlinear(whichCell, nCells_); |
465 |
|
// add this cutoff group to the list of groups in this cell; |
466 |
< |
CellListRow[cellIndex].push_back(i); |
466 |
> |
cellListRow_[cellIndex].push_back(i); |
467 |
|
} |
468 |
|
|
469 |
|
for (int i = 0; i < nGroupsInCol_; i++) { |
476 |
|
scaled[j] -= roundMe(scaled[j]); |
477 |
|
|
478 |
|
// find xyz-indices of cell that cutoffGroup is in. |
479 |
< |
whichCell.x() = nCells.x() * scaled.x(); |
480 |
< |
whichCell.y() = nCells.y() * scaled.y(); |
481 |
< |
whichCell.z() = nCells.z() * scaled.z(); |
479 |
> |
whichCell.x() = nCells_.x() * scaled.x(); |
480 |
> |
whichCell.y() = nCells_.y() * scaled.y(); |
481 |
> |
whichCell.z() = nCells_.z() * scaled.z(); |
482 |
|
|
483 |
|
// find single index of this cell: |
484 |
< |
cellIndex = Vlinear(whichCell, nCells); |
484 |
> |
cellIndex = Vlinear(whichCell, nCells_); |
485 |
|
// add this cutoff group to the list of groups in this cell; |
486 |
< |
CellListCol[cellIndex].push_back(i); |
486 |
> |
cellListCol_[cellIndex].push_back(i); |
487 |
|
} |
488 |
|
#else |
489 |
|
for (int i = 0; i < nGroups_; i++) { |
496 |
|
scaled[j] -= roundMe(scaled[j]); |
497 |
|
|
498 |
|
// find xyz-indices of cell that cutoffGroup is in. |
499 |
< |
whichCell.x() = nCells.x() * scaled.x(); |
500 |
< |
whichCell.y() = nCells.y() * scaled.y(); |
501 |
< |
whichCell.z() = nCells.z() * scaled.z(); |
499 |
> |
whichCell.x() = nCells_.x() * scaled.x(); |
500 |
> |
whichCell.y() = nCells_.y() * scaled.y(); |
501 |
> |
whichCell.z() = nCells_.z() * scaled.z(); |
502 |
|
|
503 |
|
// find single index of this cell: |
504 |
< |
cellIndex = Vlinear(whichCell, nCells); |
504 |
> |
cellIndex = Vlinear(whichCell, nCells_); |
505 |
|
// add this cutoff group to the list of groups in this cell; |
506 |
< |
CellList[cellIndex].push_back(i); |
506 |
> |
cellList_[cellIndex].push_back(i); |
507 |
|
} |
508 |
|
#endif |
509 |
|
|
510 |
|
|
511 |
|
|
512 |
< |
for (int m1z = 0; m1z < nCells.z(); m1z++) { |
513 |
< |
for (int m1y = 0; m1y < nCells.y(); m1y++) { |
514 |
< |
for (int m1x = 0; m1x < nCells.x(); m1x++) { |
512 |
> |
for (int m1z = 0; m1z < nCells_.z(); m1z++) { |
513 |
> |
for (int m1y = 0; m1y < nCells_.y(); m1y++) { |
514 |
> |
for (int m1x = 0; m1x < nCells_.x(); m1x++) { |
515 |
|
Vector3i m1v(m1x, m1y, m1z); |
516 |
< |
int m1 = Vlinear(m1v, nCells); |
544 |
< |
for (int offset = 0; offset < nOffset_; offset++) { |
545 |
< |
Vector3i m2v = m1v + cellOffsets_[offset]; |
516 |
> |
int m1 = Vlinear(m1v, nCells_); |
517 |
|
|
518 |
< |
if (m2v.x() >= nCells.x()) { |
518 |
> |
for (vector<Vector3i>::iterator os = cellOffsets_.begin(); |
519 |
> |
os != cellOffsets_.end(); ++os) { |
520 |
> |
|
521 |
> |
Vector3i m2v = m1v + (*os); |
522 |
> |
|
523 |
> |
if (m2v.x() >= nCells_.x()) { |
524 |
|
m2v.x() = 0; |
525 |
|
} else if (m2v.x() < 0) { |
526 |
< |
m2v.x() = nCells.x() - 1; |
526 |
> |
m2v.x() = nCells_.x() - 1; |
527 |
|
} |
528 |
< |
|
529 |
< |
if (m2v.y() >= nCells.y()) { |
528 |
> |
|
529 |
> |
if (m2v.y() >= nCells_.y()) { |
530 |
|
m2v.y() = 0; |
531 |
|
} else if (m2v.y() < 0) { |
532 |
< |
m2v.y() = nCells.y() - 1; |
532 |
> |
m2v.y() = nCells_.y() - 1; |
533 |
|
} |
534 |
< |
|
535 |
< |
if (m2v.z() >= nCells.z()) { |
534 |
> |
|
535 |
> |
if (m2v.z() >= nCells_.z()) { |
536 |
|
m2v.z() = 0; |
537 |
|
} else if (m2v.z() < 0) { |
538 |
< |
m2v.z() = nCells.z() - 1; |
538 |
> |
m2v.z() = nCells_.z() - 1; |
539 |
|
} |
540 |
+ |
|
541 |
+ |
int m2 = Vlinear (m2v, nCells_); |
542 |
|
|
565 |
– |
int m2 = Vlinear (m2v, nCells); |
566 |
– |
|
543 |
|
#ifdef IS_MPI |
544 |
< |
for (vector<int>::iterator j1 = CellListRow[m1].begin(); |
545 |
< |
j1 != CellListRow[m1].end(); ++j1) { |
546 |
< |
for (vector<int>::iterator j2 = CellListCol[m2].begin(); |
547 |
< |
j2 != CellListCol[m2].end(); ++j2) { |
544 |
> |
for (vector<int>::iterator j1 = cellListRow_[m1].begin(); |
545 |
> |
j1 != cellListRow_[m1].end(); ++j1) { |
546 |
> |
for (vector<int>::iterator j2 = cellListCol_[m2].begin(); |
547 |
> |
j2 != cellListCol_[m2].end(); ++j2) { |
548 |
|
|
549 |
|
// Always do this if we're in different cells or if |
550 |
|
// we're in the same cell and the global index of the |
560 |
|
} |
561 |
|
} |
562 |
|
#else |
563 |
< |
for (vector<int>::iterator j1 = CellList[m1].begin(); |
564 |
< |
j1 != CellList[m1].end(); ++j1) { |
565 |
< |
for (vector<int>::iterator j2 = CellList[m2].begin(); |
566 |
< |
j2 != CellList[m2].end(); ++j2) { |
563 |
> |
for (vector<int>::iterator j1 = cellList_[m1].begin(); |
564 |
> |
j1 != cellList_[m1].end(); ++j1) { |
565 |
> |
for (vector<int>::iterator j2 = cellList_[m2].begin(); |
566 |
> |
j2 != cellList_[m2].end(); ++j2) { |
567 |
|
|
568 |
|
// Always do this if we're in different cells or if |
569 |
|
// we're in the same cell and the global index of the |
583 |
|
} |
584 |
|
} |
585 |
|
} |
586 |
+ |
|
587 |
+ |
// save the local cutoff group positions for the check that is |
588 |
+ |
// done on each loop: |
589 |
+ |
saved_CG_positions_.clear(); |
590 |
+ |
for (int i = 0; i < nGroups_; i++) |
591 |
+ |
saved_CG_positions_.push_back(snap_->cgData.position[i]); |
592 |
+ |
|
593 |
|
return neighborList; |
594 |
|
} |
595 |
|
} //end namespace OpenMD |