ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/ForceManager.cpp
(Generate patch)

Comparing:
trunk/src/brains/ForceManager.cpp (file contents), Revision 1448 by gezelter, Thu Jun 17 14:58:49 2010 UTC vs.
branches/development/src/brains/ForceManager.cpp (file contents), Revision 1483 by gezelter, Tue Jul 27 21:17:31 2010 UTC

# Line 57 | Line 57
57   #include "primitives/Bend.hpp"
58   #include "primitives/Torsion.hpp"
59   #include "primitives/Inversion.hpp"
60 +
61   namespace OpenMD {
62 +  
63 +  ForceManager::ForceManager(SimInfo * info) : info_(info),
64 +                                               NBforcesInitialized_(false) {
65 +    lj_ = LJ::Instance();
66 +    lj_->setForceField(info_->getForceField());
67  
68 <  void ForceManager::calcForces(bool needPotential, bool needStress) {
68 >    gb_ = GB::Instance();
69 >    gb_->setForceField(info_->getForceField());
70 >
71 >    eam_ = EAM::Instance();
72 >    eam_->setForceField(info_->getForceField());
73 >  }
74 >
75 >  void ForceManager::calcForces() {
76      
77      if (!info_->isFortranInitialized()) {
78        info_->update();
# Line 69 | Line 82 | namespace OpenMD {
82      
83      calcShortRangeInteraction();
84  
85 <    calcLongRangeInteraction(needPotential, needStress);
85 >    calcLongRangeInteraction();
86  
87 <    postCalculation(needStress);
87 >    postCalculation();
88      
89    }
90    
# Line 223 | Line 236 | namespace OpenMD {
236      
237    }
238    
239 <  void ForceManager::calcLongRangeInteraction(bool needPotential,
227 <                                              bool needStress) {
239 >  void ForceManager::calcLongRangeInteraction() {
240      Snapshot* curSnapshot;
241      DataStorage* config;
242      RealType* frc;
# Line 277 | Line 289 | namespace OpenMD {
289      RealType longRangePotential[LR_POT_TYPES];
290      RealType lrPot = 0.0;
291      Vector3d totalDipole;
280    short int passedCalcPot = needPotential;
281    short int passedCalcStress = needStress;
292      int isError = 0;
293  
294      for (int i=0; i<LR_POT_TYPES;i++){
# Line 294 | Line 304 | namespace OpenMD {
304                  tau.getArrayPointer(),
305                  longRangePotential,
306                  particlePot,
297                &passedCalcPot,
298                &passedCalcStress,
307                  &isError );
308      
309      if( isError ){
# Line 324 | Line 332 | namespace OpenMD {
332    }
333  
334    
335 <  void ForceManager::postCalculation(bool needStress) {
335 >  void ForceManager::postCalculation() {
336      SimInfo::MoleculeIterator mi;
337      Molecule* mol;
338      Molecule::RigidBodyIterator rbIter;
# Line 337 | Line 345 | namespace OpenMD {
345           mol = info_->nextMolecule(mi)) {
346        for (rb = mol->beginRigidBody(rbIter); rb != NULL;
347             rb = mol->nextRigidBody(rbIter)) {
348 <        if (needStress) {          
349 <          Mat3x3d rbTau = rb->calcForcesAndTorquesAndVirial();
342 <          tau += rbTau;
343 <        } else{
344 <          rb->calcForcesAndTorques();
345 <        }
348 >        Mat3x3d rbTau = rb->calcForcesAndTorquesAndVirial();
349 >        tau += rbTau;
350        }
351      }
352 <
349 <    if (needStress) {
352 >    
353   #ifdef IS_MPI
354 <      Mat3x3d tmpTau(tau);
355 <      MPI_Allreduce(tmpTau.getArrayPointer(), tau.getArrayPointer(),
356 <                    9, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
354 >    Mat3x3d tmpTau(tau);
355 >    MPI_Allreduce(tmpTau.getArrayPointer(), tau.getArrayPointer(),
356 >                  9, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
357   #endif
358 <      curSnapshot->statData.setTau(tau);
356 <    }
358 >    curSnapshot->statData.setTau(tau);
359    }
360  
361   } //end namespace OpenMD

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines