| 114 |
|
} |
| 115 |
|
|
| 116 |
|
//notify fortran simulation box has changed |
| 117 |
< |
setFortranBox(fortranHmat, fortranInvHmat, &orthoRhombic_); |
| 117 |
> |
// setFortranBox(fortranHmat, fortranInvHmat, &orthoRhombic_); |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
|
| 121 |
|
void Snapshot::wrapVector(Vector3d& pos) { |
| 122 |
+ |
|
| 123 |
+ |
Vector3d scaled = scaleVector(pos); |
| 124 |
+ |
|
| 125 |
+ |
for (int i = 0; i < 3; i++) |
| 126 |
+ |
scaled[i] -= roundMe(scaled[i]); |
| 127 |
|
|
| 128 |
< |
int i; |
| 124 |
< |
Vector3d scaled; |
| 125 |
< |
|
| 126 |
< |
if( !orthoRhombic_ ){ |
| 127 |
< |
|
| 128 |
< |
// calc the scaled coordinates. |
| 129 |
< |
scaled = invHmat_* pos; |
| 130 |
< |
|
| 131 |
< |
// wrap the scaled coordinates |
| 132 |
< |
for (i = 0; i < 3; ++i) { |
| 133 |
< |
scaled[i] -= roundMe(scaled[i]); |
| 134 |
< |
} |
| 135 |
< |
|
| 136 |
< |
// calc the wrapped real coordinates from the wrapped scaled coordinates |
| 128 |
> |
if( !orthoRhombic_ ) |
| 129 |
|
pos = hmat_ * scaled; |
| 130 |
+ |
else { |
| 131 |
|
|
| 139 |
– |
} else { |
| 140 |
– |
|
| 141 |
– |
// if it is orthoRhombic, we could improve efficiency by only |
| 142 |
– |
// caculating the diagonal element |
| 143 |
– |
|
| 144 |
– |
// calc the scaled coordinates. |
| 145 |
– |
for (i=0; i<3; i++) { |
| 146 |
– |
scaled[i] = pos[i] * invHmat_(i, i); |
| 147 |
– |
} |
| 148 |
– |
|
| 149 |
– |
// wrap the scaled coordinates |
| 150 |
– |
for (i = 0; i < 3; ++i) { |
| 151 |
– |
scaled[i] -= roundMe(scaled[i]); |
| 152 |
– |
} |
| 153 |
– |
|
| 132 |
|
// calc the wrapped real coordinates from the wrapped scaled coordinates |
| 133 |
< |
for (i=0; i<3; i++) { |
| 133 |
> |
for (int i=0; i<3; i++) { |
| 134 |
|
pos[i] = scaled[i] * hmat_(i, i); |
| 135 |
|
} |
| 136 |
|
} |
| 137 |
|
} |
| 138 |
|
|
| 139 |
+ |
inline Vector3d Snapshot::scaleVector(Vector3d& pos) { |
| 140 |
+ |
|
| 141 |
+ |
Vector3d scaled; |
| 142 |
+ |
|
| 143 |
+ |
if( !orthoRhombic_ ) |
| 144 |
+ |
scaled = invHmat_* pos; |
| 145 |
+ |
else { |
| 146 |
+ |
// calc the scaled coordinates. |
| 147 |
+ |
for (int i=0; i<3; i++) |
| 148 |
+ |
scaled[i] = pos[i] * invHmat_(i, i); |
| 149 |
+ |
} |
| 150 |
+ |
|
| 151 |
+ |
return scaled; |
| 152 |
+ |
} |
| 153 |
+ |
|
| 154 |
|
Vector3d Snapshot::getCOM() { |
| 155 |
|
if( !hasCOM_ ) { |
| 156 |
|
sprintf( painCave.errMsg, "COM was requested before COM was computed!\n"); |