--- trunk/OOPSE/libmdtools/SimInfo.cpp 2003/10/29 20:41:39 843 +++ trunk/OOPSE/libmdtools/SimInfo.cpp 2003/11/06 22:01:37 855 @@ -49,8 +49,10 @@ SimInfo::SimInfo(){ boxIsInit = 0; resetTime = 1e99; - + orthoTolerance = 1E-6; + useInitXSstate = true; + usePBC = 0; useLJ = 0; useSticky = 0; @@ -146,6 +148,7 @@ void SimInfo::calcHmatInv( void ) { void SimInfo::calcHmatInv( void ) { + int oldOrtho; int i,j; double smallDiag; double tol; @@ -153,28 +156,44 @@ void SimInfo::calcHmatInv( void ) { invertMat3( Hmat, HmatInv ); - // Check the inverse to make sure it is sane: - - matMul3( Hmat, HmatInv, sanity ); - // check to see if Hmat is orthorhombic - smallDiag = Hmat[0][0]; - if(smallDiag > Hmat[1][1]) smallDiag = Hmat[1][1]; - if(smallDiag > Hmat[2][2]) smallDiag = Hmat[2][2]; - tol = smallDiag * 1E-6; + oldOrtho = orthoRhombic; + 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]); + tol = smallDiag * orthoTolerance; + orthoRhombic = 1; for (i = 0; i < 3; i++ ) { for (j = 0 ; j < 3; j++) { if (i != j) { if (orthoRhombic) { - if (Hmat[i][j] >= tol) orthoRhombic = 0; + if ( fabs(Hmat[i][j]) >= tol) orthoRhombic = 0; } } } } + + if( oldOrtho != orthoRhombic ){ + + if( orthoRhombic ){ + sprintf( painCave.errMsg, + "Hmat is switching from Non-Orthorhombic to OrthoRhombic\n" + " If this is a bad thing, change the orthoBoxTolerance( currently %G ).\n", + orthoTolerance); + simError(); + } + else { + sprintf( painCave.errMsg, + "Hmat is switching from Orthorhombic to Non-OrthoRhombic\n" + " If this is a bad thing, change the orthoBoxTolerance( currently %G ).\n", + orthoTolerance); + simError(); + } + } } double SimInfo::matDet3(double a[3][3]) { @@ -524,6 +543,8 @@ void SimInfo::setDefaultRcut( double theRcut ){ haveOrigRcut = 1; origRcut = theRcut; rCut = theRcut; + + ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); } @@ -539,7 +560,10 @@ void SimInfo::setDefaultEcr( double theEcr ){ haveOrigEcr = 1; origEcr = theEcr; + ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; + ecr = theEcr; + notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); } @@ -622,7 +646,6 @@ void SimInfo::checkCutOffs( void ){ ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; if( cutChanged ){ - notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); }