| 34 | 
  | 
  setTemp = 0; | 
| 35 | 
  | 
  thermalTime = 0.0; | 
| 36 | 
  | 
  rCut = 0.0; | 
| 37 | 
+ | 
  ecr = 0.0; | 
| 38 | 
+ | 
  est = 0.0; | 
| 39 | 
  | 
 | 
| 40 | 
  | 
  usePBC = 0; | 
| 41 | 
  | 
  useLJ = 0;  | 
| 79 | 
  | 
  for(i=0; i < 3; i++)  | 
| 80 | 
  | 
    for (j=0; j < 3; j++) Hmat[i][j] = theBox[i][j]; | 
| 81 | 
  | 
   | 
| 82 | 
< | 
  cerr  | 
| 83 | 
< | 
    << "setting Hmat ->\n" | 
| 84 | 
< | 
    << "[ " << Hmat[0][0] << ", " << Hmat[0][1] << ", " << Hmat[0][2] << " ]\n" | 
| 85 | 
< | 
    << "[ " << Hmat[1][0] << ", " << Hmat[1][1] << ", " << Hmat[1][2] << " ]\n" | 
| 86 | 
< | 
    << "[ " << Hmat[2][0] << ", " << Hmat[2][1] << ", " << Hmat[2][2] << " ]\n"; | 
| 82 | 
> | 
  //  cerr  | 
| 83 | 
> | 
  // << "setting Hmat ->\n" | 
| 84 | 
> | 
  // << "[ " << Hmat[0][0] << ", " << Hmat[0][1] << ", " << Hmat[0][2] << " ]\n" | 
| 85 | 
> | 
  // << "[ " << Hmat[1][0] << ", " << Hmat[1][1] << ", " << Hmat[1][2] << " ]\n" | 
| 86 | 
> | 
  // << "[ " << Hmat[2][0] << ", " << Hmat[2][1] << ", " << Hmat[2][2] << " ]\n"; | 
| 87 | 
  | 
 | 
| 88 | 
  | 
  calcBoxL(); | 
| 89 | 
  | 
  calcHmatInv(); | 
| 95 | 
  | 
    } | 
| 96 | 
  | 
  } | 
| 97 | 
  | 
 | 
| 98 | 
< | 
  setFortranBoxSize(FortranHmat, FortranHmatI, &orthoRhombic); | 
| 98 | 
> | 
  setFortranBoxSize(FortranHmat, FortranHmatInv, &orthoRhombic); | 
| 99 | 
  | 
  | 
| 100 | 
  | 
  smallestBoxL = boxLx; | 
| 101 | 
  | 
  if (boxLy < smallestBoxL) smallestBoxL = boxLy; | 
| 124 | 
  | 
    refreshSim(); | 
| 125 | 
  | 
  } | 
| 126 | 
  | 
 | 
| 127 | 
< | 
  if (rCut > maxCutoff) { | 
| 127 | 
> | 
  if( ecr > maxCutoff ){ | 
| 128 | 
> | 
 | 
| 129 | 
  | 
    sprintf( painCave.errMsg, | 
| 130 | 
< | 
             "New Box size is forcing cutoff radius down to %lf\n", | 
| 130 | 
> | 
             "New Box size is forcing electrostatic cutoff radius " | 
| 131 | 
> | 
             "down to %lf\n", | 
| 132 | 
  | 
             maxCutoff ); | 
| 133 | 
  | 
    painCave.isFatal = 0; | 
| 134 | 
  | 
    simError(); | 
| 135 | 
  | 
 | 
| 136 | 
< | 
    status = 0; | 
| 137 | 
< | 
    LJ_new_rcut(&rCut, &status); | 
| 138 | 
< | 
    if (status != 0) { | 
| 139 | 
< | 
      sprintf( painCave.errMsg, | 
| 136 | 
< | 
               "Error in recomputing LJ shifts based on new rcut\n"); | 
| 137 | 
< | 
      painCave.isFatal = 1; | 
| 138 | 
< | 
      simError(); | 
| 139 | 
< | 
    } | 
| 136 | 
> | 
    ecr = maxCutoff; | 
| 137 | 
> | 
    est = 0.05 * ecr; | 
| 138 | 
> | 
 | 
| 139 | 
> | 
    refreshSim(); | 
| 140 | 
  | 
  } | 
| 141 | 
+ | 
     | 
| 142 | 
  | 
} | 
| 143 | 
  | 
  | 
| 144 | 
  | 
 | 
| 154 | 
  | 
  double theBox[3][3]; | 
| 155 | 
  | 
  int i, j; | 
| 156 | 
  | 
 | 
| 157 | 
< | 
  cerr << "Scaling box by " << scale << "\n"; | 
