| 53 | 
  | 
#include <mpi.h> | 
| 54 | 
  | 
#endif | 
| 55 | 
  | 
 | 
| 56 | 
+ | 
#ifdef _MSC_VER | 
| 57 | 
+ | 
#define isnan(x) _isnan((x)) | 
| 58 | 
+ | 
#define isinf(x) (!_finite(x) && !_isnan(x)) | 
| 59 | 
+ | 
#endif | 
| 60 | 
+ | 
 | 
| 61 | 
  | 
#define HONKING_LARGE_VALUE 1.0e10 | 
| 62 | 
  | 
 | 
| 63 | 
  | 
using namespace std; | 
| 70 | 
  | 
    failTrialCount_ = 0; | 
| 71 | 
  | 
    failRootCount_ = 0; | 
| 72 | 
  | 
 | 
| 68 | 
– | 
    int seedValue; | 
| 73 | 
  | 
    Globals * simParams = info->getSimParams(); | 
| 74 | 
  | 
    RNEMDParameters* rnemdParams = simParams->getRNEMDParameters(); | 
| 75 | 
  | 
 | 
| 84 | 
  | 
    stringToFluxType_["Px"]  = rnemdPx; | 
| 85 | 
  | 
    stringToFluxType_["Py"]  = rnemdPy; | 
| 86 | 
  | 
    stringToFluxType_["Pz"]  = rnemdPz; | 
| 87 | 
+ | 
    stringToFluxType_["Pvector"]  = rnemdPvector; | 
| 88 | 
  | 
    stringToFluxType_["KE+Px"]  = rnemdKePx; | 
| 89 | 
  | 
    stringToFluxType_["KE+Py"]  = rnemdKePy; | 
| 90 | 
  | 
    stringToFluxType_["KE+Pvector"]  = rnemdKePvector; | 
| 106 | 
  | 
      sprintf(painCave.errMsg,  | 
| 107 | 
  | 
              "RNEMD: No fluxType was set in the md file.  This parameter,\n" | 
| 108 | 
  | 
              "\twhich must be one of the following values:\n" | 
| 109 | 
< | 
              "\tKE, Px, Py, Pz, KE+Px, KE+Py, KE+Pvector, must be set to\n" | 
| 110 | 
< | 
              "\tuse RNEMD\n"); | 
| 109 | 
> | 
              "\tKE, Px, Py, Pz, Pvector, KE+Px, KE+Py, KE+Pvector\n" | 
| 110 | 
> | 
              "\tmust be set to use RNEMD\n"); | 
| 111 | 
  | 
      painCave.isFatal = 1; | 
| 112 | 
  | 
      painCave.severity = OPENMD_ERROR; | 
| 113 | 
  | 
      simError(); | 
| 205 | 
  | 
        break; | 
| 206 | 
  | 
      case rnemdPvector: | 
| 207 | 
  | 
        hasCorrectFlux = hasMomentumFluxVector; | 
| 208 | 
+ | 
        break; | 
| 209 | 
  | 
      case rnemdKePx: | 
| 210 | 
  | 
      case rnemdKePy: | 
| 211 | 
  | 
        hasCorrectFlux = hasMomentumFlux && hasKineticFlux; | 
| 233 | 
  | 
    }  | 
| 234 | 
  | 
    if (!hasCorrectFlux) { | 
| 235 | 
  | 
      sprintf(painCave.errMsg,  | 
| 236 | 
< | 
              "RNEMD: The current method,\n" | 
| 231 | 
< | 
              "\t%s, and flux type %s\n" | 
| 236 | 
> | 
              "RNEMD: The current method, %s, and flux type, %s,\n" | 
| 237 | 
  | 
              "\tdid not have the correct flux value specified. Options\n" | 
| 238 | 
  | 
              "\tinclude: kineticFlux, momentumFlux, and momentumFluxVector\n", | 
| 239 | 
  | 
              methStr.c_str(), fluxStr.c_str()); | 
| 243 | 
  | 
    }  | 
| 244 | 
  | 
 | 
