- Timestamp:
- Oct 14, 2011, 3:15:32 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:
- e09d67
- Parents:
- 765f16
- git-author:
- Frederik Heber <heber@…> (09/28/11 12:58:10)
- git-committer:
- Frederik Heber <heber@…> (10/14/11 15:15:32)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/MpqcParser_Parameters.cpp
r765f16 rd3d6c6 21 21 #include <boost/tokenizer.hpp> 22 22 #include <string> 23 #include <typeinfo> 23 24 24 25 #include "CodePatterns/MemDebug.hpp" 25 26 26 27 #include "CodePatterns/Log.hpp" 27 #include "CodePatterns/Verbose.hpp"28 28 29 29 #include "MpqcParser.hpp" … … 37 37 { 38 38 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 invert 47 * \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 uniqueness 59 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->first 65 << "," << iter->second << "). Key is already present as (" << inserter.first->first 66 << "," << inserter.first->second << ") in InvertMap."); 67 } 39 68 } 40 69 … … 49 78 TheoryNames[MBPT2]="MBPT2"; 50 79 TheoryNames[MBPT2_R12]="MBPT2_R12"; 51 52 { 53 // TODO: throw exception instead of eLog() 54 std::pair<TheoryLookupType::iterator, bool> inserter; 55 for (TheoryNamesType::iterator iter = TheoryNames.begin(); 56 iter != TheoryNames.end(); 57 ++iter) { 58 inserter = TheoryLookup.insert( make_pair(iter->second, iter->first) ); 59 if (!inserter.second) 60 DoeLog(0) && (eLog() << Verbose(0) 61 << "MpqcParser_Parameters::MpqcParser_Parameters() - Theory name already present: " 62 << (inserter.first)->second << " and " << iter->first << "!" 63 << std::endl); 64 } 65 } 80 InvertMap<TheoryNamesType,TheoryLookupType>(TheoryNames,TheoryLookup); 66 81 67 82 // add all integration names 68 83 IntegrationNames[IntegralCints] = "IntegralCints"; 69 { 70 // TODO: throw exception instead of eLog() 71 std::pair<IntegrationLookupType::iterator, bool> inserter; 72 for (IntegrationNamesType::iterator iter = IntegrationNames.begin(); 73 iter != IntegrationNames.end(); 74 ++iter) { 75 inserter = IntegrationLookup.insert( make_pair(iter->second, iter->first) ); 76 if (!inserter.second) 77 DoeLog(0) && (eLog() << Verbose(0) 78 << "MpqcParser_Parameters::MpqcParser_Parameters() - Integration name already present: " 79 << (inserter.first)->second << " and " << iter->first << "!" 80 << std::endl); 81 } 82 } 84 InvertMap<IntegrationNamesType,IntegrationLookupType>(IntegrationNames, IntegrationLookup); 83 85 84 86 // have names for all parmaters … … 94 96 ParamNames[integrationParam] = "integration"; 95 97 ParamNames[theoryParam] = "theory"; 96 97 { 98 // TODO: throw exception instead of eLog() 99 std::pair<ParamLookupType::iterator, bool> inserter; 100 for (ParamNamesType::iterator iter = ParamNames.begin(); 101 iter != ParamNames.end(); 102 ++iter) { 103 inserter = ParamLookup.insert( make_pair(iter->second, iter->first) ); 104 if (!inserter.second) 105 DoeLog(0) && (eLog() << Verbose(0) 106 << "MpqcParser_Parameters::MpqcParser_Parameters() - parameter name already present: " 107 << (inserter.first)->second << " and " << iter->first << "!" 108 << std::endl); 109 } 110 } 98 InvertMap<ParamNamesType,ParamLookupType>(ParamNames, ParamLookup); 111 99 112 100 initParameters();
Note:
See TracChangeset
for help on using the changeset viewer.