ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/SimInfo.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/SimInfo.cpp (file contents):
Revision 845 by gezelter, Thu Oct 30 18:59:20 2003 UTC vs.
Revision 855 by mmeineke, Thu Nov 6 22:01:37 2003 UTC

# Line 49 | Line 49 | SimInfo::SimInfo(){
49    boxIsInit = 0;
50    
51    resetTime = 1e99;
52  
52  
53 +  orthoTolerance = 1E-6;
54 +  useInitXSstate = true;
55 +
56    usePBC = 0;
57    useLJ = 0;
58    useSticky = 0;
# Line 146 | Line 148 | void SimInfo::calcHmatInv( void ) {
148  
149   void SimInfo::calcHmatInv( void ) {
150    
151 +  int oldOrtho;
152    int i,j;
153    double smallDiag;
154    double tol;
# Line 153 | Line 156 | void SimInfo::calcHmatInv( void ) {
156  
157    invertMat3( Hmat, HmatInv );
158  
156  // Check the inverse to make sure it is sane:
157
158  matMul3( Hmat, HmatInv, sanity );
159    
159    // check to see if Hmat is orthorhombic
160    
161 <  smallDiag = Hmat[0][0];
163 <  if(smallDiag > Hmat[1][1]) smallDiag = Hmat[1][1];
164 <  if(smallDiag > Hmat[2][2]) smallDiag = Hmat[2][2];
165 <  tol = smallDiag * 1E-6;
161 >  oldOrtho = orthoRhombic;
162  
163 +  smallDiag = fabs(Hmat[0][0]);
164 +  if(smallDiag > fabs(Hmat[1][1])) smallDiag = fabs(Hmat[1][1]);
165 +  if(smallDiag > fabs(Hmat[2][2])) smallDiag = fabs(Hmat[2][2]);
166 +  tol = smallDiag * orthoTolerance;
167 +
168    orthoRhombic = 1;
169    
170    for (i = 0; i < 3; i++ ) {
171      for (j = 0 ; j < 3; j++) {
172        if (i != j) {
173          if (orthoRhombic) {
174 <          if (Hmat[i][j] >= tol) orthoRhombic = 0;
174 >          if ( fabs(Hmat[i][j]) >= tol) orthoRhombic = 0;
175          }        
176        }
177      }
178    }
179 +
180 +  if( oldOrtho != orthoRhombic ){
181 +    
182 +    if( orthoRhombic ){
183 +      sprintf( painCave.errMsg,
184 +               "Hmat is switching from Non-Orthorhombic to OrthoRhombic\n"
185 +               "       If this is a bad thing, change the orthoBoxTolerance( currently %G ).\n",
186 +               orthoTolerance);
187 +      simError();
188 +    }
189 +    else {
190 +      sprintf( painCave.errMsg,
191 +               "Hmat is switching from Orthorhombic to Non-OrthoRhombic\n"
192 +               "       If this is a bad thing, change the orthoBoxTolerance( currently %G ).\n",
193 +               orthoTolerance);
194 +      simError();
195 +    }
196 +  }
197   }
198  
199   double SimInfo::matDet3(double a[3][3]) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines