# | Line 45 | Line 45 | |
---|---|---|
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") | |
# | Line 98 | Line 98 | Globals::Globals() { | |
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 | > | |
105 | DefineOptionalParameterWithDefaultValue(UsePeriodicBoundaryConditions, "usePeriodicBoundaryConditions", true); | |
106 | DefineOptionalParameterWithDefaultValue(UseInitalTime, "useInitialTime", false); | |
107 | DefineOptionalParameterWithDefaultValue(UseIntialExtendedSystemState, "useInitialExtendedSystemState", false); | |
# | Line 121 | Line 124 | Globals::~Globals() { | |
124 | } | |
125 | ||
126 | Globals::~Globals() { | |
127 | < | |
128 | < | |
127 | > | MemoryUtils::deletePointers(components_); |
128 | > | MemoryUtils::deletePointers(zconstraints_); |
129 | } | |
130 | ||
131 | void Globals::validate() { | |
# | Line 130 | Line 133 | void Globals::validate() { | |
133 | ||
134 | CheckParameter(ForceField, isNotEmpty()); | |
135 | CheckParameter(TargetTemp, isPositive()); | |
136 | < | CheckParameter(Ensemble, isEqualIgnoreCase(std::string("NVE")) || isEqualIgnoreCase(std::string("NVT")) || isEqualIgnoreCase(std::string("NPTi")) || isEqualIgnoreCase(std::string("NPTf")) || isEqualIgnoreCase(std::string("NPTxyz")) ); |
136 | > | CheckParameter(Ensemble, isEqualIgnoreCase("NVE") || isEqualIgnoreCase("NVT") || isEqualIgnoreCase("NPTi") || isEqualIgnoreCase("NPTf") || isEqualIgnoreCase("NPTxyz") || isEqualIgnoreCase("NPAT") || isEqualIgnoreCase("LANGEVINDYNAMICS") || isEqualIgnoreCase("NPRT")); |
137 | CheckParameter(Dt, isPositive()); | |
138 | CheckParameter(RunTime, isPositive()); | |
139 | CheckParameter(InitialConfig, isNotEmpty()); | |
# | Line 148 | Line 151 | void Globals::validate() { | |
151 | CheckParameter(ZconsTime, isPositive()); | |
152 | CheckParameter(ZconsTol, isPositive()); | |
153 | CheckParameter(Seed, isPositive()); | |
154 | < | CheckParameter(Minimizer, isEqualIgnoreCase(std::string("SD")) || isEqualIgnoreCase(std::string("CG"))); |
154 | > | CheckParameter(Minimizer, isEqualIgnoreCase("SD") || isEqualIgnoreCase("CG")); |
155 | CheckParameter(MinimizerMaxIter, isPositive()); | |
156 | CheckParameter(MinimizerWriteFrq, isPositive()); | |
157 | CheckParameter(MinimizerStepSize, isPositive()); | |
# | Line 165 | Line 168 | void Globals::validate() { | |
168 | CheckParameter(ThermIntDistSpringConst, isPositive()); | |
169 | CheckParameter(ThermIntThetaSpringConst, isPositive()); | |
170 | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | |
171 | < | CheckParameter(SurfaceTension, isPositive()); |
172 | < | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase(std::string("NONE")) || isEqualIgnoreCase(std::string("SHIFTED_POTENTIAL")) || isEqualIgnoreCase(std::string("SHIFTED_FORCE")) || isEqualIgnoreCase(std::string("REACTION_FIELD"))); |
173 | < | CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase(std::string("UNDAMPED")) || isEqualIgnoreCase(std::string("DAMPED"))); |
174 | < | CheckParameter(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || isEqualIgnoreCase(std::string("MAX")) || isEqualIgnoreCase(std::string("TRADITIONAL"))); |
175 | < | CheckParameter(SwitchingFunctionType, isEqualIgnoreCase(std::string("CUBIC")) || isEqualIgnoreCase(std::string("FIFTH_ORDER_POLYNOMIAL"))); |
171 | > | CheckParameter(SurfaceTension, isNonNegative()); |
172 | > | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase("NONE") || isEqualIgnoreCase("SHIFTED_POTENTIAL") || isEqualIgnoreCase("SHIFTED_FORCE") || isEqualIgnoreCase("REACTION_FIELD")); |
173 | > | CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase("UNDAMPED") || isEqualIgnoreCase("DAMPED")); |
174 | > | CheckParameter(CutoffPolicy, isEqualIgnoreCase("MIX") || isEqualIgnoreCase("MAX") || isEqualIgnoreCase("TRADITIONAL")); |
175 | > | CheckParameter(SwitchingFunctionType, isEqualIgnoreCase("CUBIC") || isEqualIgnoreCase("FIFTH_ORDER_POLYNOMIAL")); |
176 | //CheckParameter(StatFileFormat,); | |
174 | – | //CheckParameter(MixingRule,); |
177 | CheckParameter(OrthoBoxTolerance, isPositive()); | |
178 | CheckParameter(ThermIntDistSpringConst, isPositive()); | |
179 | CheckParameter(ThermIntThetaSpringConst, isPositive()); | |
180 | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | |
181 | CheckParameter(DampingAlpha,isNonNegative()); | |
182 | CheckParameter(SkinThickness, isPositive()); | |
183 | < | |
183 | > | CheckParameter(Viscosity,isNonNegative()); |
184 | > | CheckParameter(BeadSize,isPositive()); |
185 | for(std::vector<Component*>::iterator i = components_.begin(); i != components_.end(); ++i) { | |
186 | if (!(*i)->findMoleculeStamp(moleculeStamps_)) { | |
187 | < | std::cout << "Globals Error: can not find molecule stamp for component" << std::endl; |
187 | > | std::ostringstream oss; |
188 | > | oss << "Globals Error: can not find molecule stamp for component " << (*i)->getType() << std::endl; |
189 | > | throw OOPSEException(oss.str()); |
190 | } | |
191 | } | |
192 | } | |
# | Line 205 | Line 210 | bool Globals::addMoleculeStamp(MoleculeStamp* molStamp | |
210 | moleculeStamps_.insert(std::map<std::string, MoleculeStamp*>::value_type(molStampName, molStamp)); | |
211 | ret = true; | |
212 | } else { | |
213 | < | |
213 | > | std::ostringstream oss; |
214 | > | oss << "Globals Error: Molecule Stamp " << molStamp->getName() << "appears multiple times\n"; |
215 | > | throw OOPSEException(oss.str()); |
216 | } | |
217 | return ret; | |
218 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |