| 6 | 
  | 
 * redistribute this software in source and binary code form, provided | 
| 7 | 
  | 
 * that the following conditions are met: | 
| 8 | 
  | 
 * | 
| 9 | 
< | 
 * 1. Acknowledgement of the program authors must be made in any | 
| 10 | 
< | 
 *    publication of scientific results based in part on use of the | 
| 11 | 
< | 
 *    program.  An acceptable form of acknowledgement is citation of | 
| 12 | 
< | 
 *    the article in which the program was described (Matthew | 
| 13 | 
< | 
 *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher | 
| 14 | 
< | 
 *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented | 
| 15 | 
< | 
 *    Parallel Simulation Engine for Molecular Dynamics," | 
| 16 | 
< | 
 *    J. Comput. Chem. 26, pp. 252-271 (2005)) | 
| 17 | 
< | 
 * | 
| 18 | 
< | 
 * 2. Redistributions of source code must retain the above copyright | 
| 9 | 
> | 
 * 1. Redistributions of source code must retain the above copyright | 
| 10 | 
  | 
 *    notice, this list of conditions and the following disclaimer. | 
| 11 | 
  | 
 * | 
| 12 | 
< | 
 * 3. Redistributions in binary form must reproduce the above copyright | 
| 12 | 
> | 
 * 2. Redistributions in binary form must reproduce the above copyright | 
| 13 | 
  | 
 *    notice, this list of conditions and the following disclaimer in the | 
| 14 | 
  | 
 *    documentation and/or other materials provided with the | 
| 15 | 
  | 
 *    distribution. | 
| 28 | 
  | 
 * arising out of the use of or inability to use software, even if the | 
| 29 | 
  | 
 * University of Notre Dame has been advised of the possibility of | 
| 30 | 
  | 
 * such damages. | 
| 31 | 
+ | 
 * | 
| 32 | 
+ | 
 * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your | 
| 33 | 
+ | 
 * research, please cite the appropriate papers when you publish your | 
| 34 | 
+ | 
 * work.  Good starting points are: | 
| 35 | 
+ | 
 *                                                                       | 
| 36 | 
+ | 
 * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).              | 
| 37 | 
+ | 
 * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).           | 
| 38 | 
+ | 
 * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).           | 
| 39 | 
+ | 
 * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010). | 
| 40 | 
+ | 
 * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). | 
| 41 | 
  | 
 */ | 
| 42 | 
  | 
  | 
| 43 | 
  | 
/** | 
| 52 | 
  | 
#define INTEGRATORS_RNEMD_HPP | 
| 53 | 
  | 
#include "brains/SimInfo.hpp" | 
| 54 | 
  | 
#include "math/RandNumGen.hpp" | 
| 55 | 
+ | 
#include "selection/SelectionEvaluator.hpp" | 
| 56 | 
+ | 
#include "selection/SelectionManager.hpp" | 
| 57 | 
+ | 
#include <iostream> | 
| 58 | 
  | 
 | 
| 59 | 
< | 
namespace oopse { | 
| 59 | 
> | 
using namespace std; | 
| 60 | 
> | 
namespace OpenMD { | 
| 61 | 
  | 
 | 
| 57 | 
– | 
  /** | 
| 58 | 
– | 
   * @class RNEMD RNEMD.hpp "integrators/RNEMD.hpp" | 
| 59 | 
– | 
   * @todo document | 
| 60 | 
– | 
   */ | 
