| 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). |
| 38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
| 39 |
|
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
|
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
|
*/ |
| 59 |
|
using namespace std; |
| 60 |
|
namespace OpenMD { |
| 61 |
|
|
| 62 |
– |
/** |
| 63 |
– |
* @class RNEMD RNEMD.hpp "integrators/RNEMD.hpp" |
| 64 |
– |
* @todo document |
| 65 |
– |
*/ |
| 62 |
|
class RNEMD { |
| 63 |
|
public: |
| 64 |
|
RNEMD(SimInfo* info); |
| 65 |
< |
virtual ~RNEMD(); |
| 65 |
> |
~RNEMD(); |
| 66 |
|
|
| 67 |
|
void doRNEMD(); |
| 68 |
< |
void doSwap(); |
| 69 |
< |
void doScale(); |
| 70 |
< |
void doShiftScale(); |
| 68 |
> |
void doSwap(SelectionManager& smanA, SelectionManager& smanB); |
| 69 |
> |
void doNIVS(SelectionManager& smanA, SelectionManager& smanB); |
| 70 |
> |
void doVSS(SelectionManager& smanA, SelectionManager& smanB); |
| 71 |
> |
RealType getDividingArea(); |
| 72 |
|
void collectData(); |
| 73 |
|
void getStarted(); |
| 74 |
< |
void getStatus(); |
| 75 |
< |
void set_RNEMD_exchange_time(RealType exchangeTime) { |
| 76 |
< |
exchangeTime_ = exchangeTime; |
| 77 |
< |
} |
| 78 |
< |
void set_RNEMD_nBins(int nbins) { nBins_ = nbins; } |
| 79 |
< |
void set_RNEMD_logWidth(int logWidth) { rnemdLogWidth_ = logWidth; } |
| 83 |
< |
void set_RNEMD_exchange_total(RealType et) { exchangeSum_ = et; } |
| 84 |
< |
void set_RNEMD_target_flux(RealType targetFlux) {targetFlux_ = targetFlux;} |
| 85 |
< |
void set_RNEMD_target_JzKE(RealType targetJzKE) {targetJzKE_ = targetJzKE;} |
| 86 |
< |
void set_RNEMD_target_jzpx(RealType targetJzpx) {targetJzpx_ = targetJzpx;} |
| 87 |
< |
void set_RNEMD_target_jzpy(RealType targetJzpy) {targetJzpy_ = targetJzpy;} |
| 88 |
< |
void set_RNEMD_target_jzpz(RealType targetJzpz) {targetJzpz_ = targetJzpz;} |
| 89 |
< |
void set_RNEMD_target_jzpz2(RealType targetJzpz2) {targetJzpz2_ = targetJzpz2;} |
| 90 |
< |
RealType get_RNEMD_exchange_total() { return exchangeSum_; } |
| 74 |
> |
void parseOutputFileFormat(const std::string& format); |
| 75 |
> |
void writeOutputFile(); |
| 76 |
> |
void writeReal(int index, unsigned int bin); |
| 77 |
> |
void writeVector(int index, unsigned int bin); |
| 78 |
> |
void writeRealStdDev(int index, unsigned int bin); |
| 79 |
> |
void writeVectorStdDev(int index, unsigned int bin); |
| 80 |
|
|
| 81 |
|
private: |
| 82 |
|
|
| 83 |
< |
enum RNEMDTypeEnum { |
| 84 |
< |
rnemdKineticSwap, |
| 85 |
< |
rnemdKineticScale, |
| 86 |
< |
rnemdKineticScaleVAM, |
| 87 |
< |
rnemdKineticScaleAM, |
| 99 |
< |
rnemdPxScale, |
| 100 |
< |
rnemdPyScale, |
| 101 |
< |
rnemdPzScale, |
| 102 |
< |
rnemdPx, |
| 103 |
< |
rnemdPy, |
| 104 |
< |
rnemdPz, |
| 105 |
< |
rnemdShiftScaleV, |
| 106 |
< |
rnemdShiftScaleVAM, |
| 107 |
< |
rnemdUnknown |
| 83 |
> |
enum RNEMDMethod { |
| 84 |
> |
rnemdSwap, |
| 85 |
> |
rnemdNIVS, |
| 86 |
> |
rnemdVSS, |
| 87 |
> |
rnemdUnkownMethod |
| 88 |
|
}; |
| 89 |
+ |
enum RNEMDFluxType { |
| 90 |
+ |
rnemdKE, // translational kinetic energy flux |
| 91 |
+ |
rnemdRotKE, // rotational kinetic energy flux |
| 92 |
+ |
rnemdFullKE, // full kinetic energy flux |
| 93 |
+ |
rnemdPx, // flux of momentum along x axis |
| 94 |
+ |
rnemdPy, // flux of momentum along y axis |
| 95 |
+ |
rnemdPz, // flux of momentum along z axis |
| 96 |
+ |
rnemdPvector, // flux of momentum vector |
| 97 |
+ |
rnemdLx, // flux of angular momentum along x axis |
| 98 |
+ |
rnemdLy, // flux of angular momentum along y axis |
| 99 |
+ |
rnemdLz, // flux of angular momentum along z axis |
| 100 |
+ |
rnemdLvector, // flux of angular momentum vector |
| 101 |
+ |
rnemdKePx, // flux of translational KE and x-momentum |
| 102 |
+ |
rnemdKePy, // flux of translational KE and y-momentum |
| 103 |
+ |
rnemdKePvector, // full combo flying platter |
| 104 |
+ |
rnemdKeLx, // flux of translational KE and x-angular momentum |
| 105 |
+ |
rnemdKeLy, // flux of translational KE and y-angular momentum |
| 106 |
+ |
rnemdKeLz, // flux of translational KE and z-angular momentum |
| 107 |
+ |
rnemdKeLvector, // full combo spinning platter |
| 108 |
+ |
rnemdUnknownFluxType |
| 109 |
+ |
}; |
| 110 |
+ |
|
| 111 |
+ |
enum OutputFields { |
| 112 |
+ |
BEGININDEX = 0, |
| 113 |
+ |
Z = BEGININDEX, |
| 114 |
+ |
R, |
| 115 |
+ |
TEMPERATURE, |
| 116 |
+ |
VELOCITY, |
| 117 |
+ |
ANGULARVELOCITY, |
| 118 |
+ |
DENSITY, |
| 119 |
+ |
ENDINDEX |
| 120 |
+ |
}; |
| 121 |
+ |
|
| 122 |
+ |
struct OutputData { |
| 123 |
+ |
string title; |
| 124 |
+ |
string units; |
| 125 |
+ |
string dataType; |
| 126 |
+ |
vector<BaseAccumulator*> accumulator; |
| 127 |
+ |
}; |
| 128 |
+ |
|
| 129 |
+ |
typedef bitset<ENDINDEX-BEGININDEX> OutputBitSet; |
| 130 |
+ |
typedef map<string, OutputFields> OutputMapType; |
| 131 |
|
|
| 132 |
|
SimInfo* info_; |
| 133 |
< |
RandNumGen* randNumGen_; |
| 134 |
< |
map<string, RNEMDTypeEnum> stringToEnumMap_; |
| 135 |
< |
RNEMDTypeEnum rnemdType_; |
| 133 |
> |
|
| 134 |
> |
map<string, RNEMDMethod> stringToMethod_; |
| 135 |
> |
map<string, RNEMDFluxType> stringToFluxType_; |
| 136 |
> |
RNEMDMethod rnemdMethod_; |
| 137 |
> |
RNEMDFluxType rnemdFluxType_; |
| 138 |
> |
|
| 139 |
> |
// object selection for specifying a particular species: |
| 140 |
|
string rnemdObjectSelection_; |
| 141 |
|
SelectionEvaluator evaluator_; |
| 142 |
|
SelectionManager seleMan_; |
| 143 |
+ |
|
| 144 |
+ |
// Geometric selections for the two regions for the exchange: |
| 145 |
+ |
string selectionA_; |
| 146 |
+ |
SelectionEvaluator evaluatorA_; |
| 147 |
+ |
SelectionManager seleManA_; |
| 148 |
+ |
string selectionB_; |
| 149 |
+ |
SelectionEvaluator evaluatorB_; |
| 150 |
+ |
SelectionManager seleManB_; |
| 151 |
+ |
SelectionManager commonA_; |
| 152 |
+ |
SelectionManager commonB_; |
| 153 |
+ |
bool hasSelectionA_; |
| 154 |
+ |
bool hasSelectionB_; |
| 155 |
+ |
bool hasSphereBRadius_; |
| 156 |
+ |
|
| 157 |
|
bool usePeriodicBoundaryConditions_; |
| 158 |
< |
bool outputTemp_; |
| 159 |
< |
bool outputVx_; |
| 160 |
< |
bool outputVy_; |
| 161 |
< |
bool output3DTemp_; |
| 162 |
< |
bool outputRotTemp_; |
| 163 |
< |
// James put this in. |
| 164 |
< |
bool outputDen_; |
| 165 |
< |
bool outputVz_; |
| 166 |
< |
int nBins_; /**< The number of bins to divide the simulation box into. */ |
| 167 |
< |
/*! |
| 168 |
< |
The middle bin for the RNEMD method. midBin_ = nBins_/2; |
| 169 |
< |
Depending on the setting of the flux, this box should contain the minimum energy (temperature) |
| 170 |
< |
within the simulation. |
| 171 |
< |
*/ |
| 172 |
< |
int midBin_; |
| 173 |
< |
int rnemdLogWidth_; /**< Number of elements to print out in logs */ |
| 174 |
< |
RealType zShift_; |
| 158 |
> |
bool hasDividingArea_; |
| 159 |
> |
RealType dividingArea_; |
| 160 |
> |
|
| 161 |
> |
int nBins_; |
| 162 |
> |
RealType binWidth_; |
| 163 |
> |
RealType slabWidth_; |
| 164 |
> |
RealType slabACenter_; |
| 165 |
> |
RealType slabBCenter_; |
| 166 |
> |
RealType sphereARadius_; |
| 167 |
> |
RealType sphereBRadius_; |
| 168 |
> |
RealType areaA_; |
| 169 |
> |
bool AisHull_; |
| 170 |
> |
RealType areaB_; |
| 171 |
> |
bool BisHull_; |
| 172 |
> |
|
| 173 |
> |
Vector3d coordinateOrigin_; |
| 174 |
> |
|
| 175 |
> |
RealType kineticFlux_; // target or desired *flux* |
| 176 |
> |
Vector3d momentumFluxVector_; // target or desired *flux* |
| 177 |
> |
Vector3d angularMomentumFluxVector_; // target or desired *flux* |
| 178 |
> |
|
| 179 |
> |
RealType kineticTarget_; // target or desired one-time exchange energy |
| 180 |
> |
Vector3d momentumTarget_; // target or desired one-time exchange momentum |
| 181 |
> |
Vector3d angularMomentumTarget_; // target or desired one-time |
| 182 |
> |
// exchange angular momentum |
| 183 |
> |
|
| 184 |
> |
RealType kineticExchange_; // actual exchange energy (running total) |
| 185 |
> |
Vector3d momentumExchange_; // actual exchange momentum (running total) |
| 186 |
> |
Vector3d angularMomentumExchange_; // actual exchange momentum |
| 187 |
> |
// (running total) |
| 188 |
|
RealType exchangeTime_; |
| 189 |
< |
RealType targetFlux_; |
| 137 |
< |
RealType targetJzKE_; |
| 138 |
< |
RealType targetJzpx_; |
| 139 |
< |
RealType targetJzpy_; |
| 140 |
< |
RealType targetJzpz_; |
| 189 |
> |
|
| 190 |
|
RealType targetJzpz2_; |
| 142 |
– |
Vector3d jzp_, njzp_; |
| 143 |
– |
RealType exchangeSum_; |
| 144 |
– |
int failTrialCount_; |
| 145 |
– |
int failRootCount_; |
| 146 |
– |
ofstream rnemdLog_; |
| 147 |
– |
int logFrameCount_; |
| 148 |
– |
// James added denLog, vzzLog |
| 149 |
– |
ofstream tempLog_, vxzLog_, vyzLog_, denLog_, vzzLog_, denLog2_; |
| 150 |
– |
ofstream xTempLog_, yTempLog_, zTempLog_, rotTempLog_, AhLog_; |
| 151 |
– |
// keeps track of what's being averaged James added DenHist, pzzHist |
| 152 |
– |
vector<RealType> tempHist_, pxzHist_, pyzHist_, mHist_, DenHist_, pzzHist_, DenHist2_; |
| 153 |
– |
vector<RealType> xTempHist_, yTempHist_, zTempHist_, rotTempHist_; |
| 154 |
– |
// keeps track of the number of degrees of freedom being averaged |
| 155 |
– |
//vector<int> pxzCount_, pyzCount_; |
| 156 |
– |
vector<int> tempCount_, xyzTempCount_, rotTempCount_; |
| 157 |
– |
RealType Asum_, Jsum_, AhCount_, runTime_, statusTime_; |
| 158 |
– |
int Numcount_; |
| 159 |
– |
bool outputAh_; |
| 160 |
– |
}; |
| 191 |
|
|
| 192 |
+ |
unsigned int trialCount_; |
| 193 |
+ |
unsigned int failTrialCount_; |
| 194 |
+ |
unsigned int failRootCount_; |
| 195 |
+ |
|
| 196 |
+ |
string rnemdFileName_; |
| 197 |
+ |
ofstream rnemdFile_; |
| 198 |
+ |
|
| 199 |
+ |
RealType runTime_, statusTime_; |
| 200 |
+ |
|
| 201 |
+ |
vector<OutputData> data_; |
| 202 |
+ |
OutputBitSet outputMask_; |
| 203 |
+ |
OutputMapType outputMap_; |
| 204 |
+ |
Accumulator* areaAccumulator_; |
| 205 |
+ |
bool doRNEMD_; |
| 206 |
+ |
bool hasData_; |
| 207 |
+ |
|
| 208 |
+ |
}; |
| 209 |
|
} |
| 210 |
|
#endif //INTEGRATORS_RNEMD_HPP |