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

Comparing trunk/OOPSE/staticProps/AllCorr.cpp (file contents):
Revision 809 by mmeineke, Fri Oct 10 17:10:22 2003 UTC vs.
Revision 810 by mmeineke, Fri Oct 17 21:19:07 2003 UTC

# Line 1 | Line 1
1   #include <stdlib.h>
2 + #include <math.h>
3   #include <vector>
4  
5 + #include "simError.h"
6   #include "AllCorr.hpp"
7  
8  
# Line 28 | Line 30 | void AllCorr::setNbins( double theNbins ){
30    haveLength = true;
31   }
32  
33 < void AllCorr::setNbins( double theNbins ){
33 > void AllCorr::setNbins( int theNbins ){
34    nBins = theNbins;
35    haveNbins = true;
36   }
# Line 88 | Line 90 | void AllCorr::setPairCorrList( vector <PairCorrList> &
90    }
91  
92  
91  theList.sort();
92  
93    nPairs = (int)theList.size();
94    pairCorrs = new PairCorrType*[nPairs];
95    
# Line 123 | Line 123 | void AllCorr::initCorrelations( char* theOutPrefix, bo
123                                  bool theHavePairCorrs,
124                                  bool theHaveStaticCorrs ){
125    int i;
126 <  atomName* theNames = new atomNames[nAtoms];
126 >  atomName* theNames = new atomName[nAtoms];
127    
128    havePairCorrs = theHavePairCorrs;
129    haveStaticCorrs = theHaveStaticCorrs;
# Line 144 | Line 144 | void AllCorr::initCorrelations( char* theOutPrefix, bo
144      }
145      
146      for(i=0;i<nPairs;i++){
147 <      pairCorrs[i]->initCoor(maxLength, theNames );
147 >      pairCorrs[i]->initCorr(maxLength, theNames );
148      }
149    }
150    
# Line 160 | Line 160 | void AllCorr::calcCorrelations(){
160  
161   void AllCorr::calcCorrelations(){
162  
163 <  SimInfor* currInfo;
163 >  SimInfo* currInfo;
164    int i,j,k,l;
165    double rij[3], rDist, uHatI[3], uHatJ[3];
166    double* grndOut = NULL;
# Line 205 | Line 205 | void AllCorr::calcCorrelations(){
205                // calc rdist and rij;
206                
207                currInfo->atoms[i]->getPos( ri );
208 <              currInfo->wrapVector( ri );
208 >                      
209 >              currInfo->atoms[j]->getPos( rj );
210                
210              currInfo->atoms[i]->getPos( rj );
211              currInfo->wrapVector( rj );            
212
211                for(l=0;l<3;l++)
212                  rij[l] = rj[l] - ri[l];
213 <              
213 >
214 >              currInfo->wrapVector( rij );
215 >
216                dSqr=0;
217                for(l=0;l<3;l++)
218 <                dSqr += rj[l] * rj[l];
218 >                dSqr += rij[l] * rij[l];
219                
220                rDist = sqrt( dSqr );
221                
222                if( currInfo->atoms[i]->isDirectional() ){
223                  
224 <                dAtom = (directionalAtom*)currInfo->atoms[i];
224 >                dAtom = (DirectionalAtom*)currInfo->atoms[i];
225                  dAtom->getU( uHatI );
226                  
227                  if( currInfo->atoms[j]->isDirectional() ){
228                    
229 <                  dAtom = (directionalAtom*)currInfo->atoms[j];
229 >                  dAtom = (DirectionalAtom*)currInfo->atoms[j];
230                    dAtom->getU( uHatJ );
231                    
232                    this->pairCorrelate( rij, rDist, uHatI, uHatJ );
# Line 238 | Line 238 | void AllCorr::calcCorrelations(){
238                }
239                else if( currInfo->atoms[j]->isDirectional() ){
240                  
241 <                dAtom = (directionalAtom*)currInfo->atoms[j];
241 >                dAtom = (DirectionalAtom*)currInfo->atoms[j];
242                  dAtom->getU( uHatJ );
243                  
244                  this->pairCorrelate( rij, rDist, grndOut, uHatJ );
# Line 296 | Line 296 | void AllCorr::pairCorrelate( double[3] Rij, double dis
296    return result;  
297   }
298  
299 < void AllCorr::pairCorrelate( double[3] Rij, double dist,
300 <                             double[3] uHatI, double[3] uHatJ ){
299 > void AllCorr::pairCorrelate( double Rij[3], double dist,
300 >                             double uHatI[3], double uHatJ[3] ){
301    
302    int i;
303    
304    for(i=0;i<nPairs;i++)
305 <    pairCorrs[i]->correlate( Rij, dist, uHatI, uHatj );
305 >    pairCorrs[i]->correlate( Rij, dist, uHatI, uHatJ );
306   }
307  
308   void AllCorr::setFrameVolume( double theVolume ){
# Line 327 | Line 327 | void AllCorr::accumulateFrame( void ){
327    
328    if( havePairCorrs ){
329      
330 <    for(i=0;i<nPair;i++)
330 >    for(i=0;i<nPairs;i++)
331        pairCorrs[i]->accumulateFrame();
332    }
333  
# Line 345 | Line 345 | void AllCorr::writeCorrs( void ){
345      if( havePairCorrs ){
346  
347        for(i=0;i<nPairs;i++)
348 <        pairCorrs[i]->writeCorrs( outPrefix );
348 >        pairCorrs[i]->writeCorr( outPrefix );
349      }
350  
351      if( haveStaticCorrs ){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines