Changeset ee50c1 for src/Parser/MpqcParser_Parameters.cpp
- Timestamp:
- Oct 17, 2011, 4:56:36 PM (13 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 1bef07
- Parents:
- 89a67f
- git-author:
- Frederik Heber <heber@…> (09/30/11 16:20:34)
- git-committer:
- Frederik Heber <heber@…> (10/17/11 16:56:36)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/MpqcParser_Parameters.cpp
r89a67f ree50c1 21 21 #include <boost/tokenizer.hpp> 22 22 #include <string> 23 #include <typeinfo>24 23 25 24 #include "CodePatterns/MemDebug.hpp" … … 31 30 #include "MpqcParser_Parameters.hpp" 32 31 33 34 using boost::any_cast; 32 #include "Parser/Parameters/ContinuousParameter.hpp" 33 #include "Parser/Parameters/DiscreteParameter.hpp" 34 #include "Parser/Parameters/StringParameter.hpp" 35 36 template <> 37 const std::string ContinuousValue<bool>::get() const 38 { 39 ASSERT(ValueSet, 40 "ContinuousValue<bool>::get() - requesting unset value."); 41 if (value) 42 return std::string("yes"); 43 else 44 return std::string("no"); 45 } 46 47 template <> 48 void ContinuousValue<bool>::set(const std::string _value) 49 { 50 if (_value == std::string("yes")) { 51 setValue(true); 52 } else if (_value == std::string("no")) { 53 setValue(false); 54 } else { 55 ASSERT(0, 56 "void ContinuousValue<bool>::set() - value "+_value+" is neither yes or no."); 57 } 58 } 59 35 60 36 61 MpqcParser_Parameters::MpqcParser_Parameters() 37 62 { 38 63 Init(); 39 }40 41 /** Inverter for the (key, value) pairs in a map.42 *43 * Basically, we just clear \a invertmap and fill with (value, key).44 * \note critial error is thrown when values are not unique in \a realmap.45 *46 * \param realmap the map to invert47 * \param invertmap the map that is cleared and filled with (value, key)48 */49 template <typename MapType, typename InvertMapType>50 void InvertMap(const MapType &realmap, InvertMapType &invertmap)51 {52 invertmap.clear();53 // TODO: throw exception instead of eLog()54 std::pair<typename InvertMapType::iterator, bool> inserter;55 for (typename MapType::const_iterator iter = realmap.begin();56 iter != realmap.end();57 ++iter) {58 // check uniqueness59 const std::pair<typename InvertMapType::iterator, bool> inserter =60 invertmap.insert( std::make_pair(iter->second, iter->first) );61 if (!inserter.second)62 ELOG(0, "InvertMap<"63 //+std::typeid(realmap).name()+", "+std::typeid(invertmap).name()64 << ">() - cannot invert (" << iter->first65 << "," << iter->second << "). Key is already present as (" << inserter.first->first66 << "," << inserter.first->second << ") in InvertMap.");67 }68 64 } 69 65 … … 73 69 initBasis(); 74 70 75 // add all theory names 76 TheoryNames[CLHF]="CLHF"; 77 TheoryNames[CLKS]="CLKS"; 78 TheoryNames[MBPT2]="MBPT2"; 79 TheoryNames[MBPT2_R12]="MBPT2_R12"; 80 InvertMap<TheoryNamesType,TheoryLookupType>(TheoryNames,TheoryLookup); 81 82 // add all integration names 83 IntegrationNames[IntegralCints] = "IntegralCints"; 84 InvertMap<IntegrationNamesType,IntegrationLookupType>(IntegrationNames, IntegrationLookup); 85 86 // have names for all parmaters 87 ParamNames[hessianParam] = "Hessian"; 88 ParamNames[savestateParam] = "savestate"; 89 ParamNames[do_gradientParam] = "do_gradient"; 90 ParamNames[maxiterParam] = "maxiter"; 91 ParamNames[memoryParam] = "memory"; 92 ParamNames[stdapproxParam] = "stdapprox"; 93 ParamNames[nfzcParam] = "nfzc"; 94 ParamNames[basisParam] = "basis"; 95 ParamNames[aux_basisParam] = "aux_basis"; 96 ParamNames[integrationParam] = "integration"; 97 ParamNames[theoryParam] = "theory"; 98 InvertMap<ParamNamesType,ParamLookupType>(ParamNames, ParamLookup); 99 100 initParameters(); 101 } 102 103 MpqcParser_Parameters::MpqcParser_Parameters(const MpqcParser_Parameters & state) 104 { 105 // init 106 Init(); 107 108 // copy values 109 copyParameters(state); 110 } 111 112 void MpqcParser_Parameters::copyParameters(const MpqcParser_Parameters & state) 113 { 114 appendParameter(hessianParam, state.getBool(hessianParam)); 115 appendParameter(savestateParam, state.getBool(savestateParam)); 116 appendParameter(do_gradientParam, state.getBool(do_gradientParam)); 117 appendParameter(maxiterParam, state.getInt(maxiterParam)); 118 appendParameter(memoryParam, state.getInt(memoryParam)); 119 appendParameter(stdapproxParam, state.getString(stdapproxParam)); 120 appendParameter(nfzcParam, state.getInt(nfzcParam)); 121 appendParameter(basisParam, state.getString(basisParam)); 122 appendParameter(aux_basisParam, state.getString(aux_basisParam)); 123 appendParameter(integrationParam, state.getIntegration()); 124 appendParameter(theoryParam, state.getTheory()); 125 } 126 127 FormatParser_Parameters* MpqcParser_Parameters::clone() const 128 { 129 //LOG(3, "Cloning parameters."); 130 MpqcParser_Parameters *instance = new MpqcParser_Parameters(*this); 131 return instance; 132 } 133 134 void MpqcParser_Parameters::makeClone(const FormatParser_Parameters & _state) 135 { 136 //LOG(3, "Cloning parameters from other instance."); 137 copyParameters(static_cast<const MpqcParser_Parameters &>(_state)); 138 } 139 140 void MpqcParser_Parameters::initParameters() 141 { 142 appendParameter(hessianParam, bool(false)); 143 appendParameter(savestateParam, bool(false)); 144 appendParameter(do_gradientParam, bool(true)); 145 appendParameter(maxiterParam, int(1000)); 146 appendParameter(memoryParam, int(16000000)); 147 appendParameter(stdapproxParam, std::string("A'")); 148 appendParameter(nfzcParam, int(1)); 149 appendParameter(basisParam, std::string("3-21G")); 150 appendParameter(aux_basisParam, std::string("aug-cc-pVDZ")); 151 appendParameter(integrationParam, IntegralCints); 152 appendParameter(theoryParam, MBPT2); 71 // add all parameter names 72 { 73 ParamNames.clear(); 74 ParamNames.resize(unknownParam); 75 ParamNames[hessianParam] = "Hessian"; 76 ParamNames[savestateParam] = "savestate"; 77 ParamNames[do_gradientParam] = "do_gradient"; 78 ParamNames[maxiterParam] = "maxiter"; 79 ParamNames[memoryParam] = "memory"; 80 ParamNames[stdapproxParam] = "stdapprox"; 81 ParamNames[nfzcParam] = "nfzc"; 82 ParamNames[basisParam] = "basis"; 83 ParamNames[aux_basisParam] = "aux_basis"; 84 ParamNames[integrationParam] = "integration"; 85 ParamNames[theoryParam] = "theory"; 86 } 87 88 // create theory parameter 89 { 90 ValidTheories.clear(); 91 ValidTheories.resize(unknownTheory); 92 ValidTheories[CLHF]="CLHF"; 93 ValidTheories[CLKS]="CLKS"; 94 ValidTheories[MBPT2]="MBPT2"; 95 ValidTheories[MBPT2_R12]="MBPT2_R12"; 96 appendParameter( 97 new DiscreteParameter<std::string>( 98 ParamNames[theoryParam], 99 ValidTheories, 100 ValidTheories[MBPT2])); 101 } 102 //InvertMap<TheoryNamesType,TheoryLookupType>(TheoryNames,TheoryLookup); 103 104 // create integration parameter 105 { 106 ValidIntegrationMethods.clear(); 107 ValidIntegrationMethods.resize(unknownIntegration); 108 ValidIntegrationMethods[IntegralCints] = "IntegralCints"; 109 appendParameter( 110 new DiscreteParameter<std::string>( 111 ParamNames[integrationParam], 112 ValidIntegrationMethods, 113 ValidIntegrationMethods[IntegralCints])); 114 } 115 116 // add all continuous parameters 117 { 118 appendParameter(new ContinuousParameter<bool>(ParamNames[hessianParam], false)); 119 appendParameter(new ContinuousParameter<bool>(ParamNames[savestateParam], false)); 120 appendParameter(new ContinuousParameter<bool>(ParamNames[do_gradientParam], true)); 121 appendParameter(new ContinuousParameter<int>(ParamNames[maxiterParam], 1000)); 122 appendParameter(new ContinuousParameter<int>(ParamNames[memoryParam], 16000000)); 123 appendParameter(new StringParameter(ParamNames[stdapproxParam], "A'")); 124 appendParameter(new ContinuousParameter<int>(ParamNames[nfzcParam], 1)); 125 appendParameter(new StringParameter(ParamNames[basisParam], "3-21G")); 126 appendParameter(new StringParameter(ParamNames[aux_basisParam], "aug-cc-pVDZ")); 127 } 153 128 } 154 129 … … 156 131 {} 157 132 158 std::ostream & operator << (std::ostream& ost, MpqcParser_Parameters const &_mpqc_params) 133 /** Getter for a specific Parameter. 134 * 135 * @param param index among enum Parameters 136 * @return value of the desired Parameters 137 */ 138 const std::string MpqcParser_Parameters::getParameter(const enum Parameters param) const 139 { 140 return FormatParser_Parameters::getParameter(ParamNames[param])->get(); 141 } 142 143 /** Setter for a specific Parameter. 144 * 145 * @param param index among enum Parameters 146 * @param _value value to set desired Parameter to 147 */ 148 void MpqcParser_Parameters::setParameter(const enum Parameters param, const std::string &_value) 149 { 150 const std::string &name = getParameterName(param); 151 FormatParser_Parameters::getParameter(name)->set(_value); 152 } 153 154 /** Getter for name of a specific Parameter. 155 * 156 * @param param index among enum Parameters 157 * @return name of the desired Parameter 158 */ 159 const std::string &MpqcParser_Parameters::getParameterName(const enum Parameters param) const 160 { 161 return ParamNames[param]; 162 } 163 164 /** Getter for name of a specific Parameter. 165 * 166 * @param param index among enum Theory 167 * @return name of the desired Theory 168 */ 169 const std::string &MpqcParser_Parameters::getTheoryName(const enum Theory theory) const 170 { 171 return ValidTheories[theory]; 172 } 173 174 /** Getter for the name of specific of IntegrationMethod. 175 * 176 * @param param index among enum IntegrationMethod 177 * @return value of the desired IntegrationMethod 178 */ 179 const std::string &MpqcParser_Parameters::getIntegrationMethodName(const enum IntegrationMethod integration) const 180 { 181 return ValidIntegrationMethods[integration]; 182 } 183 184 185 /** Output operator for the contents of MpqcParser_Parameters::params. 186 * 187 * @param ost output stream 188 * @param params reference to MpqcParser_Parameters containing params. 189 * @return reference to output stream for concatenation 190 */ 191 std::ostream & operator << (std::ostream& ost, const MpqcParser_Parameters ¶ms) 159 192 { 160 193 // this is ugly, but with boost::any to safeguard const-ness is plain impossible 161 MpqcParser_Parameters &mpqc_params = const_cast<MpqcParser_Parameters &>(_mpqc_params);162 194 std::ostringstream output; 163 output << "Hessian=" << mpqc_params.getBool(MpqcParser_Parameters::hessianParam) << ";"; 164 output << "savestate=" << mpqc_params.getBool(MpqcParser_Parameters::savestateParam) << ";"; 165 output << "do_gradient=" << mpqc_params.getBool(MpqcParser_Parameters::do_gradientParam) << ";"; 166 output << "maxiter=" << mpqc_params.getInt(MpqcParser_Parameters::maxiterParam) << ";"; 167 output << "memory=" << mpqc_params.getInt(MpqcParser_Parameters::memoryParam) << ";"; 168 output << "stdapprox=" << mpqc_params.getString(MpqcParser_Parameters::stdapproxParam) << ";"; 169 output << "nfzc=" << mpqc_params.getInt(MpqcParser_Parameters::nfzcParam) << ";"; 170 output << "basis=" << mpqc_params.getString(MpqcParser_Parameters::basisParam) << ";"; 171 output << "aux_basis=" << mpqc_params.getString(MpqcParser_Parameters::aux_basisParam) << ";"; 172 output << "integration=" << mpqc_params.getString(MpqcParser_Parameters::integrationParam) << ";"; 173 output << "theory=" << mpqc_params.getString(MpqcParser_Parameters::theoryParam) << ";"; 195 for (size_t param = (enum MpqcParser_Parameters::Parameters)0; 196 param < (size_t)MpqcParser_Parameters::unknownParam; ++param) 197 output << params.getParameterName((enum MpqcParser_Parameters::Parameters)param) 198 << "=" << params.getParameter((enum MpqcParser_Parameters::Parameters)param) << ";"; 174 199 ost << output.str(); 175 200 return ost; 176 201 } 177 202 203 /** Input operator for a list of parameters to place into \a params. 204 * 205 * @param ist input stream 206 * @param params parameters to parse into 207 * @return input stream for concatenation 208 */ 178 209 std::istream & operator >> (std::istream& ist, MpqcParser_Parameters ¶ms) 179 210 { … … 216 247 217 248 // TODO: throw exception instead of DoeLog() 218 ASSERT(params.haveParam (key),249 ASSERT(params.haveParameter(key), 219 250 "operator >> on MpqcParser_Parameters - unknown parameter name '" 220 251 +key+"' with value "+valuestream.str()+"!"); 221 if (params.haveParam(key)) 222 params.setter(params.getParam(key), valuestream); 252 if (params.haveParameter(key)) { 253 Parameter *instance = params.FormatParser_Parameters::getParameter(key); 254 instance->set(valuestream.str()); 255 } 223 256 } else { 224 257 ist.setstate(std::ios::eofbit); … … 228 261 } 229 262 230 231 /** Sets a desired value in the params from a string.232 *233 * This is due to strict typing of C++ very ugly and boost::any does not make234 * it any better because it offers to functions to use values directly from235 * stringstream. Probably, because value is unknown to is as well and hence236 * the author could not implement it beautifully, so he dropped it altogether.237 * Grrr ....238 *239 * @param _param param to set240 * @param _desired stringstream containing value as next argument241 * @return true - type ok, false - unknown type in params.242 */243 bool MpqcParser_Parameters::setter(enum Parameters _param, std::stringstream& _desired) {244 if (_param == integrationParam) {245 std::string tmp;246 _desired >> tmp;247 params[_param] = IntegrationLookup[tmp];248 } else if(_param == theoryParam) {249 std::string tmp;250 _desired >> tmp;251 params[_param] = TheoryLookup[tmp];252 } else if (params[_param].type() == typeid(std::string)) {253 std::string tmp;254 _desired >> tmp;255 params[_param] = tmp;256 } else if (params[_param].type() == typeid(int)) {257 int tmp;258 _desired >> tmp;259 params[_param] = tmp;260 } else if (params[_param].type() == typeid(double)) {261 double tmp;262 _desired >> tmp;263 params[_param] = tmp;264 } else if (params[_param].type() == typeid(bool)) {265 std::string tmp;266 _desired >> tmp;267 if ((tmp == "yes") || (tmp == "1")) {268 params[_param] = bool(true);269 } else if ((tmp == "no") || (tmp == "0")) {270 params[_param] = bool(false);271 } else {272 DoeLog(0) && (eLog() << Verbose(0)273 << "MpqcParser_Parameters::setter() - unknown boolean key "274 << tmp << "!" << std::endl);275 }276 } else {277 DoeLog(0) && (eLog() << Verbose(0)278 << "MpqcParser_Parameters::setter() - unknown type!" << std::endl);279 return false;280 }281 return true;282 }283 284 285 void MpqcParser_Parameters::setTheory(enum Theory _theory)286 {287 // TODO: throw exception instead of eLog()288 // try {289 params[theoryParam] = _theory;290 // } catch(const boost::bad_any_cast &) {291 // DoeLog(0) && (eLog() << Verbose(0)292 // << "MpqcParser_Parameters::setTheory() - could not set boolean!" << std::endl);293 // }294 }295 296 void MpqcParser_Parameters::setIntegration(enum MpqcParser_Parameters::IntegrationMethod _integration){297 // TODO: throw exception instead of eLog()298 // try {299 params[integrationParam] = _integration;300 // } catch(const boost::bad_any_cast &) {301 // DoeLog(0) && (eLog() << Verbose(0)302 // << "MpqcParser_Parameters::setIntegration() - could not set boolean!" << std::endl);303 // }304 }305 306 bool MpqcParser_Parameters::haveParam(std::string _name) const307 {308 return ParamLookup.count(_name) != 0;309 }310 311 enum MpqcParser_Parameters::Parameters MpqcParser_Parameters::getParam(std::string _name) const312 {313 ParamLookupType::const_iterator iter = ParamLookup.find(_name);314 return iter->second;315 }316 317 enum MpqcParser_Parameters::IntegrationMethod MpqcParser_Parameters::getIntegration() const318 {319 parameterlist::const_iterator iter = params.find(integrationParam);320 enum IntegrationMethod value;321 // TODO: throw exception instead of eLog()322 // try {323 value = boost::any_cast<enum IntegrationMethod>(iter->second);324 // } catch(const boost::bad_any_cast &) {325 // DoeLog(0) && (eLog() << Verbose(0)326 // << "MpqcParser_Parameters::getIntegration() - could not convert "327 // +ParamNames[integrationParam]+" to enum IntegrationMethod!" << std::endl);328 // }329 return value;330 }331 332 enum MpqcParser_Parameters::Theory MpqcParser_Parameters::getTheory() const333 {334 parameterlist::const_iterator iter = params.find(theoryParam);335 enum Theory value;336 // TODO: throw exception instead of eLog()337 // try {338 value = boost::any_cast<enum Theory>(iter->second);339 // } catch(const boost::bad_any_cast &) {340 // DoeLog(0) && (eLog() << Verbose(0)341 // << "MpqcParser_Parameters::getTheory() - could not convert "342 // +ParamNames[theoryParam]+" to enum Theory!" << std::endl);343 // }344 return value;345 }346 347 std::string MpqcParser_Parameters::getString(enum Parameters _param) const348 {349 std::string value;350 enum IntegrationMethod Iindex;351 enum Theory Tindex;352 bool test;353 parameterlist::const_iterator iter = params.find(_param);354 switch (_param) {355 case hessianParam:356 case savestateParam:357 case do_gradientParam:358 test = boost::any_cast<bool>(iter->second);359 if (test)360 value = "yes";361 else362 value = "no";363 break;364 case integrationParam:365 // TODO: throw exception instead of eLog()366 // try {367 Iindex = boost::any_cast<enum IntegrationMethod>(iter->second);368 // } catch(const boost::bad_any_cast &) {369 // DoeLog(0) && (eLog() << Verbose(0)370 // << "MpqcParser_Parameters::getString() - could not convert "371 // +ParamNames[_param]+" to string!" << std::endl);372 // }373 {374 IntegrationNamesType::const_iterator Iiter = IntegrationNames.find(Iindex);375 value = Iiter->second;376 }377 break;378 case theoryParam:379 // TODO: throw exception instead of eLog()380 // try {381 Tindex = boost::any_cast<enum Theory>(iter->second);382 // } catch(const boost::bad_any_cast &) {383 // DoeLog(0) && (eLog() << Verbose(0)384 // << "MpqcParser_Parameters::getString() - could not convert "385 // +ParamNames[_param]+" to string!" << std::endl);386 // }387 {388 TheoryNamesType::const_iterator Titer = TheoryNames.find(Tindex);389 value = Titer->second;390 }391 break;392 default:393 // TODO: throw exception instead of eLog()394 // try {395 value = boost::any_cast<std::string>(iter->second);396 // } catch(const boost::bad_any_cast &) {397 // DoeLog(0) && (eLog() << Verbose(0)398 // << "MpqcParser_Parameters::getString() - could not convert "399 // +ParamNames[_param]+" to string!" << std::endl);400 // }401 break;402 }403 404 return value;405 }406 407 int MpqcParser_Parameters::getInt(enum Parameters _param) const408 {409 int value;410 parameterlist::const_iterator iter = params.find(_param);411 switch (_param) {412 default:413 // TODO: throw exception instead of eLog()414 // try {415 value = boost::any_cast<int>(iter->second);416 // } catch(const boost::bad_any_cast &) {417 // DoeLog(0) && (eLog() << Verbose(0)418 // << "MpqcParser_Parameters::getInt() - could not convert "419 // +ParamNames[_param]+" to int!" << std::endl);420 // }421 break;422 }423 return value;424 }425 426 double MpqcParser_Parameters::getDouble(enum Parameters _param) const427 {428 double value;429 parameterlist::const_iterator iter = params.find(_param);430 // TODO: throw exception instead of eLog()431 // try {432 value = boost::any_cast<double>(iter->second);433 // } catch(const boost::bad_any_cast &) {434 // DoeLog(0) && (eLog() << Verbose(0)435 // << "MpqcParser_Parameters::getDouble() - could not convert "436 // +ParamNames[_param]+" to double!" << std::endl);437 // }438 return value;439 }440 441 bool MpqcParser_Parameters::getBool(enum Parameters _param) const442 {443 bool value;444 parameterlist::const_iterator iter = params.find(_param);445 // TODO: throw exception instead of eLog()446 // try {447 value = boost::any_cast<bool>(iter->second);448 // } catch(const boost::bad_any_cast &) {449 // DoeLog(0) && (eLog() << Verbose(0)450 // << "MpqcParser_Parameters::getBool() - could not convert "451 // +ParamNames[_param]+" to bool!" << std::endl);452 // }453 return value;454 }455 456 457 263 /** Checks whether all elements in the world also have parameters in the basis. 458 264 *
Note:
See TracChangeset
for help on using the changeset viewer.