# | 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]) { | |
# | Line 524 | Line 543 | void SimInfo::setDefaultRcut( double theRcut ){ | |
543 | haveOrigRcut = 1; | |
544 | origRcut = theRcut; | |
545 | rCut = theRcut; | |
546 | + | |
547 | + | ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
548 | ||
549 | notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); | |
550 | } | |
# | Line 539 | Line 560 | void SimInfo::setDefaultEcr( double theEcr ){ | |
560 | haveOrigEcr = 1; | |
561 | origEcr = theEcr; | |
562 | ||
563 | + | ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
564 | + | |
565 | ecr = theEcr; | |
566 | + | |
567 | notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); | |
568 | } | |
569 | ||
# | Line 622 | Line 646 | void SimInfo::checkCutOffs( void ){ | |
646 | ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; | |
647 | ||
648 | if( cutChanged ){ | |
625 | – | |
649 | notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); | |
650 | } | |
651 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |