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

Comparing branches/development/src/rnemd/RNEMD.cpp (file contents):
Revision 1867 by gezelter, Mon Apr 29 17:53:48 2013 UTC vs.
Revision 1868 by gezelter, Tue Apr 30 15:56:54 2013 UTC

# Line 71 | Line 71 | namespace OpenMD {
71    RNEMD::RNEMD(SimInfo* info) : info_(info), evaluator_(info), seleMan_(info),
72                                  evaluatorA_(info), seleManA_(info),
73                                  commonA_(info), evaluatorB_(info),
74 <                                seleManB_(info), commonB_(info),
74 >                                seleManB_(info), commonB_(info),
75 >                                hasData_(false),
76                                  usePeriodicBoundaryConditions_(info->getSimParams()->getUsePeriodicBoundaryConditions()) {
77  
78      trialCount_ = 0;
# Line 603 | Line 604 | namespace OpenMD {
604   #ifdef IS_MPI
605      }
606   #endif
607 +
608 +    // delete all of the objects we created:
609 +    delete areaAccumulator_;    
610 +    data_.clear();
611    }
612    
613    void RNEMD::doSwap(SelectionManager& smanA, SelectionManager& smanB) {
# Line 2008 | Line 2013 | namespace OpenMD {
2013          }
2014        }
2015      }
2016 +    hasData_ = true;
2017    }
2018  
2019    void RNEMD::getStarted() {
# Line 2040 | Line 2046 | namespace OpenMD {
2046    
2047    void RNEMD::writeOutputFile() {
2048      if (!doRNEMD_) return;
2049 +    if (!hasData_) return;
2050      
2051   #ifdef IS_MPI
2052      // If we're the root node, should we print out the results
# Line 2061 | Line 2068 | namespace OpenMD {
2068        RealType time = currentSnap_->getTime();
2069        RealType avgArea;
2070        areaAccumulator_->getAverage(avgArea);
2064      RealType Jz = kineticExchange_ / (time * avgArea)
2065        / PhysicalConstants::energyConvert;
2066      Vector3d JzP = momentumExchange_ / (time * avgArea);      
2067      Vector3d JzL = angularMomentumExchange_ / (time * avgArea);      
2071  
2072 +      RealType Jz(0.0);
2073 +      Vector3d JzP(V3Zero);
2074 +      Vector3d JzL(V3Zero);
2075 +      if (time >= info_->getSimParams()->getDt()) {
2076 +        Jz = kineticExchange_ / (time * avgArea)
2077 +          / PhysicalConstants::energyConvert;
2078 +        JzP = momentumExchange_ / (time * avgArea);
2079 +        JzL = angularMomentumExchange_ / (time * avgArea);
2080 +      }
2081 +
2082        rnemdFile_ << "#######################################################\n";
2083        rnemdFile_ << "# RNEMD {\n";
2084  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines