ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/integrators/LangevinHullForceManager.cpp
(Generate patch)

Comparing branches/development/src/integrators/LangevinHullForceManager.cpp (file contents):
Revision 1858 by gezelter, Wed Apr 3 21:32:13 2013 UTC vs.
Revision 1874 by gezelter, Wed May 15 15:09:35 2013 UTC

# Line 56 | Line 56 | namespace OpenMD {
56    
57    LangevinHullForceManager::LangevinHullForceManager(SimInfo* info) :
58      ForceManager(info) {
59 <    
59 >  
60      simParams = info->getSimParams();
61      veloMunge = new Velocitizer(info);
62      
# Line 104 | Line 104 | namespace OpenMD {
104        doThermalCoupling_ = false;
105      } else {
106        targetTemp_ = simParams->getTargetTemp();
107 +
108 +      if (!simParams->haveViscosity()) {
109 +        sprintf(painCave.errMsg,
110 +                "LangevinHullForceManager: no viscosity was set.\n"
111 +                "\tOpenMD is turning off the thermal coupling to the bath.\n");
112 +        painCave.isFatal = 0;
113 +        painCave.severity = OPENMD_INFO;
114 +        simError();      
115 +        doThermalCoupling_ = false;
116 +      }else{
117 +        viscosity_ = simParams->getViscosity();
118 +        if ( fabs(viscosity_) < 1e-6 ) {
119 +          sprintf(painCave.errMsg,
120 +                  "LangevinHullDynamics: The bath viscosity was set lower\n"
121 +                  "\tthan 1e-6 poise.  OpenMD is turning off the thermal\n"
122 +                  "\tcoupling to the bath.\n");
123 +          painCave.isFatal = 0;
124 +          painCave.severity = OPENMD_INFO;
125 +          simError();
126 +          doThermalCoupling_ = false;
127 +        }      
128 +      }      
129      }
108    
130      if (!simParams->haveTargetPressure()) {
131        sprintf(painCave.errMsg,
132                "LangevinHullForceManager: no targetPressure (atm) was set.\n"
# Line 119 | Line 140 | namespace OpenMD {
140        targetPressure_ = simParams->getTargetPressure() /
141          PhysicalConstants::pressureConvert;
142      }
122  
143      if (simParams->getUsePeriodicBoundaryConditions()) {
144        sprintf(painCave.errMsg,
145                "LangevinHallForceManager: You can't use the Langevin Hull\n"
# Line 127 | Line 147 | namespace OpenMD {
147        painCave.isFatal = 1;
148        simError();
149      }
150 <    
131 <    if (!simParams->haveViscosity()) {
132 <      sprintf(painCave.errMsg,
133 <              "LangevinHullForceManager: no viscosity was set.\n"
134 <              "\tOpenMD is turning off the thermal coupling to the bath.\n");
135 <      painCave.isFatal = 0;
136 <      painCave.severity = OPENMD_INFO;
137 <      simError();
138 <      doThermalCoupling_ = false;
139 <    }else{
140 <      viscosity_ = simParams->getViscosity();
141 <    }
142 <    
143 <    if ( fabs(viscosity_) < 1e-6 ) {
144 <      sprintf(painCave.errMsg,
145 <              "LangevinHullDynamics: The bath viscosity was set lower than\n"
146 <              "\t1e-6 poise.  OpenMD is turning off the thermal coupling to\n"
147 <              "\tthe bath.\n");
148 <      painCave.isFatal = 0;
149 <      painCave.severity = OPENMD_INFO;
150 <      simError();
151 <      doThermalCoupling_ = false;
152 <    }
153 <
150 >
151      dt_ = simParams->getDt();
152 <  
152 >
153      if (doThermalCoupling_)
154        variance_ = 2.0 * PhysicalConstants::kb * targetTemp_ / dt_;
155  
# Line 177 | Line 174 | namespace OpenMD {
174  
175      // Compute surface Mesh
176      surfaceMesh_->computeHull(localSites_);
180    Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
181    currSnapshot->setBoundingBox(surfaceMesh_->getBoundingBox());
177    }  
178 +
179 +  LangevinHullForceManager::~LangevinHullForceManager() {
180 +    delete surfaceMesh_;
181 +    delete veloMunge;
182 +  }
183    
184    void LangevinHullForceManager::postCalculation(){
185    
# Line 200 | Line 200 | namespace OpenMD {
200  
201      // Compute surface Mesh
202      surfaceMesh_->computeHull(localSites_);
203
203      // Get total area and number of surface stunt doubles
204      area = surfaceMesh_->getArea();
205      sMesh = surfaceMesh_->getMesh();
# Line 254 | Line 253 | namespace OpenMD {
253      Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
254      currSnapshot->setVolume(surfaceMesh_->getVolume());  
255      currSnapshot->setHullVolume(surfaceMesh_->getVolume());
257    // update the bounding box for use by ForceMatrixDecomposition:
258    currSnapshot->setBoundingBox(surfaceMesh_->getBoundingBox());
256      ForceManager::postCalculation();  
257    }
258      
# Line 281 | Line 278 | namespace OpenMD {
278      // push these out to the other processors
279      
280   #ifdef IS_MPI
281 <    if (worldRank == 0) {
282 <      MPI::COMM_WORLD.Bcast(&gaussRand[0], nTriangles*3, MPI::REALTYPE, 0);
286 <    } else {
287 <      MPI::COMM_WORLD.Bcast(&gaussRand[0], nTriangles*3, MPI::REALTYPE, 0);
288 <    }
281 >    // Same command on all nodes:
282 >    MPI::COMM_WORLD.Bcast(&gaussRand[0], nTriangles*3, MPI::REALTYPE, 0);
283   #endif
284      
285      return gaussRand;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines