- Timestamp:
- Feb 27, 2013, 12:42:37 PM (12 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:
- 77552d
- Parents:
- 39a07a
- git-author:
- Frederik Heber <heber@…> (12/11/12 10:42:50)
- git-committer:
- Frederik Heber <heber@…> (02/27/13 12:42:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/LevMartester.cpp
r39a07a r46fcc0 81 81 using namespace boost::assign; 82 82 83 HomologyGraph getFirstGraphwith TimesSpecificElement(83 HomologyGraph getFirstGraphwithSpecifiedElements( 84 84 const HomologyContainer &homologies, 85 const size_t _number, 86 const size_t _times) 85 const FunctionModel::charges_t &charges) 87 86 { 88 for (HomologyContainer::container_t::const_iterator iter = 89 homologies.begin(); iter != homologies.end(); ++iter) { 90 if (iter->first.hasTimesAtomicNumber(_number,_times)) 91 return iter->first; 87 ASSERT( !charges.empty(), 88 "getFirstGraphwithSpecifiedElements() - charges is empty?"); 89 // convert into count map 90 Extractors::elementcounts_t counts_per_charge = 91 Extractors::_detail::getElementCounts(charges); 92 ASSERT( !counts_per_charge.empty(), 93 "getFirstGraphwithSpecifiedElements() - charge counts are empty?"); 94 LOG(2, "DEBUG: counts_per_charge is " << counts_per_charge << "."); 95 // we want to check each (unique) key only once 96 HomologyContainer::const_key_iterator olditer = homologies.key_end(); 97 for (HomologyContainer::const_key_iterator iter = 98 homologies.key_begin(); iter != homologies.key_end(); olditer = iter++) { 99 // if it's the same as the old one, skip it 100 if (*olditer == *iter) 101 continue; 102 // if it's a new key, check if every element has the right number of counts 103 Extractors::elementcounts_t::const_iterator countiter = counts_per_charge.begin(); 104 for (; countiter != counts_per_charge.end(); ++countiter) 105 if (!(*iter).hasTimesAtomicNumber(countiter->first,countiter->second)) 106 break; 107 if( countiter == counts_per_charge.end()) 108 return *iter; 92 109 } 93 110 return HomologyGraph(); … … 176 193 ("homology-file", po::value< boost::filesystem::path >(), "homology file to parse") 177 194 ("fit-potential", po::value< std::string >(), "potential type to fit") 178 ("charges", po::value< FunctionModel::charges_t >()->multitoken(), "charges specifying the fragment") 195 ("charges", po::value< FunctionModel::charges_t >()->multitoken(), "charges specifying the potential") 196 ("fragment", po::value< FunctionModel::charges_t >()->multitoken(), "all charges in the fragment") 179 197 ; 180 198 … … 211 229 if (vm.count("charges")) { 212 230 charges = vm["charges"].as< FunctionModel::charges_t >(); 231 } else { 232 ELOG(0, "Vector of charges specifying the potential (charges) was not set."); 233 return 1; 234 } 235 236 // fragment 237 FunctionModel::charges_t fragment; 238 if (vm.count("fragment")) { 239 fragment = vm["fragment"].as< FunctionModel::charges_t >(); 213 240 } else { 214 241 ELOG(0, "Vector of charges specifying the fragment (charges) was not set."); … … 237 264 for (HomologyContainer::container_t::const_iterator iter = 238 265 homologies.begin(); iter != homologies.end(); ++iter) { 239 LOG(1, "INFO: graph " << iter->first << " has Fragment " 240 << iter->second.first << " and associated energy " << iter->second.second << "."); 241 } 242 243 LOG(0, "STATUS: I'm training now a " << potentialtype << " potential on charges " << charges << "."); 266 LOG(1, "INFO: graph " << iter->first << " has Fragment " << iter->second.first 267 << " and associated energy " << iter->second.second << "."); 268 } 269 270 LOG(0, "STATUS: I'm training now a " << potentialtype << " potential on charges " 271 << charges << "."); 244 272 245 273 /******************** TRAINING ********************/ … … 254 282 { 255 283 // then we ought to pick the right HomologyGraph ... 256 const HomologyGraph graph = getFirstGraphwith TimesSpecificElement(homologies,8,1);284 const HomologyGraph graph = getFirstGraphwithSpecifiedElements(homologies,fragment); 257 285 if (graph != HomologyGraph()) { 258 LOG(1, "First representative graph containing charges is " << graph << "."); 286 LOG(1, "First representative graph containing fragment " 287 << fragment << " is " << graph << "."); 259 288 260 289 // Afterwards we go through all of this type and gather the distance and the energy value
Note:
See TracChangeset
for help on using the changeset viewer.