# | 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 121 | Line 121 | Globals::~Globals() { | |
121 | } | |
122 | ||
123 | Globals::~Globals() { | |
124 | < | |
125 | < | |
124 | > | MemoryUtils::deletePointers(components_); |
125 | > | MemoryUtils::deletePointers(zconstraints_); |
126 | } | |
127 | ||
128 | void Globals::validate() { | |
# | Line 130 | Line 130 | 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") ); |
134 | CheckParameter(Dt, isPositive()); | |
135 | CheckParameter(RunTime, isPositive()); | |
136 | CheckParameter(InitialConfig, isNotEmpty()); | |
# | Line 148 | Line 148 | void Globals::validate() { | |
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()); | |
# | Line 166 | Line 166 | void Globals::validate() { | |
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,); | |
175 | CheckParameter(OrthoBoxTolerance, isPositive()); | |
# | Line 181 | Line 181 | void Globals::validate() { | |
181 | ||
182 | for(std::vector<Component*>::iterator i = components_.begin(); i != components_.end(); ++i) { | |
183 | if (!(*i)->findMoleculeStamp(moleculeStamps_)) { | |
184 | < | std::cout << "Globals Error: can not find molecule stamp for component" << std::endl; |
184 | > | std::ostringstream oss; |
185 | > | oss << "Globals Error: can not find molecule stamp for component " << (*i)->getType() << std::endl; |
186 | > | throw OOPSEException(oss.str()); |
187 | } | |
188 | } | |
189 | } | |
# | Line 205 | Line 207 | bool Globals::addMoleculeStamp(MoleculeStamp* molStamp | |
207 | moleculeStamps_.insert(std::map<std::string, MoleculeStamp*>::value_type(molStampName, molStamp)); | |
208 | ret = true; | |
209 | } else { | |
210 | < | |
210 | > | std::ostringstream oss; |
211 | > | oss << "Globals Error: Molecule Stamp " << molStamp->getName() << "appears multiple times\n"; |
212 | > | throw OOPSEException(oss.str()); |
213 | } | |
214 | return ret; | |
215 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |