57 |
|
#include "primitives/Bend.hpp" |
58 |
|
#include "primitives/Torsion.hpp" |
59 |
|
#include "primitives/Inversion.hpp" |
60 |
+ |
#include "parallel/ForceDecomposition.hpp" |
61 |
+ |
//#include "parallel/SerialDecomposition.hpp" |
62 |
|
|
63 |
|
namespace OpenMD { |
64 |
|
|
65 |
|
ForceManager::ForceManager(SimInfo * info) : info_(info), |
66 |
|
NBforcesInitialized_(false) { |
67 |
+ |
#ifdef IS_MPI |
68 |
+ |
decomp_ = new ForceDecomposition(info_); |
69 |
+ |
#else |
70 |
+ |
// decomp_ = new SerialDecomposition(info); |
71 |
+ |
#endif |
72 |
|
} |
73 |
|
|
74 |
|
void ForceManager::calcForces() { |
77 |
|
if (!info_->isFortranInitialized()) { |
78 |
|
info_->update(); |
79 |
|
nbiMan_->setSimInfo(info_); |
80 |
< |
nbiMan_->initialize(); |
80 |
> |
nbiMan_->initialize(); |
81 |
> |
decomp_->distributeInitialData(); |
82 |
|
info_->setupFortran(); |
83 |
|
} |
76 |
– |
|
77 |
– |
preCalculation(); |
84 |
|
|
85 |
+ |
preCalculation(); |
86 |
|
calcShortRangeInteraction(); |
80 |
– |
|
87 |
|
calcLongRangeInteraction(); |
82 |
– |
|
88 |
|
postCalculation(); |
89 |
|
|
90 |
|
} |
290 |
|
longRangePotential[i]=0.0; //Initialize array |
291 |
|
} |
292 |
|
|
293 |
< |
doForceLoop(pos, |
294 |
< |
rc, |
295 |
< |
A, |
296 |
< |
electroFrame, |
297 |
< |
frc, |
298 |
< |
trq, |
299 |
< |
tau.getArrayPointer(), |
300 |
< |
longRangePotential, |
301 |
< |
particlePot, |
302 |
< |
&isError ); |
303 |
< |
|
293 |
> |
decomp_->distributeData(); |
294 |
> |
|
295 |
> |
int nLoops = 1; |
296 |
> |
for (int iLoop = 0; iLoop < nLoops; iLoop++) { |
297 |
> |
doForceLoop(pos, |
298 |
> |
rc, |
299 |
> |
A, |
300 |
> |
electroFrame, |
301 |
> |
frc, |
302 |
> |
trq, |
303 |
> |
tau.getArrayPointer(), |
304 |
> |
longRangePotential, |
305 |
> |
particlePot, |
306 |
> |
&isError ); |
307 |
> |
|
308 |
> |
if (nLoops > 1) { |
309 |
> |
decomp_->collectIntermediateData(); |
310 |
> |
decomp_->distributeIntermediateData(); |
311 |
> |
} |
312 |
> |
} |
313 |
> |
|
314 |
> |
decomp_->collectData(); |
315 |
> |
|
316 |
|
if( isError ){ |
317 |
|
sprintf( painCave.errMsg, |
318 |
|
"Error returned from the fortran force calculation.\n" ); |