| 157 | 
> | 
  // cerr << "Scaling box by " << scale << "\n"; | 
| 158 | 
  | 
 | 
| 159 | 
  | 
  for(i=0; i<3; i++)  | 
| 160 | 
  | 
    for (j=0; j<3; j++) theBox[i][j] = Hmat[i][j]*scale; | 
| 164 | 
  | 
} | 
| 165 | 
  | 
 | 
| 166 | 
  | 
void SimInfo::calcHmatInv( void ) { | 
| 167 | 
< | 
 | 
| 167 | 
> | 
   | 
| 168 | 
> | 
  int i,j; | 
| 169 | 
  | 
  double smallDiag; | 
| 170 | 
  | 
  double tol; | 
| 171 | 
  | 
  double sanity[3][3]; | 
| 175 | 
  | 
  // Check the inverse to make sure it is sane: | 
| 176 | 
  | 
 | 
| 177 | 
  | 
  matMul3( Hmat, HmatInv, sanity ); | 
| 176 | 
– | 
 | 
| 177 | 
– | 
  cerr << "sanity => \n"  | 
| 178 | 
– | 
       << sanity[0][0] << "\t" << sanity[0][1] << "\t" << sanity [0][2] << "\n" | 
| 179 | 
– | 
       << sanity[1][0] << "\t" << sanity[1][1] << "\t" << sanity [1][2] << "\n" | 
| 180 | 
– | 
       << sanity[2][0] << "\t" << sanity[2][1] << "\t" << sanity [2][2]  | 
| 181 | 
– | 
       << "\n"; | 
| 178 | 
  | 
     | 
| 179 | 
  | 
  // check to see if Hmat is orthorhombic | 
| 180 | 
  | 
   | 
| 266 | 
  | 
  outVec[0] = m[0][0]*a0 + m[0][1]*a1 + m[0][2]*a2; | 
| 267 | 
  | 
  outVec[1] = m[1][0]*a0 + m[1][1]*a1 + m[1][2]*a2; | 
| 268 | 
  | 
  outVec[2] = m[2][0]*a0 + m[2][1]*a1 + m[2][2]*a2; | 
| 269 | 
+ | 
} | 
| 270 | 
+ | 
 | 
| 271 | 
+ | 
void SimInfo::transposeMat3(double in[3][3], double out[3][3]) { | 
| 272 | 
+ | 
  double temp[3][3]; | 
| 273 | 
+ | 
  int i, j; | 
| 274 | 
+ | 
 | 
| 275 | 
+ | 
  for (i = 0; i < 3; i++) { | 
| 276 | 
+ | 
    for (j = 0; j < 3; j++) { | 
| 277 | 
+ | 
      temp[j][i] = in[i][j]; | 
| 278 | 
+ | 
    } | 
| 279 | 
+ | 
  } | 
| 280 | 
+ | 
  for (i = 0; i < 3; i++) { | 
| 281 | 
+ | 
    for (j = 0; j < 3; j++) { | 
| 282 | 
+ | 
      out[i][j] = temp[i][j]; | 
| 283 | 
+ | 
    } | 
| 284 | 
+ | 
  } | 
| 285 | 
  | 
} | 
| 286 | 
  | 
   | 
| 287 | 
+ | 
void SimInfo::printMat3(double A[3][3] ){ | 
| 288 | 
+ | 
 | 
| 289 | 
+ | 
  std::cerr  | 
| 290 | 
+ | 
            << "[ " << A[0][0] << ", " << A[0][1] << ", " << A[0][2] << " ]\n" | 
| 291 | 
+ | 
            << "[ " << A[1][0] << ", " << A[1][1] << ", " << A[1][2] << " ]\n" | 
| 292 | 
+ | 
            << "[ " << A[2][0] << ", " << A[2][1] << ", " << A[2][2] << " ]\n"; | 
| 293 | 
+ | 
} | 
| 294 | 
+ | 
 | 
| 295 | 
+ | 
void SimInfo::printMat9(double A[9] ){ | 
| 296 | 
+ | 
 | 
| 297 | 
+ | 
  std::cerr  | 
| 298 | 
+ | 
            << "[ " << A[0] << ", " << A[1] << ", " << A[2] << " ]\n" | 
| 299 | 
+ | 
            << "[ " << A[3] << ", " << A[4] << ", " << A[5] << " ]\n" | 
| 300 | 
+ | 
            << "[ " << A[6] << ", " << A[7] << ", " << A[8] << " ]\n"; | 
| 301 | 
+ | 
} | 
| 302 | 
+ | 
 | 
| 303 | 
  | 
void SimInfo::calcBoxL( void ){ | 
| 304 | 
  | 
 | 
| 305 | 
  | 
  double dx, dy, dz, dsq; |