| 45 |  | #include <string> | 
| 46 |  |  | 
| 47 |  | #include "io/Globals.hpp" | 
| 48 | + | #include "io/ParamConstraint.hpp" | 
| 49 | + | #include "utils/MemoryUtils.hpp" | 
| 50 |  | #include "utils/simError.h" | 
| 51 |  |  | 
| 50 | – | #include "io/ParamConstraint.hpp" | 
| 51 | – |  | 
| 52 |  | namespace oopse { | 
| 53 |  | Globals::Globals() { | 
| 54 |  | DefineParameter(ForceField, "forceField") | 
| 98 |  | DefineOptionalParameter(ElectrostaticScreeningMethod, "electrostaticScreeningMethod"); | 
| 99 |  | DefineOptionalParameter(CutoffPolicy, "cutoffPolicy"); | 
| 100 |  | DefineOptionalParameter(SwitchingFunctionType, "switchingFunctionType"); | 
| 101 | < | DefineOptionalParameterWithDefaultValue(MixingRule, "mixingRule", "standard"); | 
| 101 | > | DefineOptionalParameter(HydroPropFile, "HydroPropFile"); | 
| 102 |  | DefineOptionalParameterWithDefaultValue(UsePeriodicBoundaryConditions, "usePeriodicBoundaryConditions", true); | 
| 103 |  | DefineOptionalParameterWithDefaultValue(UseInitalTime, "useInitialTime", false); | 
| 104 |  | DefineOptionalParameterWithDefaultValue(UseIntialExtendedSystemState, "useInitialExtendedSystemState", false); | 
| 121 |  | } | 
| 122 |  |  | 
| 123 |  | Globals::~Globals() { | 
| 124 | < |  | 
| 125 | < |  | 
| 124 | > | MemoryUtils::deletePointers(components_); | 
| 125 | > | MemoryUtils::deletePointers(zconstraints_); | 
| 126 |  | } | 
| 127 |  |  | 
| 128 |  | void Globals::validate() { | 
| 130 |  |  | 
| 131 |  | CheckParameter(ForceField, isNotEmpty()); | 
| 132 |  | CheckParameter(TargetTemp, isPositive()); | 
| 133 | < | CheckParameter(Ensemble, isEqualIgnoreCase(std::string("NVE")) || isEqualIgnoreCase(std::string("NVT")) || isEqualIgnoreCase(std::string("NPTi")) || isEqualIgnoreCase(std::string("NPTf")) || isEqualIgnoreCase(std::string("NPTxyz")) ); | 
| 133 | > | CheckParameter(Ensemble, isEqualIgnoreCase("NVE") || isEqualIgnoreCase("NVT") || isEqualIgnoreCase("NPTi") || isEqualIgnoreCase("NPTf") || isEqualIgnoreCase("NPTxyz") || isEqualIgnoreCase("NPAT")  || isEqualIgnoreCase("LANGEVINDYNAMICS") ); | 
| 134 |  | CheckParameter(Dt, isPositive()); | 
| 135 |  | CheckParameter(RunTime, isPositive()); | 
| 136 |  | CheckParameter(InitialConfig, isNotEmpty()); | 
| 148 |  | CheckParameter(ZconsTime, isPositive()); | 
| 149 |  | CheckParameter(ZconsTol, isPositive()); | 
| 150 |  | CheckParameter(Seed, isPositive()); | 
| 151 | < | CheckParameter(Minimizer, isEqualIgnoreCase(std::string("SD")) || isEqualIgnoreCase(std::string("CG"))); | 
| 151 | > | CheckParameter(Minimizer, isEqualIgnoreCase("SD") || isEqualIgnoreCase("CG")); | 
| 152 |  | CheckParameter(MinimizerMaxIter, isPositive()); | 
| 153 |  | CheckParameter(MinimizerWriteFrq, isPositive()); | 
| 154 |  | CheckParameter(MinimizerStepSize, isPositive()); | 
| 166 |  | CheckParameter(ThermIntThetaSpringConst, isPositive()); | 
| 167 |  | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | 
| 168 |  | CheckParameter(SurfaceTension, isPositive()); | 
| 169 | < | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase(std::string("NONE")) || isEqualIgnoreCase(std::string("SHIFTED_POTENTIAL")) || isEqualIgnoreCase(std::string("SHIFTED_FORCE")) || isEqualIgnoreCase(std::string("REACTION_FIELD"))); | 
| 170 | < | CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase(std::string("UNDAMPED")) || isEqualIgnoreCase(std::string("DAMPED"))); | 
| 171 | < | CheckParameter(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || isEqualIgnoreCase(std::string("MAX")) || isEqualIgnoreCase(std::string("TRADITIONAL"))); | 
| 172 | < | CheckParameter(SwitchingFunctionType, isEqualIgnoreCase(std::string("CUBIC")) || isEqualIgnoreCase(std::string("FIFTH_ORDER_POLYNOMIAL"))); | 
| 169 | > | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase("NONE") || isEqualIgnoreCase("SHIFTED_POTENTIAL") || isEqualIgnoreCase("SHIFTED_FORCE") || isEqualIgnoreCase("REACTION_FIELD")); | 
| 170 | > | CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase("UNDAMPED") || isEqualIgnoreCase("DAMPED")); | 
| 171 | > | CheckParameter(CutoffPolicy, isEqualIgnoreCase("MIX") || isEqualIgnoreCase("MAX") || isEqualIgnoreCase("TRADITIONAL")); | 
| 172 | > | CheckParameter(SwitchingFunctionType, isEqualIgnoreCase("CUBIC") || isEqualIgnoreCase("FIFTH_ORDER_POLYNOMIAL")); | 
| 173 |  | //CheckParameter(StatFileFormat,); | 
| 174 | – | //CheckParameter(MixingRule,); | 
| 174 |  | CheckParameter(OrthoBoxTolerance, isPositive()); | 
| 175 |  | CheckParameter(ThermIntDistSpringConst, isPositive()); | 
| 176 |  | CheckParameter(ThermIntThetaSpringConst, isPositive()); | 
| 180 |  |  | 
| 181 |  | for(std::vector<Component*>::iterator i = components_.begin(); i != components_.end(); ++i) { | 
| 182 |  | if (!(*i)->findMoleculeStamp(moleculeStamps_)) { | 
| 183 | < | std::cout << "Globals Error: can not find molecule stamp for component" << std::endl; | 
| 183 | > | std::ostringstream oss; | 
| 184 | > | oss << "Globals Error: can not find molecule stamp for component " << (*i)->getType() << std::endl; | 
| 185 | > | throw OOPSEException(oss.str()); | 
| 186 |  | } | 
| 187 |  | } | 
| 188 |  | } | 
| 206 |  | moleculeStamps_.insert(std::map<std::string, MoleculeStamp*>::value_type(molStampName, molStamp)); | 
| 207 |  | ret = true; | 
| 208 |  | } else { | 
| 209 | < | std::cout << "Globals Error: Molecule Stamp " << molStamp->getName() << "appears multiple times\n"; | 
| 209 | > | std::ostringstream oss; | 
| 210 | > | oss << "Globals Error: Molecule Stamp " << molStamp->getName() << "appears multiple times\n"; | 
| 211 | > | throw OOPSEException(oss.str()); | 
| 212 |  | } | 
| 213 |  | return ret; | 
| 214 |  | } |