39 |
|
* such damages. |
40 |
|
*/ |
41 |
|
#include "applications/hydrodynamics/AnalyticalModel.hpp" |
42 |
< |
#include "applications/hydrodynamics/Spheric.hpp" |
43 |
< |
#include "applications/hydrodynamics/Ellipsoid.hpp" |
42 |
> |
#include "hydrodynamics/Sphere.hpp" |
43 |
> |
#include "hydrodynamics/Ellipsoid.hpp" |
44 |
|
#include "applications/hydrodynamics/CompositeShape.hpp" |
45 |
|
#include "math/LU.hpp" |
46 |
|
namespace oopse { |
47 |
< |
bool AnalyticalModel::calcHydroProps(Spheric* spheric, double viscosity, double temperature) { |
48 |
< |
|
49 |
< |
double radius = spheric->getRadius(); |
50 |
< |
HydroProps props; |
51 |
< |
props.center =V3Zero; |
52 |
< |
double Xitt = 6.0 * NumericConstant::PI * viscosity * radius; |
53 |
< |
double Xirr = 8.0 * NumericConstant::PI * viscosity * radius * radius * radius; |
54 |
< |
props.Xi(0, 0) = Xitt; |
55 |
< |
props.Xi(1, 1) = Xitt; |
56 |
< |
props.Xi(2, 2) = Xitt; |
57 |
< |
props.Xi(3, 3) = Xirr; |
58 |
< |
props.Xi(4, 4) = Xirr; |
59 |
< |
props.Xi(5, 5) = Xirr; |
47 |
> |
|
48 |
> |
bool AnalyticalModel::calcHydroProps(Shape* shape, RealType viscosity, RealType temperature) { |
49 |
|
|
61 |
– |
const double convertConstant = 6.023; //convert poise.angstrom to amu/fs |
62 |
– |
props.Xi *= convertConstant; |
63 |
– |
Mat6x6d XiCopy = props.Xi; |
64 |
– |
invertMatrix(XiCopy, props.D); |
65 |
– |
double kt = OOPSEConstant::kB * temperature; |
66 |
– |
props.D *= kt; |
67 |
– |
props.Xi *= OOPSEConstant::kb * temperature; |
68 |
– |
|
69 |
– |
setCR(props); |
70 |
– |
setCD(props); |
71 |
– |
|
72 |
– |
return true; |
73 |
– |
|
74 |
– |
} |
75 |
– |
|
76 |
– |
/** |
77 |
– |
* calculate the ratio of friction coeffiction constant between ellipsoid and spheric |
78 |
– |
* with same volume. |
79 |
– |
* @param m |
80 |
– |
* @param n |
81 |
– |
* @note |
82 |
– |
* Reference: |
83 |
– |
* |
84 |
– |
* (1) Victor A. Bloomfield, On-Line Biophysics Textbook, Volume: Separations and Hydrodynamics |
85 |
– |
* Chapter 1,Survey of Biomolecular Hydrodynamics |
86 |
– |
* http://www.biophysics.org/education/vbloomfield.pdf |
87 |
– |
* (2) F. Perrin , J. Phys. Radium, [7] 5, 497-511, 1934 |
88 |
– |
* (3) F. Perrin, J. Phys. Radium, [7] 7, 1-11, 1936 |
89 |
– |
*/ |
90 |
– |
bool AnalyticalModel::calcHydroProps(Ellipsoid* ellipsoid, double viscosity, double temperature) { |
91 |
– |
double ft; |
92 |
– |
double fra; |
93 |
– |
double frb; |
94 |
– |
double a = ellipsoid->getA(); |
95 |
– |
double b = ellipsoid->getB(); |
96 |
– |
double q = a/b; //? |
97 |
– |
if (q > 1.0) {//prolate |
98 |
– |
ft = sqrt(1-q*q)/(pow(q, 2.0/3.0)*log((1 + sqrt(1-q*q))/q)); |
99 |
– |
fra = 4*(1-q*q)/(3*(2 - 2*pow(q, 4.0/3.0)/ft)); //not sure |
100 |
– |
frb = 4*(1-q*q*q*q) /(3*q*q*(2*pow(q, -2.0/3.0)*(2-q*q)/ft-2)); |
101 |
– |
} else {//oblate |
102 |
– |
ft = sqrt(1-q*q)/(pow(q, 2.0/3.0)*atan(sqrt(q*q-1))); |
103 |
– |
fra = 4*(1-q*q)/(3*(2 - 2*pow(q, 4.0/3.0)/ft)); //not sure |
104 |
– |
frb = 4*(1-q*q*q*q) /(3*q*q*(2*pow(q, -2.0/3.0)*(2-q*q)/ft-2)); |
105 |
– |
} |
106 |
– |
|
107 |
– |
double radius = pow(a*a*b, 1.0/3.0); |
50 |
|
HydroProps props; |
51 |
< |
double Xitt = 6.0 * NumericConstant::PI * viscosity * radius; |
52 |
< |
double Xirr = 8.0 * NumericConstant::PI * viscosity * radius * radius * radius; |
53 |
< |
props.Xi(0, 0) = Xitt; |
54 |
< |
props.Xi(1, 1) = Xitt; |
55 |
< |
props.Xi(2, 2) = Xitt; |
56 |
< |
props.Xi(3, 3) = Xirr; |
57 |
< |
props.Xi(4, 4) = Xirr; |
58 |
< |
props.Xi(5, 5) = Xirr; |
51 |
> |
Sphere* sphere = dynamic_cast<Sphere*>(shape); |
52 |
> |
if (sphere != NULL) { |
53 |
> |
props = sphere->getHydroProps(viscosity, temperature); |
54 |
> |
setCR(props); |
55 |
> |
setCD(props); |
56 |
> |
return true; |
57 |
> |
} else { |
58 |
> |
Ellipsoid* ellipsoid = dynamic_cast<Ellipsoid*>(shape); |
59 |
> |
if (ellipsoid != NULL) { |
60 |
> |
props = ellipsoid->getHydroProps(viscosity, temperature); |
61 |
> |
setCR(props); |
62 |
> |
setCD(props); |
63 |
> |
return true; |
64 |
> |
} else { |
65 |
> |
CompositeShape* composite = dynamic_cast<CompositeShape*>(shape); |
66 |
> |
if (composite != NULL) { |
67 |
> |
return false; |
68 |
> |
} else { |
69 |
> |
sprintf( painCave.errMsg, |
70 |
> |
"Could not figure out what kind of shape this is!\n"); |
71 |
> |
painCave.severity = OOPSE_ERROR; |
72 |
> |
painCave.isFatal = 1; |
73 |
> |
simError(); |
74 |
> |
return false; |
75 |
> |
} |
76 |
> |
} |
77 |
> |
} |
78 |
> |
} |
79 |
|
|
80 |
< |
const double convertConstant = 6.023; //convert poise.angstrom to amu/fs |
81 |
< |
props.Xi *= convertConstant; |
82 |
< |
props.Xi(0,0) *= ft; |
83 |
< |
props.Xi(1,1) *= ft; |
84 |
< |
props.Xi(2,2) *= ft; |
85 |
< |
props.Xi(3,3) *= fra; |
124 |
< |
props.Xi(4,4) *= fra; |
125 |
< |
props.Xi(5,5) *= frb; |
126 |
< |
|
127 |
< |
Mat6x6d XiCopy = props.Xi; |
128 |
< |
XiCopy /= OOPSEConstant::kb * temperature; |
129 |
< |
invertMatrix(XiCopy, props.D); |
130 |
< |
double kt = OOPSEConstant::kB * temperature; |
131 |
< |
props.D *= kt; |
132 |
< |
|
133 |
< |
setCR(props); |
134 |
< |
setCD(props); |
135 |
< |
|
136 |
< |
return true; |
80 |
> |
void AnalyticalModel::writeBeads(std::ostream& os) { |
81 |
> |
os << "1\n"; |
82 |
> |
os << "Generated by Hydro\n"; |
83 |
> |
Vector3d pos = sd_->getPos(); |
84 |
> |
os << sd_->getType() << "\t" << pos[0] << "\t" << pos[1] << "\t" << pos[2] << std::endl; |
85 |
> |
} |
86 |
|
} |
138 |
– |
|
139 |
– |
bool AnalyticalModel::calcHydroProps(CompositeShape* compositexShape, double viscosity, double temperature) { |
140 |
– |
return false; |
141 |
– |
} |
142 |
– |
|
143 |
– |
|
144 |
– |
|
145 |
– |
} |