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 1868 by gezelter, Tue Apr 30 15:56:54 2013 UTC vs.
Revision 1875 by gezelter, Fri May 17 14:41:42 2013 UTC

# Line 72 | Line 72 | namespace OpenMD {
72                                  evaluatorA_(info), seleManA_(info),
73                                  commonA_(info), evaluatorB_(info),
74                                  seleManB_(info), commonB_(info),
75 <                                hasData_(false),
75 >                                hasData_(false), hasDividingArea_(false),
76                                  usePeriodicBoundaryConditions_(info->getSimParams()->getUsePeriodicBoundaryConditions()) {
77  
78      trialCount_ = 0;
# Line 1151 | Line 1151 | namespace OpenMD {
1151            //if w is in the right range, so should be x, y, z.
1152            vector<StuntDouble*>::iterator sdi;
1153            Vector3d vel;
1154 <          for (sdi = coldBin.begin(); sdi != coldBin.end(); sdi++) {
1154 >          for (sdi = coldBin.begin(); sdi != coldBin.end(); ++sdi) {
1155              if (rnemdFluxType_ == rnemdFullKE) {
1156                vel = (*sdi)->getVel() * c;
1157                (*sdi)->setVel(vel);
# Line 1162 | Line 1162 | namespace OpenMD {
1162              }
1163            }
1164            w = sqrt(w);
1165 <          for (sdi = hotBin.begin(); sdi != hotBin.end(); sdi++) {
1165 >          for (sdi = hotBin.begin(); sdi != hotBin.end(); ++sdi) {
1166              if (rnemdFluxType_ == rnemdFullKE) {
1167                vel = (*sdi)->getVel();
1168                vel.x() *= x;
# Line 1281 | Line 1281 | namespace OpenMD {
1281        vector<RealType>::iterator ri;
1282        RealType r1, r2, alpha0;
1283        vector<pair<RealType,RealType> > rps;
1284 <      for (ri = realRoots.begin(); ri !=realRoots.end(); ri++) {
1284 >      for (ri = realRoots.begin(); ri !=realRoots.end(); ++ri) {
1285          r2 = *ri;
1286          //check if FindRealRoots() give the right answer
1287          if ( fabs(u0 + r2 * (u1 + r2 * (u2 + r2 * (u3 + r2 * u4)))) > 1e-6 ) {
# Line 1313 | Line 1313 | namespace OpenMD {
1313          RealType diff;
1314          pair<RealType,RealType> bestPair = make_pair(1.0, 1.0);
1315          vector<pair<RealType,RealType> >::iterator rpi;
1316 <        for (rpi = rps.begin(); rpi != rps.end(); rpi++) {
1316 >        for (rpi = rps.begin(); rpi != rps.end(); ++rpi) {
1317            r1 = (*rpi).first;
1318            r2 = (*rpi).second;
1319            switch(rnemdFluxType_) {
# Line 1380 | Line 1380 | namespace OpenMD {
1380          }
1381          vector<StuntDouble*>::iterator sdi;
1382          Vector3d vel;
1383 <        for (sdi = coldBin.begin(); sdi != coldBin.end(); sdi++) {
1383 >        for (sdi = coldBin.begin(); sdi != coldBin.end(); ++sdi) {
1384            vel = (*sdi)->getVel();
1385            vel.x() *= x;
1386            vel.y() *= y;
# Line 1391 | Line 1391 | namespace OpenMD {
1391          x = 1.0 + px * (1.0 - x);
1392          y = 1.0 + py * (1.0 - y);
1393          z = 1.0 + pz * (1.0 - z);
1394 <        for (sdi = hotBin.begin(); sdi != hotBin.end(); sdi++) {
1394 >        for (sdi = hotBin.begin(); sdi != hotBin.end(); ++sdi) {
1395            vel = (*sdi)->getVel();
1396            vel.x() *= x;
1397            vel.y() *= y;
# Line 1597 | Line 1597 | namespace OpenMD {
1597  
1598      Vector3d ac, acrec, bc, bcrec;
1599      Vector3d ah, ahrec, bh, bhrec;
1600    RealType cNumerator, cDenominator;
1601    RealType hNumerator, hDenominator;
1600  
1603
1601      bool successfulExchange = false;
1602      if ((Mh > 0.0) && (Mc > 0.0)) {//both slabs are not empty
1603        Vector3d vc = Pc / Mc;
# Line 1614 | Line 1611 | namespace OpenMD {
1611        bc  = -(Ici * angularMomentumTarget_) + omegac;
1612        bcrec = bc - omegac;
1613        
1614 <      cNumerator = Kc - kineticTarget_;
1614 >      RealType cNumerator = Kc - kineticTarget_;
1615        if (doLinearPart)
1616          cNumerator -= 0.5 * Mc * ac.lengthSquare();
1617        
# Line 1623 | Line 1620 | namespace OpenMD {
1620  
1621        if (cNumerator > 0.0) {
1622          
1623 <        cDenominator = Kc;
1623 >        RealType cDenominator = Kc;
1624  
1625          if (doLinearPart)
1626            cDenominator -= 0.5 * Mc * vc.lengthSquare();
# Line 1646 | Line 1643 | namespace OpenMD {
1643              bh  = (Ihi * angularMomentumTarget_) + omegah;
1644              bhrec = bh - omegah;
1645              
1646 <            hNumerator = Kh + kineticTarget_;
1646 >            RealType hNumerator = Kh + kineticTarget_;
1647              if (doLinearPart)
1648                hNumerator -= 0.5 * Mh * ah.lengthSquare();
1649              
# Line 1655 | Line 1652 | namespace OpenMD {
1652                
1653              if (hNumerator > 0.0) {
1654                
1655 <              hDenominator = Kh;
1655 >              RealType hDenominator = Kh;
1656                if (doLinearPart)
1657                  hDenominator -= 0.5 * Mh * vh.lengthSquare();
1658                if (doAngularPart)
# Line 1669 | Line 1666 | namespace OpenMD {
1666                    Vector3d vel;
1667                    Vector3d rPos;
1668                    
1669 <                  for (sdi = coldBin.begin(); sdi != coldBin.end(); sdi++) {
1669 >                  for (sdi = coldBin.begin(); sdi != coldBin.end(); ++sdi) {
1670                      //vel = (*sdi)->getVel();
1671                      rPos = (*sdi)->getPos() - coordinateOrigin_;
1672                      if (doLinearPart)
# Line 1685 | Line 1682 | namespace OpenMD {
1682                        }
1683                      }
1684                    }
1685 <                  for (sdi = hotBin.begin(); sdi != hotBin.end(); sdi++) {
1685 >                  for (sdi = hotBin.begin(); sdi != hotBin.end(); ++sdi) {
1686                      //vel = (*sdi)->getVel();
1687                      rPos = (*sdi)->getPos() - coordinateOrigin_;
1688                      if (doLinearPart)
# Line 2231 | Line 2228 | namespace OpenMD {
2228        rnemdFile_ << "\t" << s;
2229      } else{
2230        sprintf( painCave.errMsg,
2231 <               "RNEMD detected a numerical error writing: %s for bin %d",
2231 >               "RNEMD detected a numerical error writing: %s for bin %u",
2232                 data_[index].title.c_str(), bin);
2233        painCave.isFatal = 1;
2234        simError();
# Line 2254 | Line 2251 | namespace OpenMD {
2251          isinf(s[1]) || isnan(s[1]) ||
2252          isinf(s[2]) || isnan(s[2]) ) {      
2253        sprintf( painCave.errMsg,
2254 <               "RNEMD detected a numerical error writing: %s for bin %d",
2254 >               "RNEMD detected a numerical error writing: %s for bin %u",
2255                 data_[index].title.c_str(), bin);
2256        painCave.isFatal = 1;
2257        simError();
# Line 2279 | Line 2276 | namespace OpenMD {
2276        rnemdFile_ << "\t" << s;
2277      } else{
2278        sprintf( painCave.errMsg,
2279 <               "RNEMD detected a numerical error writing: %s std. dev. for bin %d",
2279 >               "RNEMD detected a numerical error writing: %s std. dev. for bin %u",
2280                 data_[index].title.c_str(), bin);
2281        painCave.isFatal = 1;
2282        simError();
# Line 2301 | Line 2298 | namespace OpenMD {
2298          isinf(s[1]) || isnan(s[1]) ||
2299          isinf(s[2]) || isnan(s[2]) ) {      
2300        sprintf( painCave.errMsg,
2301 <               "RNEMD detected a numerical error writing: %s std. dev. for bin %d",
2301 >               "RNEMD detected a numerical error writing: %s std. dev. for bin %u",
2302                 data_[index].title.c_str(), bin);
2303        painCave.isFatal = 1;
2304        simError();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines