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

Comparing trunk/OOPSE/libmdtools/Thermo.cpp (file contents):
Revision 608 by gezelter, Tue Jul 15 14:45:09 2003 UTC vs.
Revision 708 by tim, Wed Aug 20 22:23:34 2003 UTC

# Line 16 | Line 16 | using namespace std;
16   #include "mpiSimulation.hpp"
17   #endif // is_mpi
18  
19 <
20 < #define BASE_SEED 123456789
21 <
22 < Thermo::Thermo( SimInfo* the_entry_plug ) {
23 <  entry_plug = the_entry_plug;
24 <  int baseSeed = BASE_SEED;
19 > Thermo::Thermo( SimInfo* the_info ) {
20 >  info = the_info;
21 >  int baseSeed = the_info->getSeed();
22    
23    gaussStream = new gaussianSPRNG( baseSeed );
24   }
# Line 45 | Line 42 | double Thermo::getKinetic(){
42    Atom** atoms;
43  
44    
45 <  n_atoms = entry_plug->n_atoms;
46 <  atoms = entry_plug->atoms;
45 >  n_atoms = info->n_atoms;
46 >  atoms = info->atoms;
47  
48    kinetic = 0.0;
49    kinetic_global = 0.0;
# Line 88 | Line 85 | double Thermo::getPotential(){
85    int el, nSRI;
86    Molecule* molecules;
87  
88 <  molecules = entry_plug->molecules;
89 <  nSRI = entry_plug->n_SRI;
88 >  molecules = info->molecules;
89 >  nSRI = info->n_SRI;
90  
91    potential_local = 0.0;
92    potential = 0.0;
93 <  potential_local += entry_plug->lrPot;
93 >  potential_local += info->lrPot;
94  
95 <  for( el=0; el<entry_plug->n_mol; el++ ){    
95 >  for( el=0; el<info->n_mol; el++ ){    
96      potential_local += molecules[el].getPotential();
97    }
98  
# Line 129 | Line 126 | double Thermo::getTemperature(){
126    const double kb = 1.9872179E-3; // boltzman's constant in kcal/(mol K)
127    double temperature;
128    
129 <  temperature = ( 2.0 * this->getKinetic() ) / ((double)entry_plug->ndf * kb );
129 >  temperature = ( 2.0 * this->getKinetic() ) / ((double)info->ndf * kb );
130    return temperature;
131   }
132  
# Line 151 | Line 148 | double Thermo::getVolume() {
148  
149   double Thermo::getVolume() {
150  
151 <  return entry_plug->boxVol;
151 >  return info->boxVol;
152   }
153  
154   double Thermo::getPressure() {
# Line 180 | Line 177 | void Thermo::getPressureTensor(double press[3][3]){
177    double molmass, volume;
178    double vcom[3];
179    double p_local[9], p_global[9];
180 <  int i, j, k, l, nMols;
180 >  int i, j, k, nMols;
181    Molecule* molecules;
182  
183 <  nMols = entry_plug->n_mol;
184 <  molecules = entry_plug->molecules;
185 <  //tau = entry_plug->tau;
183 >  nMols = info->n_mol;
184 >  molecules = info->molecules;
185 >  //tau = info->tau;
186  
187    // use velocities of molecular centers of mass and molecular masses:
188    for (i=0; i < 9; i++) {    
# Line 217 | Line 214 | void Thermo::getPressureTensor(double press[3][3]){
214    }
215   #endif // is_mpi
216  
217 <  volume = entry_plug->boxVol;
217 >  volume = this->getVolume();
218  
219    for(i = 0; i < 3; i++) {
220      for (j = 0; j < 3; j++) {
221        k = 3*i + j;
222 <      l = 3*j + i;
223 <      press[i][j] = (p_global[k] - entry_plug->tau[l]*e_convert) / volume;
222 >      press[i][j] = (p_global[k] + info->tau[k]*e_convert) / volume;
223 >
224      }
225    }
226   }
# Line 245 | Line 242 | void Thermo::velocitize() {
242    int n_oriented;
243    int n_constraints;
244  
245 <  atoms         = entry_plug->atoms;
246 <  n_atoms       = entry_plug->n_atoms;
247 <  temperature   = entry_plug->target_temp;
248 <  n_oriented    = entry_plug->n_oriented;
249 <  n_constraints = entry_plug->n_constraints;
245 >  atoms         = info->atoms;
246 >  n_atoms       = info->n_atoms;
247 >  temperature   = info->target_temp;
248 >  n_oriented    = info->n_oriented;
249 >  n_constraints = info->n_constraints;
250    
251 <  kebar = kb * temperature * (double)entry_plug->ndf /
252 <    ( 2.0 * (double)entry_plug->ndfRaw );
251 >  kebar = kb * temperature * (double)info->ndf /
252 >    ( 2.0 * (double)info->ndfRaw );
253    
254    for(vr = 0; vr < n_atoms; vr++){
255      
# Line 323 | Line 320 | void Thermo::getCOMVel(double vdrift[3]){
320    // We are very careless here with the distinction between n_atoms and n_local
321    // We should really fix this before someone pokes an eye out.
322  
323 <  n_atoms = entry_plug->n_atoms;  
324 <  atoms   = entry_plug->atoms;
323 >  n_atoms = info->n_atoms;  
324 >  atoms   = info->atoms;
325  
326    mtot_local = 0.0;
327    vdrift_local[0] = 0.0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines