ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new-templateless/OOPSE/libmdtools/NPTxyz.cpp
(Generate patch)

Comparing branches/new-templateless/OOPSE/libmdtools/NPTxyz.cpp (file contents):
Revision 848, Fri Oct 31 18:28:53 2003 UTC vs.
Revision 851 by mmeineke, Wed Nov 5 19:18:17 2003 UTC

# Line 23 | Line 23
23   //
24   //    Hoover, W. G., 1986, Phys. Rev. A, 34, 2499.
25  
26 < template<typename T> NPTxyz<T>::NPTxyz ( SimInfo *theInfo, ForceFields* the_ff):
27 <  T( theInfo, the_ff )
26 > NPTxyz::NPTxyz ( SimInfo *theInfo, ForceFields* the_ff):
27 >  NPT( theInfo, the_ff )
28   {
29    GenericData* data;
30 <  DoubleArrayData * etaValue;
31 <  vector<double> etaArray;
30 >  double *etaArray;
31    int i,j;
32  
33    for(i = 0; i < 3; i++){
# Line 41 | Line 40 | template<typename T> NPTxyz<T>::NPTxyz ( SimInfo *theI
40  
41    // retrieve eta array from simInfo if it exists
42    data = info->getProperty(ETAVALUE_ID);
43 <  if(data){
44 <    etaValue = dynamic_cast<DoubleArrayData*>(data);
45 <
46 <    if(etaValue){
47 <      etaArray = etaValue->getData();
48 <
43 >  if(data != NULL){
44 >    
45 >    int test = data->getDarray(etaArray);
46 >    
47 >    if( test == 9 ){
48 >      
49        for(i = 0; i < 3; i++){
50 <        for (j = 0; j < 3; j++){
51 <          eta[i][j] = etaArray[3*i+j];
52 <          oldEta[i][j] = eta[i][j];
53 <        }
54 <      }
50 >        for (j = 0; j < 3; j++){
51 >          eta[i][j] = etaArray[3*i+j];
52 >          oldEta[i][j] = eta[i][j];
53 >        }
54 >      }    
55 >      delete[] etaArray;
56      }
57 +    else
58 +      std::cerr << "NPTxyz error: etaArray is not length 9 (actual = " << test
59 +                << ").\n"
60 +                << "            Simulation wil proceed with eta = 0;\n";
61    }
58
62   }
63  
64 < template<typename T> NPTxyz<T>::~NPTxyz() {
64 > NPTxyz::~NPTxyz() {
65  
66    // empty for now
67   }
68  
69 < template<typename T> void NPTxyz<T>::resetIntegrator() {
69 > void NPTxyz::resetIntegrator() {
70  
71    int i, j;
72  
# Line 71 | Line 74 | template<typename T> void NPTxyz<T>::resetIntegrator()
74      for (j = 0; j < 3; j++)
75        eta[i][j] = 0.0;
76  
77 <  T::resetIntegrator();
77 >  NPT::resetIntegrator();
78   }
79  
80 < template<typename T> void NPTxyz<T>::evolveEtaA() {
80 > void NPTxyz::evolveEtaA() {
81  
82    int i, j;
83  
# Line 93 | Line 96 | template<typename T> void NPTxyz<T>::evolveEtaA() {
96        oldEta[i][j] = eta[i][j];
97   }
98  
99 < template<typename T> void NPTxyz<T>::evolveEtaB() {
99 > void NPTxyz::evolveEtaB() {
100  
101    int i,j;
102  
# Line 113 | Line 116 | template<typename T> void NPTxyz<T>::evolveEtaB() {
116    }
117   }
118  
119 < template<typename T> void NPTxyz<T>::getVelScaleA(double sc[3], double vel[3]) {
119 > void NPTxyz::getVelScaleA(double sc[3], double vel[3]) {
120    int i,j;
121    double vScale[3][3];
122  
# Line 130 | Line 133 | template<typename T> void NPTxyz<T>::getVelScaleA(doub
133    info->matVecMul3( vScale, vel, sc );
134   }
135  
136 < template<typename T> void NPTxyz<T>::getVelScaleB(double sc[3], int index ){
136 > void NPTxyz::getVelScaleB(double sc[3], int index ){
137    int i,j;
138    double myVel[3];
139    double vScale[3][3];
# Line 151 | Line 154 | template<typename T> void NPTxyz<T>::getVelScaleB(doub
154    info->matVecMul3( vScale, myVel, sc );
155   }
156  
157 < template<typename T> void NPTxyz<T>::getPosScale(double pos[3], double COM[3],
157 > void NPTxyz::getPosScale(double pos[3], double COM[3],
158                                                 int index, double sc[3]){
159    int j;
160    double rj[3];
# Line 162 | Line 165 | template<typename T> void NPTxyz<T>::getPosScale(doubl
165    info->matVecMul3( eta, rj, sc );
166   }
167  
168 < template<typename T> void NPTxyz<T>::scaleSimBox( void ){
168 > void NPTxyz::scaleSimBox( void ){
169  
170    int i,j,k;
171    double scaleMat[3][3];
# Line 245 | Line 248 | template<typename T> void NPTxyz<T>::scaleSimBox( void
248    }
249   }
250  
251 < template<typename T> bool NPTxyz<T>::etaConverged() {
251 > bool NPTxyz::etaConverged() {
252    int i;
253    double diffEta, sumEta;
254  
# Line 258 | Line 261 | template<typename T> bool NPTxyz<T>::etaConverged() {
261    return ( diffEta <= etaTolerance );
262   }
263  
264 < template<typename T> double NPTxyz<T>::getConservedQuantity(void){
264 > double NPTxyz::getConservedQuantity(void){
265  
266    double conservedQuantity;
267    double totalEnergy;
# Line 300 | Line 303 | template<typename T> double NPTxyz<T>::getConservedQua
303  
304   }
305  
306 < template<typename T> string NPTxyz<T>::getAdditionalParameters(void){
304 <  string parameters;
305 <  const int BUFFERSIZE = 2000; // size of the read buffer
306 <  char buffer[BUFFERSIZE];
306 > char* NPTxyz::getAdditionalParameters(void){
307  
308 <  sprintf(buffer,"\t%lf\t%lf;", chi, integralOfChidt);
309 <  parameters += buffer;
308 >  sprintf(addParamBuffer,
309 >          "\t%G\t%G;"
310 >          "\t%G\t%G\t%G;"
311 >          "\t%G\t%G\t%G;"
312 >          "\t%G\t%G\t%G;",
313 >          chi, integralOfChidt,
314 >          eta[0][0], eta[0][1], eta[0][2],
315 >          eta[1][0], eta[1][1], eta[1][2],
316 >          eta[2][0], eta[2][1], eta[2][2]
317 >          );
318  
319 <  for(int i = 0; i < 3; i++){
312 <    sprintf(buffer,"\t%lf\t%lf\t%lf;", eta[3*i], eta[3*i+1], eta[3*i+2]);
313 <    parameters += buffer;
314 <  }
315 <
316 <  return parameters;
317 <
319 >  return addParamBuffer;
320   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines