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 1866 by gezelter, Thu Apr 25 14:32:56 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 1730 | Line 1735 | namespace OpenMD {
1735        int isd;
1736        StuntDouble* sd;
1737        vector<StuntDouble*> aSites;
1733      ConvexHull* surfaceMeshA = new ConvexHull();
1738        seleManA_.setSelectionSet(evaluatorA_.evaluate());
1739        for (sd = seleManA_.beginSelected(isd); sd != NULL;
1740             sd = seleManA_.nextSelected(isd)) {
1741          aSites.push_back(sd);
1742        }
1743 <
1743 >      ConvexHull* surfaceMeshA = new ConvexHull();
1744        surfaceMeshA->computeHull(aSites);
1745        areaA = surfaceMeshA->getArea();
1746 +      delete surfaceMeshA;
1747 +
1748      } else {
1749        if (usePeriodicBoundaryConditions_) {
1750          // in periodic boundaries, the surface area is twice the x-y
# Line 1758 | Line 1764 | namespace OpenMD {
1764        int isd;
1765        StuntDouble* sd;
1766        vector<StuntDouble*> bSites;
1761
1767        seleManB_.setSelectionSet(evaluatorB_.evaluate());
1763    
1768        for (sd = seleManB_.beginSelected(isd); sd != NULL;
1769             sd = seleManB_.nextSelected(isd)) {
1770          bSites.push_back(sd);
1771        }
1772 <
1769 <      ConvexHull* surfaceMeshB = new ConvexHull();
1770 <
1772 >      ConvexHull* surfaceMeshB = new ConvexHull();    
1773        surfaceMeshB->computeHull(bSites);
1774        areaB = surfaceMeshB->getArea();
1775 +      delete surfaceMeshB;
1776 +
1777      } else {
1778        if (usePeriodicBoundaryConditions_) {
1779          // in periodic boundaries, the surface area is twice the x-y
# Line 2009 | Line 2013 | namespace OpenMD {
2013          }
2014        }
2015      }
2016 +    hasData_ = true;
2017    }
2018  
2019    void RNEMD::getStarted() {
# Line 2041 | 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 2062 | Line 2068 | namespace OpenMD {
2068        RealType time = currentSnap_->getTime();
2069        RealType avgArea;
2070        areaAccumulator_->getAverage(avgArea);
2071 <      RealType Jz = kineticExchange_ / (time * avgArea)
2072 <        / PhysicalConstants::energyConvert;
2073 <      Vector3d JzP = momentumExchange_ / (time * avgArea);      
2074 <      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";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines