1 |
gezelter |
1329 |
/* |
2 |
|
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
|
* |
4 |
|
|
* The University of Notre Dame grants you ("Licensee") a |
5 |
|
|
* non-exclusive, royalty free, license to use, modify and |
6 |
|
|
* redistribute this software in source and binary code form, provided |
7 |
|
|
* that the following conditions are met: |
8 |
|
|
* |
9 |
gezelter |
1390 |
* 1. Redistributions of source code must retain the above copyright |
10 |
gezelter |
1329 |
* notice, this list of conditions and the following disclaimer. |
11 |
|
|
* |
12 |
gezelter |
1390 |
* 2. Redistributions in binary form must reproduce the above copyright |
13 |
gezelter |
1329 |
* notice, this list of conditions and the following disclaimer in the |
14 |
|
|
* documentation and/or other materials provided with the |
15 |
|
|
* distribution. |
16 |
|
|
* |
17 |
|
|
* This software is provided "AS IS," without a warranty of any |
18 |
|
|
* kind. All express or implied conditions, representations and |
19 |
|
|
* warranties, including any implied warranty of merchantability, |
20 |
|
|
* fitness for a particular purpose or non-infringement, are hereby |
21 |
|
|
* excluded. The University of Notre Dame and its licensors shall not |
22 |
|
|
* be liable for any damages suffered by licensee as a result of |
23 |
|
|
* using, modifying or distributing the software or its |
24 |
|
|
* derivatives. In no event will the University of Notre Dame or its |
25 |
|
|
* licensors be liable for any lost revenue, profit or data, or for |
26 |
|
|
* direct, indirect, special, consequential, incidental or punitive |
27 |
|
|
* damages, however caused and regardless of the theory of liability, |
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 |
gezelter |
1390 |
* |
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 |
gezelter |
1850 |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
39 |
jmarr |
1728 |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
|
|
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
gezelter |
1329 |
*/ |
42 |
|
|
|
43 |
|
|
/** |
44 |
|
|
* @file RNEMD.hpp |
45 |
|
|
* @author gezelter |
46 |
|
|
* @date 03/13/2009 |
47 |
gezelter |
1813 |
* @time 15:56pm |
48 |
gezelter |
1329 |
* @version 1.0 |
49 |
|
|
*/ |
50 |
|
|
|
51 |
|
|
#ifndef INTEGRATORS_RNEMD_HPP |
52 |
|
|
#define INTEGRATORS_RNEMD_HPP |
53 |
|
|
#include "brains/SimInfo.hpp" |
54 |
|
|
#include "math/RandNumGen.hpp" |
55 |
gezelter |
1331 |
#include "selection/SelectionEvaluator.hpp" |
56 |
|
|
#include "selection/SelectionManager.hpp" |
57 |
skuang |
1368 |
#include <iostream> |
58 |
gezelter |
1329 |
|
59 |
gezelter |
1629 |
using namespace std; |
60 |
gezelter |
1390 |
namespace OpenMD { |
61 |
gezelter |
1329 |
|
62 |
|
|
class RNEMD { |
63 |
|
|
public: |
64 |
|
|
RNEMD(SimInfo* info); |
65 |
|
|
virtual ~RNEMD(); |
66 |
skuang |
1368 |
|
67 |
|
|
void doRNEMD(); |
68 |
gezelter |
1854 |
void doSwap(SelectionManager& smanA, SelectionManager& smanB); |
69 |
|
|
void doNIVS(SelectionManager& smanA, SelectionManager& smanB); |
70 |
|
|
void doVSS(SelectionManager& smanA, SelectionManager& smanB); |
71 |
|
|
RealType getDividingArea(); |
72 |
skuang |
1368 |
void collectData(); |
73 |
|
|
void getStarted(); |
74 |
gezelter |
1773 |
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 |
gezelter |
1774 |
void writeRealStdDev(int index, unsigned int bin); |
79 |
|
|
void writeVectorStdDev(int index, unsigned int bin); |
80 |
gezelter |
1331 |
|
81 |
gezelter |
1329 |
private: |
82 |
gezelter |
1331 |
|
83 |
gezelter |
1773 |
enum RNEMDMethod { |
84 |
|
|
rnemdSwap, |
85 |
|
|
rnemdNIVS, |
86 |
|
|
rnemdVSS, |
87 |
|
|
rnemdUnkownMethod |
88 |
gezelter |
1329 |
}; |
89 |
gezelter |
1773 |
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 |
gezelter |
1854 |
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 |
gezelter |
1773 |
rnemdKePx, // flux of translational KE and x-momentum |
102 |
|
|
rnemdKePy, // flux of translational KE and y-momentum |
103 |
gezelter |
1854 |
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 |
gezelter |
1773 |
rnemdUnknownFluxType |
109 |
|
|
}; |
110 |
|
|
|
111 |
|
|
enum OutputFields { |
112 |
|
|
BEGININDEX = 0, |
113 |
|
|
Z = BEGININDEX, |
114 |
gezelter |
1854 |
R, |
115 |
gezelter |
1773 |
TEMPERATURE, |
116 |
|
|
VELOCITY, |
117 |
gezelter |
1854 |
ANGULARVELOCITY, |
118 |
gezelter |
1773 |
DENSITY, |
119 |
|
|
ENDINDEX |
120 |
|
|
}; |
121 |
|
|
|
122 |
|
|
struct OutputData { |
123 |
|
|
string title; |
124 |
|
|
string units; |
125 |
|
|
string dataType; |
126 |
gezelter |
1813 |
vector<BaseAccumulator*> accumulator; |
127 |
gezelter |
1773 |
}; |
128 |
|
|
|
129 |
|
|
typedef bitset<ENDINDEX-BEGININDEX> OutputBitSet; |
130 |
|
|
typedef map<string, OutputFields> OutputMapType; |
131 |
skuang |
1368 |
|
132 |
gezelter |
1329 |
SimInfo* info_; |
133 |
gezelter |
1773 |
|
134 |
|
|
map<string, RNEMDMethod> stringToMethod_; |
135 |
|
|
map<string, RNEMDFluxType> stringToFluxType_; |
136 |
|
|
RNEMDMethod rnemdMethod_; |
137 |
|
|
RNEMDFluxType rnemdFluxType_; |
138 |
gezelter |
1854 |
|
139 |
|
|
// object selection for specifying a particular species: |
140 |
gezelter |
1629 |
string rnemdObjectSelection_; |
141 |
skuang |
1368 |
SelectionEvaluator evaluator_; |
142 |
gezelter |
1331 |
SelectionManager seleMan_; |
143 |
gezelter |
1854 |
|
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 |
gezelter |
1331 |
bool usePeriodicBoundaryConditions_; |
158 |
gezelter |
1854 |
bool hasDividingArea_; |
159 |
|
|
RealType dividingArea_; |
160 |
|
|
|
161 |
|
|
int nBins_; |
162 |
|
|
RealType binWidth_; |
163 |
gezelter |
1773 |
RealType slabWidth_; |
164 |
|
|
RealType slabACenter_; |
165 |
|
|
RealType slabBCenter_; |
166 |
gezelter |
1854 |
RealType sphereARadius_; |
167 |
|
|
RealType sphereBRadius_; |
168 |
gezelter |
1773 |
|
169 |
gezelter |
1854 |
Vector3d coordinateOrigin_; |
170 |
|
|
|
171 |
gezelter |
1773 |
RealType kineticFlux_; // target or desired *flux* |
172 |
|
|
Vector3d momentumFluxVector_; // target or desired *flux* |
173 |
gezelter |
1854 |
Vector3d angularMomentumFluxVector_; // target or desired *flux* |
174 |
gezelter |
1773 |
|
175 |
|
|
RealType kineticTarget_; // target or desired one-time exchange energy |
176 |
|
|
Vector3d momentumTarget_; // target or desired one-time exchange momentum |
177 |
gezelter |
1854 |
Vector3d angularMomentumTarget_; // target or desired one-time |
178 |
|
|
// exchange angular momentum |
179 |
gezelter |
1773 |
|
180 |
|
|
RealType kineticExchange_; // actual exchange energy (running total) |
181 |
|
|
Vector3d momentumExchange_; // actual exchange momentum (running total) |
182 |
gezelter |
1854 |
Vector3d angularMomentumExchange_; // actual exchange momentum |
183 |
|
|
// (running total) |
184 |
skuang |
1368 |
RealType exchangeTime_; |
185 |
gezelter |
1773 |
|
186 |
jmarr |
1728 |
RealType targetJzpz2_; |
187 |
gezelter |
1773 |
|
188 |
|
|
unsigned int trialCount_; |
189 |
|
|
unsigned int failTrialCount_; |
190 |
|
|
unsigned int failRootCount_; |
191 |
|
|
|
192 |
|
|
string rnemdFileName_; |
193 |
|
|
ofstream rnemdFile_; |
194 |
|
|
|
195 |
|
|
RealType runTime_, statusTime_; |
196 |
|
|
|
197 |
|
|
vector<OutputData> data_; |
198 |
|
|
OutputBitSet outputMask_; |
199 |
|
|
OutputMapType outputMap_; |
200 |
gezelter |
1774 |
Accumulator* areaAccumulator_; |
201 |
gezelter |
1776 |
bool doRNEMD_; |
202 |
gezelter |
1773 |
|
203 |
gezelter |
1329 |
}; |
204 |
|
|
} |
205 |
skuang |
1368 |
#endif //INTEGRATORS_RNEMD_HPP |