47 |
|
} |
48 |
|
|
49 |
|
void SimInfo::setBox(double newBox[3]) { |
50 |
< |
|
51 |
< |
double smallestBoxL, maxCutoff; |
52 |
< |
int status; |
50 |
> |
|
51 |
|
int i; |
52 |
+ |
double tempMat[9]; |
53 |
|
|
54 |
< |
for(i=0; i<9; i++) Hmat[i] = 0.0;; |
54 |
> |
for(i=0; i<9; i++) tempMat[i] = 0.0;; |
55 |
|
|
56 |
< |
Hmat[0] = newBox[0]; |
57 |
< |
Hmat[4] = newBox[1]; |
58 |
< |
Hmat[8] = newBox[2]; |
60 |
< |
|
61 |
< |
calcHmatI(); |
62 |
< |
calcBoxL(); |
63 |
< |
|
64 |
< |
setFortranBoxSize(Hmat, HmatI, &orthoRhombic); |
65 |
< |
|
66 |
< |
smallestBoxL = boxLx; |
67 |
< |
if (boxLy < smallestBoxL) smallestBoxL = boxLy; |
68 |
< |
if (boxLz < smallestBoxL) smallestBoxL = boxLz; |
69 |
< |
|
70 |
< |
maxCutoff = smallestBoxL / 2.0; |
71 |
< |
|
72 |
< |
if (rList > maxCutoff) { |
73 |
< |
sprintf( painCave.errMsg, |
74 |
< |
"New Box size is forcing neighborlist radius down to %lf\n", |
75 |
< |
maxCutoff ); |
76 |
< |
painCave.isFatal = 0; |
77 |
< |
simError(); |
78 |
< |
|
79 |
< |
rList = maxCutoff; |
80 |
< |
|
81 |
< |
sprintf( painCave.errMsg, |
82 |
< |
"New Box size is forcing cutoff radius down to %lf\n", |
83 |
< |
maxCutoff - 1.0 ); |
84 |
< |
painCave.isFatal = 0; |
85 |
< |
simError(); |
56 |
> |
tempMat[0] = newBox[0]; |
57 |
> |
tempMat[4] = newBox[1]; |
58 |
> |
tempMat[8] = newBox[2]; |
59 |
|
|
60 |
< |
rCut = rList - 1.0; |
60 |
> |
setBoxM( tempMat ); |
61 |
|
|
89 |
– |
// list radius changed so we have to refresh the simulation structure. |
90 |
– |
refreshSim(); |
91 |
– |
} |
92 |
– |
|
93 |
– |
if (rCut > maxCutoff) { |
94 |
– |
sprintf( painCave.errMsg, |
95 |
– |
"New Box size is forcing cutoff radius down to %lf\n", |
96 |
– |
maxCutoff ); |
97 |
– |
painCave.isFatal = 0; |
98 |
– |
simError(); |
99 |
– |
|
100 |
– |
status = 0; |
101 |
– |
LJ_new_rcut(&rCut, &status); |
102 |
– |
if (status != 0) { |
103 |
– |
sprintf( painCave.errMsg, |
104 |
– |
"Error in recomputing LJ shifts based on new rcut\n"); |
105 |
– |
painCave.isFatal = 1; |
106 |
– |
simError(); |
107 |
– |
} |
108 |
– |
} |
62 |
|
} |
63 |
|
|
64 |
|
void SimInfo::setBoxM( double theBox[9] ){ |
67 |
|
double smallestBoxL, maxCutoff; |
68 |
|
|
69 |
|
for(i=0; i<9; i++) Hmat[i] = theBox[i]; |
70 |
+ |
|
71 |
+ |
cerr |
72 |
+ |
<< "setting Hmat ->\n" |
73 |
+ |
<< "[ " << Hmat[0] << ", " << Hmat[3] << ", " << Hmat[6] << " ]\n" |
74 |
+ |
<< "[ " << Hmat[1] << ", " << Hmat[4] << ", " << Hmat[7] << " ]\n" |
75 |
+ |
<< "[ " << Hmat[2] << ", " << Hmat[5] << ", " << Hmat[8] << " ]\n"; |
76 |
+ |
|
77 |
|
calcHmatI(); |
78 |
|
calcBoxL(); |
79 |
+ |
|
80 |
+ |
|
81 |
|
|
82 |
|
setFortranBoxSize(Hmat, HmatI, &orthoRhombic); |
83 |
|
|
137 |
|
void SimInfo::scaleBox(double scale) { |
138 |
|
double theBox[9]; |
139 |
|
int i; |
140 |
+ |
|
141 |
+ |
cerr << "Scaling box by " << scale << "\n"; |
142 |
|
|
143 |
|
for(i=0; i<9; i++) theBox[i] = Hmat[i]*scale; |
144 |
|
|