| 56 |
|
|
| 57 |
|
LangevinHullForceManager::LangevinHullForceManager(SimInfo* info) : |
| 58 |
|
ForceManager(info) { |
| 59 |
< |
|
| 59 |
> |
|
| 60 |
|
simParams = info->getSimParams(); |
| 61 |
|
veloMunge = new Velocitizer(info); |
| 62 |
|
|
| 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" |
| 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" |
| 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 |
|
|
| 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 |
|
|
| 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(); |
| 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 |
|
|
| 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; |