1 |
tim |
906 |
/* |
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 |
|
|
* 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 |
19 |
|
|
* notice, this list of conditions and the following disclaimer. |
20 |
|
|
* |
21 |
|
|
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
|
|
* notice, this list of conditions and the following disclaimer in the |
23 |
|
|
* documentation and/or other materials provided with the |
24 |
|
|
* distribution. |
25 |
|
|
* |
26 |
|
|
* This software is provided "AS IS," without a warranty of any |
27 |
|
|
* kind. All express or implied conditions, representations and |
28 |
|
|
* warranties, including any implied warranty of merchantability, |
29 |
|
|
* fitness for a particular purpose or non-infringement, are hereby |
30 |
|
|
* excluded. The University of Notre Dame and its licensors shall not |
31 |
|
|
* be liable for any damages suffered by licensee as a result of |
32 |
|
|
* using, modifying or distributing the software or its |
33 |
|
|
* derivatives. In no event will the University of Notre Dame or its |
34 |
|
|
* licensors be liable for any lost revenue, profit or data, or for |
35 |
|
|
* direct, indirect, special, consequential, incidental or punitive |
36 |
|
|
* damages, however caused and regardless of the theory of liability, |
37 |
|
|
* arising out of the use of or inability to use software, even if the |
38 |
|
|
* University of Notre Dame has been advised of the possibility of |
39 |
|
|
* such damages. |
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" |
49 |
|
|
#include "applications/hydrodynamics/CompositeShape.hpp" |
50 |
|
|
#include "math/LU.hpp" |
51 |
|
|
namespace oopse { |
52 |
|
|
/** |
53 |
|
|
* Reference: |
54 |
|
|
* Beatriz Carrasco and Jose Gracia de la Torre, Hydrodynamic Properties of Rigid Particles: |
55 |
|
|
* Comparison of Different Modeling and Computational Procedures. |
56 |
|
|
* Biophysical Journal, 75(6), 3044, 1999 |
57 |
|
|
*/ |
58 |
|
|
|
59 |
|
|
ApproximationModel::ApproximationModel(StuntDouble* sd, SimInfo* info): HydrodynamicsModel(sd, info){ |
60 |
|
|
/* |
61 |
|
|
DynamicProperty::const_iterator iter; |
62 |
|
|
|
63 |
|
|
iter = extraParams.find("Viscosity"); |
64 |
|
|
if (iter != extraParams.end()) { |
65 |
|
|
boost::any param = iter->second; |
66 |
|
|
viscosity = boost::any_cast<double>(param); |
67 |
|
|
}else { |
68 |
|
|
std::cout << "ApproximationModel Error\n" ; |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
iter = extraParams.find("Temperature"); |
72 |
|
|
if (iter != extraParams.end()) { |
73 |
|
|
boost::any param = iter->second; |
74 |
|
|
temperature = boost::any_cast<double>(param); |
75 |
|
|
}else { |
76 |
|
|
std::cout << "ApproximationModel Error\n" ; |
77 |
|
|
} |
78 |
|
|
*/ |
79 |
|
|
} |
80 |
|
|
|
81 |
|
|
bool ApproximationModel::calcHydroProps(Spheric* spheric, double viscosity, double temperature) { |
82 |
|
|
return internalCalcHydroProps(static_cast<Shape*>(spheric), viscosity, temperature); |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
bool ApproximationModel::calcHydroProps(Ellipsoid* ellipsoid, double viscosity, double temperature) { |
86 |
|
|
return internalCalcHydroProps(static_cast<Shape*>(ellipsoid), viscosity, temperature); |
87 |
|
|
} |
88 |
|
|
bool ApproximationModel::calcHydroProps(CompositeShape* compositeShape, double viscosity, double temperature) { |
89 |
|
|
return internalCalcHydroProps(static_cast<Shape*>(compositeShape), viscosity, temperature); |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
|
93 |
|
|
bool ApproximationModel::internalCalcHydroProps(Shape* shape, double viscosity, double temperature) { |
94 |
|
|
if (!createBeads(beads_)) { |
95 |
|
|
std::cout << "can not create beads" << std::endl; |
96 |
|
|
return false; |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
bool ret = true; |
100 |
|
|
HydroProps cr; |
101 |
|
|
HydroProps cd; |
102 |
|
|
calcHydroPropsAtCR(beads_, viscosity, temperature, cr); |
103 |
|
|
calcHydroPropsAtCD(beads_, viscosity, temperature, cd); |
104 |
|
|
setCR(cr); |
105 |
|
|
setCD(cd); |
106 |
|
|
|
107 |
|
|
return true; |
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
bool ApproximationModel::calcHydroPropsAtCR(std::vector<BeadParam>& beads, double viscosity, double temperature, HydroProps& cr) { |
111 |
|
|
|
112 |
|
|
int nbeads = beads.size(); |
113 |
|
|
DynamicRectMatrix<double> B(3*nbeads, 3*nbeads); |
114 |
|
|
DynamicRectMatrix<double> C(3*nbeads, 3*nbeads); |
115 |
|
|
Mat3x3d I; |
116 |
|
|
I(0, 0) = 1.0; |
117 |
|
|
I(1, 1) = 1.0; |
118 |
|
|
I(2, 2) = 1.0; |
119 |
|
|
|
120 |
|
|
for (std::size_t i = 0; i < nbeads; ++i) { |
121 |
|
|
for (std::size_t j = 0; j < nbeads; ++j) { |
122 |
|
|
Mat3x3d Tij; |
123 |
|
|
if (i != j ) { |
124 |
|
|
Vector3d Rij = beads[i].pos - beads[j].pos; |
125 |
|
|
double rij = Rij.length(); |
126 |
|
|
double rij2 = rij * rij; |
127 |
|
|
double sumSigma2OverRij2 = ((beads[i].radius*beads[i].radius) + (beads[i].radius*beads[i].radius)) / rij2; |
128 |
|
|
Mat3x3d tmpMat; |
129 |
|
|
tmpMat = outProduct(Rij, Rij) / rij2; |
130 |
|
|
double constant = 8.0 * NumericConstant::PI * viscosity * rij; |
131 |
|
|
Tij = ((1.0 + sumSigma2OverRij2/3.0) * I + (1.0 - sumSigma2OverRij2) * tmpMat ) / constant; |
132 |
|
|
}else { |
133 |
|
|
double constant = 1.0 / (6.0 * NumericConstant::PI * viscosity * beads[i].radius); |
134 |
|
|
Tij(0, 0) = constant; |
135 |
|
|
Tij(1, 1) = constant; |
136 |
|
|
Tij(2, 2) = constant; |
137 |
|
|
} |
138 |
|
|
B.setSubMatrix(i*3, j*3, Tij); |
139 |
|
|
} |
140 |
|
|
} |
141 |
|
|
|
142 |
|
|
//invert B Matrix |
143 |
|
|
invertMatrix(B, C); |
144 |
|
|
|
145 |
|
|
//prepare U Matrix relative to arbitrary origin O(0.0, 0.0, 0.0) |
146 |
|
|
std::vector<Mat3x3d> U; |
147 |
|
|
for (int i = 0; i < nbeads; ++i) { |
148 |
|
|
Mat3x3d currU; |
149 |
|
|
currU.setupSkewMat(beads[i].pos); |
150 |
|
|
U.push_back(currU); |
151 |
|
|
} |
152 |
|
|
|
153 |
|
|
//calculate Xi matrix at arbitrary origin O |
154 |
|
|
Mat3x3d Xiott; |
155 |
|
|
Mat3x3d Xiorr; |
156 |
|
|
Mat3x3d Xiotr; |
157 |
|
|
|
158 |
|
|
//calculate the total volume |
159 |
|
|
|
160 |
|
|
double volume = 0.0; |
161 |
|
|
for (std::vector<BeadParam>::iterator iter = beads.begin(); iter != beads.end(); ++iter) { |
162 |
|
|
volume += 4.0/3.0 * NumericConstant::PI * pow((*iter).radius,3); |
163 |
|
|
} |
164 |
|
|
|
165 |
|
|
for (std::size_t i = 0; i < nbeads; ++i) { |
166 |
|
|
for (std::size_t j = 0; j < nbeads; ++j) { |
167 |
|
|
Mat3x3d Cij; |
168 |
|
|
C.getSubMatrix(i*3, j*3, Cij); |
169 |
|
|
|
170 |
|
|
Xiott += Cij; |
171 |
|
|
Xiotr += U[i] * Cij; |
172 |
|
|
Xiorr += -U[i] * Cij * U[j] + (6 * viscosity * volume) * I; |
173 |
|
|
} |
174 |
|
|
} |
175 |
|
|
|
176 |
|
|
const double convertConstant = 6.023; //convert poise.angstrom to amu/fs |
177 |
|
|
Xiott *= convertConstant; |
178 |
|
|
Xiotr *= convertConstant; |
179 |
|
|
Xiorr *= convertConstant; |
180 |
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
Mat3x3d tmp; |
184 |
|
|
Mat3x3d tmpInv; |
185 |
|
|
Vector3d tmpVec; |
186 |
|
|
tmp(0, 0) = Xiott(1, 1) + Xiott(2, 2); |
187 |
|
|
tmp(0, 1) = - Xiott(0, 1); |
188 |
|
|
tmp(0, 2) = -Xiott(0, 2); |
189 |
|
|
tmp(1, 0) = -Xiott(0, 1); |
190 |
|
|
tmp(1, 1) = Xiott(0, 0) + Xiott(2, 2); |
191 |
|
|
tmp(1, 2) = -Xiott(1, 2); |
192 |
|
|
tmp(2, 0) = -Xiott(0, 2); |
193 |
|
|
tmp(2, 1) = -Xiott(1, 2); |
194 |
|
|
tmp(2, 2) = Xiott(1, 1) + Xiott(0, 0); |
195 |
|
|
tmpVec[0] = Xiotr(2, 1) - Xiotr(1, 2); |
196 |
|
|
tmpVec[1] = Xiotr(0, 2) - Xiotr(2, 0); |
197 |
|
|
tmpVec[2] = Xiotr(1, 0) - Xiotr(0, 1); |
198 |
|
|
tmpInv = tmp.inverse(); |
199 |
|
|
Vector3d ror = tmpInv * tmpVec; //center of resistance |
200 |
|
|
Mat3x3d Uor; |
201 |
|
|
Uor.setupSkewMat(ror); |
202 |
|
|
|
203 |
|
|
Mat3x3d Xirtt; |
204 |
|
|
Mat3x3d Xirrr; |
205 |
|
|
Mat3x3d Xirtr; |
206 |
|
|
|
207 |
|
|
Xirtt = Xiott; |
208 |
|
|
Xirtr = (Xiotr - Uor * Xiott); |
209 |
|
|
Xirrr = Xiorr - Uor * Xiott * Uor + Xiotr * Uor - Uor * Xiotr.transpose(); |
210 |
|
|
|
211 |
|
|
|
212 |
|
|
SquareMatrix<double,6> Xir6x6; |
213 |
|
|
SquareMatrix<double,6> Dr6x6; |
214 |
|
|
|
215 |
|
|
Xir6x6.setSubMatrix(0, 0, Xirtt); |
216 |
|
|
Xir6x6.setSubMatrix(0, 3, Xirtr.transpose()); |
217 |
|
|
Xir6x6.setSubMatrix(3, 0, Xirtr); |
218 |
|
|
Xir6x6.setSubMatrix(3, 3, Xirrr); |
219 |
|
|
|
220 |
|
|
invertMatrix(Xir6x6, Dr6x6); |
221 |
|
|
Mat3x3d Drtt; |
222 |
|
|
Mat3x3d Drtr; |
223 |
|
|
Mat3x3d Drrt; |
224 |
|
|
Mat3x3d Drrr; |
225 |
|
|
Dr6x6.getSubMatrix(0, 0, Drtt); |
226 |
|
|
Dr6x6.getSubMatrix(0, 3, Drrt); |
227 |
|
|
Dr6x6.getSubMatrix(3, 0, Drtr); |
228 |
|
|
Dr6x6.getSubMatrix(3, 3, Drrr); |
229 |
|
|
double kt = OOPSEConstant::kB * temperature ; |
230 |
|
|
Drtt *= kt; |
231 |
|
|
Drrt *= kt; |
232 |
|
|
Drtr *= kt; |
233 |
|
|
Drrr *= kt; |
234 |
|
|
Xirtt *= OOPSEConstant::kb * temperature; |
235 |
|
|
Xirtr *= OOPSEConstant::kb * temperature; |
236 |
|
|
Xirrr *= OOPSEConstant::kb * temperature; |
237 |
|
|
|
238 |
|
|
|
239 |
|
|
cr.center = ror; |
240 |
|
|
cr.Xi.setSubMatrix(0, 0, Xirtt); |
241 |
|
|
cr.Xi.setSubMatrix(0, 3, Xirtr); |
242 |
|
|
cr.Xi.setSubMatrix(3, 0, Xirtr); |
243 |
|
|
cr.Xi.setSubMatrix(3, 3, Xirrr); |
244 |
|
|
cr.D.setSubMatrix(0, 0, Drtt); |
245 |
|
|
cr.D.setSubMatrix(0, 3, Drrt); |
246 |
|
|
cr.D.setSubMatrix(3, 0, Drtr); |
247 |
|
|
cr.D.setSubMatrix(3, 3, Drrr); |
248 |
|
|
|
249 |
|
|
std::cout << "-----------------------------------------\n"; |
250 |
|
|
std::cout << "center of resistance :" << std::endl; |
251 |
|
|
std::cout << ror << std::endl; |
252 |
|
|
std::cout << "resistant tensor at center of resistance" << std::endl; |
253 |
|
|
std::cout << "translation:" << std::endl; |
254 |
|
|
std::cout << Xirtt << std::endl; |
255 |
|
|
std::cout << "translation-rotation:" << std::endl; |
256 |
|
|
std::cout << Xirtr << std::endl; |
257 |
|
|
std::cout << "rotation:" << std::endl; |
258 |
|
|
std::cout << Xirrr << std::endl; |
259 |
|
|
std::cout << "diffusion tensor at center of resistance" << std::endl; |
260 |
|
|
std::cout << "translation:" << std::endl; |
261 |
|
|
std::cout << Drtt << std::endl; |
262 |
|
|
std::cout << "rotation-translation:" << std::endl; |
263 |
|
|
std::cout << Drrt << std::endl; |
264 |
|
|
std::cout << "translation-rotation:" << std::endl; |
265 |
|
|
std::cout << Drtr << std::endl; |
266 |
|
|
std::cout << "rotation:" << std::endl; |
267 |
|
|
std::cout << Drrr << std::endl; |
268 |
|
|
std::cout << "-----------------------------------------\n"; |
269 |
|
|
|
270 |
|
|
return true; |
271 |
|
|
} |
272 |
|
|
|
273 |
|
|
bool ApproximationModel::calcHydroPropsAtCD(std::vector<BeadParam>& beads, double viscosity, double temperature, HydroProps& cr) { |
274 |
|
|
|
275 |
|
|
int nbeads = beads.size(); |
276 |
|
|
DynamicRectMatrix<double> B(3*nbeads, 3*nbeads); |
277 |
|
|
DynamicRectMatrix<double> C(3*nbeads, 3*nbeads); |
278 |
|
|
Mat3x3d I; |
279 |
|
|
I(0, 0) = 1.0; |
280 |
|
|
I(1, 1) = 1.0; |
281 |
|
|
I(2, 2) = 1.0; |
282 |
|
|
|
283 |
|
|
for (std::size_t i = 0; i < nbeads; ++i) { |
284 |
|
|
for (std::size_t j = 0; j < nbeads; ++j) { |
285 |
|
|
Mat3x3d Tij; |
286 |
|
|
if (i != j ) { |
287 |
|
|
Vector3d Rij = beads[i].pos - beads[j].pos; |
288 |
|
|
double rij = Rij.length(); |
289 |
|
|
double rij2 = rij * rij; |
290 |
|
|
double sumSigma2OverRij2 = ((beads[i].radius*beads[i].radius) + (beads[i].radius*beads[i].radius)) / rij2; |
291 |
|
|
Mat3x3d tmpMat; |
292 |
|
|
tmpMat = outProduct(Rij, Rij) / rij2; |
293 |
|
|
double constant = 8.0 * NumericConstant::PI * viscosity * rij; |
294 |
|
|
Tij = ((1.0 + sumSigma2OverRij2/3.0) * I + (1.0 - sumSigma2OverRij2) * tmpMat ) / constant; |
295 |
|
|
}else { |
296 |
|
|
double constant = 1.0 / (6.0 * NumericConstant::PI * viscosity * beads[i].radius); |
297 |
|
|
Tij(0, 0) = constant; |
298 |
|
|
Tij(1, 1) = constant; |
299 |
|
|
Tij(2, 2) = constant; |
300 |
|
|
} |
301 |
|
|
B.setSubMatrix(i*3, j*3, Tij); |
302 |
|
|
} |
303 |
|
|
} |
304 |
|
|
|
305 |
|
|
//invert B Matrix |
306 |
|
|
invertMatrix(B, C); |
307 |
|
|
|
308 |
|
|
//prepare U Matrix relative to arbitrary origin O(0.0, 0.0, 0.0) |
309 |
|
|
std::vector<Mat3x3d> U; |
310 |
|
|
for (int i = 0; i < nbeads; ++i) { |
311 |
|
|
Mat3x3d currU; |
312 |
|
|
currU.setupSkewMat(beads[i].pos); |
313 |
|
|
U.push_back(currU); |
314 |
|
|
} |
315 |
|
|
|
316 |
|
|
//calculate Xi matrix at arbitrary origin O |
317 |
|
|
Mat3x3d Xitt; |
318 |
|
|
Mat3x3d Xirr; |
319 |
|
|
Mat3x3d Xitr; |
320 |
|
|
|
321 |
|
|
//calculate the total volume |
322 |
|
|
|
323 |
|
|
double volume = 0.0; |
324 |
|
|
for (std::vector<BeadParam>::iterator iter = beads.begin(); iter != beads.end(); ++iter) { |
325 |
|
|
volume += 4.0/3.0 * NumericConstant::PI * pow((*iter).radius,3); |
326 |
|
|
} |
327 |
|
|
|
328 |
|
|
for (std::size_t i = 0; i < nbeads; ++i) { |
329 |
|
|
for (std::size_t j = 0; j < nbeads; ++j) { |
330 |
|
|
Mat3x3d Cij; |
331 |
|
|
C.getSubMatrix(i*3, j*3, Cij); |
332 |
|
|
|
333 |
|
|
Xitt += Cij; |
334 |
|
|
Xitr += U[i] * Cij; |
335 |
|
|
Xirr += -U[i] * Cij * U[j] + (6 * viscosity * volume) * I; |
336 |
|
|
} |
337 |
|
|
} |
338 |
|
|
|
339 |
|
|
const double convertConstant = 6.023; //convert poise.angstrom to amu/fs |
340 |
|
|
Xitt *= convertConstant; |
341 |
|
|
Xitr *= convertConstant; |
342 |
|
|
Xirr *= convertConstant; |
343 |
|
|
|
344 |
|
|
double kt = OOPSEConstant::kB * temperature; |
345 |
|
|
|
346 |
|
|
Mat3x3d Dott; //translational diffusion tensor at arbitrary origin O |
347 |
|
|
Mat3x3d Dorr; //rotational diffusion tensor at arbitrary origin O |
348 |
|
|
Mat3x3d Dotr; //translation-rotation couplingl diffusion tensor at arbitrary origin O |
349 |
|
|
|
350 |
|
|
const static Mat3x3d zeroMat(0.0); |
351 |
|
|
|
352 |
|
|
Mat3x3d XittInv(0.0); |
353 |
|
|
XittInv = Xitt.inverse(); |
354 |
|
|
|
355 |
|
|
Mat3x3d XirrInv; |
356 |
|
|
XirrInv = Xirr.inverse(); |
357 |
|
|
|
358 |
|
|
Mat3x3d tmp; |
359 |
|
|
Mat3x3d tmpInv; |
360 |
|
|
tmp = Xitt - Xitr.transpose() * XirrInv * Xitr; |
361 |
|
|
tmpInv = tmp.inverse(); |
362 |
|
|
|
363 |
|
|
Dott = tmpInv; |
364 |
|
|
Dotr = -XirrInv * Xitr * tmpInv; |
365 |
|
|
|
366 |
|
|
tmp = Xirr - Xitr * XittInv * Xitr.transpose(); |
367 |
|
|
tmpInv = tmp.inverse(); |
368 |
|
|
|
369 |
|
|
Dorr = tmpInv; |
370 |
|
|
|
371 |
|
|
//calculate center of diffusion |
372 |
|
|
tmp(0, 0) = Dorr(1, 1) + Dorr(2, 2); |
373 |
|
|
tmp(0, 1) = - Dorr(0, 1); |
374 |
|
|
tmp(0, 2) = -Dorr(0, 2); |
375 |
|
|
tmp(1, 0) = -Dorr(0, 1); |
376 |
|
|
tmp(1, 1) = Dorr(0, 0) + Dorr(2, 2); |
377 |
|
|
tmp(1, 2) = -Dorr(1, 2); |
378 |
|
|
tmp(2, 0) = -Dorr(0, 2); |
379 |
|
|
tmp(2, 1) = -Dorr(1, 2); |
380 |
|
|
tmp(2, 2) = Dorr(1, 1) + Dorr(0, 0); |
381 |
|
|
|
382 |
|
|
Vector3d tmpVec; |
383 |
|
|
tmpVec[0] = Dotr(1, 2) - Dotr(2, 1); |
384 |
|
|
tmpVec[1] = Dotr(2, 0) - Dotr(0, 2); |
385 |
|
|
tmpVec[2] = Dotr(0, 1) - Dotr(1, 0); |
386 |
|
|
|
387 |
|
|
tmpInv = tmp.inverse(); |
388 |
|
|
|
389 |
|
|
Vector3d rod = tmpInv * tmpVec; |
390 |
|
|
|
391 |
|
|
//calculate Diffusion Tensor at center of diffusion |
392 |
|
|
Mat3x3d Uod; |
393 |
|
|
Uod.setupSkewMat(rod); |
394 |
|
|
|
395 |
|
|
Mat3x3d Ddtt; //translational diffusion tensor at diffusion center |
396 |
|
|
Mat3x3d Ddtr; //rotational diffusion tensor at diffusion center |
397 |
|
|
Mat3x3d Ddrr; //translation-rotation couplingl diffusion tensor at diffusion tensor |
398 |
|
|
|
399 |
|
|
Ddtt = Dott - Uod * Dorr * Uod + Dotr.transpose() * Uod - Uod * Dotr; |
400 |
|
|
Ddrr = Dorr; |
401 |
|
|
Ddtr = Dotr + Dorr * Uod; |
402 |
|
|
|
403 |
|
|
SquareMatrix<double, 6> Dd; |
404 |
|
|
Dd.setSubMatrix(0, 0, Ddtt); |
405 |
|
|
Dd.setSubMatrix(0, 3, Ddtr.transpose()); |
406 |
|
|
Dd.setSubMatrix(3, 0, Ddtr); |
407 |
|
|
Dd.setSubMatrix(3, 3, Ddrr); |
408 |
|
|
SquareMatrix<double, 6> Xid; |
409 |
|
|
Ddtt *= kt; |
410 |
|
|
Ddtr *=kt; |
411 |
|
|
Ddrr *= kt; |
412 |
|
|
invertMatrix(Dd, Xid); |
413 |
|
|
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
//Xidtt in units of kcal*fs*mol^-1*Ang^-2 |
417 |
|
|
//Xid /= OOPSEConstant::energyConvert; |
418 |
|
|
Xid *= OOPSEConstant::kb * temperature; |
419 |
|
|
|
420 |
|
|
cr.center = rod; |
421 |
|
|
cr.D.setSubMatrix(0, 0, Ddtt); |
422 |
|
|
cr.D.setSubMatrix(0, 3, Ddtr); |
423 |
|
|
cr.D.setSubMatrix(3, 0, Ddtr); |
424 |
|
|
cr.D.setSubMatrix(3, 3, Ddrr); |
425 |
|
|
cr.Xi = Xid; |
426 |
|
|
|
427 |
|
|
std::cout << "viscosity = " << viscosity << std::endl; |
428 |
|
|
std::cout << "temperature = " << temperature << std::endl; |
429 |
|
|
std::cout << "center of diffusion :" << std::endl; |
430 |
|
|
std::cout << rod << std::endl; |
431 |
|
|
std::cout << "diffusion tensor at center of diffusion " << std::endl; |
432 |
|
|
std::cout << "translation(A^2/fs) :" << std::endl; |
433 |
|
|
std::cout << Ddtt << std::endl; |
434 |
|
|
std::cout << "translation-rotation(A^3/fs):" << std::endl; |
435 |
|
|
std::cout << Ddtr << std::endl; |
436 |
|
|
std::cout << "rotation(A^4/fs):" << std::endl; |
437 |
|
|
std::cout << Ddrr << std::endl; |
438 |
|
|
|
439 |
|
|
std::cout << "resistance tensor at center of diffusion " << std::endl; |
440 |
|
|
std::cout << "translation(kcal*fs*mol^-1*Ang^-2) :" << std::endl; |
441 |
|
|
|
442 |
|
|
Mat3x3d Xidtt; |
443 |
|
|
Mat3x3d Xidrt; |
444 |
|
|
Mat3x3d Xidtr; |
445 |
|
|
Mat3x3d Xidrr; |
446 |
|
|
Xid.getSubMatrix(0, 0, Xidtt); |
447 |
|
|
Xid.getSubMatrix(0, 3, Xidrt); |
448 |
|
|
Xid.getSubMatrix(3, 0, Xidtr); |
449 |
|
|
Xid.getSubMatrix(3, 3, Xidrr); |
450 |
|
|
|
451 |
|
|
std::cout << Xidtt << std::endl; |
452 |
|
|
std::cout << "rotation-translation (kcal*fs*mol^-1*Ang^-3):" << std::endl; |
453 |
|
|
std::cout << Xidrt << std::endl; |
454 |
|
|
std::cout << "translation-rotation(kcal*fs*mol^-1*Ang^-3):" << std::endl; |
455 |
|
|
std::cout << Xidtr << std::endl; |
456 |
|
|
std::cout << "rotation(kcal*fs*mol^-1*Ang^-4):" << std::endl; |
457 |
|
|
std::cout << Xidrr << std::endl; |
458 |
|
|
|
459 |
|
|
return true; |
460 |
|
|
|
461 |
|
|
} |
462 |
|
|
|
463 |
|
|
/* |
464 |
|
|
void ApproximationModel::writeBeads(std::ostream& os) { |
465 |
|
|
std::vector<BeadParam>::iterator iter; |
466 |
|
|
os << beads_.size() << std::endl; |
467 |
|
|
os << "Generated by Hydro" << std::endl; |
468 |
|
|
for (iter = beads_.begin(); iter != beads_.end(); ++iter) { |
469 |
|
|
os << iter->atomName << "\t" << iter->pos[0] << "\t" << iter->pos[1] << "\t" << iter->pos[2] << std::endl; |
470 |
|
|
} |
471 |
|
|
|
472 |
|
|
} |
473 |
|
|
*/ |
474 |
|
|
|
475 |
|
|
|
476 |
|
|
} |