| 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 | > | DefineOptionalParameter(Viscosity, "viscosity"); | 
| 103 | > | DefineOptionalParameter(BeadSize, "beadSize"); | 
| 104 | > | DefineOptionalParameter(FrozenBufferRadius, "frozenBufferRadius"); | 
| 105 | > | DefineOptionalParameter(LangevinBufferRadius, "langevinBufferRadius"); | 
| 106 | > |  | 
| 107 |  | DefineOptionalParameterWithDefaultValue(UsePeriodicBoundaryConditions, "usePeriodicBoundaryConditions", true); | 
| 108 |  | DefineOptionalParameterWithDefaultValue(UseInitalTime, "useInitialTime", false); | 
| 109 |  | DefineOptionalParameterWithDefaultValue(UseIntialExtendedSystemState, "useInitialExtendedSystemState", false); | 
| 118 |  | DefineOptionalParameterWithDefaultValue(OutputForceVector, "outputForceVector", 0); | 
| 119 |  | DefineOptionalParameterWithDefaultValue(SkinThickness, "skinThickness", 1.0); | 
| 120 |  | DefineOptionalParameterWithDefaultValue(StatFileFormat, "statFileFormat", "TIME|TOTAL_ENERGY|POTENTIAL_ENERGY|KINETIC_ENERGY|TEMPERATURE|PRESSURE|VOLUME|CONSERVED_QUANTITY"); | 
| 121 | + | DefineOptionalParameterWithDefaultValue(UseSphericalBoundaryConditions, "useSphericalBoundaryConditions", false); | 
| 122 |  |  | 
| 123 |  |  | 
| 124 |  | deprecatedKeywords_.insert("nComponents"); | 
| 127 |  | } | 
| 128 |  |  | 
| 129 |  | Globals::~Globals() { | 
| 130 | < |  | 
| 131 | < |  | 
| 130 | > | MemoryUtils::deletePointers(components_); | 
| 131 | > | MemoryUtils::deletePointers(zconstraints_); | 
| 132 |  | } | 
| 133 |  |  | 
| 134 |  | void Globals::validate() { | 
| 136 |  |  | 
| 137 |  | CheckParameter(ForceField, isNotEmpty()); | 
| 138 |  | CheckParameter(TargetTemp, isPositive()); | 
| 139 | < | CheckParameter(Ensemble, isEqualIgnoreCase(std::string("NVE")) || isEqualIgnoreCase(std::string("NVT")) || isEqualIgnoreCase(std::string("NPTi")) || isEqualIgnoreCase(std::string("NPTf")) || isEqualIgnoreCase(std::string("NPTxyz")) ); | 
| 139 | > | CheckParameter(Ensemble, isEqualIgnoreCase("NVE") || isEqualIgnoreCase("NVT") || isEqualIgnoreCase("NPTi") || isEqualIgnoreCase("NPTf") || isEqualIgnoreCase("NPTxyz") || isEqualIgnoreCase("NPAT")  || isEqualIgnoreCase("LANGEVINDYNAMICS") || isEqualIgnoreCase("LD") || isEqualIgnoreCase("NPRT") || isEqualIgnoreCase("NPGT")); | 
| 140 |  | CheckParameter(Dt, isPositive()); | 
| 141 |  | CheckParameter(RunTime, isPositive()); | 
| 142 |  | CheckParameter(InitialConfig, isNotEmpty()); | 
| 154 |  | CheckParameter(ZconsTime, isPositive()); | 
| 155 |  | CheckParameter(ZconsTol, isPositive()); | 
| 156 |  | CheckParameter(Seed, isPositive()); | 
| 157 | < | CheckParameter(Minimizer, isEqualIgnoreCase(std::string("SD")) || isEqualIgnoreCase(std::string("CG"))); | 
| 157 | > | CheckParameter(Minimizer, isEqualIgnoreCase("SD") || isEqualIgnoreCase("CG")); | 
| 158 |  | CheckParameter(MinimizerMaxIter, isPositive()); | 
| 159 |  | CheckParameter(MinimizerWriteFrq, isPositive()); | 
| 160 |  | CheckParameter(MinimizerStepSize, isPositive()); | 
| 164 |  | CheckParameter(MinimizerLSMaxIter, isPositive()); | 
| 165 |  | CheckParameter(ZconsGap, isPositive()); | 
| 166 |  | CheckParameter(ZconsFixtime, isPositive()); | 
| 167 | < | CheckParameter(ThermodynamicIntegrationLambda, isPositive()); | 
| 167 | > | CheckParameter(ThermodynamicIntegrationLambda, isNonNegative()); | 
| 168 |  | CheckParameter(ThermodynamicIntegrationK, isPositive()); | 
| 169 |  | CheckParameter(ForceFieldVariant, isNotEmpty()); | 
| 170 |  | CheckParameter(ForceFieldFileName, isNotEmpty()); | 
| 171 |  | CheckParameter(ThermIntDistSpringConst, isPositive()); | 
| 172 |  | CheckParameter(ThermIntThetaSpringConst, isPositive()); | 
| 173 |  | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | 
| 174 | < | CheckParameter(SurfaceTension, isPositive()); | 
| 175 | < | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase(std::string("NONE")) || isEqualIgnoreCase(std::string("SHIFTED_POTENTIAL")) || isEqualIgnoreCase(std::string("SHIFTED_FORCE")) || isEqualIgnoreCase(std::string("REACTION_FIELD"))); | 
| 176 | < | CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase(std::string("UNDAMPED")) || isEqualIgnoreCase(std::string("DAMPED"))); | 
| 177 | < | CheckParameter(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || isEqualIgnoreCase(std::string("MAX")) || isEqualIgnoreCase(std::string("TRADITIONAL"))); | 
| 178 | < | CheckParameter(SwitchingFunctionType, isEqualIgnoreCase(std::string("CUBIC")) || isEqualIgnoreCase(std::string("FIFTH_ORDER_POLYNOMIAL"))); | 
| 174 | > | CheckParameter(SurfaceTension, isNonNegative()); | 
| 175 | > | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase("NONE") || isEqualIgnoreCase("SHIFTED_POTENTIAL") || isEqualIgnoreCase("SHIFTED_FORCE") || isEqualIgnoreCase("REACTION_FIELD")); | 
| 176 | > | CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase("UNDAMPED") || isEqualIgnoreCase("DAMPED")); | 
| 177 | > | CheckParameter(CutoffPolicy, isEqualIgnoreCase("MIX") || isEqualIgnoreCase("MAX") || isEqualIgnoreCase("TRADITIONAL")); | 
| 178 | > | CheckParameter(SwitchingFunctionType, isEqualIgnoreCase("CUBIC") || isEqualIgnoreCase("FIFTH_ORDER_POLYNOMIAL")); | 
| 179 |  | //CheckParameter(StatFileFormat,); | 
| 174 | – | //CheckParameter(MixingRule,); | 
| 180 |  | CheckParameter(OrthoBoxTolerance, isPositive()); | 
| 181 |  | CheckParameter(ThermIntDistSpringConst, isPositive()); | 
| 182 |  | CheckParameter(ThermIntThetaSpringConst, isPositive()); | 
| 183 |  | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | 
| 184 |  | CheckParameter(DampingAlpha,isNonNegative()); | 
| 185 |  | CheckParameter(SkinThickness, isPositive()); | 
| 186 | < |  | 
| 186 | > | CheckParameter(Viscosity, isNonNegative()); | 
| 187 | > | CheckParameter(BeadSize, isPositive()); | 
| 188 | > | CheckParameter(FrozenBufferRadius, isPositive()); | 
| 189 | > | CheckParameter(LangevinBufferRadius, isPositive()); | 
| 190 |  | for(std::vector<Component*>::iterator i = components_.begin(); i != components_.end(); ++i) { | 
| 191 |  | if (!(*i)->findMoleculeStamp(moleculeStamps_)) { | 
| 192 | < | std::cout << "Globals Error: can not find molecule stamp for component" << std::endl; | 
| 192 | > | std::ostringstream oss; | 
| 193 | > | oss << "Globals Error: can not find molecule stamp for component " << (*i)->getType() << std::endl; | 
| 194 | > | throw OOPSEException(oss.str()); | 
| 195 |  | } | 
| 196 |  | } | 
| 197 |  | } | 
| 215 |  | moleculeStamps_.insert(std::map<std::string, MoleculeStamp*>::value_type(molStampName, molStamp)); | 
| 216 |  | ret = true; | 
| 217 |  | } else { | 
| 218 | < |  | 
| 218 | > | std::ostringstream oss; | 
| 219 | > | oss << "Globals Error: Molecule Stamp " << molStamp->getName() << "appears multiple times\n"; | 
| 220 | > | throw OOPSEException(oss.str()); | 
| 221 |  | } | 
| 222 |  | return ret; | 
| 223 |  | } |