| 9 |
|
|
| 10 |
|
#include "Thermo.hpp" |
| 11 |
|
#include "SRI.hpp" |
| 12 |
– |
#include "LRI.hpp" |
| 12 |
|
#include "Integrator.hpp" |
| 13 |
|
|
| 14 |
|
#define BASE_SEED 123456789 |
| 176 |
|
|
| 177 |
|
// picks random velocities from a gaussian distribution |
| 178 |
|
// centered on vbar |
| 180 |
– |
#ifndef USE_SPRNG |
| 181 |
– |
/* If we are using mpi, we need to use the SPRNG random |
| 182 |
– |
generator. The non drand48 generator will just repeat |
| 183 |
– |
the same numbers for every node creating a non-gaussian |
| 184 |
– |
distribution for the simulation. drand48 is fine for the |
| 185 |
– |
single processor version of the code, but SPRNG should |
| 186 |
– |
still be preferred for consistency. |
| 187 |
– |
*/ |
| 179 |
|
|
| 189 |
– |
#ifdef IS_MPI |
| 190 |
– |
#error "SPRNG random number generator must be used for MPI" |
| 191 |
– |
#else |
| 192 |
– |
// warning "Using drand48 for random number generation" |
| 193 |
– |
#endif // is_mpi |
| 194 |
– |
|
| 195 |
– |
x = drand48(); |
| 196 |
– |
y = drand48(); |
| 197 |
– |
vx = vbar * sqrt( -2.0 * log(x)) * cos(2 * M_PI * y); |
| 198 |
– |
|
| 199 |
– |
x = drand48(); |
| 200 |
– |
y = drand48(); |
| 201 |
– |
vy = vbar * sqrt( -2.0 * log(x)) * cos(2 * M_PI * y); |
| 202 |
– |
|
| 203 |
– |
x = drand48(); |
| 204 |
– |
y = drand48(); |
| 205 |
– |
vz = vbar * sqrt( -2.0 * log(x)) * cos(2 * M_PI * y); |
| 206 |
– |
|
| 207 |
– |
#endif // use_spring |
| 208 |
– |
|
| 209 |
– |
#ifdef USE_SPRNG |
| 180 |
|
vx = vbar * gaussStream->getGaussian(); |
| 181 |
|
vy = vbar * gaussStream->getGaussian(); |
| 182 |
|
vz = vbar * gaussStream->getGaussian(); |
| 213 |
– |
#endif // use_spring |
| 183 |
|
|
| 184 |
|
atoms[vr]->set_vx( vx ); |
| 185 |
|
atoms[vr]->set_vy( vy ); |
| 229 |
|
|
| 230 |
|
dAtom = (DirectionalAtom *)atoms[i]; |
| 231 |
|
|
| 263 |
– |
#ifndef USE_SPRNG |
| 264 |
– |
|
| 265 |
– |
#ifdef IS_MPI |
| 266 |
– |
#error "SPRNG random number generator must be used for MPI" |
| 267 |
– |
#else // is_mpi |
| 268 |
– |
//warning "Using drand48 for random number generation" |
| 269 |
– |
#endif // is_MPI |
| 270 |
– |
|
| 232 |
|
vbar = sqrt( 2.0 * kebar * dAtom->getIxx() ); |
| 272 |
– |
x = drand48(); |
| 273 |
– |
y = drand48(); |
| 274 |
– |
jx = vbar * sqrt( -2.0 * log(x)) * cos(2 * M_PI * y); |
| 275 |
– |
|
| 276 |
– |
vbar = sqrt( 2.0 * kebar * dAtom->getIyy() ); |
| 277 |
– |
x = drand48(); |
| 278 |
– |
y = drand48(); |
| 279 |
– |
jy = vbar * sqrt( -2.0 * log(x)) * cos(2 * M_PI * y); |
| 280 |
– |
|
| 281 |
– |
vbar = sqrt( 2.0 * kebar * dAtom->getIzz() ); |
| 282 |
– |
x = drand48(); |
| 283 |
– |
y = drand48(); |
| 284 |
– |
jz = vbar * sqrt( -2.0 * log(x)) * cos(2 * M_PI * y); |
| 285 |
– |
|
| 286 |
– |
#else //use_sprng |
| 287 |
– |
|
| 288 |
– |
vbar = sqrt( 2.0 * kebar * dAtom->getIxx() ); |
| 233 |
|
jx = vbar * gaussStream->getGaussian(); |
| 234 |
|
|
| 235 |
|
vbar = sqrt( 2.0 * kebar * dAtom->getIyy() ); |
| 237 |
|
|
| 238 |
|
vbar = sqrt( 2.0 * kebar * dAtom->getIzz() ); |
| 239 |
|
jz = vbar * gaussStream->getGaussian(); |
| 296 |
– |
#endif //use_sprng |
| 240 |
|
|
| 241 |
|
dAtom->setJx( jx ); |
| 242 |
|
dAtom->setJy( jy ); |