| 1 |
|
#include <cmath> |
| 2 |
|
#include <iostream> |
| 3 |
+ |
using namespace std; |
| 4 |
|
|
| 4 |
– |
|
| 5 |
|
#ifdef IS_MPI |
| 6 |
+ |
#include <mpi.h> |
| 7 |
|
#include <mpi++.h> |
| 8 |
|
#endif //is_mpi |
| 9 |
|
|
| 17 |
|
Thermo::Thermo( SimInfo* the_entry_plug ) { |
| 18 |
|
entry_plug = the_entry_plug; |
| 19 |
|
int baseSeed = BASE_SEED; |
| 20 |
+ |
|
| 21 |
+ |
cerr << "creating thermo stream\n"; |
| 22 |
|
gaussStream = new gaussianSPRNG( baseSeed ); |
| 23 |
+ |
cerr << "created thermo stream\n"; |
| 24 |
|
} |
| 25 |
|
|
| 26 |
|
Thermo::~Thermo(){ |
| 69 |
|
} |
| 70 |
|
} |
| 71 |
|
#ifdef IS_MPI |
| 72 |
< |
MPI_COMM_WORLD.Allreduce(&kinetic,&kinetic_global,1,MPI_DOUBLE,MPI_SUM); |
| 72 |
> |
MPI::COMM_WORLD.Allreduce(&kinetic,&kinetic_global,1,MPI_DOUBLE,MPI_SUM); |
| 73 |
|
kinetic = kinetic_global; |
| 74 |
|
#endif //is_mpi |
| 75 |
|
|
| 100 |
|
|
| 101 |
|
// Get total potential for entire system from MPI. |
| 102 |
|
#ifdef IS_MPI |
| 103 |
< |
MPI_COMM_WORLD.Allreduce(&potential,&potential_global,1,MPI_DOUBLE,MPI_SUM); |
| 103 |
> |
MPI::COMM_WORLD.Allreduce(&potential,&potential_global,1,MPI_DOUBLE,MPI_SUM); |
| 104 |
|
potential = potential_global; |
| 105 |
|
#endif // is_mpi |
| 106 |
|
|
| 168 |
|
ndf = ndfRaw - n_constraints - 3; |
| 169 |
|
kebar = kb * temperature * (double)ndf / ( 2.0 * (double)ndfRaw ); |
| 170 |
|
|
| 167 |
– |
printf("Entered Velocitize\n"); |
| 171 |
|
for(vr = 0; vr < n_atoms; vr++){ |
| 172 |
|
|
| 173 |
|
// uses equipartition theory to solve for vbar in angstrom/fs |
| 191 |
|
#ifdef IS_MPI |
| 192 |
|
#error "SPRNG random number generator must be used for MPI" |
| 193 |
|
#else |
| 194 |
< |
#warning "Using drand48 for random number generation" |
| 194 |
> |
// warning "Using drand48 for random number generation" |
| 195 |
|
#endif // is_mpi |
| 196 |
|
|
| 197 |
|
x = drand48(); |
| 205 |
|
x = drand48(); |
| 206 |
|
y = drand48(); |
| 207 |
|
vz = vbar * sqrt( -2.0 * log(x)) * cos(2 * M_PI * y); |
| 208 |
< |
printf("Setting new velocities vx: %f\n",vx); |
| 208 |
> |
|
| 209 |
|
#endif // use_spring |
| 210 |
|
|
| 211 |
|
#ifdef USE_SPRNG |
| 267 |
|
#ifdef IS_MPI |
| 268 |
|
#error "SPRNG random number generator must be used for MPI" |
| 269 |
|
#else // is_mpi |
| 270 |
< |
#warning "Using drand48 for random number generation" |
| 270 |
> |
//warning "Using drand48 for random number generation" |
| 271 |
|
#endif // is_MPI |
| 272 |
|
|
| 273 |
|
vbar = sqrt( 2.0 * kebar * dAtom->getIxx() ); |