| 6 |
|
* redistribute this software in source and binary code form, provided |
| 7 |
|
* that the following conditions are met: |
| 8 |
|
* |
| 9 |
< |
* 1. Acknowledgement of the program authors must be made in any |
| 10 |
< |
* publication of scientific results based in part on use of the |
| 11 |
< |
* program. An acceptable form of acknowledgement is citation of |
| 12 |
< |
* the article in which the program was described (Matthew |
| 13 |
< |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
| 14 |
< |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
| 15 |
< |
* Parallel Simulation Engine for Molecular Dynamics," |
| 16 |
< |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
| 17 |
< |
* |
| 18 |
< |
* 2. Redistributions of source code must retain the above copyright |
| 9 |
> |
* 1. Redistributions of source code must retain the above copyright |
| 10 |
|
* notice, this list of conditions and the following disclaimer. |
| 11 |
|
* |
| 12 |
< |
* 3. Redistributions in binary form must reproduce the above copyright |
| 12 |
> |
* 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
|
* notice, this list of conditions and the following disclaimer in the |
| 14 |
|
* documentation and/or other materials provided with the |
| 15 |
|
* distribution. |
| 28 |
|
* arising out of the use of or inability to use software, even if the |
| 29 |
|
* University of Notre Dame has been advised of the possibility of |
| 30 |
|
* such damages. |
| 31 |
+ |
* |
| 32 |
+ |
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your |
| 33 |
+ |
* research, please cite the appropriate papers when you publish your |
| 34 |
+ |
* work. Good starting points are: |
| 35 |
+ |
* |
| 36 |
+ |
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
+ |
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
+ |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 39 |
+ |
* [4] Vardeman & Gezelter, in progress (2009). |
| 40 |
|
*/ |
| 41 |
|
#include <fstream> |
| 42 |
|
#include <iostream> |
| 43 |
|
#include "integrators/LDForceManager.hpp" |
| 44 |
|
#include "math/CholeskyDecomposition.hpp" |
| 45 |
< |
#include "utils/OOPSEConstant.hpp" |
| 45 |
> |
#include "utils/PhysicalConstants.hpp" |
| 46 |
|
#include "hydrodynamics/Sphere.hpp" |
| 47 |
|
#include "hydrodynamics/Ellipsoid.hpp" |
| 48 |
|
#include "utils/ElementsTable.hpp" |
| 49 |
|
|
| 50 |
< |
namespace oopse { |
| 50 |
> |
namespace OpenMD { |
| 51 |
|
|
| 52 |
|
LDForceManager::LDForceManager(SimInfo* info) : ForceManager(info), forceTolerance_(1e-6), maxIterNum_(4) { |
| 53 |
|
simParams = info->getSimParams(); |
| 62 |
|
sprintf( painCave.errMsg, |
| 63 |
|
"langevinBufferRadius must be specified " |
| 64 |
|
"when useSphericalBoundaryConditions is turned on.\n"); |
| 65 |
< |
painCave.severity = OOPSE_ERROR; |
| 65 |
> |
painCave.severity = OPENMD_ERROR; |
| 66 |
|
painCave.isFatal = 1; |
| 67 |
|
simError(); |
| 68 |
|
} |
| 73 |
|
sprintf( painCave.errMsg, |
| 74 |
|
"frozenBufferRadius must be specified " |
| 75 |
|
"when useSphericalBoundaryConditions is turned on.\n"); |
| 76 |
< |
painCave.severity = OOPSE_ERROR; |
| 76 |
> |
painCave.severity = OPENMD_ERROR; |
| 77 |
|
painCave.isFatal = 1; |
| 78 |
|
simError(); |
| 79 |
|
} |
| 82 |
|
sprintf( painCave.errMsg, |
| 83 |
|
"frozenBufferRadius has been set smaller than the " |
| 84 |
|
"langevinBufferRadius. This is probably an error.\n"); |
| 85 |
< |
painCave.severity = OOPSE_WARNING; |
| 85 |
> |
painCave.severity = OPENMD_WARNING; |
| 86 |
|
painCave.isFatal = 0; |
| 87 |
|
simError(); |
| 88 |
|
} |
| 120 |
|
"HydroPropFile must be set to a file name if Langevin Dynamics\n" |
| 121 |
|
"\tis specified for rigidBodies which contain more than one atom\n" |
| 122 |
|
"\tTo create a HydroPropFile, run the \"Hydro\" program.\n"); |
| 123 |
< |
painCave.severity = OOPSE_ERROR; |
| 123 |
> |
painCave.severity = OPENMD_ERROR; |
| 124 |
|
painCave.isFatal = 1; |
| 125 |
|
simError(); |
| 126 |
|
} |
| 137 |
|
} else { |
| 138 |
|
sprintf( painCave.errMsg, |
| 139 |
|
"Can not find resistance tensor for atom [%s]\n", integrableObject->getType().c_str()); |
| 140 |
< |
painCave.severity = OOPSE_ERROR; |
| 140 |
> |
painCave.severity = OPENMD_ERROR; |
| 141 |
|
painCave.isFatal = 1; |
| 142 |
|
simError(); |
| 143 |
|
} |
| 171 |
|
} else { |
| 172 |
|
sprintf( painCave.errMsg, |
| 173 |
|
"Can not cast GenericData to GayBerneParam\n"); |
| 174 |
< |
painCave.severity = OOPSE_ERROR; |
| 174 |
> |
painCave.severity = OPENMD_ERROR; |
| 175 |
|
painCave.isFatal = 1; |
| 176 |
|
simError(); |
| 177 |
|
} |
| 178 |
|
} else { |
| 179 |
|
sprintf( painCave.errMsg, "Can not find Parameters for GayBerne\n"); |
| 180 |
< |
painCave.severity = OOPSE_ERROR; |
| 180 |
> |
painCave.severity = OPENMD_ERROR; |
| 181 |
|
painCave.isFatal = 1; |
| 182 |
|
simError(); |
| 183 |
|
} |
| 192 |
|
} else { |
| 193 |
|
sprintf( painCave.errMsg, |
| 194 |
|
"Can not cast GenericData to LJParam\n"); |
| 195 |
< |
painCave.severity = OOPSE_ERROR; |
| 195 |
> |
painCave.severity = OPENMD_ERROR; |
| 196 |
|
painCave.isFatal = 1; |
| 197 |
|
simError(); |
| 198 |
|
} |
| 204 |
|
} else { |
| 205 |
|
sprintf( painCave.errMsg, |
| 206 |
|
"Could not find atom type in default element.txt\n"); |
| 207 |
< |
painCave.severity = OOPSE_ERROR; |
| 207 |
> |
painCave.severity = OPENMD_ERROR; |
| 208 |
|
painCave.isFatal = 1; |
| 209 |
|
simError(); |
| 210 |
|
} |
| 215 |
|
if (!simParams->haveTargetTemp()) { |
| 216 |
|
sprintf(painCave.errMsg, "You can't use LangevinDynamics without a targetTemp!\n"); |
| 217 |
|
painCave.isFatal = 1; |
| 218 |
< |
painCave.severity = OOPSE_ERROR; |
| 218 |
> |
painCave.severity = OPENMD_ERROR; |
| 219 |
|
simError(); |
| 220 |
|
} |
| 221 |
|
|
| 222 |
|
if (!simParams->haveViscosity()) { |
| 223 |
|
sprintf(painCave.errMsg, "You can't use LangevinDynamics without a viscosity!\n"); |
| 224 |
|
painCave.isFatal = 1; |
| 225 |
< |
painCave.severity = OOPSE_ERROR; |
| 225 |
> |
painCave.severity = OPENMD_ERROR; |
| 226 |
|
simError(); |
| 227 |
|
} |
| 228 |
|
|
| 239 |
|
} |
| 240 |
|
} |
| 241 |
|
} |
| 242 |
< |
variance_ = 2.0 * OOPSEConstant::kb*simParams->getTargetTemp()/simParams->getDt(); |
| 242 |
> |
variance_ = 2.0 * PhysicalConstants::kb*simParams->getTargetTemp()/simParams->getDt(); |
| 243 |
|
} |
| 244 |
|
|
| 245 |
|
std::map<std::string, HydroProp*> LDForceManager::parseFrictionFile(const std::string& filename) { |
| 342 |
|
//estimate velocity at full-step using everything but friction forces: |
| 343 |
|
|
| 344 |
|
frc = integrableObject->getFrc(); |
| 345 |
< |
Vector3d velStep = vel + (dt2_ /mass * OOPSEConstant::energyConvert) * frc; |
| 345 |
> |
Vector3d velStep = vel + (dt2_ /mass * PhysicalConstants::energyConvert) * frc; |
| 346 |
|
|
| 347 |
|
Tb = integrableObject->lab2Body(integrableObject->getTrq()); |
| 348 |
< |
Vector3d angMomStep = angMom + (dt2_ * OOPSEConstant::energyConvert) * Tb; |
| 348 |
> |
Vector3d angMomStep = angMom + (dt2_ * PhysicalConstants::energyConvert) * Tb; |
| 349 |
|
|
| 350 |
|
Vector3d omegaLab; |
| 351 |
|
Vector3d vcdLab; |
| 391 |
|
|
| 392 |
|
// re-estimate velocities at full-step using friction forces: |
| 393 |
|
|
| 394 |
< |
velStep = vel + (dt2_ / mass * OOPSEConstant::energyConvert) * (frc + frictionForceLab); |
| 395 |
< |
angMomStep = angMom + (dt2_ * OOPSEConstant::energyConvert) * (Tb + frictionTorqueBody); |
| 394 |
> |
velStep = vel + (dt2_ / mass * PhysicalConstants::energyConvert) * (frc + frictionForceLab); |
| 395 |
> |
angMomStep = angMom + (dt2_ * PhysicalConstants::energyConvert) * (Tb + frictionTorqueBody); |
| 396 |
|
|
| 397 |
|
// check for convergence (if the vectors have converged, fdot and tdot will both be 1.0): |
| 398 |
|
|
| 427 |
|
//estimate velocity at full-step using everything but friction forces: |
| 428 |
|
|
| 429 |
|
frc = integrableObject->getFrc(); |
| 430 |
< |
Vector3d velStep = vel + (dt2_ / mass * OOPSEConstant::energyConvert) * frc; |
| 430 |
> |
Vector3d velStep = vel + (dt2_ / mass * PhysicalConstants::energyConvert) * frc; |
| 431 |
|
|
| 432 |
|
Vector3d frictionForce(0.0); |
| 433 |
|
Vector3d oldFF; // used to test for convergence |
| 442 |
|
|
| 443 |
|
// re-estimate velocities at full-step using friction forces: |
| 444 |
|
|
| 445 |
< |
velStep = vel + (dt2_ / mass * OOPSEConstant::energyConvert) * (frc + frictionForce); |
| 445 |
> |
velStep = vel + (dt2_ / mass * PhysicalConstants::energyConvert) * (frc + frictionForce); |
| 446 |
|
|
| 447 |
|
// check for convergence (if the vector has converged, fdot will be 1.0): |
| 448 |
|
|