| 245 | 
  | 
    if (hasKineticFlux) { | 
| 246 | 
< | 
      kineticFlux_ = rnemdParams->getKineticFlux(); | 
| 246 | 
> | 
      // convert the kcal / mol / Angstroms^2 / fs values in the md file  | 
| 247 | 
> | 
      // into  amu / fs^3: | 
| 248 | 
> | 
      kineticFlux_ = rnemdParams->getKineticFlux()  | 
| 249 | 
> | 
        * PhysicalConstants::energyConvert; | 
| 250 | 
  | 
    } else { | 
| 251 | 
  | 
      kineticFlux_ = 0.0; | 
| 252 | 
  | 
    } | 
| 281 | 
  | 
    // do some sanity checking | 
| 282 | 
  | 
 | 
| 283 | 
  | 
    int selectionCount = seleMan_.getSelectionCount(); | 
| 284 | 
+ | 
 | 
| 285 | 
  | 
    int nIntegrable = info->getNGlobalIntegrableObjects(); | 
| 286 | 
  | 
 | 
| 287 | 
  | 
    if (selectionCount > nIntegrable) { | 
| 310 | 
  | 
    z.title =  "Z"; | 
| 311 | 
  | 
    z.dataType = "RealType"; | 
| 312 | 
  | 
    z.accumulator.reserve(nBins_); | 
| 313 | 
< | 
    for (unsigned int i = 0; i < nBins_; i++)  | 
| 313 | 
> | 
    for (int i = 0; i < nBins_; i++)  | 
| 314 | 
  | 
      z.accumulator.push_back( new Accumulator() ); | 
| 315 | 
  | 
    data_[Z] = z; | 
| 316 | 
  | 
    outputMap_["Z"] =  Z; | 
| 320 | 
  | 
    temperature.title =  "Temperature"; | 
| 321 | 
  | 
    temperature.dataType = "RealType"; | 
| 322 | 
  | 
    temperature.accumulator.reserve(nBins_); | 
| 323 | 
< | 
    for (unsigned int i = 0; i < nBins_; i++)  | 
| 323 | 
> | 
    for (int i = 0; i < nBins_; i++)  | 
| 324 | 
  | 
      temperature.accumulator.push_back( new Accumulator() ); | 
| 325 | 
  | 
    data_[TEMPERATURE] = temperature; | 
| 326 | 
  | 
    outputMap_["TEMPERATURE"] =  TEMPERATURE; | 
| 327 | 
  | 
 | 
| 328 | 
  | 
    OutputData velocity; | 
| 329 | 
< | 
    velocity.units = "amu/fs"; | 
| 329 | 
> | 
    velocity.units = "angstroms/fs"; | 
| 330 | 
  | 
    velocity.title =  "Velocity";   | 
| 331 | 
  | 
    velocity.dataType = "Vector3d"; | 
| 332 | 
  | 
    velocity.accumulator.reserve(nBins_); | 
| 333 | 
< | 
    for (unsigned int i = 0; i < nBins_; i++)  | 
| 333 | 
> | 
    for (int i = 0; i < nBins_; i++)  | 
| 334 | 
  | 
      velocity.accumulator.push_back( new VectorAccumulator() ); | 
| 335 | 
  | 
    data_[VELOCITY] = velocity; | 
| 336 | 
  | 
    outputMap_["VELOCITY"] = VELOCITY; | 
| 340 | 
  | 
    density.title =  "Density"; | 
| 341 | 
  | 
    density.dataType = "RealType"; | 
| 342 | 
  | 
    density.accumulator.reserve(nBins_); | 
| 343 | 
< | 
    for (unsigned int i = 0; i < nBins_; i++)  | 
| 343 | 
> | 
    for (int i = 0; i < nBins_; i++)  | 
| 344 | 
  | 
      density.accumulator.push_back( new Accumulator() ); | 
| 345 | 
  | 
    data_[DENSITY] = density; | 
| 346 | 
  | 
    outputMap_["DENSITY"] =  DENSITY; | 
| 452 | 
  | 
 | 
| 453 | 
  | 
    int selei; | 
| 454 | 
  | 
    StuntDouble* sd; | 
| 446 | 
– | 
    int idx; | 
| 455 | 
  | 
 | 
| 456 | 
  | 
    RealType min_val; | 
| 457 | 
  | 
    bool min_found = false;    | 
| 464 | 
  | 
    for (sd = seleMan_.beginSelected(selei); sd != NULL;  | 
| 465 | 
  | 
         sd = seleMan_.nextSelected(selei)) { | 
| 466 | 
  | 
 | 
| 459 | 
– | 
      idx = sd->getLocalIndex(); | 
| 460 | 
– | 
 | 
| 467 | 
  | 
      Vector3d pos = sd->getPos(); | 
| 468 | 
  | 
 | 
| 469 | 
  | 
      // wrap the stuntdouble's position back into the box: | 
| 500 | 
  | 
                + angMom[2]*angMom[2]/I(2, 2); | 
| 501 | 
  | 
            } | 
| 502 | 
  | 
          } //angular momenta exchange enabled | 
