| 67 |
|
using namespace std; |
| 68 |
|
namespace OpenMD { |
| 69 |
|
|
| 70 |
< |
ForceManager::ForceManager(SimInfo * info) : info_(info) { |
| 70 |
> |
ForceManager::ForceManager(SimInfo * info) : info_(info), switcher_(NULL) { |
| 71 |
|
forceField_ = info_->getForceField(); |
| 72 |
|
interactionMan_ = new InteractionManager(); |
| 73 |
|
fDecomp_ = new ForceMatrixDecomposition(info_, interactionMan_); |
| 74 |
+ |
thermo = new Thermo(info_); |
| 75 |
|
} |
| 76 |
|
|
| 77 |
+ |
ForceManager::~ForceManager() { |
| 78 |
+ |
perturbations_.clear(); |
| 79 |
+ |
|
| 80 |
+ |
delete switcher_; |
| 81 |
+ |
delete interactionMan_; |
| 82 |
+ |
delete fDecomp_; |
| 83 |
+ |
delete thermo; |
| 84 |
+ |
} |
| 85 |
+ |
|
| 86 |
|
/** |
| 87 |
|
* setupCutoffs |
| 88 |
|
* |
| 443 |
|
perturbations_.push_back(eField); |
| 444 |
|
} |
| 445 |
|
|
| 446 |
+ |
usePeriodicBoundaryConditions_ = info_->getSimParams()->getUsePeriodicBoundaryConditions(); |
| 447 |
+ |
|
| 448 |
|
fDecomp_->distributeInitialData(); |
| 449 |
< |
|
| 450 |
< |
initialized_ = true; |
| 451 |
< |
|
| 449 |
> |
|
| 450 |
> |
initialized_ = true; |
| 451 |
> |
|
| 452 |
|
} |
| 453 |
< |
|
| 453 |
> |
|
| 454 |
|
void ForceManager::calcForces() { |
| 455 |
|
|
| 456 |
|
if (!initialized_) initialize(); |
| 457 |
< |
|
| 457 |
> |
|
| 458 |
|
preCalculation(); |
| 459 |
|
shortRangeInteractions(); |
| 460 |
|
longRangeInteractions(); |
| 738 |
|
|
| 739 |
|
if (iLoop == loopStart) { |
| 740 |
|
bool update_nlist = fDecomp_->checkNeighborList(); |
| 741 |
< |
if (update_nlist) |
| 741 |
> |
if (update_nlist) { |
| 742 |
> |
if (!usePeriodicBoundaryConditions_) |
| 743 |
> |
Mat3x3d bbox = thermo->getBoundingBox(); |
| 744 |
|
neighborList = fDecomp_->buildNeighborList(); |
| 745 |
< |
} |
| 745 |
> |
} |
| 746 |
> |
} |
| 747 |
|
|
| 748 |
|
for (vector<pair<int, int> >::iterator it = neighborList.begin(); |
| 749 |
|
it != neighborList.end(); ++it) { |