| 24 |
|
// The NPTim variant scales the molecular center-of-mass coordinates |
| 25 |
|
// instead of the atomic coordinates |
| 26 |
|
|
| 27 |
< |
NPTim::NPTim ( SimInfo *theInfo, ForceFields* the_ff): |
| 28 |
< |
Integrator( theInfo, the_ff ) |
| 27 |
> |
template<typename T> NPTim<T>::NPTim ( SimInfo *theInfo, ForceFields* the_ff): |
| 28 |
> |
T( theInfo, the_ff ) |
| 29 |
|
{ |
| 30 |
|
chi = 0.0; |
| 31 |
|
eta = 0.0; |
| 35 |
|
have_target_pressure = 0; |
| 36 |
|
} |
| 37 |
|
|
| 38 |
< |
void NPTim::moveA() { |
| 38 |
> |
template<typename T> void NPTim<T>::moveA() { |
| 39 |
|
|
| 40 |
|
int i, j, k; |
| 41 |
|
DirectionalAtom* dAtom; |
| 46 |
|
|
| 47 |
|
double rj[3]; |
| 48 |
|
double instaTemp, instaPress, instaVol; |
| 49 |
< |
double tt2, tb2; |
| 49 |
> |
double tt2, tb2, scaleFactor; |
| 50 |
|
|
| 51 |
|
int nInMol; |
| 52 |
|
double rc[3]; |
| 146 |
|
} |
| 147 |
|
} |
| 148 |
|
} |
| 149 |
+ |
|
| 150 |
|
// Scale the box after all the positions have been moved: |
| 151 |
|
|
| 152 |
< |
cerr << "eta = " << eta |
| 153 |
< |
<< "; exp(dt*eta) = " << exp(eta*dt) << "\n"; |
| 154 |
< |
|
| 155 |
< |
info->scaleBox(exp(dt*eta)); |
| 152 |
> |
scaleFactor = exp(dt*eta); |
| 153 |
> |
|
| 154 |
> |
if (scaleFactor > 1.1 || scaleFactor < 0.9) { |
| 155 |
> |
sprintf( painCave.errMsg, |
| 156 |
> |
"NPTi error: Attempting a Box scaling of more than 10 percent" |
| 157 |
> |
" check your tauBarostat, as it is probably too small!\n" |
| 158 |
> |
" eta = %lf, scaleFactor = %lf\n", eta, scaleFactor |
| 159 |
> |
); |
| 160 |
> |
painCave.isFatal = 1; |
| 161 |
> |
simError(); |
| 162 |
> |
} else { |
| 163 |
> |
info->scaleBox(exp(dt*eta)); |
| 164 |
> |
} |
| 165 |
|
} |
| 166 |
|
|
| 167 |
< |
void NPTim::moveB( void ){ |
| 167 |
> |
template<typename T> void NPTim<T>::moveB( void ){ |
| 168 |
|
int i, j; |
| 169 |
|
DirectionalAtom* dAtom; |
| 170 |
|
double Tb[3], ji[3]; |
| 219 |
|
} |
| 220 |
|
} |
| 221 |
|
|
| 222 |
< |
int NPTim::readyCheck() { |
| 222 |
> |
template<typename T> int NPTim<T>::readyCheck() { |
| 223 |
> |
|
| 224 |
> |
//check parent's readyCheck() first |
| 225 |
> |
if (T::readyCheck() == -1) |
| 226 |
> |
return -1; |
| 227 |
|
|
| 228 |
|
// First check to see if we have a target temperature. |
| 229 |
|
// Not having one is fatal. |