Changeset c1db05 for src/Parser/MpqcParser_Parameters.cpp
- Timestamp:
- Oct 10, 2011, 2:27:06 PM (14 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, Candidate_v1.7.0, 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:
- 4151b0
- Parents:
- e611dc
- git-author:
- Frederik Heber <heber@…> (09/06/11 08:45:22)
- git-committer:
- Frederik Heber <heber@…> (10/10/11 14:27:06)
- File:
-
- 1 edited
-
src/Parser/MpqcParser_Parameters.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/MpqcParser_Parameters.cpp
re611dc rc1db05 35 35 36 36 MpqcParser_Parameters::MpqcParser_Parameters() 37 { 38 Init(); 39 } 40 41 void MpqcParser_Parameters::Init() 37 42 { 38 43 // add all known basis … … 106 111 107 112 initParameters(); 113 } 114 115 MpqcParser_Parameters::MpqcParser_Parameters(const MpqcParser_Parameters & state) 116 { 117 // init 118 Init(); 119 120 // copy values 121 copyParameters(state); 122 } 123 124 void MpqcParser_Parameters::copyParameters(const MpqcParser_Parameters & state) 125 { 126 appendParameter(hessianParam, state.getBool(hessianParam)); 127 appendParameter(savestateParam, state.getBool(savestateParam)); 128 appendParameter(do_gradientParam, state.getBool(do_gradientParam)); 129 appendParameter(maxiterParam, state.getInt(maxiterParam)); 130 appendParameter(memoryParam, state.getInt(memoryParam)); 131 appendParameter(stdapproxParam, state.getString(stdapproxParam)); 132 appendParameter(nfzcParam, state.getInt(nfzcParam)); 133 appendParameter(basisParam, state.getString(basisParam)); 134 appendParameter(aux_basisParam, state.getString(aux_basisParam)); 135 appendParameter(integrationParam, state.getIntegration()); 136 appendParameter(theoryParam, state.getTheory()); 137 } 138 139 FormatParser_Parameters* MpqcParser_Parameters::clone() const 140 { 141 //LOG(3, "Cloning parameters."); 142 MpqcParser_Parameters *instance = new MpqcParser_Parameters(*this); 143 return instance; 144 } 145 146 void MpqcParser_Parameters::makeClone(const FormatParser_Parameters & _state) 147 { 148 //LOG(3, "Cloning parameters from other instance."); 149 copyParameters(static_cast<const MpqcParser_Parameters &>(_state)); 108 150 } 109 151 … … 279 321 } 280 322 281 enum MpqcParser_Parameters::Parameters MpqcParser_Parameters::getParam(std::string _name) 282 { 283 return ParamLookup[_name]; 284 } 285 286 enum MpqcParser_Parameters::IntegrationMethod MpqcParser_Parameters::getIntegration() 287 { 323 enum MpqcParser_Parameters::Parameters MpqcParser_Parameters::getParam(std::string _name) const 324 { 325 ParamLookupType::const_iterator iter = ParamLookup.find(_name); 326 return iter->second; 327 } 328 329 enum MpqcParser_Parameters::IntegrationMethod MpqcParser_Parameters::getIntegration() const 330 { 331 parameterlist::const_iterator iter = params.find(integrationParam); 288 332 enum IntegrationMethod value; 289 333 // TODO: throw exception instead of eLog() 290 334 // try { 291 value = boost::any_cast<enum IntegrationMethod>( params[integrationParam]);335 value = boost::any_cast<enum IntegrationMethod>(iter->second); 292 336 // } catch(const boost::bad_any_cast &) { 293 337 // DoeLog(0) && (eLog() << Verbose(0) … … 298 342 } 299 343 300 enum MpqcParser_Parameters::Theory MpqcParser_Parameters::getTheory() 301 { 344 enum MpqcParser_Parameters::Theory MpqcParser_Parameters::getTheory() const 345 { 346 parameterlist::const_iterator iter = params.find(theoryParam); 302 347 enum Theory value; 303 348 // TODO: throw exception instead of eLog() 304 349 // try { 305 value = boost::any_cast<enum Theory>( params[theoryParam]);350 value = boost::any_cast<enum Theory>(iter->second); 306 351 // } catch(const boost::bad_any_cast &) { 307 352 // DoeLog(0) && (eLog() << Verbose(0) … … 312 357 } 313 358 314 std::string MpqcParser_Parameters::getString(enum Parameters _param) 359 std::string MpqcParser_Parameters::getString(enum Parameters _param) const 315 360 { 316 361 std::string value; … … 318 363 enum Theory Tindex; 319 364 bool test; 365 parameterlist::const_iterator iter = params.find(_param); 320 366 switch (_param) { 321 367 case hessianParam: 322 368 case savestateParam: 323 369 case do_gradientParam: 324 test = boost::any_cast<bool>( params[_param]);370 test = boost::any_cast<bool>(iter->second); 325 371 if (test) 326 372 value = "yes"; … … 331 377 // TODO: throw exception instead of eLog() 332 378 // try { 333 Iindex = boost::any_cast<enum IntegrationMethod>( params[_param]);379 Iindex = boost::any_cast<enum IntegrationMethod>(iter->second); 334 380 // } catch(const boost::bad_any_cast &) { 335 381 // DoeLog(0) && (eLog() << Verbose(0) … … 337 383 // +ParamNames[_param]+" to string!" << std::endl); 338 384 // } 339 value = IntegrationNames[Iindex]; 385 { 386 IntegrationNamesType::const_iterator Iiter = IntegrationNames.find(Iindex); 387 value = Iiter->second; 388 } 340 389 break; 341 390 case theoryParam: 342 391 // TODO: throw exception instead of eLog() 343 392 // try { 344 Tindex = boost::any_cast<enum Theory>( params[_param]);393 Tindex = boost::any_cast<enum Theory>(iter->second); 345 394 // } catch(const boost::bad_any_cast &) { 346 395 // DoeLog(0) && (eLog() << Verbose(0) … … 348 397 // +ParamNames[_param]+" to string!" << std::endl); 349 398 // } 350 value = TheoryNames[(enum Theory)Tindex]; 399 { 400 TheoryNamesType::const_iterator Titer = TheoryNames.find(Tindex); 401 value = Titer->second; 402 } 351 403 break; 352 404 default: 353 405 // TODO: throw exception instead of eLog() 354 406 // try { 355 value = boost::any_cast<std::string>( params[_param]);407 value = boost::any_cast<std::string>(iter->second); 356 408 // } catch(const boost::bad_any_cast &) { 357 409 // DoeLog(0) && (eLog() << Verbose(0) … … 365 417 } 366 418 367 int MpqcParser_Parameters::getInt(enum Parameters _param) 419 int MpqcParser_Parameters::getInt(enum Parameters _param) const 368 420 { 369 421 int value; 422 parameterlist::const_iterator iter = params.find(_param); 370 423 switch (_param) { 371 424 default: 372 425 // TODO: throw exception instead of eLog() 373 426 // try { 374 value = boost::any_cast<int>( params[_param]);427 value = boost::any_cast<int>(iter->second); 375 428 // } catch(const boost::bad_any_cast &) { 376 429 // DoeLog(0) && (eLog() << Verbose(0) … … 383 436 } 384 437 385 double MpqcParser_Parameters::getDouble(enum Parameters _param) 438 double MpqcParser_Parameters::getDouble(enum Parameters _param) const 386 439 { 387 440 double value; 388 // TODO: throw exception instead of eLog() 389 // try { 390 value = boost::any_cast<double>(params[_param]); 441 parameterlist::const_iterator iter = params.find(_param); 442 // TODO: throw exception instead of eLog() 443 // try { 444 value = boost::any_cast<double>(iter->second); 391 445 // } catch(const boost::bad_any_cast &) { 392 446 // DoeLog(0) && (eLog() << Verbose(0) … … 397 451 } 398 452 399 bool MpqcParser_Parameters::getBool(enum Parameters _param) 453 bool MpqcParser_Parameters::getBool(enum Parameters _param) const 400 454 { 401 455 bool value; 402 // TODO: throw exception instead of eLog() 403 // try { 404 value = boost::any_cast<bool>(params[_param]); 456 parameterlist::const_iterator iter = params.find(_param); 457 // TODO: throw exception instead of eLog() 458 // try { 459 value = boost::any_cast<bool>(iter->second); 405 460 // } catch(const boost::bad_any_cast &) { 406 461 // DoeLog(0) && (eLog() << Verbose(0)
Note:
See TracChangeset
for help on using the changeset viewer.
