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

Comparing trunk/src/rnemd/RNEMD.cpp (file contents):
Revision 2070 by gezelter, Thu Mar 5 15:40:58 2015 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 UTC

# Line 68 | Line 68 | namespace OpenMD {
68   using namespace std;
69   namespace OpenMD {
70    
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),
75 <                                hasData_(false), hasDividingArea_(false),
76 <                                usePeriodicBoundaryConditions_(info->getSimParams()->getUsePeriodicBoundaryConditions()) {
71 >  RNEMD::RNEMD(SimInfo* info) : info_(info),
72 >                                evaluator_(info_), seleMan_(info_),
73 >                                evaluatorA_(info_), seleManA_(info_),
74 >                                evaluatorB_(info_), seleManB_(info_),
75 >                                commonA_(info_), commonB_(info_),
76 >                                usePeriodicBoundaryConditions_(info_->getSimParams()->getUsePeriodicBoundaryConditions()),
77 >                                hasDividingArea_(false),
78 >                                hasData_(false) {
79  
80      trialCount_ = 0;
81      failTrialCount_ = 0;
# Line 674 | Line 676 | namespace OpenMD {
676        
677        RealType mass = sd->getMass();
678        Vector3d vel = sd->getVel();
679 <      RealType value;
679 >      RealType value(0.0);
680        
681        switch(rnemdFluxType_) {
682        case rnemdKE :
# Line 735 | Line 737 | namespace OpenMD {
737        
738        RealType mass = sd->getMass();
739        Vector3d vel = sd->getVel();
740 <      RealType value;
740 >      RealType value(0.0);
741        
742        switch(rnemdFluxType_) {
743        case rnemdKE :
# Line 1146 | Line 1148 | namespace OpenMD {
1148      RealType px = Pcx / Phx;
1149      RealType py = Pcy / Phy;
1150      RealType pz = Pcz / Phz;
1151 <    RealType c, x, y, z;
1151 >    RealType c(0.0), x(0.0), y(0.0), z(0.0);
1152      bool successfulScale = false;
1153      if ((rnemdFluxType_ == rnemdFullKE) ||
1154          (rnemdFluxType_ == rnemdRotKE)) {
# Line 1216 | Line 1218 | namespace OpenMD {
1218          }
1219        }
1220      } else {
1221 <      RealType a000, a110, c0, a001, a111, b01, b11, c1;
1221 >      RealType a000(0.0), a110(0.0), c0(0.0);
1222 >      RealType a001(0.0), a111(0.0), b01(0.0), b11(0.0), c1(0.0);
1223        switch(rnemdFluxType_) {
1224        case rnemdKE :
1225          /* used hotBin coeff's & only scale x & y dimensions
# Line 1319 | Line 1322 | namespace OpenMD {
1322        vector<pair<RealType,RealType> > rps;
1323        for (ri = realRoots.begin(); ri !=realRoots.end(); ++ri) {
1324          r2 = *ri;
1325 <        //check if FindRealRoots() give the right answer
1325 >        // Check to see if FindRealRoots() gave the right answer:
1326          if ( fabs(u0 + r2 * (u1 + r2 * (u2 + r2 * (u3 + r2 * u4)))) > 1e-6 ) {
1327            sprintf(painCave.errMsg,
1328                    "RNEMD Warning: polynomial solve seems to have an error!");
# Line 1327 | Line 1330 | namespace OpenMD {
1330            simError();
1331            failRootCount_++;
1332          }
1333 <        //might not be useful w/o rescaling coefficients
1333 >        // Might not be useful w/o rescaling coefficients
1334          alpha0 = -c0 - a110 * r2 * r2;
1335          if (alpha0 >= 0.0) {
1336            r1 = sqrt(alpha0 / a000);
# Line 1342 | Line 1345 | namespace OpenMD {
1345            }
1346          }
1347        }
1348 <      // Consider combining together the solving pair part w/ the searching
1349 <      // best solution part so that we don't need the pairs vector
1348 >      // Consider combining together the part for solving for the pair
1349 >      // w/ the searching for the best solution part so that we don't
1350 >      // need the pairs vector:
1351        if (!rps.empty()) {
1352          RealType smallestDiff = HONKING_LARGE_VALUE;
1353 <        RealType diff;
1354 <        pair<RealType,RealType> bestPair = make_pair(1.0, 1.0);
1355 <        vector<pair<RealType,RealType> >::iterator rpi;
1353 >        RealType diff(0.0);
1354 >        std::pair<RealType,RealType> bestPair = std::make_pair(1.0, 1.0);
1355 >        std::vector<std::pair<RealType,RealType> >::iterator rpi;
1356          for (rpi = rps.begin(); rpi != rps.end(); ++rpi) {
1357            r1 = (*rpi).first;
1358            r2 = (*rpi).second;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines