Changeset 7b019a for src/Potentials/Specifics
- Timestamp:
- Feb 27, 2013, 12:39:03 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:
- d52819
- Parents:
- 69fcba
- git-author:
- Frederik Heber <heber@…> (11/30/12 15:33:58)
- git-committer:
- Frederik Heber <heber@…> (02/27/13 12:39:03)
- Location:
- src/Potentials/Specifics
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Potentials/Specifics/ManyBodyPotential_Tersoff.cpp
r69fcba r7b019a 48 48 #include "CodePatterns/Log.hpp" 49 49 50 #include "FunctionApproximation/Extractors.hpp" 50 51 #include "Potentials/helpers.hpp" 51 52 #include "Potentials/ParticleTypeCheckers.hpp" 53 54 class Fragment; 52 55 53 56 // static definitions … … 680 683 } 681 684 685 FunctionModel::extractor_t 686 ManyBodyPotential_Tersoff::getFragmentSpecificExtractor( 687 const charges_t &charges) const 688 { 689 ASSERT(charges.size() <= (size_t)2, 690 "ManyBodyPotential_Tersoff::getFragmentSpecificExtractor() - requires 1 charge."); 691 FunctionModel::extractor_t returnfunction = 692 boost::bind(&Extractors::gatherAllDistances, 693 boost::bind(&Fragment::getPositions, _1), 694 boost::bind(&Fragment::getCharges, _1), 695 _2); 696 return returnfunction; 697 } 698 -
src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp
r69fcba r7b019a 178 178 } 179 179 180 /** Returns a bound function to be used with TrainingData, extracting distances 181 * from a Fragment. 182 * 183 * \param charges vector of charges to be extracted 184 * \return bound function extracting distances from a fragment 185 */ 186 FunctionModel::extractor_t getFragmentSpecificExtractor(const charges_t &charges) const; 187 180 188 private: 181 189 /** Prohibit private default constructor. -
src/Potentials/Specifics/PairPotential_Angle.cpp
r69fcba r7b019a 40 40 41 41 #include <boost/assign/list_of.hpp> // for 'map_list_of()' 42 #include <boost/bind.hpp> 42 43 #include <string> 43 44 44 45 #include "CodePatterns/Assert.hpp" 45 46 47 #include "FunctionApproximation/Extractors.hpp" 46 48 #include "Potentials/helpers.hpp" 47 49 #include "Potentials/ParticleTypeCheckers.hpp" 50 51 class Fragment; 48 52 49 53 // static definitions … … 199 203 } 200 204 } 205 206 FunctionModel::extractor_t 207 PairPotential_Angle::getFragmentSpecificExtractor( 208 const charges_t &charges) const 209 { 210 ASSERT(charges.size() == (size_t)3, 211 "PairPotential_Angle::getFragmentSpecificExtractor() - requires 3 charges."); 212 FunctionModel::extractor_t returnfunction = 213 boost::bind(&Extractors::gatherDistancesFromFragment, 214 boost::bind(&Fragment::getPositions, _1), 215 boost::bind(&Fragment::getCharges, _1), 216 boost::cref(charges), 217 _2); 218 return returnfunction; 219 } 220 -
src/Potentials/Specifics/PairPotential_Angle.hpp
r69fcba r7b019a 145 145 } 146 146 147 /** Returns a bound function to be used with TrainingData, extracting distances 148 * from a Fragment. 149 * 150 * \param charges vector of charges to be extracted 151 * \return bound function extracting distances from a fragment 152 */ 153 FunctionModel::extractor_t getFragmentSpecificExtractor(const charges_t &charges) const; 154 147 155 enum parameter_enum_t { 148 156 spring_constant=0, -
src/Potentials/Specifics/PairPotential_Harmonic.cpp
r69fcba r7b019a 40 40 41 41 #include <boost/assign/list_of.hpp> // for 'map_list_of()' 42 #include <boost/bind.hpp> 42 43 #include <string> 43 44 44 45 #include "CodePatterns/Assert.hpp" 45 46 47 #include "FunctionApproximation/Extractors.hpp" 46 48 #include "Potentials/helpers.hpp" 47 49 #include "Potentials/ParticleTypeCheckers.hpp" 50 51 class Fragment; 48 52 49 53 // static definitions … … 176 180 } 177 181 182 FunctionModel::extractor_t 183 PairPotential_Harmonic::getFragmentSpecificExtractor( 184 const charges_t &charges) const 185 { 186 ASSERT(charges.size() == (size_t)2, 187 "PairPotential_Harmonic::getFragmentSpecificExtractor() - requires 2 charges."); 188 FunctionModel::extractor_t returnfunction = 189 boost::bind(&Extractors::gatherDistancesFromFragment, 190 boost::bind(&Fragment::getPositions, _1), 191 boost::bind(&Fragment::getCharges, _1), 192 boost::cref(charges), 193 _2); 194 return returnfunction; 195 } 196 -
src/Potentials/Specifics/PairPotential_Harmonic.hpp
r69fcba r7b019a 127 127 } 128 128 129 /** Returns a bound function to be used with TrainingData, extracting distances 130 * from a Fragment. 131 * 132 * \param charges vector of charges to be extracted 133 * \return bound function extracting distances from a fragment 134 */ 135 FunctionModel::extractor_t getFragmentSpecificExtractor(const charges_t &charges) const; 136 129 137 /** Return the token name of this specific potential. 130 138 * -
src/Potentials/Specifics/PairPotential_Morse.cpp
r69fcba r7b019a 40 40 41 41 #include <boost/assign/list_of.hpp> // for 'map_list_of()' 42 #include <boost/bind.hpp> 42 43 #include <cmath> 43 44 #include <string> … … 45 46 #include "CodePatterns/Assert.hpp" 46 47 48 #include "FunctionApproximation/Extractors.hpp" 47 49 #include "Potentials/helpers.hpp" 48 50 #include "Potentials/ParticleTypeCheckers.hpp" 51 52 class Fragment; 49 53 50 54 // static definitions … … 204 208 return std::vector<result_t>(1, 0.); 205 209 } 210 211 FunctionModel::extractor_t 212 PairPotential_Morse::getFragmentSpecificExtractor( 213 const charges_t &charges) const 214 { 215 ASSERT(charges.size() == (size_t)2, 216 "PairPotential_Morse::getFragmentSpecificExtractor() - requires 2 charges."); 217 FunctionModel::extractor_t returnfunction = 218 boost::bind(&Extractors::gatherDistancesFromFragment, 219 boost::bind(&Fragment::getPositions, _1), 220 boost::bind(&Fragment::getCharges, _1), 221 boost::cref(charges), 222 _2); 223 return returnfunction; 224 } 225 -
src/Potentials/Specifics/PairPotential_Morse.hpp
r69fcba r7b019a 144 144 } 145 145 146 /** Returns a bound function to be used with TrainingData, extracting distances 147 * from a Fragment. 148 * 149 * \param charges vector of charges to be extracted 150 * \return bound function extracting distances from a fragment 151 */ 152 FunctionModel::extractor_t getFragmentSpecificExtractor(const charges_t &charges) const; 153 146 154 enum parameter_enum_t { 147 155 spring_constant=0, -
src/Potentials/Specifics/SaturationPotential.cpp
r69fcba r7b019a 47 47 #include "CodePatterns/Log.hpp" 48 48 49 #include "FunctionApproximation/Extractors.hpp" 49 50 #include "Potentials/helpers.hpp" 50 51 #include "Potentials/ParticleTypeCheckers.hpp" 52 53 class Fragment; 51 54 52 55 using namespace boost::assign; … … 75 78 triplefunction(_triplefunction), 76 79 saturation_cutoff(_saturation_cutoff) 77 {} 80 { 81 // have some decent defaults for parameter_derivative checking 82 // Morse and Angle have their own defaults, offset is set 83 ASSERT( _ParticleTypes.size() == (size_t)2, 84 "SaturationPotential::SaturationPotential() - exactly two types must be given."); 85 ASSERT( _ParticleTypes[1] == 1, 86 "SaturationPotential::SaturationPotential() - second type must be hydrogen."); 87 } 78 88 79 89 SaturationPotential::SaturationPotential( … … 94 104 saturation_cutoff(_saturation_cutoff) 95 105 { 106 ASSERT( _ParticleTypes.size() == (size_t)2, 107 "SaturationPotential::SaturationPotential() - exactly two types must be given."); 108 ASSERT( _ParticleTypes[1] == 1, 109 "SaturationPotential::SaturationPotential() - second type must be hydrogen."); 96 110 parameters_t morse_params(morse.getParameterDimension()); 97 111 morse_params[PairPotential_Morse::spring_constant] = _morse_spring_constant; … … 303 317 return ist; 304 318 } 319 320 FunctionModel::extractor_t 321 SaturationPotential::getFragmentSpecificExtractor( 322 const charges_t &charges) const 323 { 324 ASSERT(charges.size() == (size_t)2, 325 "SaturationPotential::getFragmentSpecificExtractor() - requires 2 charges."); 326 FunctionModel::extractor_t returnfunction; 327 if (charges[0] == charges[1]) { 328 // In case both types are equal there is only a single pair of possible 329 // type combinations. 330 returnfunction = 331 boost::bind(&Extractors::gatherAllDistancesFromFragment, 332 boost::bind(&Fragment::getPositions, _1), 333 boost::bind(&Fragment::getCharges, _1), 334 boost::cref(charges), 335 _2); 336 } else { 337 // we have to chain here a rather complex "tree" of functions 338 // as we only have a couple of ParticleTypes but need to get 339 // all possible three pairs of the set of the two types. 340 // Finally, we also need to arrange them in correct order 341 // (for PairPotentiale_Angle). 342 charges_t firstpair(2, boost::cref(charges[0])); 343 charges_t secondpair(2, boost::cref(charges[1])); 344 const charges_t &thirdpair = charges; 345 returnfunction = 346 boost::bind(&Extractors::reorderArgumentsByParticleTypes, 347 boost::bind(&Extractors::combineArguments, 348 boost::bind(&Extractors::combineArguments, 349 boost::bind(&Extractors::gatherAllDistancesFromFragment, 350 boost::bind(&Fragment::getPositions, _1), 351 boost::bind(&Fragment::getCharges, _1), 352 firstpair, // no crefs here as are temporaries! 353 _2), 354 boost::bind(&Extractors::gatherAllDistancesFromFragment, 355 boost::bind(&Fragment::getPositions, _1), 356 boost::bind(&Fragment::getCharges, _1), 357 secondpair, // no crefs here as are temporaries! 358 _2) 359 ), 360 boost::bind(&Extractors::gatherAllDistancesFromFragment, 361 boost::bind(&Fragment::getPositions, _1), 362 boost::bind(&Fragment::getCharges, _1), 363 boost::cref(thirdpair), // only the last one is no temporary 364 _2) 365 ), 366 boost::cref(angle.getParticleTypes()) 367 ); 368 } 369 return returnfunction; 370 } -
src/Potentials/Specifics/SaturationPotential.hpp
r69fcba r7b019a 156 156 } 157 157 158 /** Returns a bound function to be used with TrainingData, extracting distances 159 * from a Fragment. 160 * 161 * \param charges vector of charges to be extracted 162 * \return bound function extracting distances from a fragment 163 */ 164 FunctionModel::extractor_t getFragmentSpecificExtractor(const charges_t &charges) const; 165 158 166 enum parameter_enum_t { 159 167 all_energy_offset, -
src/Potentials/Specifics/unittests/Makefile.am
r69fcba r7b019a 26 26 POTENTIALSSPECIFICSLIBS = \ 27 27 ../libMolecuilderPotentials.la \ 28 ../libMolecuilderFragmentationSetValues.la \ 29 ../libMolecuilderFunctionApproximation.la \ 28 30 $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la \ 29 31 ${CodePatterns_LIBS} \ 30 32 $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS) \ 31 33 $(BOOST_LIB) 32 34
Note:
See TracChangeset
for help on using the changeset viewer.