| 35 |
|
} |
| 36 |
|
|
| 37 |
|
void SimInfo::setBox(double newBox[3]) { |
| 38 |
+ |
double smallestBox, maxCutoff; |
| 39 |
+ |
int status; |
| 40 |
|
box_x = newBox[0]; |
| 41 |
|
box_y = newBox[1]; |
| 42 |
|
box_z = newBox[2]; |
| 43 |
|
setFortranBoxSize(newBox); |
| 44 |
+ |
|
| 45 |
+ |
smallestBox = box_x; |
| 46 |
+ |
if (box_y < smallestBox) smallestBox = box_y; |
| 47 |
+ |
if (box_z < smallestBox) smallestBox = box_z; |
| 48 |
+ |
|
| 49 |
+ |
maxCutoff = smallestBox / 2.0; |
| 50 |
+ |
|
| 51 |
+ |
if (rList > maxCutoff) { |
| 52 |
+ |
sprintf( painCave.errMsg, |
| 53 |
+ |
"New Box size is forcing neighborlist radius down to %lf\n", |
| 54 |
+ |
maxCutoff ); |
| 55 |
+ |
painCave.isFatal = 0; |
| 56 |
+ |
simError(); |
| 57 |
+ |
|
| 58 |
+ |
rList = maxCutoff; |
| 59 |
+ |
|
| 60 |
+ |
sprintf( painCave.errMsg, |
| 61 |
+ |
"New Box size is forcing cutoff radius down to %lf\n", |
| 62 |
+ |
maxCutoff - 1.0 ); |
| 63 |
+ |
painCave.isFatal = 0; |
| 64 |
+ |
simError(); |
| 65 |
+ |
|
| 66 |
+ |
rCut = rList - 1.0; |
| 67 |
+ |
|
| 68 |
+ |
// list radius changed so we have to refresh the simulation structure. |
| 69 |
+ |
refreshSim(); |
| 70 |
+ |
} |
| 71 |
+ |
|
| 72 |
+ |
if (rCut > maxCutoff) { |
| 73 |
+ |
sprintf( painCave.errMsg, |
| 74 |
+ |
"New Box size is forcing cutoff radius down to %lf\n", |
| 75 |
+ |
maxCutoff ); |
| 76 |
+ |
painCave.isFatal = 0; |
| 77 |
+ |
simError(); |
| 78 |
+ |
|
| 79 |
+ |
status = 0; |
| 80 |
+ |
LJ_new_rcut(&rCut, &status); |
| 81 |
+ |
if (status != 0) { |
| 82 |
+ |
sprintf( painCave.errMsg, |
| 83 |
+ |
"Error in recomputing LJ shifts based on new rcut\n"); |
| 84 |
+ |
painCave.isFatal = 1; |
| 85 |
+ |
simError(); |
| 86 |
+ |
} |
| 87 |
+ |
} |
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
void SimInfo::getBox(double theBox[3]) { |