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 803 by mmeineke, Fri Oct 10 17:10:22 2003 UTC vs.
Revision 885 by mmeineke, Fri Dec 19 15:12:23 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 104 | Line 104 | void AllCorr::setPairCorrList( vector <PairCorrList> &
104        pairCorrs[i] = new GofR(pair1, pair2, nAtoms, nBins);
105        break;
106  
107 +    case gofrTheta:
108 +      pairCorrs[i] = new GofRtheta(pair1, pair2, nAtoms, nBins);
109 +      break;
110 +
111 +    case gofrOmega:
112 +      pairCorrs[i] = new GofRomega(pair1, pair2, nAtoms, nBins);
113 +      break;
114 +
115      default:
116        
117        sprintf( painCave.errMsg,
# Line 123 | Line 131 | void AllCorr::initCorrelations( char* theOutPrefix, bo
131                                  bool theHavePairCorrs,
132                                  bool theHaveStaticCorrs ){
133    int i;
134 <  atomName* theNames = new atomNames[nAtoms];
134 >  atomName* theNames = new atomName[nAtoms];
135    
136    havePairCorrs = theHavePairCorrs;
137    haveStaticCorrs = theHaveStaticCorrs;
# Line 144 | Line 152 | void AllCorr::initCorrelations( char* theOutPrefix, bo
152      }
153      
154      for(i=0;i<nPairs;i++){
155 <      pairCorrs[i]->initCoor(maxLength, theNames );
155 >      pairCorrs[i]->initCorr(maxLength, theNames );
156      }
157    }
158    
# Line 160 | Line 168 | void AllCorr::calcCorrelations(){
168  
169   void AllCorr::calcCorrelations(){
170  
171 <  SimInfor* currInfo;
171 >  SimInfo* currInfo;
172    int i,j,k,l;
173    double rij[3], rDist, uHatI[3], uHatJ[3];
174    double* grndOut = NULL;
# Line 205 | Line 213 | void AllCorr::calcCorrelations(){
213                // calc rdist and rij;
214                
215                currInfo->atoms[i]->getPos( ri );
216 <              currInfo->wrapVector( ri );
217 <              
218 <              currInfo->atoms[i]->getPos( rj );
211 <              currInfo->wrapVector( rj );            
212 <
216 >                      
217 >              currInfo->atoms[j]->getPos( rj );
218 >              
219                for(l=0;l<3;l++)
220                  rij[l] = rj[l] - ri[l];
221 <              
221 >
222 >              currInfo->wrapVector( rij );
223 >
224                dSqr=0;
225                for(l=0;l<3;l++)
226 <                dSqr += rj[l] * rj[l];
226 >                dSqr += rij[l] * rij[l];
227                
228                rDist = sqrt( dSqr );
229                
230                if( currInfo->atoms[i]->isDirectional() ){
231                  
232 <                dAtom = (directionalAtom*)currInfo->atoms[i];
232 >                dAtom = (DirectionalAtom*)currInfo->atoms[i];
233                  dAtom->getU( uHatI );
234                  
235                  if( currInfo->atoms[j]->isDirectional() ){
236                    
237 <                  dAtom = (directionalAtom*)currInfo->atoms[j];
237 >                  dAtom = (DirectionalAtom*)currInfo->atoms[j];
238                    dAtom->getU( uHatJ );
239                    
240                    this->pairCorrelate( rij, rDist, uHatI, uHatJ );
# Line 238 | Line 246 | void AllCorr::calcCorrelations(){
246                }
247                else if( currInfo->atoms[j]->isDirectional() ){
248                  
249 <                dAtom = (directionalAtom*)currInfo->atoms[j];
249 >                dAtom = (DirectionalAtom*)currInfo->atoms[j];
250                  dAtom->getU( uHatJ );
251                  
252                  this->pairCorrelate( rij, rDist, grndOut, uHatJ );
# Line 296 | Line 304 | void AllCorr::pairCorrelate( double[3] Rij, double dis
304    return result;  
305   }
306  
307 < void AllCorr::pairCorrelate( double[3] Rij, double dist,
308 <                             double[3] uHatI, double[3] uHatJ ){
307 > void AllCorr::pairCorrelate( double Rij[3], double dist,
308 >                             double uHatI[3], double uHatJ[3] ){
309    
310    int i;
311    
312    for(i=0;i<nPairs;i++)
313 <    pairCorrs[i]->correlate( Rij, dist, uHatI, uHatj );
313 >    pairCorrs[i]->correlate( Rij, dist, uHatI, uHatJ );
314   }
315  
316   void AllCorr::setFrameVolume( double theVolume ){
# Line 327 | Line 335 | void AllCorr::accumulateFrame( void ){
335    
336    if( havePairCorrs ){
337      
338 <    for(i=0;i<nPair;i++)
338 >    for(i=0;i<nPairs;i++)
339        pairCorrs[i]->accumulateFrame();
340    }
341  
# Line 345 | Line 353 | void AllCorr::writeCorrs( void ){
353      if( havePairCorrs ){
354  
355        for(i=0;i<nPairs;i++)
356 <        pairCorrs[i]->writeCorrs( outPrefix );
356 >        pairCorrs[i]->writeCorr( outPrefix );
357      }
358  
359      if( haveStaticCorrs ){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines