--- trunk/src/brains/Snapshot.cpp 2006/02/16 22:05:48 890 +++ trunk/src/brains/Snapshot.cpp 2007/01/03 20:47:00 1112 @@ -54,23 +54,23 @@ namespace oopse { namespace oopse { void Snapshot::setHmat(const Mat3x3d& m) { - const double orthoTolerance = NumericConstant::epsilon; hmat_ = m; invHmat_ = hmat_.inverse(); + //prepare fortran Hmat - double fortranHmat[9]; - double fortranInvHmat[9]; + RealType fortranHmat[9]; + RealType fortranInvHmat[9]; hmat_.getArray(fortranHmat); invHmat_.getArray(fortranInvHmat); //determine whether the box is orthoTolerance or not int oldOrthoRhombic = orthoRhombic_; - double smallDiag = fabs(hmat_(0, 0)); + RealType smallDiag = fabs(hmat_(0, 0)); if(smallDiag > fabs(hmat_(1, 1))) smallDiag = fabs(hmat_(1, 1)); if(smallDiag > fabs(hmat_(2, 2))) smallDiag = fabs(hmat_(2, 2)); - double tol = smallDiag * orthoTolerance; + RealType tol = smallDiag * orthoTolerance_; orthoRhombic_ = 1; @@ -94,7 +94,7 @@ namespace oopse { "\tThis is usually a good thing, but if you want the\n" "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" "\tvariable ( currently set to %G ) smaller.\n", - orthoTolerance); + orthoTolerance_); painCave.severity = OOPSE_INFO; simError(); } @@ -106,7 +106,7 @@ namespace oopse { "\tNPTf integration. If you want to live on the edge with\n" "\tthe Orthorhombic computations, make the orthoBoxTolerance\n" "\tvariable ( currently set to %G ) larger.\n", - orthoTolerance); + orthoTolerance_); painCave.severity = OOPSE_WARNING; simError(); } @@ -156,5 +156,32 @@ namespace oopse { } + Vector3d Snapshot::getCOM() { + if( !hasCOM_ ) { + sprintf( painCave.errMsg, "COM was requested before COM was computed!\n"); + painCave.severity = OOPSE_ERROR; + simError(); + } + return COM_; + } + + Vector3d Snapshot::getCOMvel() { + if( !hasCOM_ ) { + sprintf( painCave.errMsg, "COMvel was requested before COM was computed!\n"); + painCave.severity = OOPSE_ERROR; + simError(); + } + return COMvel_; + } + + Vector3d Snapshot::getCOMw() { + if( !hasCOM_ ) { + sprintf( painCave.errMsg, "COMw was requested before COM was computed!\n"); + painCave.severity = OOPSE_ERROR; + simError(); + } + return COMw_; + } + }