| 62 | 
  | 
  class RNEMD { | 
| 63 | 
  | 
  public: | 
| 64 | 
  | 
    RNEMD(SimInfo* info); | 
| 65 | 
  | 
    virtual ~RNEMD(); | 
| 66 | 
< | 
         | 
| 66 | 
> | 
     | 
| 67 | 
> | 
    void doRNEMD(); | 
| 68 | 
  | 
    void doSwap(); | 
| 69 | 
< | 
    void set_RNEMD_swapTime(RealType swapTime) { swapTime_ = swapTime; } | 
| 70 | 
< | 
    void set_RNEMD_nBins(int nbins) { nBins_ = nbins; } | 
| 71 | 
< | 
    RealType get_RNEMD_exchange_total() { return exchangeSum_; } | 
| 72 | 
< | 
    void set_RNEMD_exchange_total(RealType et) {exchangeSum_ = et;} | 
| 73 | 
< | 
         | 
| 69 | 
> | 
    void doNIVS(); | 
| 70 | 
> | 
    void doVSS(); | 
| 71 | 
> | 
    void collectData(); | 
| 72 | 
> | 
    void getStarted(); | 
| 73 | 
> | 
    bool inSlabA(Vector3d pos); | 
| 74 | 
> | 
    bool inSlabB(Vector3d pos); | 
| 75 | 
> | 
    void parseOutputFileFormat(const std::string& format); | 
| 76 | 
> | 
    void writeOutputFile(); | 
| 77 | 
> | 
    void writeReal(int index, unsigned int bin); | 
| 78 | 
> | 
    void writeVector(int index, unsigned int bin); | 
| 79 | 
> | 
 | 
| 80 | 
  | 
  private: | 
| 81 | 
< | 
         | 
| 82 | 
< | 
    enum RNEMDTypeEnum { | 
| 83 | 
< | 
      rnemdKinetic, | 
| 84 | 
< | 
      rnemdPx, | 
| 85 | 
< | 
      rnemdPy, | 
| 86 | 
< | 
      rnemdPz, | 
| 79 | 
< | 
      rnemdUnknown | 
| 81 | 
> | 
 | 
| 82 | 
> | 
    enum RNEMDMethod { | 
| 83 | 
> | 
      rnemdSwap, | 
| 84 | 
> | 
      rnemdNIVS, | 
| 85 | 
> | 
      rnemdVSS, | 
| 86 | 
> | 
      rnemdUnkownMethod | 
| 87 | 
  | 
    }; | 
| 88 | 
< | 
      | 
| 88 | 
> | 
    enum RNEMDFluxType { | 
| 89 | 
> | 
      rnemdKE,       // translational kinetic energy flux | 
| 90 | 
> | 
      rnemdRotKE,    // rotational kinetic energy flux | 
| 91 | 
> | 
      rnemdFullKE,   // full kinetic energy flux | 
| 92 | 
> | 
      rnemdPx,       // flux of momentum along x axis  | 
| 93 | 
> | 
      rnemdPy,       // flux of momentum along y axis  | 
| 94 | 
> | 
      rnemdPz,       // flux of momentum along z axis  | 
| 95 | 
> | 
      rnemdPvector,  // flux of momentum vector | 
| 96 | 
> | 
      rnemdKePx,     // flux of translational KE and x-momentum | 
| 97 | 
> | 
      rnemdKePy,     // flux of translational KE and y-momentum | 
| 98 | 
> | 
      rnemdKePvector, // full combo platter | 
| 99 | 
> | 
      rnemdUnknownFluxType | 
| 100 | 
> | 
    }; | 
| 101 | 
> | 
 | 
| 102 | 
> | 
    enum OutputFields { | 
| 103 | 
> | 
      BEGININDEX = 0, | 
| 104 | 
> | 
      Z = BEGININDEX, | 
| 105 | 
> | 
      TEMPERATURE, | 
| 106 | 
> | 
      VELOCITY, | 
| 107 | 
> | 
      DENSITY, | 
| 108 | 
> | 
      ENDINDEX  | 
| 109 | 
> | 
    }; | 
| 110 | 
> | 
 | 
| 111 | 
> | 
    struct OutputData { | 
| 112 | 
> | 
      string title; | 
| 113 | 
> | 
      string units; | 
| 114 | 
> | 
      string dataType; | 
| 115 | 
> | 
      vector<Accumulator*> accumulator; | 
| 116 | 
> | 
    }; | 
| 117 | 
> | 
 | 
| 118 | 
> | 
    typedef bitset<ENDINDEX-BEGININDEX> OutputBitSet; | 
| 119 | 
> | 
    typedef map<string, OutputFields> OutputMapType; | 
| 120 | 
> | 
     | 
| 121 | 
  | 
    SimInfo* info_; | 
| 83 | 
– | 
    RandNumGen* randNumGen_; | 
| 84 | 
– | 
    int nBins_;    | 
| 85 | 
– | 
    RealType swapTime_; | 
| 86 | 
– | 
    RealType exchangeSum_; | 
| 87 | 
– | 
    RNEMDTypeEnum rnemdType_; | 
| 88 | 
– | 
    std::map<std::string, RNEMDTypeEnum> stringToEnumMap_; | 
| 122 | 
  | 
 | 
| 123 | 
+ | 
    map<string, RNEMDMethod> stringToMethod_; | 
| 124 | 
+ | 
    map<string, RNEMDFluxType> stringToFluxType_; | 
| 125 | 
+ | 
    RNEMDMethod rnemdMethod_; | 
| 126 | 
+ | 
    RNEMDFluxType rnemdFluxType_; | 
| 127 | 
+ | 
    string rnemdObjectSelection_; | 
| 128 | 
+ | 
    SelectionEvaluator evaluator_; | 
| 129 | 
+ | 
    SelectionManager seleMan_; | 
| 130 | 
+ | 
    bool usePeriodicBoundaryConditions_; | 
| 131 | 
+ | 
    int nBins_;  | 
| 132 | 
+ | 
    RealType slabWidth_; | 
| 133 | 
+ | 
    RealType slabACenter_; | 
| 134 | 
+ | 
    RealType slabBCenter_; | 
| 135 | 
  | 
 | 
| 136 | 
< | 
  }; | 
| 136 | 
> | 
    RealType kineticFlux_;        // target or desired *flux* | 
| 137 | 
> | 
    Vector3d momentumFluxVector_; // target or desired *flux* | 
| 138 | 
  | 
 | 
| 139 | 
+ | 
    RealType kineticTarget_;     // target or desired one-time exchange energy | 
| 140 | 
+ | 
    Vector3d momentumTarget_;    // target or desired one-time exchange momentum | 
| 141 | 
+ | 
 | 
| 142 | 
+ | 
    RealType kineticExchange_;    // actual exchange energy (running total) | 
| 143 | 
+ | 
    Vector3d momentumExchange_;   // actual exchange momentum (running total) | 
| 144 | 
+ | 
 | 
| 145 | 
+ | 
    RealType exchangeTime_; | 
| 146 | 
+ | 
 | 
| 147 | 
+ | 
    RealType targetJzpz2_; | 
| 148 | 
+ | 
 | 
| 149 | 
+ | 
    unsigned int trialCount_; | 
| 150 | 
+ | 
    unsigned int failTrialCount_; | 
| 151 | 
+ | 
    unsigned int failRootCount_; | 
| 152 | 
+ | 
 | 
| 153 | 
+ | 
    string rnemdFileName_; | 
| 154 | 
+ | 
    ofstream rnemdFile_; | 
| 155 | 
+ | 
 | 
| 156 | 
+ | 
    RealType runTime_, statusTime_; | 
| 157 | 
+ | 
 | 
| 158 | 
+ | 
    vector<OutputData> data_; | 
| 159 | 
+ | 
    OutputBitSet outputMask_; | 
| 160 | 
+ | 
    OutputMapType outputMap_; | 
| 161 | 
+ | 
 | 
| 162 | 
+ | 
  }; | 
| 163 | 
  | 
} | 
| 164 | 
< | 
#endif //INTEGRATORS_VELOCITIZER_HPP | 
| 164 | 
> | 
#endif //INTEGRATORS_RNEMD_HPP |