| 54 |
|
namespace oopse { |
| 55 |
|
|
| 56 |
|
void Snapshot::setHmat(const Mat3x3d& m) { |
| 57 |
– |
const double orthoTolerance = NumericConstant::epsilon; |
| 57 |
|
hmat_ = m; |
| 58 |
|
invHmat_ = hmat_.inverse(); |
| 59 |
|
|
| 60 |
+ |
|
| 61 |
|
//prepare fortran Hmat |
| 62 |
< |
double fortranHmat[9]; |
| 63 |
< |
double fortranInvHmat[9]; |
| 62 |
> |
RealType fortranHmat[9]; |
| 63 |
> |
RealType fortranInvHmat[9]; |
| 64 |
|
hmat_.getArray(fortranHmat); |
| 65 |
|
invHmat_.getArray(fortranInvHmat); |
| 66 |
|
|
| 67 |
|
//determine whether the box is orthoTolerance or not |
| 68 |
|
int oldOrthoRhombic = orthoRhombic_; |
| 69 |
|
|
| 70 |
< |
double smallDiag = fabs(hmat_(0, 0)); |
| 70 |
> |
RealType smallDiag = fabs(hmat_(0, 0)); |
| 71 |
|
if(smallDiag > fabs(hmat_(1, 1))) smallDiag = fabs(hmat_(1, 1)); |
| 72 |
|
if(smallDiag > fabs(hmat_(2, 2))) smallDiag = fabs(hmat_(2, 2)); |
| 73 |
< |
double tol = smallDiag * orthoTolerance; |
| 73 |
> |
RealType tol = smallDiag * orthoTolerance_; |
| 74 |
|
|
| 75 |
|
orthoRhombic_ = 1; |
| 76 |
|
|
| 91 |
|
sprintf( painCave.errMsg, |
| 92 |
|
"OOPSE is switching from the default Non-Orthorhombic\n" |
| 93 |
|
"\tto the faster Orthorhombic periodic boundary computations.\n" |
| 94 |
< |
"\tThis is usually a good thing, but if you wan't the\n" |
| 94 |
> |
"\tThis is usually a good thing, but if you want the\n" |
| 95 |
|
"\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" |
| 96 |
|
"\tvariable ( currently set to %G ) smaller.\n", |
| 97 |
< |
orthoTolerance); |
| 97 |
> |
orthoTolerance_); |
| 98 |
|
painCave.severity = OOPSE_INFO; |
| 99 |
|
simError(); |
| 100 |
|
} |
| 103 |
|
"OOPSE is switching from the faster Orthorhombic to the more\n" |
| 104 |
|
"\tflexible Non-Orthorhombic periodic boundary computations.\n" |
| 105 |
|
"\tThis is usually because the box has deformed under\n" |
| 106 |
< |
"\tNPTf integration. If you wan't to live on the edge with\n" |
| 106 |
> |
"\tNPTf integration. If you want to live on the edge with\n" |
| 107 |
|
"\tthe Orthorhombic computations, make the orthoBoxTolerance\n" |
| 108 |
|
"\tvariable ( currently set to %G ) larger.\n", |
| 109 |
< |
orthoTolerance); |
| 109 |
> |
orthoTolerance_); |
| 110 |
|
painCave.severity = OOPSE_WARNING; |
| 111 |
|
simError(); |
| 112 |
|
} |
| 156 |
|
|
| 157 |
|
} |
| 158 |
|
|
| 159 |
+ |
Vector3d Snapshot::getCOM() { |
| 160 |
+ |
if( !hasCOM_ ) { |
| 161 |
+ |
sprintf( painCave.errMsg, "COM was requested before COM was computed!\n"); |
| 162 |
+ |
painCave.severity = OOPSE_ERROR; |
| 163 |
+ |
simError(); |
| 164 |
+ |
} |
| 165 |
+ |
return COM_; |
| 166 |
+ |
} |
| 167 |
+ |
|
| 168 |
+ |
Vector3d Snapshot::getCOMvel() { |
| 169 |
+ |
if( !hasCOM_ ) { |
| 170 |
+ |
sprintf( painCave.errMsg, "COMvel was requested before COM was computed!\n"); |
| 171 |
+ |
painCave.severity = OOPSE_ERROR; |
| 172 |
+ |
simError(); |
| 173 |
+ |
} |
| 174 |
+ |
return COMvel_; |
| 175 |
+ |
} |
| 176 |
+ |
|
| 177 |
+ |
Vector3d Snapshot::getCOMw() { |
| 178 |
+ |
if( !hasCOM_ ) { |
| 179 |
+ |
sprintf( painCave.errMsg, "COMw was requested before COM was computed!\n"); |
| 180 |
+ |
painCave.severity = OOPSE_ERROR; |
| 181 |
+ |
simError(); |
| 182 |
+ |
} |
| 183 |
+ |
return COMw_; |
| 184 |
+ |
} |
| 185 |
+ |
|
| 186 |
|
} |
| 187 |
|
|