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); |
66 |
|
|
67 |
|
void doRNEMD(); |
68 |
|
void doSwap(); |
69 |
< |
void doScale(); |
70 |
< |
void doShiftScale(); |
69 |
> |
void doNIVS(); |
70 |
> |
void doVSS(); |
71 |
|
void collectData(); |
72 |
|
void getStarted(); |
73 |
< |
void getStatus(); |
74 |
< |
void set_RNEMD_exchange_time(RealType exchangeTime) { |
75 |
< |
exchangeTime_ = exchangeTime; |
76 |
< |
} |
77 |
< |
void set_RNEMD_nBins(int nbins) { nBins_ = nbins; } |
78 |
< |
void set_RNEMD_logWidth(int logWidth) { rnemdLogWidth_ = logWidth; } |
79 |
< |
void set_RNEMD_exchange_total(RealType et) { exchangeSum_ = et; } |
80 |
< |
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_; } |
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 |
> |
void writeRealStdDev(int index, unsigned int bin); |
80 |
> |
void writeVectorStdDev(int index, unsigned int bin); |
81 |
|
|
82 |
|
private: |
83 |
|
|
84 |
< |
enum RNEMDTypeEnum { |
85 |
< |
rnemdKineticSwap, |
86 |
< |
rnemdKineticScale, |
87 |
< |
rnemdKineticScaleVAM, |
88 |
< |
rnemdKineticScaleAM, |
99 |
< |
rnemdPxScale, |
100 |
< |
rnemdPyScale, |
101 |
< |
rnemdPzScale, |
102 |
< |
rnemdPx, |
103 |
< |
rnemdPy, |
104 |
< |
rnemdPz, |
105 |
< |
rnemdShiftScaleV, |
106 |
< |
rnemdShiftScaleVAM, |
107 |
< |
rnemdUnknown |
84 |
> |
enum RNEMDMethod { |
85 |
> |
rnemdSwap, |
86 |
> |
rnemdNIVS, |
87 |
> |
rnemdVSS, |
88 |
> |
rnemdUnkownMethod |
89 |
|
}; |
90 |
+ |
enum RNEMDFluxType { |
91 |
+ |
rnemdKE, // translational kinetic energy flux |
92 |
+ |
rnemdRotKE, // rotational kinetic energy flux |
93 |
+ |
rnemdFullKE, // full kinetic energy flux |
94 |
+ |
rnemdPx, // flux of momentum along x axis |
95 |
+ |
rnemdPy, // flux of momentum along y axis |
96 |
+ |
rnemdPz, // flux of momentum along z axis |
97 |
+ |
rnemdPvector, // flux of momentum vector |
98 |
+ |
rnemdKePx, // flux of translational KE and x-momentum |
99 |
+ |
rnemdKePy, // flux of translational KE and y-momentum |
100 |
+ |
rnemdKePvector, // full combo platter |
101 |
+ |
rnemdUnknownFluxType |
102 |
+ |
}; |
103 |
+ |
|
104 |
+ |
enum OutputFields { |
105 |
+ |
BEGININDEX = 0, |
106 |
+ |
Z = BEGININDEX, |
107 |
+ |
TEMPERATURE, |
108 |
+ |
VELOCITY, |
109 |
+ |
DENSITY, |
110 |
+ |
ENDINDEX |
111 |
+ |
}; |
112 |
+ |
|
113 |
+ |
struct OutputData { |
114 |
+ |
string title; |
115 |
+ |
string units; |
116 |
+ |
string dataType; |
117 |
+ |
vector<Accumulator*> accumulator; |
118 |
+ |
}; |
119 |
+ |
|
120 |
+ |
typedef bitset<ENDINDEX-BEGININDEX> OutputBitSet; |
121 |
+ |
typedef map<string, OutputFields> OutputMapType; |
122 |
|
|
123 |
|
SimInfo* info_; |
124 |
< |
RandNumGen* randNumGen_; |
125 |
< |
map<string, RNEMDTypeEnum> stringToEnumMap_; |
126 |
< |
RNEMDTypeEnum rnemdType_; |
124 |
> |
|
125 |
> |
map<string, RNEMDMethod> stringToMethod_; |
126 |
> |
map<string, RNEMDFluxType> stringToFluxType_; |
127 |
> |
RNEMDMethod rnemdMethod_; |
128 |
> |
RNEMDFluxType rnemdFluxType_; |
129 |
|
string rnemdObjectSelection_; |
130 |
|
SelectionEvaluator evaluator_; |
131 |
|
SelectionManager seleMan_; |
132 |
|
bool usePeriodicBoundaryConditions_; |
133 |
< |
bool outputTemp_; |
134 |
< |
bool outputVx_; |
135 |
< |
bool outputVy_; |
136 |
< |
bool output3DTemp_; |
137 |
< |
bool outputRotTemp_; |
138 |
< |
// James put this in. |
139 |
< |
bool outputDen_; |
140 |
< |
bool outputVz_; |
141 |
< |
int nBins_; /**< The number of bins to divide the simulation box into. */ |
142 |
< |
/*! |
143 |
< |
The middle bin for the RNEMD method. midBin_ = nBins_/2; |
144 |
< |
Depending on the setting of the flux, this box should contain the minimum energy (temperature) |
145 |
< |
within the simulation. |
146 |
< |
*/ |
132 |
< |
int midBin_; |
133 |
< |
int rnemdLogWidth_; /**< Number of elements to print out in logs */ |
134 |
< |
RealType zShift_; |
133 |
> |
int nBins_; |
134 |
> |
RealType slabWidth_; |
135 |
> |
RealType slabACenter_; |
136 |
> |
RealType slabBCenter_; |
137 |
> |
|
138 |
> |
RealType kineticFlux_; // target or desired *flux* |
139 |
> |
Vector3d momentumFluxVector_; // target or desired *flux* |
140 |
> |
|
141 |
> |
RealType kineticTarget_; // target or desired one-time exchange energy |
142 |
> |
Vector3d momentumTarget_; // target or desired one-time exchange momentum |
143 |
> |
|
144 |
> |
RealType kineticExchange_; // actual exchange energy (running total) |
145 |
> |
Vector3d momentumExchange_; // actual exchange momentum (running total) |
146 |
> |
|
147 |
|
RealType exchangeTime_; |
148 |
< |
RealType targetFlux_; |
137 |
< |
RealType targetJzKE_; |
138 |
< |
RealType targetJzpx_; |
139 |
< |
RealType targetJzpy_; |
140 |
< |
RealType targetJzpz_; |
148 |
> |
|
149 |
|
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 |
– |
}; |
150 |
|
|
151 |
+ |
unsigned int trialCount_; |
152 |
+ |
unsigned int failTrialCount_; |
153 |
+ |
unsigned int failRootCount_; |
154 |
+ |
|
155 |
+ |
string rnemdFileName_; |
156 |
+ |
ofstream rnemdFile_; |
157 |
+ |
|
158 |
+ |
RealType runTime_, statusTime_; |
159 |
+ |
|
160 |
+ |
vector<OutputData> data_; |
161 |
+ |
OutputBitSet outputMask_; |
162 |
+ |
OutputMapType outputMap_; |
163 |
+ |
Accumulator* areaAccumulator_; |
164 |
+ |
|
165 |
+ |
}; |
166 |
|
} |
167 |
|
#endif //INTEGRATORS_RNEMD_HPP |