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

Comparing branches/new-templateless/OOPSE/libmdtools/NPTf.cpp (file contents):
Revision 849 by mmeineke, Fri Oct 31 21:06:47 2003 UTC vs.
Revision 850 by mmeineke, Mon Nov 3 22:07:17 2003 UTC

# Line 1 | Line 1
1 + #include <stdlib.h>
2   #include <math.h>
3 +
4   #include "Atom.hpp"
5   #include "SRI.hpp"
6   #include "AbstractClasses.hpp"
# Line 24 | Line 26 | NPTf::NPTf ( SimInfo *theInfo, ForceFields* the_ff):
26   //    Hoover, W. G., 1986, Phys. Rev. A, 34, 2499.
27  
28   NPTf::NPTf ( SimInfo *theInfo, ForceFields* the_ff):
29 <  Integrator( theInfo, the_ff )
29 >  NPT( theInfo, the_ff )
30   {
31    GenericData* data;
32 <  DoubleArrayData * etaValue;
31 <  vector<double> etaArray;
32 >  double *etaArray;
33    int i,j;
34  
35    for(i = 0; i < 3; i++){
# Line 39 | Line 40 | NPTf::NPTf ( SimInfo *theInfo, ForceFields* the_ff):
40      }
41    }
42  
43 <    // retrieve eta array from simInfo if it exists
44 <    data = info->getProperty(ETAVALUE_ID);
45 <    if(data){
46 <      etaValue = dynamic_cast<DoubleArrayData*>(data);
47 <
48 <      if(etaValue){
49 <        etaArray = etaValue->getData();
50 <
51 <        for(i = 0; i < 3; i++){
52 <          for (j = 0; j < 3; j++){
53 <            eta[i][j] = etaArray[3*i+j];
54 <            oldEta[i][j] = eta[i][j];
55 <          }
56 <        }
57 <
57 <      }
43 >  // retrieve eta array from simInfo if it exists
44 >  data = info->getProperty(ETAVALUE_ID);
45 >  if(data != NULL){
46 >    
47 >    int test = data->getDarray(etaArray);
48 >    
49 >    if( test == 9 ){
50 >      
51 >      for(i = 0; i < 3; i++){
52 >        for (j = 0; j < 3; j++){
53 >          eta[i][j] = etaArray[3*i+j];
54 >          oldEta[i][j] = eta[i][j];
55 >        }
56 >      }    
57 >      delete[] etaArray;
58      }
59 <
59 >    else
60 >      std::cerr << "NPTf error: etaArray is not length 9 (actual = " << test
61 >                << ").\n"
62 >                << "            Simulation wil proceed with eta = 0;\n";
63 >  }
64   }
65  
66   NPTf::~NPTf() {
# Line 72 | Line 76 | void NPTf::resetIntegrator() {
76      for (j = 0; j < 3; j++)
77        eta[i][j] = 0.0;
78  
79 <  Integrator::resetIntegrator();
79 >  NPT::resetIntegrator();
80   }
81  
82   void NPTf::evolveEtaA() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines