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] Vardeman & Gezelter, in progress (2009). |
40 |
|
*/ |
41 |
|
|
42 |
|
#include "applications/hydrodynamics/ApproximationModel.hpp" |
43 |
|
#include "math/LU.hpp" |
44 |
|
#include "math/DynamicRectMatrix.hpp" |
45 |
|
#include "math/SquareMatrix3.hpp" |
46 |
< |
#include "utils/OOPSEConstant.hpp" |
47 |
< |
#include "applications/hydrodynamics/Spheric.hpp" |
48 |
< |
#include "applications/hydrodynamics/Ellipsoid.hpp" |
46 |
> |
#include "utils/PhysicalConstants.hpp" |
47 |
> |
#include "hydrodynamics/Sphere.hpp" |
48 |
> |
#include "hydrodynamics/Ellipsoid.hpp" |
49 |
|
#include "applications/hydrodynamics/CompositeShape.hpp" |
50 |
|
#include "math/LU.hpp" |
51 |
|
#include "utils/simError.h" |
52 |
< |
namespace oopse { |
52 |
> |
namespace OpenMD { |
53 |
|
/** |
54 |
|
* Reference: |
55 |
|
* Beatriz Carrasco and Jose Gracia de la Torre, Hydrodynamic Properties of Rigid Particles: |
57 |
|
* Biophysical Journal, 75(6), 3044, 1999 |
58 |
|
*/ |
59 |
|
|
60 |
< |
ApproximationModel::ApproximationModel(StuntDouble* sd, SimInfo* info): HydrodynamicsModel(sd, info){ |
61 |
< |
|
62 |
< |
} |
63 |
< |
|
64 |
< |
bool ApproximationModel::calcHydroProps(Spheric* spheric, double viscosity, double temperature) { |
65 |
< |
return internalCalcHydroProps(static_cast<Shape*>(spheric), viscosity, temperature); |
66 |
< |
} |
67 |
< |
|
68 |
< |
bool ApproximationModel::calcHydroProps(Ellipsoid* ellipsoid, double viscosity, double temperature) { |
69 |
< |
return internalCalcHydroProps(static_cast<Shape*>(ellipsoid), viscosity, temperature); |
70 |
< |
} |
71 |
< |
bool ApproximationModel::calcHydroProps(CompositeShape* compositeShape, double viscosity, double temperature) { |
72 |
< |
return internalCalcHydroProps(static_cast<Shape*>(compositeShape), viscosity, temperature); |
73 |
< |
} |
74 |
< |
|
75 |
< |
void ApproximationModel::init() { |
60 |
> |
ApproximationModel::ApproximationModel(StuntDouble* sd, SimInfo* info): HydrodynamicsModel(sd, info){ |
61 |
> |
} |
62 |
> |
|
63 |
> |
void ApproximationModel::init() { |
64 |
|
if (!createBeads(beads_)) { |
65 |
|
sprintf(painCave.errMsg, "ApproximationModel::init() : Can not create beads\n"); |
66 |
|
painCave.isFatal = 1; |
67 |
|
simError(); |
68 |
|
} |
69 |
< |
|
70 |
< |
} |
71 |
< |
|
72 |
< |
bool ApproximationModel::internalCalcHydroProps(Shape* shape, double viscosity, double temperature) { |
73 |
< |
|
69 |
> |
|
70 |
> |
} |
71 |
> |
|
72 |
> |
bool ApproximationModel::calcHydroProps(Shape* shape, RealType viscosity, RealType temperature) { |
73 |
> |
|
74 |
|
bool ret = true; |
75 |
< |
HydroProps cr; |
76 |
< |
HydroProps cd; |
75 |
> |
HydroProp* cr = new HydroProp(); |
76 |
> |
HydroProp* cd = new HydroProp(); |
77 |
|
calcHydroPropsAtCR(beads_, viscosity, temperature, cr); |
78 |
< |
//calcHydroPropsAtCD(beads_, viscosity, temperature, cd); |
78 |
> |
calcHydroPropsAtCD(beads_, viscosity, temperature, cd); |
79 |
|
setCR(cr); |
80 |
|
setCD(cd); |
93 |
– |
|
81 |
|
return true; |
82 |
< |
} |
83 |
< |
|
84 |
< |
bool ApproximationModel::calcHydroPropsAtCR(std::vector<BeadParam>& beads, double viscosity, double temperature, HydroProps& cr) { |
85 |
< |
|
82 |
> |
} |
83 |
> |
|
84 |
> |
bool ApproximationModel::calcHydroPropsAtCR(std::vector<BeadParam>& beads, RealType viscosity, RealType temperature, HydroProp* cr) { |
85 |
> |
|
86 |
|
int nbeads = beads.size(); |
87 |
< |
DynamicRectMatrix<double> B(3*nbeads, 3*nbeads); |
88 |
< |
DynamicRectMatrix<double> C(3*nbeads, 3*nbeads); |
87 |
> |
DynamicRectMatrix<RealType> B(3*nbeads, 3*nbeads); |
88 |
> |
DynamicRectMatrix<RealType> C(3*nbeads, 3*nbeads); |
89 |
|
Mat3x3d I; |
90 |
|
I(0, 0) = 1.0; |
91 |
|
I(1, 1) = 1.0; |
92 |
|
I(2, 2) = 1.0; |
93 |
|
|
94 |
|
for (std::size_t i = 0; i < nbeads; ++i) { |
95 |
< |
for (std::size_t j = 0; j < nbeads; ++j) { |
96 |
< |
Mat3x3d Tij; |
95 |
> |
for (std::size_t j = 0; j < nbeads; ++j) { |
96 |
> |
Mat3x3d Tij; |
97 |
|
if (i != j ) { |
98 |
< |
Vector3d Rij = beads[i].pos - beads[j].pos; |
99 |
< |
double rij = Rij.length(); |
100 |
< |
double rij2 = rij * rij; |
101 |
< |
double sumSigma2OverRij2 = ((beads[i].radius*beads[i].radius) + (beads[j].radius*beads[j].radius)) / rij2; |
102 |
< |
Mat3x3d tmpMat; |
103 |
< |
tmpMat = outProduct(Rij, Rij) / rij2; |
104 |
< |
double constant = 8.0 * NumericConstant::PI * viscosity * rij; |
105 |
< |
Tij = ((1.0 + sumSigma2OverRij2/3.0) * I + (1.0 - sumSigma2OverRij2) * tmpMat ) / constant; |
98 |
> |
Vector3d Rij = beads[i].pos - beads[j].pos; |
99 |
> |
RealType rij = Rij.length(); |
100 |
> |
RealType rij2 = rij * rij; |
101 |
> |
RealType sumSigma2OverRij2 = ((beads[i].radius*beads[i].radius) + (beads[j].radius*beads[j].radius)) / rij2; |
102 |
> |
Mat3x3d tmpMat; |
103 |
> |
tmpMat = outProduct(Rij, Rij) / rij2; |
104 |
> |
RealType constant = 8.0 * NumericConstant::PI * viscosity * rij; |
105 |
> |
RealType tmp1 = 1.0 + sumSigma2OverRij2/3.0; |
106 |
> |
RealType tmp2 = 1.0 - sumSigma2OverRij2; |
107 |
> |
Tij = (tmp1 * I + tmp2 * tmpMat ) / constant; |
108 |
|
}else { |
109 |
< |
double constant = 1.0 / (6.0 * NumericConstant::PI * viscosity * beads[i].radius); |
110 |
< |
Tij(0, 0) = constant; |
111 |
< |
Tij(1, 1) = constant; |
112 |
< |
Tij(2, 2) = constant; |
109 |
> |
RealType constant = 1.0 / (6.0 * NumericConstant::PI * viscosity * beads[i].radius); |
110 |
> |
Tij(0, 0) = constant; |
111 |
> |
Tij(1, 1) = constant; |
112 |
> |
Tij(2, 2) = constant; |
113 |
|
} |
114 |
|
B.setSubMatrix(i*3, j*3, Tij); |
115 |
< |
} |
115 |
> |
} |
116 |
|
} |
117 |
< |
|
117 |
> |
|
118 |
|
//invert B Matrix |
119 |
|
invertMatrix(B, C); |
120 |
|
|
121 |
|
//prepare U Matrix relative to arbitrary origin O(0.0, 0.0, 0.0) |
122 |
|
std::vector<Mat3x3d> U; |
123 |
|
for (int i = 0; i < nbeads; ++i) { |
124 |
< |
Mat3x3d currU; |
125 |
< |
currU.setupSkewMat(beads[i].pos); |
126 |
< |
U.push_back(currU); |
124 |
> |
Mat3x3d currU; |
125 |
> |
currU.setupSkewMat(beads[i].pos); |
126 |
> |
U.push_back(currU); |
127 |
|
} |
128 |
|
|
129 |
|
//calculate Xi matrix at arbitrary origin O |
130 |
|
Mat3x3d Xiott; |
131 |
|
Mat3x3d Xiorr; |
132 |
|
Mat3x3d Xiotr; |
133 |
< |
|
133 |
> |
|
134 |
|
//calculate the total volume |
135 |
< |
|
136 |
< |
double volume = 0.0; |
135 |
> |
|
136 |
> |
RealType volume = 0.0; |
137 |
|
for (std::vector<BeadParam>::iterator iter = beads.begin(); iter != beads.end(); ++iter) { |
138 |
< |
volume += 4.0/3.0 * NumericConstant::PI * pow((*iter).radius,3); |
138 |
> |
volume += 4.0/3.0 * NumericConstant::PI * pow((*iter).radius,3); |
139 |
|
} |
140 |
< |
|
140 |
> |
|
141 |
|
for (std::size_t i = 0; i < nbeads; ++i) { |
142 |
< |
for (std::size_t j = 0; j < nbeads; ++j) { |
143 |
< |
Mat3x3d Cij; |
144 |
< |
C.getSubMatrix(i*3, j*3, Cij); |
145 |
< |
|
146 |
< |
Xiott += Cij; |
147 |
< |
Xiotr += U[i] * Cij; |
148 |
< |
//Xiorr += -U[i] * Cij * U[j] + (6 * viscosity * volume) * I; |
149 |
< |
Xiorr += -U[i] * Cij * U[j]; |
150 |
< |
} |
142 |
> |
for (std::size_t j = 0; j < nbeads; ++j) { |
143 |
> |
Mat3x3d Cij; |
144 |
> |
C.getSubMatrix(i*3, j*3, Cij); |
145 |
> |
|
146 |
> |
Xiott += Cij; |
147 |
> |
Xiotr += U[i] * Cij; |
148 |
> |
// uncorrected here. Volume correction is added after we assemble Xiorr |
149 |
> |
Xiorr += -U[i] * Cij * U[j]; |
150 |
> |
} |
151 |
|
} |
152 |
|
|
153 |
< |
const double convertConstant = 6.023; //convert poise.angstrom to amu/fs |
154 |
< |
Xiott *= convertConstant; |
166 |
< |
Xiotr *= convertConstant; |
167 |
< |
Xiorr *= convertConstant; |
153 |
> |
// add the volume correction |
154 |
> |
Xiorr += (6.0 * viscosity * volume) * I; |
155 |
|
|
156 |
< |
|
156 |
> |
Xiott *= PhysicalConstants::viscoConvert; |
157 |
> |
Xiotr *= PhysicalConstants::viscoConvert; |
158 |
> |
Xiorr *= PhysicalConstants::viscoConvert; |
159 |
|
|
160 |
|
Mat3x3d tmp; |
161 |
|
Mat3x3d tmpInv; |
186 |
|
Xirrr = Xiorr - Uor * Xiott * Uor + Xiotr * Uor - Uor * Xiotr.transpose(); |
187 |
|
|
188 |
|
|
189 |
< |
SquareMatrix<double,6> Xir6x6; |
190 |
< |
SquareMatrix<double,6> Dr6x6; |
189 |
> |
SquareMatrix<RealType,6> Xir6x6; |
190 |
> |
SquareMatrix<RealType,6> Dr6x6; |
191 |
|
|
192 |
|
Xir6x6.setSubMatrix(0, 0, Xirtt); |
193 |
|
Xir6x6.setSubMatrix(0, 3, Xirtr.transpose()); |
203 |
|
Dr6x6.getSubMatrix(0, 3, Drrt); |
204 |
|
Dr6x6.getSubMatrix(3, 0, Drtr); |
205 |
|
Dr6x6.getSubMatrix(3, 3, Drrr); |
206 |
< |
double kt = OOPSEConstant::kB * temperature ; |
206 |
> |
RealType kt = PhysicalConstants::kb * temperature ; // in kcal mol^-1 |
207 |
|
Drtt *= kt; |
208 |
|
Drrt *= kt; |
209 |
|
Drtr *= kt; |
210 |
|
Drrr *= kt; |
211 |
< |
Xirtt *= OOPSEConstant::kb * temperature; |
212 |
< |
Xirtr *= OOPSEConstant::kb * temperature; |
213 |
< |
Xirrr *= OOPSEConstant::kb * temperature; |
211 |
> |
//Xirtt *= PhysicalConstants::kb * temperature; |
212 |
> |
//Xirtr *= PhysicalConstants::kb * temperature; |
213 |
> |
//Xirrr *= PhysicalConstants::kb * temperature; |
214 |
|
|
215 |
+ |
Mat6x6d Xi, D; |
216 |
|
|
217 |
< |
cr.center = ror; |
218 |
< |
cr.Xi.setSubMatrix(0, 0, Xirtt); |
219 |
< |
cr.Xi.setSubMatrix(0, 3, Xirtr); |
220 |
< |
cr.Xi.setSubMatrix(3, 0, Xirtr); |
221 |
< |
cr.Xi.setSubMatrix(3, 3, Xirrr); |
222 |
< |
cr.D.setSubMatrix(0, 0, Drtt); |
223 |
< |
cr.D.setSubMatrix(0, 3, Drrt); |
224 |
< |
cr.D.setSubMatrix(3, 0, Drtr); |
225 |
< |
cr.D.setSubMatrix(3, 3, Drrr); |
217 |
> |
cr->setCOR(ror); |
218 |
> |
|
219 |
> |
Xi.setSubMatrix(0, 0, Xirtt); |
220 |
> |
Xi.setSubMatrix(0, 3, Xirtr); |
221 |
> |
Xi.setSubMatrix(3, 0, Xirtr); |
222 |
> |
Xi.setSubMatrix(3, 3, Xirrr); |
223 |
> |
|
224 |
> |
cr->setXi(Xi); |
225 |
> |
|
226 |
> |
D.setSubMatrix(0, 0, Drtt); |
227 |
> |
D.setSubMatrix(0, 3, Drrt); |
228 |
> |
D.setSubMatrix(3, 0, Drtr); |
229 |
> |
D.setSubMatrix(3, 3, Drrr); |
230 |
> |
|
231 |
> |
cr->setD(D); |
232 |
|
|
233 |
|
std::cout << "-----------------------------------------\n"; |
234 |
|
std::cout << "center of resistance :" << std::endl; |
253 |
|
|
254 |
|
return true; |
255 |
|
} |
256 |
< |
|
257 |
< |
bool ApproximationModel::calcHydroPropsAtCD(std::vector<BeadParam>& beads, double viscosity, double temperature, HydroProps& cr) { |
258 |
< |
|
256 |
> |
|
257 |
> |
bool ApproximationModel::calcHydroPropsAtCD(std::vector<BeadParam>& beads, RealType viscosity, RealType temperature, HydroProp* cd) { |
258 |
> |
|
259 |
|
int nbeads = beads.size(); |
260 |
< |
DynamicRectMatrix<double> B(3*nbeads, 3*nbeads); |
261 |
< |
DynamicRectMatrix<double> C(3*nbeads, 3*nbeads); |
260 |
> |
DynamicRectMatrix<RealType> B(3*nbeads, 3*nbeads); |
261 |
> |
DynamicRectMatrix<RealType> C(3*nbeads, 3*nbeads); |
262 |
|
Mat3x3d I; |
263 |
|
I(0, 0) = 1.0; |
264 |
|
I(1, 1) = 1.0; |
265 |
|
I(2, 2) = 1.0; |
266 |
|
|
267 |
|
for (std::size_t i = 0; i < nbeads; ++i) { |
268 |
< |
for (std::size_t j = 0; j < nbeads; ++j) { |
269 |
< |
Mat3x3d Tij; |
270 |
< |
if (i != j ) { |
271 |
< |
Vector3d Rij = beads[i].pos - beads[j].pos; |
272 |
< |
double rij = Rij.length(); |
273 |
< |
double rij2 = rij * rij; |
274 |
< |
double sumSigma2OverRij2 = ((beads[i].radius*beads[i].radius) + (beads[j].radius*beads[j].radius)) / rij2; |
275 |
< |
Mat3x3d tmpMat; |
276 |
< |
tmpMat = outProduct(Rij, Rij) / rij2; |
277 |
< |
double constant = 8.0 * NumericConstant::PI * viscosity * rij; |
278 |
< |
Tij = ((1.0 + sumSigma2OverRij2/3.0) * I + (1.0 - sumSigma2OverRij2) * tmpMat ) / constant; |
279 |
< |
}else { |
280 |
< |
double constant = 1.0 / (6.0 * NumericConstant::PI * viscosity * beads[i].radius); |
281 |
< |
Tij(0, 0) = constant; |
282 |
< |
Tij(1, 1) = constant; |
283 |
< |
Tij(2, 2) = constant; |
284 |
< |
} |
285 |
< |
B.setSubMatrix(i*3, j*3, Tij); |
268 |
> |
for (std::size_t j = 0; j < nbeads; ++j) { |
269 |
> |
Mat3x3d Tij; |
270 |
> |
if (i != j ) { |
271 |
> |
Vector3d Rij = beads[i].pos - beads[j].pos; |
272 |
> |
RealType rij = Rij.length(); |
273 |
> |
RealType rij2 = rij * rij; |
274 |
> |
RealType sumSigma2OverRij2 = ((beads[i].radius*beads[i].radius) + (beads[j].radius*beads[j].radius)) / rij2; |
275 |
> |
Mat3x3d tmpMat; |
276 |
> |
tmpMat = outProduct(Rij, Rij) / rij2; |
277 |
> |
RealType constant = 8.0 * NumericConstant::PI * viscosity * rij; |
278 |
> |
RealType tmp1 = 1.0 + sumSigma2OverRij2/3.0; |
279 |
> |
RealType tmp2 = 1.0 - sumSigma2OverRij2; |
280 |
> |
Tij = (tmp1 * I + tmp2 * tmpMat ) / constant; |
281 |
> |
}else { |
282 |
> |
RealType constant = 1.0 / (6.0 * NumericConstant::PI * viscosity * beads[i].radius); |
283 |
> |
Tij(0, 0) = constant; |
284 |
> |
Tij(1, 1) = constant; |
285 |
> |
Tij(2, 2) = constant; |
286 |
|
} |
287 |
+ |
B.setSubMatrix(i*3, j*3, Tij); |
288 |
+ |
} |
289 |
|
} |
290 |
< |
|
290 |
> |
|
291 |
|
//invert B Matrix |
292 |
|
invertMatrix(B, C); |
293 |
< |
|
293 |
> |
|
294 |
|
//prepare U Matrix relative to arbitrary origin O(0.0, 0.0, 0.0) |
295 |
|
std::vector<Mat3x3d> U; |
296 |
|
for (int i = 0; i < nbeads; ++i) { |
297 |
< |
Mat3x3d currU; |
298 |
< |
currU.setupSkewMat(beads[i].pos); |
299 |
< |
U.push_back(currU); |
297 |
> |
Mat3x3d currU; |
298 |
> |
currU.setupSkewMat(beads[i].pos); |
299 |
> |
U.push_back(currU); |
300 |
|
} |
301 |
|
|
302 |
|
//calculate Xi matrix at arbitrary origin O |
306 |
|
|
307 |
|
//calculate the total volume |
308 |
|
|
309 |
< |
double volume = 0.0; |
309 |
> |
RealType volume = 0.0; |
310 |
|
for (std::vector<BeadParam>::iterator iter = beads.begin(); iter != beads.end(); ++iter) { |
311 |
< |
volume += 4.0/3.0 * NumericConstant::PI * pow((*iter).radius,3); |
311 |
> |
volume += 4.0/3.0 * NumericConstant::PI * pow((*iter).radius,3); |
312 |
|
} |
313 |
< |
|
313 |
> |
|
314 |
|
for (std::size_t i = 0; i < nbeads; ++i) { |
315 |
< |
for (std::size_t j = 0; j < nbeads; ++j) { |
316 |
< |
Mat3x3d Cij; |
317 |
< |
C.getSubMatrix(i*3, j*3, Cij); |
315 |
> |
for (std::size_t j = 0; j < nbeads; ++j) { |
316 |
> |
Mat3x3d Cij; |
317 |
> |
C.getSubMatrix(i*3, j*3, Cij); |
318 |
|
|
319 |
< |
Xitt += Cij; |
320 |
< |
Xitr += U[i] * Cij; |
321 |
< |
//Xirr += -U[i] * Cij * U[j] + (6 * viscosity * volume) * I; |
322 |
< |
Xirr += -U[i] * Cij * U[j]; |
323 |
< |
} |
319 |
> |
Xitt += Cij; |
320 |
> |
Xitr += U[i] * Cij; |
321 |
> |
// uncorrected here. Volume correction is added after we assemble Xiorr |
322 |
> |
Xirr += -U[i] * Cij * U[j]; |
323 |
> |
} |
324 |
|
} |
325 |
< |
|
326 |
< |
const double convertConstant = 6.023; //convert poise.angstrom to amu/fs |
327 |
< |
Xitt *= convertConstant; |
328 |
< |
Xitr *= convertConstant; |
329 |
< |
Xirr *= convertConstant; |
330 |
< |
|
331 |
< |
double kt = OOPSEConstant::kB * temperature; |
332 |
< |
|
325 |
> |
// add the volume correction here: |
326 |
> |
Xirr += (6.0 * viscosity * volume) * I; |
327 |
> |
|
328 |
> |
Xitt *= PhysicalConstants::viscoConvert; |
329 |
> |
Xitr *= PhysicalConstants::viscoConvert; |
330 |
> |
Xirr *= PhysicalConstants::viscoConvert; |
331 |
> |
|
332 |
> |
RealType kt = PhysicalConstants::kb * temperature; // in kcal mol^-1 |
333 |
> |
|
334 |
|
Mat3x3d Dott; //translational diffusion tensor at arbitrary origin O |
335 |
|
Mat3x3d Dorr; //rotational diffusion tensor at arbitrary origin O |
336 |
|
Mat3x3d Dotr; //translation-rotation couplingl diffusion tensor at arbitrary origin O |
337 |
< |
|
337 |
> |
|
338 |
|
const static Mat3x3d zeroMat(0.0); |
339 |
|
|
340 |
|
Mat3x3d XittInv(0.0); |
388 |
|
Ddrr = Dorr; |
389 |
|
Ddtr = Dotr + Dorr * Uod; |
390 |
|
|
391 |
< |
SquareMatrix<double, 6> Dd; |
391 |
> |
SquareMatrix<RealType, 6> Dd; |
392 |
|
Dd.setSubMatrix(0, 0, Ddtt); |
393 |
|
Dd.setSubMatrix(0, 3, Ddtr.transpose()); |
394 |
|
Dd.setSubMatrix(3, 0, Ddtr); |
395 |
|
Dd.setSubMatrix(3, 3, Ddrr); |
396 |
< |
SquareMatrix<double, 6> Xid; |
396 |
> |
SquareMatrix<RealType, 6> Xid; |
397 |
|
Ddtt *= kt; |
398 |
|
Ddtr *=kt; |
399 |
|
Ddrr *= kt; |
402 |
|
|
403 |
|
|
404 |
|
//Xidtt in units of kcal*fs*mol^-1*Ang^-2 |
405 |
< |
//Xid /= OOPSEConstant::energyConvert; |
406 |
< |
Xid *= OOPSEConstant::kb * temperature; |
405 |
> |
//Xid /= PhysicalConstants::energyConvert; |
406 |
> |
Xid *= PhysicalConstants::kb * temperature; |
407 |
|
|
408 |
< |
cr.center = rod; |
410 |
< |
cr.D.setSubMatrix(0, 0, Ddtt); |
411 |
< |
cr.D.setSubMatrix(0, 3, Ddtr); |
412 |
< |
cr.D.setSubMatrix(3, 0, Ddtr); |
413 |
< |
cr.D.setSubMatrix(3, 3, Ddrr); |
414 |
< |
cr.Xi = Xid; |
408 |
> |
Mat6x6d Xi, D; |
409 |
|
|
410 |
+ |
cd->setCOR(rod); |
411 |
+ |
|
412 |
+ |
cd->setXi(Xid); |
413 |
+ |
|
414 |
+ |
D.setSubMatrix(0, 0, Ddtt); |
415 |
+ |
D.setSubMatrix(0, 3, Ddtr); |
416 |
+ |
D.setSubMatrix(3, 0, Ddtr); |
417 |
+ |
D.setSubMatrix(3, 3, Ddrr); |
418 |
+ |
|
419 |
+ |
cd->setD(D); |
420 |
+ |
|
421 |
|
std::cout << "viscosity = " << viscosity << std::endl; |
422 |
|
std::cout << "temperature = " << temperature << std::endl; |
423 |
|
std::cout << "center of diffusion :" << std::endl; |
424 |
|
std::cout << rod << std::endl; |
425 |
|
std::cout << "diffusion tensor at center of diffusion " << std::endl; |
426 |
< |
std::cout << "translation(A^2/fs) :" << std::endl; |
426 |
> |
std::cout << "translation(A^2 / fs) :" << std::endl; |
427 |
|
std::cout << Ddtt << std::endl; |
428 |
< |
std::cout << "translation-rotation(A^3/fs):" << std::endl; |
428 |
> |
std::cout << "translation-rotation(A / fs):" << std::endl; |
429 |
|
std::cout << Ddtr << std::endl; |
430 |
< |
std::cout << "rotation(A^4/fs):" << std::endl; |
430 |
> |
std::cout << "rotation(fs^-1):" << std::endl; |
431 |
|
std::cout << Ddrr << std::endl; |
432 |
|
|
433 |
|
std::cout << "resistance tensor at center of diffusion " << std::endl; |
443 |
|
Xid.getSubMatrix(3, 3, Xidrr); |
444 |
|
|
445 |
|
std::cout << Xidtt << std::endl; |
446 |
< |
std::cout << "rotation-translation (kcal*fs*mol^-1*Ang^-3):" << std::endl; |
446 |
> |
std::cout << "rotation-translation (kcal*fs*mol^-1*Ang^-1):" << std::endl; |
447 |
|
std::cout << Xidrt << std::endl; |
448 |
< |
std::cout << "translation-rotation(kcal*fs*mol^-1*Ang^-3):" << std::endl; |
448 |
> |
std::cout << "translation-rotation(kcal*fs*mol^-1*Ang^-1):" << std::endl; |
449 |
|
std::cout << Xidtr << std::endl; |
450 |
< |
std::cout << "rotation(kcal*fs*mol^-1*Ang^-4):" << std::endl; |
450 |
> |
std::cout << "rotation(kcal*fs*mol^-1):" << std::endl; |
451 |
|
std::cout << Xidrr << std::endl; |
452 |
|
|
453 |
|
return true; |
454 |
< |
|
455 |
< |
} |
454 |
> |
|
455 |
> |
} |
456 |
|
|
457 |
< |
|
453 |
< |
void ApproximationModel::writeBeads(std::ostream& os) { |
457 |
> |
void ApproximationModel::writeBeads(std::ostream& os) { |
458 |
|
std::vector<BeadParam>::iterator iter; |
459 |
|
os << beads_.size() << std::endl; |
460 |
|
os << "Generated by Hydro" << std::endl; |
461 |
|
for (iter = beads_.begin(); iter != beads_.end(); ++iter) { |
462 |
< |
os << iter->atomName << "\t" << iter->pos[0] << "\t" << iter->pos[1] << "\t" << iter->pos[2] << std::endl; |
462 |
> |
os << iter->atomName << "\t" << iter->pos[0] << "\t" << iter->pos[1] << "\t" << iter->pos[2] << std::endl; |
463 |
|
} |
464 |
< |
|
464 |
> |
|
465 |
> |
} |
466 |
|
} |
462 |
– |
|
463 |
– |
|
464 |
– |
|
465 |
– |
} |