| 497 | 
– | 
          //energyConvert temporarily disabled | 
| 498 | 
– | 
          //make kineticExchange_ comparable between swap & scale | 
| 499 | 
– | 
          //value = value * 0.5 / PhysicalConstants::energyConvert; | 
| 503 | 
  | 
          value *= 0.5; | 
| 504 | 
  | 
          break; | 
| 505 | 
  | 
        case rnemdPx : | 
| 541 | 
  | 
      } | 
| 542 | 
  | 
    } | 
| 543 | 
  | 
     | 
| 544 | 
< | 
#ifdef IS_MPI | 
| 545 | 
< | 
    int nProc, worldRank; | 
| 544 | 
> | 
#ifdef IS_MPI     | 
| 545 | 
> | 
    int worldRank = MPI::COMM_WORLD.Get_rank(); | 
| 546 | 
  | 
     | 
| 544 | 
– | 
    nProc = MPI::COMM_WORLD.Get_size(); | 
| 545 | 
– | 
    worldRank = MPI::COMM_WORLD.Get_rank(); | 
| 546 | 
– | 
 | 
| 547 | 
  | 
    bool my_min_found = min_found; | 
| 548 | 
  | 
    bool my_max_found = max_found; | 
| 549 | 
  | 
 | 
| 734 | 
  | 
         | 
| 735 | 
  | 
        switch(rnemdFluxType_) { | 
| 736 | 
  | 
        case rnemdKE: | 
| 737 | 
– | 
          cerr << "KE\n"; | 
| 737 | 
  | 
          kineticExchange_ += max_val - min_val; | 
| 738 | 
  | 
          break; | 
| 739 | 
  | 
        case rnemdPx: | 
| 746 | 
  | 
          momentumExchange_.z() += max_val - min_val; | 
| 747 | 
  | 
          break; | 
| 748 | 
  | 
        default: | 
| 750 | 
– | 
          cerr << "default\n"; | 
| 749 | 
  | 
          break; | 
| 750 | 
  | 
        } | 
