Changeset b3eabc for src/Potentials/Specifics
- Timestamp:
- Feb 25, 2013, 5:29:09 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:
- 55fe788
- Parents:
- b10ada
- git-author:
- Frederik Heber <heber@…> (11/30/12 09:07:59)
- git-committer:
- Frederik Heber <heber@…> (02/25/13 17:29:09)
- Location:
- src/Potentials/Specifics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Potentials/Specifics/SaturationPotential.cpp
rb10ada rb3eabc 75 75 SaturationPotential::SaturationPotential( 76 76 const ParticleTypes_t &_ParticleTypes, 77 const double _all_energy_offset, 77 78 const double _morse_spring_constant, 78 79 const double _morse_equilibrium_distance, … … 80 81 const double _angle_spring_constant, 81 82 const double _angle_equilibrium_distance, 82 const double _all_energy_offset,83 83 const double _saturation_cutoff, 84 84 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction) : … … 182 182 if (result != result) 183 183 ELOG(1, "result is NAN."); 184 185 // Angle contribution 186 std::vector<arguments_t> triples = triplefunction(r_ij, saturation_cutoff); 187 args.resize(3, r_ij); 188 for (std::vector<arguments_t>::const_iterator iter = triples.begin(); 189 iter != triples.end(); ++iter) { 190 ASSERT( iter->size() == 2, 191 "SaturationPotential::function_derivative_c() - the triples result must contain exactly two distances."); 192 const argument_t &r_ik = (*iter)[0]; 193 const argument_t &r_jk = (*iter)[1]; 194 args[1] = r_ik; 195 args[2] = r_jk; 196 result += .5*angle(args)[0]; // as we have all distances we get both jk and kj 197 if (result != result) 198 ELOG(1, "result is NAN."); 199 } 200 } 201 } 184 } 185 } 186 // Angle contribution 187 result += angle(arguments)[0]; // as we have all distances we get both jk and kj 188 if (result != result) 189 ELOG(1, "result is NAN."); 190 // 191 // // Angle contribution 192 // std::vector<arguments_t> triples = triplefunction(r_ij, saturation_cutoff); 193 // args.resize(3, r_ij); 194 // for (std::vector<arguments_t>::const_iterator iter = triples.begin(); 195 // iter != triples.end(); ++iter) { 196 // ASSERT( iter->size() == 2, 197 // "SaturationPotential::function_derivative_c() - the triples result must contain exactly two distances."); 198 // const argument_t &r_ik = (*iter)[0]; 199 // const argument_t &r_jk = (*iter)[1]; 200 // args[1] = r_ik; 201 // args[2] = r_jk; 202 // result += .5*angle(args)[0]; // as we have all distances we get both jk and kj 203 // if (result != result) 204 // ELOG(1, "result is NAN."); 205 // } 206 // } 207 // } 202 208 return std::vector<result_t>(1, energy_offset + result); 203 209 } … … 221 227 { 222 228 double result = 0.; 223 if (index == all_energy_offset) { 224 result = 1.; 225 } else { 226 for(arguments_t::const_iterator argiter = arguments.begin(); 227 argiter != arguments.end(); 228 ++argiter) { 229 const argument_t &r_ij = *argiter; 230 if ((r_ij.indices.first == 0)) { // first item must be the non-hydrogen 231 arguments_t args(1, r_ij); 232 switch (index) { 233 case morse_spring_constant: 234 { 235 result += morse.parameter_derivative(args, PairPotential_Morse::spring_constant)[0]; 236 break; 237 } 238 case morse_equilibrium_distance: 239 { 240 result += morse.parameter_derivative(args, PairPotential_Morse::equilibrium_distance)[0]; 241 break; 242 } 243 case morse_dissociation_energy: 244 { 245 result += morse.parameter_derivative(args, PairPotential_Morse::dissociation_energy)[0]; 246 break; 247 } 248 default: 249 { 250 args.resize(3, r_ij); 251 std::vector<arguments_t> triples = triplefunction(r_ij, saturation_cutoff); 252 for (std::vector<arguments_t>::const_iterator iter = triples.begin(); 253 iter != triples.end(); ++iter) { 254 ASSERT( iter->size() == 2, 255 "SaturationPotential::parameter_derivative() - the triples result must contain exactly two distances."); 256 const argument_t &r_ik = (*iter)[0]; 257 ASSERT( r_ik.indices.first == r_ij.indices.first, 258 "SaturationPotential::parameter_derivative() - i not same in ij, ik."); 259 const argument_t &r_jk = (*iter)[1]; 260 ASSERT( r_jk.indices.first == r_ij.indices.second, 261 "SaturationPotential::parameter_derivative() - j not same in ij, jk."); 262 ASSERT( r_ik.indices.second == r_jk.indices.second, 263 "SaturationPotential::parameter_derivative() - k not same in ik, jk."); 264 args[1] = r_ik; 265 args[2] = r_jk; 266 switch (index) { // .5 due to we have all distances we get both jk and kj 267 case angle_spring_constant: 268 { 269 result += .5*angle.parameter_derivative(args, PairPotential_Angle::spring_constant)[0]; 270 break; 271 } 272 case angle_equilibrium_distance: 273 { 274 result += .5*angle.parameter_derivative(args, PairPotential_Angle::equilibrium_distance)[0]; 275 break; 276 } 277 default: 278 break; 279 } 280 } 281 break; 229 switch (index) { 230 case all_energy_offset: 231 { 232 result = 1.; 233 break; 234 } 235 case morse_spring_constant: 236 case morse_equilibrium_distance: 237 case morse_dissociation_energy: 238 { 239 const ParticleTypes_t &morse_types = morse.getParticleTypes(); 240 for(arguments_t::const_iterator argiter = arguments.begin(); 241 argiter != arguments.end(); 242 ++argiter) { 243 const argument_t &r_ij = *argiter; 244 if (((r_ij.types.first == morse_types[0]) && (r_ij.types.second == morse_types[1])) 245 || ((r_ij.types.first == morse_types[1]) && (r_ij.types.second == morse_types[0]))) { 246 arguments_t args(1, r_ij); 247 switch (index) { 248 case morse_spring_constant: 249 result += morse.parameter_derivative(args, PairPotential_Morse::spring_constant)[0]; 250 break; 251 case morse_equilibrium_distance: 252 result += morse.parameter_derivative(args, PairPotential_Morse::equilibrium_distance)[0]; 253 break; 254 case morse_dissociation_energy: 255 result += morse.parameter_derivative(args, PairPotential_Morse::dissociation_energy)[0]; 256 break; 257 default: 258 ASSERT( 0, "SaturationPotential::parameter_derivative() - impossible to get here."); 259 break; 282 260 } 283 261 } 284 262 } 285 } 263 break; 264 } 265 case angle_spring_constant: 266 { 267 result = angle.parameter_derivative(arguments, PairPotential_Angle::spring_constant)[0]; 268 break; 269 } 270 case angle_equilibrium_distance: 271 { 272 result = angle.parameter_derivative(arguments, PairPotential_Angle::equilibrium_distance)[0]; 273 break; 274 } 275 default: 276 ELOG(1, "SaturationPotential::parameter_derivative() - index " << index << " invalid."); 277 break; 286 278 } 287 279 return SaturationPotential::results_t(1, result); -
src/Potentials/Specifics/SaturationPotential.hpp
rb10ada rb3eabc 54 54 SaturationPotential( 55 55 const ParticleTypes_t &_ParticleTypes, 56 const double _all_energy_offset, 56 57 const double _morse_spring_constant, 57 58 const double _morse_equilibrium_distance, … … 59 60 const double _angle_spring_constant, 60 61 const double _angle_equilibrium_distance, 61 const double _energy_offset,62 62 const double _saturation_cutoff, 63 63 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction
Note:
See TracChangeset
for help on using the changeset viewer.