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; |
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) { |
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 |
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 |
2013 |
|
} |
2014 |
|
} |
2015 |
|
} |
2016 |
+ |
hasData_ = true; |
2017 |
|
} |
2018 |
|
|
2019 |
|
void RNEMD::getStarted() { |
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 |
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"; |