| 751 | 
  | 
      } else {         | 
| 776 | 
  | 
 | 
| 777 | 
  | 
    int selei; | 
| 778 | 
  | 
    StuntDouble* sd; | 
| 781 | 
– | 
    int idx; | 
| 779 | 
  | 
 | 
| 780 | 
  | 
    vector<StuntDouble*> hotBin, coldBin; | 
| 781 | 
  | 
 | 
| 797 | 
  | 
    for (sd = seleMan_.beginSelected(selei); sd != NULL;  | 
| 798 | 
  | 
         sd = seleMan_.nextSelected(selei)) { | 
| 799 | 
  | 
 | 
| 803 | 
– | 
      idx = sd->getLocalIndex(); | 
| 804 | 
– | 
 | 
| 800 | 
  | 
      Vector3d pos = sd->getPos(); | 
| 801 | 
  | 
 | 
| 802 | 
  | 
      // wrap the stuntdouble's position back into the box: | 
| 909 | 
  | 
 | 
| 910 | 
  | 
      if ((c > 0.81) && (c < 1.21)) {//restrict scaling coefficients | 
| 911 | 
  | 
        c = sqrt(c); | 
| 912 | 
< | 
        //std::cerr << "cold slab scaling coefficient: " << c << endl; | 
| 918 | 
< | 
        //now convert to hotBin coefficient | 
| 912 | 
> | 
 | 
| 913 | 
  | 
        RealType w = 0.0; | 
| 914 | 
  | 
        if (rnemdFluxType_ ==  rnemdFullKE) { | 
| 915 | 
  | 
          x = 1.0 + px * (1.0 - c); | 
| 947 | 
  | 
            } | 
| 948 | 
  | 
          } | 
| 949 | 
  | 
          w = sqrt(w); | 
| 956 | 
– | 
          // std::cerr << "xh= " << x << "\tyh= " << y << "\tzh= " << z | 
| 957 | 
– | 
          //           << "\twh= " << w << endl; | 
| 950 | 
  | 
          for (sdi = hotBin.begin(); sdi != hotBin.end(); sdi++) { | 
| 951 | 
  | 
            if (rnemdFluxType_ == rnemdFullKE) { | 
| 952 | 
  | 
              vel = (*sdi)->getVel(); | 
| 1220 | 
  | 
 | 
| 1221 | 
  | 
    int selei; | 
| 1222 | 
  | 
    StuntDouble* sd; | 
| 1231 | 
– | 
    int idx; | 
| 1223 | 
  | 
 | 
| 1224 | 
  | 
    vector<StuntDouble*> hotBin, coldBin; | 
| 1225 | 
  | 
 | 
| 1234 | 
  | 
    for (sd = seleMan_.beginSelected(selei); sd != NULL;  | 
| 1235 | 
  | 
         sd = seleMan_.nextSelected(selei)) { | 
| 1236 | 
  | 
 | 
| 1246 | 
– | 
      idx = sd->getLocalIndex(); | 
| 1247 | 
– | 
 | 
| 1237 | 
  | 
      Vector3d pos = sd->getPos(); | 
| 1238 | 
  | 
 | 
| 1239 | 
  | 
      // wrap the stuntdouble's position back into the box: | 
| 1252 | 
  | 
        | 
| 1253 | 
  | 
        if (inA) { | 
| 1254 | 
  | 
          hotBin.push_back(sd); | 
| 1266 | 
– | 
          //std::cerr << "before, velocity = " << vel << endl; | 
| 1255 | 
  | 
          Ph += mass * vel; | 
| 1268 | 
– | 
          //std::cerr << "after, velocity = " << vel << endl; | 
| 1256 | 
  | 
          Mh += mass; | 
| 1257 | 
  | 
          Kh += mass * vel.lengthSquare(); | 
| 1258 | 
  | 
          if (rnemdFluxType_ == rnemdFullKE) { | 
| 1300 | 
  | 
     | 
| 1301 | 
  | 
    Kh *= 0.5; | 
| 1302 | 
  | 
    Kc *= 0.5; | 
| 1316 | 
– | 
 | 
| 1317 | 
– | 
    // std::cerr << "Mh= " << Mh << "\tKh= " << Kh << "\tMc= " << Mc | 
| 1318 | 
– | 
    //        << "\tKc= " << Kc << endl; | 
| 1319 | 
– | 
    // std::cerr << "Ph= " << Ph << "\tPc= " << Pc << endl; | 
| 1303 | 
  | 
     | 
| 1304 | 
  | 
#ifdef IS_MPI | 
| 1305 | 
  | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &Ph[0], 3, MPI::REALTYPE, MPI::SUM); | 
| 1331 | 
  | 
              if (hDenominator > 0.0) { | 
| 1332 | 
  | 
                RealType h = sqrt(hNumerator / hDenominator); | 
| 1333 | 
  | 
                if ((h > 0.9) && (h < 1.1)) { | 
| 1334 | 
< | 
                  // std::cerr << "cold slab scaling coefficient: " << c << "\n"; | 
| 1352 | 
< | 
                  // std::cerr << "hot slab scaling coefficient: " << h <<  "\n"; | 
| 1334 | 
> | 
 | 
| 1335 | 
  | 
                  vector<StuntDouble*>::iterator sdi; | 
| 1336 | 
  | 
                  Vector3d vel; | 
| 1337 | 
  | 
                  for (sdi = coldBin.begin(); sdi != coldBin.end(); sdi++) { | 
| 1406 | 
  | 
 | 
| 1407 | 
  | 
    seleMan_.setSelectionSet(evaluator_.evaluate()); | 
| 1408 | 
  | 
 | 
| 1409 | 
< | 
    int selei; | 
| 1409 | 
> | 
    int selei(0); | 
| 1410 | 
  | 
    StuntDouble* sd; | 
| 1429 | 
– | 
    int idx; | 
| 1411 | 
  | 
 | 
| 1412 | 
  | 
    vector<RealType> binMass(nBins_, 0.0); | 
| 1413 | 
  | 
    vector<RealType> binPx(nBins_, 0.0); | 
| 1431 | 
  | 
             sd != NULL; | 
| 1432 | 
  | 
             sd = mol->nextIntegrableObject(iiter)) | 
| 1433 | 
  | 
    */ | 
| 1434 | 
+ | 
 | 
| 1435 | 
  | 
    for (sd = seleMan_.beginSelected(selei); sd != NULL;  | 
| 1436 | 
< | 
         sd = seleMan_.nextSelected(selei)) { | 
| 1437 | 
< | 
       | 
| 1456 | 
< | 
      idx = sd->getLocalIndex(); | 
| 1457 | 
< | 
       | 
| 1436 | 
> | 
         sd = seleMan_.nextSelected(selei)) {      | 
| 1437 | 
> | 
     | 
| 1438 | 
  | 
      Vector3d pos = sd->getPos(); | 
| 1439 | 
  | 
 | 
| 1440 | 
  | 
      // wrap the stuntdouble's position back into the box: | 
| 1449 | 
  | 
      // The modulo operator is used to wrap the case when we are  | 
| 1450 | 
  | 
      // beyond the end of the bins back to the beginning. | 
| 1451 | 
  | 
      int binNo = int(nBins_ * (pos.z() / hmat(2,2) + 0.5)) % nBins_; | 
| 1452 | 
< | 
      | 
| 1452 | 
> | 
 | 
| 1453 | 
  | 
      RealType mass = sd->getMass(); | 
| 1454 | 
  | 
      Vector3d vel = sd->getVel(); | 
| 1455 | 
  | 
 | 
| 1480 | 
  | 
      } | 
| 1481 | 
  | 
    } | 
| 1482 | 
  | 
     | 
| 1503 | 
– | 
 | 
| 1483 | 
  | 
#ifdef IS_MPI | 
| 1484 | 
  | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binCount[0], | 
| 1485 | 
  | 
                              nBins_, MPI::INT, MPI::SUM); | 
| 1506 | 
  | 
      vel.x() = binPx[i] / binMass[i]; | 
| 1507 | 
  | 
      vel.y() = binPy[i] / binMass[i]; | 
| 1508 | 
  | 
      vel.z() = binPz[i] / binMass[i]; | 
| 1530 | 
– | 
      den = binCount[i] * nBins_ / currentSnap_->getVolume(); | 
| 1531 | 
– | 
      temp = 2.0 * binKE[i] / (binDOF[i] * PhysicalConstants::kb * | 
| 1532 | 
– | 
                               PhysicalConstants::energyConvert); | 
| 1509 | 
  | 
 | 
| 1510 | 
< | 
      for (unsigned int j = 0; j < outputMask_.size(); ++j) { | 
| 1511 | 
< | 
        if(outputMask_[j]) { | 
| 1512 | 
< | 
          switch(j) { | 
| 1513 | 
< | 
          case Z: | 
| 1514 | 
< | 
            (data_[j].accumulator[i])->add(z); | 
| 1515 | 
< | 
            break; | 
| 1516 | 
< | 
          case TEMPERATURE: | 
| 1517 | 
< | 
            data_[j].accumulator[i]->add(temp); | 
| 1518 | 
< | 
            break; | 
| 1519 | 
< | 
          case VELOCITY: | 
| 1520 | 
< | 
            dynamic_cast<VectorAccumulator *>(data_[j].accumulator[i])->add(vel); | 
| 1521 | 
< | 
            break; | 
| 1522 | 
< | 
          case DENSITY: | 
| 1523 | 
< | 
            data_[j].accumulator[i]->add(den); | 
| 1524 | 
< | 
            break; | 
| 1510 | 
> | 
      den = binMass[i] * nBins_ * PhysicalConstants::densityConvert  | 
| 1511 | 
> | 
        / currentSnap_->getVolume() ; | 
| 1512 | 
> | 
 | 
| 1513 | 
> | 
      if (binCount[i] > 0) { | 
| 1514 | 
> | 
        // only add values if there are things to add | 
| 1515 | 
> | 
        temp = 2.0 * binKE[i] / (binDOF[i] * PhysicalConstants::kb * | 
| 1516 | 
> | 
                                 PhysicalConstants::energyConvert); | 
| 1517 | 
> | 
         | 
| 1518 | 
> | 
        for (unsigned int j = 0; j < outputMask_.size(); ++j) { | 
| 1519 | 
> | 
          if(outputMask_[j]) { | 
| 1520 | 
> | 
            switch(j) { | 
| 1521 | 
> | 
            case Z: | 
| 1522 | 
> | 
              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(z); | 
| 1523 | 
> | 
              break; | 
| 1524 | 
> | 
            case TEMPERATURE: | 
| 1525 | 
> | 
              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(temp); | 
| 1526 | 
> | 
              break; | 
| 1527 | 
> | 
            case VELOCITY: | 
| 1528 | 
> | 
              dynamic_cast<VectorAccumulator *>(data_[j].accumulator[i])->add(vel); | 
| 1529 | 
> | 
              break; | 
| 1530 | 
> | 
            case DENSITY: | 
| 1531 | 
> | 
              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(den); | 
| 1532 | 
> | 
              break; | 
| 1533 | 
> | 
            } | 
| 1534 | 
  | 
          } | 
| 1535 | 
  | 
        } | 
| 1536 | 
  | 
      } | 
| 1587 | 
  | 
      RealType time = currentSnap_->getTime(); | 
| 1588 | 
  | 
      RealType avgArea; | 
| 1589 | 
  | 
      areaAccumulator_->getAverage(avgArea); | 
| 1590 | 
< | 
      RealType Jz = kineticExchange_ / (2.0 * time * avgArea); | 
| 1590 | 
> | 
      RealType Jz = kineticExchange_ / (2.0 * time * avgArea)  | 
| 1591 | 
> | 
        / PhysicalConstants::energyConvert; | 
| 1592 | 
  | 
      Vector3d JzP = momentumExchange_ / (2.0 * time * avgArea);       | 
| 1593 | 
  | 
 | 
| 1594 | 
  | 
      rnemdFile_ << "#######################################################\n"; | 
| 1617 | 
  | 
      rnemdFile_ << "# RNEMD report:\n";       | 
| 1618 | 
  | 
      rnemdFile_ << "#     running time = " << time << " fs\n"; | 
| 1619 | 
  | 
      rnemdFile_ << "#     target flux:\n"; | 
| 1620 | 
< | 
      rnemdFile_ << "#         kinetic = " << kineticFlux_ << "\n"; | 
| 1621 | 
< | 
      rnemdFile_ << "#         momentum = " << momentumFluxVector_ << "\n"; | 
| 1620 | 
> | 
      rnemdFile_ << "#         kinetic = "  | 
| 1621 | 
> | 
                 << kineticFlux_ / PhysicalConstants::energyConvert  | 
| 1622 | 
> | 
                 << " (kcal/mol/A^2/fs)\n"; | 
| 1623 | 
> | 
      rnemdFile_ << "#         momentum = " << momentumFluxVector_  | 
| 1624 | 
> | 
                 << " (amu/A/fs^2)\n"; | 
| 1625 | 
  | 
      rnemdFile_ << "#     target one-time exchanges:\n"; | 
| 1626 | 
< | 
      rnemdFile_ << "#         kinetic = " << kineticTarget_ << "\n"; | 
| 1627 | 
< | 
      rnemdFile_ << "#         momentum = " << momentumTarget_ << "\n"; | 
| 1626 | 
> | 
      rnemdFile_ << "#         kinetic = "  | 
| 1627 | 
> | 
                 << kineticTarget_ / PhysicalConstants::energyConvert  | 
| 1628 | 
> | 
                 << " (kcal/mol)\n"; | 
| 1629 | 
> | 
      rnemdFile_ << "#         momentum = " << momentumTarget_  | 
| 1630 | 
> | 
                 << " (amu*A/fs)\n"; | 
| 1631 | 
  | 
      rnemdFile_ << "#     actual exchange totals:\n"; | 
| 1632 | 
< | 
      rnemdFile_ << "#         kinetic = " << kineticExchange_ << "\n"; | 
| 1633 | 
< | 
      rnemdFile_ << "#         momentum = " << momentumExchange_  << "\n"; | 
| 1632 | 
> | 
      rnemdFile_ << "#         kinetic = "  | 
| 1633 | 
> | 
                 << kineticExchange_ / PhysicalConstants::energyConvert  | 
| 1634 | 
> | 
                 << " (kcal/mol)\n"; | 
| 1635 | 
> | 
      rnemdFile_ << "#         momentum = " << momentumExchange_  | 
| 1636 | 
> | 
                 << " (amu*A/fs)\n";       | 
| 1637 | 
  | 
      rnemdFile_ << "#     actual flux:\n"; | 
| 1638 | 
< | 
      rnemdFile_ << "#         kinetic = " << Jz << "\n"; | 
| 1639 | 
< | 
      rnemdFile_ << "#         momentum = " << JzP  << "\n"; | 
| 1638 | 
> | 
      rnemdFile_ << "#         kinetic = " << Jz | 
| 1639 | 
> | 
                 << " (kcal/mol/A^2/fs)\n"; | 
| 1640 | 
> | 
      rnemdFile_ << "#         momentum = " << JzP  | 
| 1641 | 
> | 
                 << " (amu/A/fs^2)\n"; | 
| 1642 | 
  | 
      rnemdFile_ << "#     exchange statistics:\n"; | 
| 1643 | 
  | 
      rnemdFile_ << "#         attempted = " << trialCount_ << "\n"; | 
| 1644 | 
  | 
      rnemdFile_ << "#         failed = " << failTrialCount_ << "\n";      | 
| 1656 | 
  | 
        if (outputMask_[i]) { | 
| 1657 | 
  | 
          rnemdFile_ << "\t" << data_[i].title <<  | 
| 1658 | 
  | 
            "(" << data_[i].units << ")"; | 
| 1659 | 
+ | 
          // add some extra tabs for column alignment | 
| 1660 | 
+ | 
          if (data_[i].dataType == "Vector3d") rnemdFile_ << "\t\t"; | 
| 1661 | 
  | 
        } | 
| 1662 | 
  | 
      } | 
| 1663 | 
  | 
      rnemdFile_ << std::endl; | 
| 1664 | 
  | 
       | 
| 1665 | 
  | 
      rnemdFile_.precision(8); | 
| 1666 | 
  | 
       | 
| 1667 | 
< | 
      for (unsigned int j = 0; j < nBins_; j++) {         | 
| 1667 | 
> | 
      for (int j = 0; j < nBins_; j++) {         | 
| 1668 | 
  | 
         | 
| 1669 | 
  | 
        for (unsigned int i = 0; i < outputMask_.size(); ++i) { | 
| 1670 | 
  | 
          if (outputMask_[i]) { | 
| 1690 | 
  | 
      rnemdFile_ << "#######################################################\n"; | 
| 1691 | 
  | 
 | 
| 1692 | 
  | 
 | 
| 1693 | 
< | 
      for (unsigned int j = 0; j < nBins_; j++) {         | 
| 1693 | 
> | 
      for (int j = 0; j < nBins_; j++) {         | 
| 1694 | 
  | 
        rnemdFile_ << "#"; | 
| 1695 | 
  | 
        for (unsigned int i = 0; i < outputMask_.size(); ++i) { | 
| 1696 | 
  | 
          if (outputMask_[i]) { | 
| 1726 | 
  | 
    assert(bin < nBins_); | 
| 1727 | 
  | 
    RealType s; | 
| 1728 | 
  | 
     | 
| 1729 | 
< | 
    data_[index].accumulator[bin]->getAverage(s); | 
| 1729 | 
> | 
    dynamic_cast<Accumulator *>(data_[index].accumulator[bin])->getAverage(s); | 
| 1730 | 
  | 
     | 
| 1731 | 
  | 
    if (! isinf(s) && ! isnan(s)) { | 
| 1732 | 
  | 
      rnemdFile_ << "\t" << s; | 
| 1764 | 
  | 
    assert(bin < nBins_); | 
| 1765 | 
  | 
    RealType s; | 
| 1766 | 
  | 
     | 
| 1767 | 
< | 
    data_[index].accumulator[bin]->getStdDev(s); | 
| 1767 | 
> | 
    dynamic_cast<Accumulator *>(data_[index].accumulator[bin])->getStdDev(s); | 
| 1768 | 
  | 
     | 
| 1769 | 
  | 
    if (! isinf(s) && ! isnan(s)) { | 
| 1770 | 
  | 
      rnemdFile_ << "\t" << s; |