ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/integrators/NPTxyz.cpp
(Generate patch)

Comparing trunk/OOPSE-3.0/src/integrators/NPTxyz.cpp (file contents):
Revision 2203 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# Line 60 | Line 60 | double NPTxyz::calcConservedQuantity(){
60   namespace oopse {
61  
62      
63 < double NPTxyz::calcConservedQuantity(){
63 >  double NPTxyz::calcConservedQuantity(){
64  
65      // We need NkBT a lot, so just set it here: This is the RAW number
66      // of integrableObjects, so no subtraction or addition of constraints or
# Line 94 | Line 94 | double NPTxyz::calcConservedQuantity(){
94      barostat_potential = (targetPressure * thermo.getVolume() / OOPSEConstant::pressureConvert) /OOPSEConstant::energyConvert;
95  
96      conservedQuantity = totalEnergy + thermostat_kinetic + thermostat_potential +
97 <        barostat_kinetic + barostat_potential;
97 >      barostat_kinetic + barostat_potential;
98  
99  
100      return conservedQuantity;
101  
102 < }
102 >  }
103  
104      
105 < void NPTxyz::scaleSimBox(){
105 >  void NPTxyz::scaleSimBox(){
106  
107      int i,j,k;
108      Mat3x3d scaleMat;
# Line 113 | Line 113 | void NPTxyz::scaleSimBox(){
113  
114  
115  
116 <  // Scale the box after all the positions have been moved:
116 >    // Scale the box after all the positions have been moved:
117  
118 <  // Use a taylor expansion for eta products:  Hmat = Hmat . exp(dt * etaMat)
119 <  //  Hmat = Hmat . ( Ident + dt * etaMat  + dt^2 * etaMat*etaMat / 2)
118 >    // Use a taylor expansion for eta products:  Hmat = Hmat . exp(dt * etaMat)
119 >    //  Hmat = Hmat . ( Ident + dt * etaMat  + dt^2 * etaMat*etaMat / 2)
120  
121      bigScale = 1.0;
122      smallScale = 1.0;
123      offDiagMax = 0.0;
124  
125      for(i=0; i<3; i++){
126 <        for(j=0; j<3; j++){
127 <            scaleMat(i, j) = 0.0;
128 <            if(i==j) {
129 <                scaleMat(i, j) = 1.0;
130 <            }
131 <        }
126 >      for(j=0; j<3; j++){
127 >        scaleMat(i, j) = 0.0;
128 >        if(i==j) {
129 >          scaleMat(i, j) = 1.0;
130 >        }
131 >      }
132      }
133  
134      for(i=0;i<3;i++){
135  
136 <    // calculate the scaleFactors
136 >      // calculate the scaleFactors
137  
138 <        scaleFactor = exp(dt*eta(i, i));
138 >      scaleFactor = exp(dt*eta(i, i));
139  
140 <        scaleMat(i, i) = scaleFactor;
140 >      scaleMat(i, i) = scaleFactor;
141  
142 <        if (scaleMat(i, i) > bigScale) {
143 <            bigScale = scaleMat(i, i);
144 <        }
142 >      if (scaleMat(i, i) > bigScale) {
143 >        bigScale = scaleMat(i, i);
144 >      }
145          
146 <        if (scaleMat(i, i) < smallScale) {
147 <            smallScale = scaleMat(i, i);
148 <        }
146 >      if (scaleMat(i, i) < smallScale) {
147 >        smallScale = scaleMat(i, i);
148 >      }
149      }
150  
151      if ((bigScale > 1.1) || (smallScale < 0.9)) {
152 <        sprintf( painCave.errMsg,
153 <            "NPTxyz error: Attempting a Box scaling of more than 10 percent.\n"
154 <            " Check your tauBarostat, as it is probably too small!\n\n"
155 <            " scaleMat = [%lf\t%lf\t%lf]\n"
156 <            "            [%lf\t%lf\t%lf]\n"
157 <            "            [%lf\t%lf\t%lf]\n",
158 <        scaleMat(0, 0),scaleMat(0, 1),scaleMat(0, 2),
159 <        scaleMat(1, 0),scaleMat(1, 1),scaleMat(1, 2),
160 <        scaleMat(2, 0),scaleMat(2, 1),scaleMat(2, 2));
161 <        painCave.isFatal = 1;
162 <        simError();
152 >      sprintf( painCave.errMsg,
153 >               "NPTxyz error: Attempting a Box scaling of more than 10 percent.\n"
154 >               " Check your tauBarostat, as it is probably too small!\n\n"
155 >               " scaleMat = [%lf\t%lf\t%lf]\n"
156 >               "            [%lf\t%lf\t%lf]\n"
157 >               "            [%lf\t%lf\t%lf]\n",
158 >               scaleMat(0, 0),scaleMat(0, 1),scaleMat(0, 2),
159 >               scaleMat(1, 0),scaleMat(1, 1),scaleMat(1, 2),
160 >               scaleMat(2, 0),scaleMat(2, 1),scaleMat(2, 2));
161 >      painCave.isFatal = 1;
162 >      simError();
163      } else {
164  
165 <        Mat3x3d hmat = currentSnapshot_->getHmat();
166 <        hmat = hmat *scaleMat;
167 <        currentSnapshot_->setHmat(hmat);
165 >      Mat3x3d hmat = currentSnapshot_->getHmat();
166 >      hmat = hmat *scaleMat;
167 >      currentSnapshot_->setHmat(hmat);
168      }
169 < }
169 >  }
170  
171 < void NPTxyz::loadEta() {
171 >  void NPTxyz::loadEta() {
172      eta= currentSnapshot_->getEta();
173 < }
173 >  }
174  
175   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines