| 1 | gezelter | 404 | /* | 
| 2 | chuckv | 1402 | * Copyright (c) 2005, 2010 The University of Notre Dame. All Rights Reserved. | 
| 3 | gezelter | 246 | * | 
| 4 |  |  | * The University of Notre Dame grants you ("Licensee") a | 
| 5 |  |  | * non-exclusive, royalty free, license to use, modify and | 
| 6 |  |  | * redistribute this software in source and binary code form, provided | 
| 7 |  |  | * that the following conditions are met: | 
| 8 |  |  | * | 
| 9 | gezelter | 1390 | * 1. Redistributions of source code must retain the above copyright | 
| 10 | gezelter | 246 | *    notice, this list of conditions and the following disclaimer. | 
| 11 |  |  | * | 
| 12 | gezelter | 1390 | * 2. Redistributions in binary form must reproduce the above copyright | 
| 13 | gezelter | 246 | *    notice, this list of conditions and the following disclaimer in the | 
| 14 |  |  | *    documentation and/or other materials provided with the | 
| 15 |  |  | *    distribution. | 
| 16 |  |  | * | 
| 17 |  |  | * This software is provided "AS IS," without a warranty of any | 
| 18 |  |  | * kind. All express or implied conditions, representations and | 
| 19 |  |  | * warranties, including any implied warranty of merchantability, | 
| 20 |  |  | * fitness for a particular purpose or non-infringement, are hereby | 
| 21 |  |  | * excluded.  The University of Notre Dame and its licensors shall not | 
| 22 |  |  | * be liable for any damages suffered by licensee as a result of | 
| 23 |  |  | * using, modifying or distributing the software or its | 
| 24 |  |  | * derivatives. In no event will the University of Notre Dame or its | 
| 25 |  |  | * licensors be liable for any lost revenue, profit or data, or for | 
| 26 |  |  | * direct, indirect, special, consequential, incidental or punitive | 
| 27 |  |  | * damages, however caused and regardless of the theory of liability, | 
| 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 | gezelter | 1390 | * | 
| 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 | gezelter | 1879 | * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). | 
| 39 | gezelter | 1782 | * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010). | 
| 40 |  |  | * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). | 
| 41 | gezelter | 246 | */ | 
| 42 |  |  |  | 
| 43 | gezelter | 2 | #include <stdlib.h> | 
| 44 |  |  | #include <stdio.h> | 
| 45 |  |  | #include <string.h> | 
| 46 | tim | 665 | #include <string> | 
| 47 | gezelter | 2 |  | 
| 48 | tim | 3 | #include "io/Globals.hpp" | 
| 49 | tim | 816 | #include "io/ParamConstraint.hpp" | 
| 50 |  |  | #include "utils/MemoryUtils.hpp" | 
| 51 | tim | 3 | #include "utils/simError.h" | 
| 52 | gezelter | 2 |  | 
| 53 | gezelter | 1390 | namespace OpenMD { | 
| 54 | gezelter | 1879 | Globals::Globals() { | 
| 55 | gezelter | 1782 |  | 
| 56 | gezelter | 1879 | flucQpars_ = new FluctuatingChargeParameters(); | 
| 57 |  |  | rnemdPars_ = new RNEMDParameters(); | 
| 58 |  |  | minimizerPars_ = new MinimizerParameters(); | 
| 59 | gezelter | 1782 |  | 
| 60 | gezelter | 1879 | DefineParameter(ForceField, "forceField"); | 
| 61 |  |  |  | 
| 62 |  |  | DefineOptionalParameter(TargetTemp, "targetTemp"); | 
| 63 |  |  | DefineOptionalParameter(Ensemble, "ensemble"); | 
| 64 |  |  | DefineOptionalParameter(Dt, "dt"); | 
| 65 |  |  | DefineOptionalParameter(RunTime, "runTime"); | 
| 66 |  |  | DefineOptionalParameter(FinalConfig, "finalConfig"); | 
| 67 |  |  | DefineOptionalParameter(SampleTime, "sampleTime"); | 
| 68 |  |  | DefineOptionalParameter(ResetTime, "resetTime"); | 
| 69 |  |  | DefineOptionalParameter(StatusTime, "statusTime"); | 
| 70 |  |  | DefineOptionalParameter(CutoffRadius, "cutoffRadius"); | 
| 71 |  |  | DefineOptionalParameter(SwitchingRadius, "switchingRadius"); | 
| 72 |  |  | DefineOptionalParameter(TempSet, "tempSet"); | 
| 73 |  |  | DefineOptionalParameter(ThermalTime, "thermalTime"); | 
| 74 |  |  | DefineOptionalParameter(TargetPressure, "targetPressure"); | 
| 75 |  |  | DefineOptionalParameter(TauThermostat, "tauThermostat"); | 
| 76 |  |  | DefineOptionalParameter(TauBarostat, "tauBarostat"); | 
| 77 |  |  | DefineOptionalParameter(ZconsTime, "zconsTime"); | 
| 78 |  |  | DefineOptionalParameter(ZconsTol, "zconsTol"); | 
| 79 |  |  | DefineOptionalParameter(ZconsForcePolicy, "zconsForcePolicy"); | 
| 80 |  |  | DefineOptionalParameter(Seed, "seed"); | 
| 81 |  |  | DefineOptionalParameter(ZconsGap, "zconsGap"); | 
| 82 |  |  | DefineOptionalParameter(ZconsFixtime, "zconsFixtime"); | 
| 83 |  |  | DefineOptionalParameter(ZconsUsingSMD, "zconsUsingSMD"); | 
| 84 |  |  | DefineOptionalParameter(ThermodynamicIntegrationLambda, | 
| 85 |  |  | "thermodynamicIntegrationLambda"); | 
| 86 |  |  | DefineOptionalParameter(ThermodynamicIntegrationK, | 
| 87 |  |  | "thermodynamicIntegrationK"); | 
| 88 |  |  | DefineOptionalParameter(ForceFieldVariant, "forceFieldVariant"); | 
| 89 |  |  | DefineOptionalParameter(ForceFieldFileName, "forceFieldFileName"); | 
| 90 |  |  | DefineOptionalParameter(DampingAlpha, "dampingAlpha"); | 
| 91 |  |  | DefineOptionalParameter(SurfaceTension, "surfaceTension"); | 
| 92 |  |  | DefineOptionalParameter(PrintPressureTensor, "printPressureTensor"); | 
| 93 |  |  | DefineOptionalParameter(ElectricField, "electricField"); | 
| 94 | gezelter | 2020 | DefineOptionalParameter(UniformField, "uniformField"); | 
| 95 | gezelter | 2034 | DefineOptionalParameter(UniformGradientStrength, "uniformGradientStrength"); | 
| 96 |  |  | DefineOptionalParameter(UniformGradientDirection1, "uniformGradientDirection1"); | 
| 97 |  |  | DefineOptionalParameter(UniformGradientDirection2, "uniformGradientDirection2"); | 
| 98 | gezelter | 2020 | //DefineOptionalParameter(PeriodicField, "periodicField"); | 
| 99 |  |  | //DefineOptionalParameter(PeriodicFieldStrength, "periodicFieldStrength"); | 
| 100 |  |  |  | 
| 101 | gezelter | 1782 |  | 
| 102 | gezelter | 1879 | DefineOptionalParameter(TaggedAtomPair, "taggedAtomPair"); | 
| 103 |  |  | DefineOptionalParameter(PrintTaggedPairDistance, "printTaggedPairDistance"); | 
| 104 |  |  | DefineOptionalParameter(SwitchingFunctionType, "switchingFunctionType"); | 
| 105 |  |  | DefineOptionalParameter(HydroPropFile, "HydroPropFile"); | 
| 106 |  |  | DefineOptionalParameter(Viscosity, "viscosity"); | 
| 107 |  |  | DefineOptionalParameter(BeadSize, "beadSize"); | 
| 108 |  |  | DefineOptionalParameter(FrozenBufferRadius, "frozenBufferRadius"); | 
| 109 |  |  | DefineOptionalParameter(LangevinBufferRadius, "langevinBufferRadius"); | 
| 110 |  |  | DefineOptionalParameter(NeighborListNeighbors,"NeighborListNeighbors"); | 
| 111 |  |  | DefineOptionalParameter(UseMultipleTemperatureMethod, | 
| 112 |  |  | "useMultipleTemperatureMethod"); | 
| 113 |  |  | DefineOptionalParameter(ElectrostaticSummationMethod, | 
| 114 |  |  | "electrostaticSummationMethod"); | 
| 115 |  |  | DefineOptionalParameter(MTM_Ce, "MTM_Ce"); | 
| 116 |  |  | DefineOptionalParameter(MTM_G, "MTM_G"); | 
| 117 |  |  | DefineOptionalParameter(MTM_Io, "MTM_Io"); | 
| 118 |  |  | DefineOptionalParameter(MTM_Sigma, "MTM_Sigma"); | 
| 119 |  |  | DefineOptionalParameter(MTM_R, "MTM_R"); | 
| 120 |  |  | DefineOptionalParameter(Alpha, "alpha"); | 
| 121 | gezelter | 1981 | DefineOptionalParameter(ConstraintTime, "constraintTime"); | 
| 122 | gezelter | 1327 |  | 
| 123 | chuckv | 1147 |  | 
| 124 | gezelter | 1879 | DefineOptionalParameterWithDefaultValue(UsePeriodicBoundaryConditions, | 
| 125 |  |  | "usePeriodicBoundaryConditions", | 
| 126 |  |  | true); | 
| 127 |  |  | DefineOptionalParameterWithDefaultValue(UseAtomicVirial, "useAtomicVirial", | 
| 128 |  |  | true); | 
| 129 |  |  | DefineOptionalParameterWithDefaultValue(UseLongRangeCorrections, | 
| 130 |  |  | "useLongRangeCorrections", true); | 
| 131 |  |  | DefineOptionalParameterWithDefaultValue(UseInitalTime, "useInitialTime", | 
| 132 |  |  | false); | 
| 133 |  |  | DefineOptionalParameterWithDefaultValue(UseIntialExtendedSystemState, | 
| 134 |  |  | "useInitialExtendedSystemState", | 
| 135 |  |  | false); | 
| 136 |  |  | DefineOptionalParameterWithDefaultValue(OrthoBoxTolerance, | 
| 137 |  |  | "orthoBoxTolerance", 1E-6); | 
| 138 |  |  | DefineOptionalParameterWithDefaultValue(CutoffMethod, "cutoffMethod", | 
| 139 |  |  | "SHIFTED_FORCE"); | 
| 140 |  |  | DefineOptionalParameterWithDefaultValue(ElectrostaticScreeningMethod, | 
| 141 |  |  | "electrostaticScreeningMethod", | 
| 142 |  |  | "DAMPED"); | 
| 143 |  |  | DefineOptionalParameterWithDefaultValue(Dielectric, "dielectric", 80.0); | 
| 144 |  |  | DefineOptionalParameterWithDefaultValue(CompressDumpFile, | 
| 145 |  |  | "compressDumpFile", false); | 
| 146 |  |  | DefineOptionalParameterWithDefaultValue(PrintHeatFlux, "printHeatFlux", | 
| 147 |  |  | false); | 
| 148 |  |  | DefineOptionalParameterWithDefaultValue(OutputForceVector, | 
| 149 |  |  | "outputForceVector", false); | 
| 150 |  |  | DefineOptionalParameterWithDefaultValue(OutputParticlePotential, | 
| 151 |  |  | "outputParticlePotential", false); | 
| 152 |  |  | DefineOptionalParameterWithDefaultValue(OutputElectricField, | 
| 153 |  |  | "outputElectricField", false); | 
| 154 |  |  | DefineOptionalParameterWithDefaultValue(OutputFluctuatingCharges, | 
| 155 |  |  | "outputFluctuatingCharges", false); | 
| 156 | gezelter | 1993 | DefineOptionalParameterWithDefaultValue(OutputSitePotential, | 
| 157 |  |  | "outputSitePotential", false); | 
| 158 | gezelter | 1879 | DefineOptionalParameterWithDefaultValue(SkinThickness, "skinThickness", | 
| 159 |  |  | 1.0); | 
| 160 |  |  | DefineOptionalParameterWithDefaultValue(StatFileFormat, | 
| 161 |  |  | "statFileFormat", | 
| 162 |  |  | "TIME|TOTAL_ENERGY|POTENTIAL_ENERGY|KINETIC_ENERGY|TEMPERATURE|PRESSURE|VOLUME|CONSERVED_QUANTITY"); | 
| 163 |  |  | DefineOptionalParameterWithDefaultValue(UseSphericalBoundaryConditions, | 
| 164 |  |  | "useSphericalBoundaryConditions", | 
| 165 |  |  | false); | 
| 166 |  |  | DefineOptionalParameterWithDefaultValue(AccumulateBoxDipole, | 
| 167 |  |  | "accumulateBoxDipole", false); | 
| 168 | gezelter | 2022 | DefineOptionalParameterWithDefaultValue(AccumulateBoxQuadrupole, | 
| 169 |  |  | "accumulateBoxQuadrupole", false); | 
| 170 | gezelter | 1879 | DefineOptionalParameterWithDefaultValue(UseRestraints, "useRestraints", | 
| 171 |  |  | false); | 
| 172 |  |  | DefineOptionalParameterWithDefaultValue(Restraint_file, "Restraint_file", | 
| 173 |  |  | "idealCrystal.in"); | 
| 174 |  |  | DefineOptionalParameterWithDefaultValue(UseThermodynamicIntegration, | 
| 175 |  |  | "useThermodynamicIntegration", | 
| 176 |  |  | false); | 
| 177 |  |  | DefineOptionalParameterWithDefaultValue(HULL_Method,"HULL_Method","Convex"); | 
| 178 | tim | 681 |  | 
| 179 | gezelter | 1879 | deprecatedKeywords_.insert("nComponents"); | 
| 180 |  |  | deprecatedKeywords_.insert("nZconstraints"); | 
| 181 |  |  | deprecatedKeywords_.insert("initialConfig"); | 
| 182 |  |  | deprecatedKeywords_.insert("thermIntDistSpringConst"); | 
| 183 |  |  | deprecatedKeywords_.insert("thermIntThetaSpringConst"); | 
| 184 |  |  | deprecatedKeywords_.insert("thermIntOmegaSpringConst"); | 
| 185 |  |  | deprecatedKeywords_.insert("useSolidThermInt"); | 
| 186 |  |  | deprecatedKeywords_.insert("useLiquidThermInt"); | 
| 187 |  |  | deprecatedKeywords_.insert("minimizerMaxIter"); | 
| 188 |  |  | deprecatedKeywords_.insert("minimizerWriteFreq"); | 
| 189 |  |  | deprecatedKeywords_.insert("minimizerStepSize"); | 
| 190 |  |  | deprecatedKeywords_.insert("minimizerFTol"); | 
| 191 |  |  | deprecatedKeywords_.insert("minimizerGTol"); | 
| 192 |  |  | deprecatedKeywords_.insert("minimizerLSTol"); | 
| 193 |  |  | deprecatedKeywords_.insert("minimizerLSMaxIter"); | 
| 194 | gezelter | 2020 | deprecatedKeywords_.insert("electricField"); | 
| 195 | gezelter | 2057 | deprecatedKeywords_.insert("cutoffPolicy"); | 
| 196 | gezelter | 1879 | } | 
| 197 | gezelter | 2 |  | 
| 198 | gezelter | 1879 | Globals::~Globals() { | 
| 199 | tim | 816 | MemoryUtils::deletePointers(components_); | 
| 200 |  |  | MemoryUtils::deletePointers(zconstraints_); | 
| 201 | cli2 | 1360 | MemoryUtils::deletePointers(restraints_); | 
| 202 | gezelter | 1964 | delete flucQpars_; | 
| 203 |  |  | delete rnemdPars_; | 
| 204 |  |  | delete minimizerPars_; | 
| 205 | gezelter | 1879 | } | 
| 206 | gezelter | 2 |  | 
| 207 | gezelter | 1879 | void Globals::validate() { | 
| 208 |  |  | DataHolder::validate(); | 
| 209 | gezelter | 2 |  | 
| 210 | gezelter | 1879 | CheckParameter(ForceField, isNotEmpty()); | 
| 211 |  |  | CheckParameter(TargetTemp, isPositive()); | 
| 212 |  |  | CheckParameter(Ensemble, isEqualIgnoreCase("NVE") || | 
| 213 |  |  | isEqualIgnoreCase("NVT") || isEqualIgnoreCase("NPTi") || | 
| 214 |  |  | isEqualIgnoreCase("NPTf") || isEqualIgnoreCase("NPTxyz") || | 
| 215 |  |  | isEqualIgnoreCase("NPTsz") || isEqualIgnoreCase("NPAT")  || | 
| 216 | gezelter | 2011 | isEqualIgnoreCase("NPA") || | 
| 217 | gezelter | 1879 | isEqualIgnoreCase("LANGEVINDYNAMICS") || | 
| 218 |  |  | isEqualIgnoreCase("LD") || isEqualIgnoreCase("NPRT") || | 
| 219 |  |  | isEqualIgnoreCase("NPGT") || isEqualIgnoreCase("NGammaT") || | 
| 220 |  |  | isEqualIgnoreCase("NGT") || | 
| 221 |  |  | isEqualIgnoreCase("LANGEVINHULL") || | 
| 222 |  |  | isEqualIgnoreCase("LHULL") || isEqualIgnoreCase("SMIPD")); | 
| 223 |  |  | CheckParameter(Dt, isPositive()); | 
| 224 |  |  | CheckParameter(RunTime, isPositive()); | 
| 225 |  |  | CheckParameter(FinalConfig, isNotEmpty()); | 
| 226 |  |  | CheckParameter(SampleTime, isNonNegative()); | 
| 227 |  |  | CheckParameter(ResetTime, isNonNegative()); | 
| 228 |  |  | CheckParameter(StatusTime, isNonNegative()); | 
| 229 |  |  | CheckParameter(CutoffRadius, isPositive()); | 
| 230 |  |  | CheckParameter(SwitchingRadius, isNonNegative()); | 
| 231 |  |  | CheckParameter(Dielectric, isPositive()); | 
| 232 |  |  | CheckParameter(ThermalTime,  isNonNegative()); | 
| 233 |  |  | CheckParameter(TauThermostat, isPositive()); | 
| 234 |  |  | CheckParameter(TauBarostat, isPositive()); | 
| 235 |  |  | CheckParameter(ZconsTime, isPositive()); | 
| 236 |  |  | CheckParameter(ZconsTol, isPositive()); | 
| 237 |  |  | CheckParameter(Seed, isPositive()); | 
| 238 |  |  | CheckParameter(ZconsGap, isPositive()); | 
| 239 |  |  | CheckParameter(ZconsFixtime, isPositive()); | 
| 240 |  |  | CheckParameter(ThermodynamicIntegrationLambda, isNonNegative()); | 
| 241 |  |  | CheckParameter(ThermodynamicIntegrationK, isPositive()); | 
| 242 |  |  | CheckParameter(ForceFieldVariant, isNotEmpty()); | 
| 243 |  |  | CheckParameter(ForceFieldFileName, isNotEmpty()); | 
| 244 |  |  | CheckParameter(CutoffMethod, isEqualIgnoreCase("HARD") || | 
| 245 |  |  | isEqualIgnoreCase("SWITCHED") || | 
| 246 |  |  | isEqualIgnoreCase("SHIFTED_POTENTIAL") || | 
| 247 |  |  | isEqualIgnoreCase("SHIFTED_FORCE") || | 
| 248 | gezelter | 1915 | isEqualIgnoreCase("TAYLOR_SHIFTED") || | 
| 249 |  |  | isEqualIgnoreCase("EWALD_FULL")); | 
| 250 | gezelter | 1879 | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase("NONE") || | 
| 251 | gezelter | 2057 | isEqualIgnoreCase("HARD") || | 
| 252 |  |  | isEqualIgnoreCase("SWITCHED") || | 
| 253 | gezelter | 1879 | isEqualIgnoreCase("SHIFTED_POTENTIAL") || | 
| 254 |  |  | isEqualIgnoreCase("SHIFTED_FORCE") || | 
| 255 |  |  | isEqualIgnoreCase("REACTION_FIELD") || | 
| 256 |  |  | isEqualIgnoreCase("TAYLOR_SHIFTED")); | 
| 257 |  |  | CheckParameter(ElectrostaticScreeningMethod, | 
| 258 | gezelter | 2057 | isEqualIgnoreCase("UNDAMPED") || | 
| 259 |  |  | isEqualIgnoreCase("DAMPED")); | 
| 260 | gezelter | 1879 | CheckParameter(SwitchingFunctionType, isEqualIgnoreCase("CUBIC") || | 
| 261 |  |  | isEqualIgnoreCase("FIFTH_ORDER_POLYNOMIAL")); | 
| 262 |  |  | CheckParameter(OrthoBoxTolerance, isPositive()); | 
| 263 |  |  | CheckParameter(DampingAlpha,isNonNegative()); | 
| 264 |  |  | CheckParameter(SkinThickness, isPositive()); | 
| 265 |  |  | CheckParameter(Viscosity, isNonNegative()); | 
| 266 |  |  | CheckParameter(BeadSize, isPositive()); | 
| 267 |  |  | CheckParameter(FrozenBufferRadius, isPositive()); | 
| 268 |  |  | CheckParameter(LangevinBufferRadius, isPositive()); | 
| 269 |  |  | CheckParameter(NeighborListNeighbors, isPositive()); | 
| 270 |  |  | CheckParameter(HULL_Method, isEqualIgnoreCase("Convex") || | 
| 271 |  |  | isEqualIgnoreCase("AlphaShape")); | 
| 272 |  |  | CheckParameter(Alpha, isPositive()); | 
| 273 | chuckv | 1402 |  | 
| 274 | gezelter | 1879 | for(std::vector<Component*>::iterator i = components_.begin(); | 
| 275 |  |  | i != components_.end(); ++i) { | 
| 276 |  |  | if (!(*i)->findMoleculeStamp(moleculeStamps_)) { | 
| 277 | tim | 845 | std::ostringstream oss; | 
| 278 | gezelter | 1879 | oss << "Globals Error: can not find molecule stamp for component " | 
| 279 |  |  | << (*i)->getType() << std::endl; | 
| 280 | gezelter | 1390 | throw OpenMDException(oss.str()); | 
| 281 | gezelter | 1879 | } | 
| 282 | tim | 770 | } | 
| 283 |  |  | } | 
| 284 | gezelter | 1879 |  | 
| 285 |  |  | bool Globals::addComponent(Component* comp) { | 
| 286 | tim | 770 | components_.push_back(comp); | 
| 287 |  |  | return true; | 
| 288 | gezelter | 1879 | } | 
| 289 | gezelter | 2 |  | 
| 290 | gezelter | 1879 | bool Globals::addZConsStamp(ZConsStamp* zcons) { | 
| 291 | tim | 770 | zconstraints_.push_back(zcons); | 
| 292 |  |  | return true; | 
| 293 | gezelter | 1879 | } | 
| 294 | gezelter | 2 |  | 
| 295 | gezelter | 1879 | bool Globals::addRestraintStamp(RestraintStamp* rest) { | 
| 296 | cli2 | 1360 | restraints_.push_back(rest); | 
| 297 |  |  | return true; | 
| 298 | gezelter | 1879 | } | 
| 299 | cli2 | 1360 |  | 
| 300 | gezelter | 1879 | bool Globals::addFluctuatingChargeParameters(FluctuatingChargeParameters* fqp) { | 
| 301 |  |  | if (flucQpars_ != NULL) | 
| 302 |  |  | delete flucQpars_; | 
| 303 | gezelter | 1782 |  | 
| 304 | gezelter | 1879 | flucQpars_ = fqp; | 
| 305 |  |  | return true; | 
| 306 |  |  | } | 
| 307 | gezelter | 1782 |  | 
| 308 | gezelter | 1879 | bool Globals::addRNEMDParameters(RNEMDParameters* rnemdPars) { | 
| 309 |  |  | if (rnemdPars_ != NULL) | 
| 310 |  |  | delete rnemdPars_; | 
| 311 | gezelter | 1782 |  | 
| 312 | gezelter | 1879 | rnemdPars_ = rnemdPars; | 
| 313 |  |  | return true; | 
| 314 |  |  | } | 
| 315 | gezelter | 1782 |  | 
| 316 | gezelter | 1879 | bool Globals::addMinimizerParameters(MinimizerParameters* miniPars) { | 
| 317 |  |  | if (minimizerPars_ != NULL) | 
| 318 |  |  | delete minimizerPars_; | 
| 319 | gezelter | 1782 |  | 
| 320 | gezelter | 1879 | minimizerPars_ = miniPars; | 
| 321 |  |  | return true; | 
| 322 |  |  | } | 
| 323 | gezelter | 1782 |  | 
| 324 | gezelter | 1879 | bool Globals::addMoleculeStamp(MoleculeStamp* molStamp) { | 
| 325 | tim | 770 | std::string molStampName = molStamp->getName(); | 
| 326 |  |  | std::map<std::string, MoleculeStamp*>::iterator i; | 
| 327 |  |  | bool ret = false; | 
| 328 |  |  | i = moleculeStamps_.find(molStampName); | 
| 329 |  |  | if (i == moleculeStamps_.end()) { | 
| 330 | gezelter | 1879 | moleculeStamps_.insert(std::map<std::string, MoleculeStamp*>::value_type(molStampName, molStamp)); | 
| 331 |  |  | ret = true; | 
| 332 | tim | 770 | } else { | 
| 333 | gezelter | 1879 | std::ostringstream oss; | 
| 334 |  |  | oss << "Globals Error: Molecule Stamp " << molStamp->getName() | 
| 335 |  |  | << "appears multiple times\n"; | 
| 336 |  |  | throw OpenMDException(oss.str()); | 
| 337 | tim | 770 | } | 
| 338 |  |  | return ret; | 
| 339 | gezelter | 1879 | } | 
| 340 | gezelter | 2 | } |