ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/md_code/Thermo.cpp
(Generate patch)

Comparing trunk/mdtools/md_code/Thermo.cpp (file contents):
Revision 252 by chuckv, Tue Jan 28 22:16:55 2003 UTC vs.
Revision 264 by chuckv, Tue Feb 4 20:16:08 2003 UTC

# Line 1 | Line 1
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  
# Line 16 | Line 17 | Thermo::Thermo( SimInfo* the_entry_plug ) {
17   Thermo::Thermo( SimInfo* the_entry_plug ) {
18    entry_plug = the_entry_plug;
19    int baseSeed = BASE_SEED;
20 +  
21    gaussStream = new gaussianSPRNG( baseSeed );
22   }
23  
# Line 65 | Line 67 | double Thermo::getKinetic(){
67      }
68    }
69   #ifdef IS_MPI
70 <  MPI_COMM_WORLD.Allreduce(&kinetic,&kinetic_global,1,MPI_DOUBLE,MPI_SUM);
70 >  MPI::COMM_WORLD.Allreduce(&kinetic,&kinetic_global,1,MPI_DOUBLE,MPI_SUM);
71    kinetic = kinetic_global;
72   #endif //is_mpi
73  
# Line 96 | Line 98 | double Thermo::getPotential(){
98  
99    // Get total potential for entire system from MPI.
100   #ifdef IS_MPI
101 <  MPI_COMM_WORLD.Allreduce(&potential,&potential_global,1,MPI_DOUBLE,MPI_SUM);
101 >  MPI::COMM_WORLD.Allreduce(&potential,&potential_global,1,MPI_DOUBLE,MPI_SUM);
102    potential = potential_global;
103 +
104   #endif // is_mpi
105  
106    return potential;
# Line 164 | Line 167 | void Thermo::velocitize() {
167    ndf = ndfRaw - n_constraints - 3;
168    kebar = kb * temperature * (double)ndf / ( 2.0 * (double)ndfRaw );
169    
167  printf("Entered Velocitize\n");
170    for(vr = 0; vr < n_atoms; vr++){
171      
172      // uses equipartition theory to solve for vbar in angstrom/fs
# Line 188 | Line 190 | void Thermo::velocitize() {
190   #ifdef IS_MPI
191   #error "SPRNG random number generator must be used for MPI"
192   #else
193 < #warning "Using drand48 for random number generation"
193 >    // warning "Using drand48 for random number generation"
194   #endif  // is_mpi
195  
196      x = drand48();
# Line 202 | Line 204 | void Thermo::velocitize() {
204      x = drand48();
205      y = drand48();
206      vz = vbar * sqrt( -2.0 * log(x)) * cos(2 * M_PI * y);
207 <    printf("Setting new velocities vx: %f\n",vx);
207 >
208   #endif // use_spring
209  
210   #ifdef USE_SPRNG
# Line 264 | Line 266 | void Thermo::velocitize() {
266   #ifdef IS_MPI
267   #error "SPRNG random number generator must be used for MPI"
268   #else  // is_mpi
269 < #warning "Using drand48 for random number generation"
269 >        //warning "Using drand48 for random number generation"
270   #endif   // is_MPI
271          
272          vbar = sqrt( 2.0 * kebar * dAtom->getIxx() );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines