Changeset 7c1091 for src/Potentials/unittests
- Timestamp:
- Jul 8, 2013, 2:22: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:
- baccf6
- Parents:
- c5e63a
- git-author:
- Frederik Heber <heber@…> (05/09/13 19:25:45)
- git-committer:
- Frederik Heber <heber@…> (07/08/13 14:22:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Potentials/unittests/CompoundPotentialUnitTest.cpp
rc5e63a r7c1091 92 92 } 93 93 94 // create graph 94 // create graph (i.e. this simulates a water molecule) 95 95 { 96 96 // add nodes 97 97 nodes += 98 std::make_pair(FragmentNode(0, 1),1),99 std::make_pair(FragmentNode(1,1), 1);98 std::make_pair(FragmentNode(0,2),1), 99 std::make_pair(FragmentNode(1,1),2); 100 100 101 101 // add edges 102 102 edges += 103 std::make_pair(FragmentEdge(0,1), 1);103 std::make_pair(FragmentEdge(0,1),2); 104 104 105 105 // construct graph … … 125 125 4.46595; 126 126 output += 127 -78.5211,128 -78.8049,129 -78.935,130 -78.9822,131 -78.9867,132 -78.971,133 -78.9475,134 -78.9225,135 -78.899,136 -78.8784;127 2.*0.467226+d, 128 2.*0.183388+d, 129 2.*0.0532649+d, 130 2.*0.00609808+d, 131 2.*0.00160056+d, 132 2.*0.0172506+d, 133 2.*0.0407952+d, 134 2.*0.0658475+d, 135 2.*0.0893157+d, 136 2.*0.109914+d; 137 137 138 138 CPPUNIT_ASSERT_EQUAL( input.size(), output.size() ); … … 157 157 compound.setParameters(params); 158 158 for (size_t index = 0; index < input.size(); ++index) { 159 argument_t arg(argument_t::indices_t(0,1), argument_t::types_t(0,1), input[index]); 160 const double result = compound( FunctionModel::arguments_t(1,arg) )[0]; 159 argument_t firstarg(argument_t::indices_t(0,1), argument_t::types_t(0,1), input[index]); 160 argument_t secondarg(argument_t::indices_t(0,2), argument_t::types_t(0,1), input[index]); 161 FunctionModel::arguments_t args; 162 args += firstarg,secondarg; 163 const double result = compound( args )[0]; 161 164 CPPUNIT_ASSERT( 162 165 Helpers::isEqual( … … 177 180 // params += d,a,c,D; 178 181 // compound.setParameters(params); 179 // argument_t arg(argument_t::indices_t(0,1), argument_t::types_t(0,1), c); 180 // const double result = compound.derivative(FunctionModel::arguments_t(1,arg))[0] 182 // argument_t firstarg(argument_t::indices_t(0,1), argument_t::types_t(0,1), input[index]); 183 // argument_t secondarg(argument_t::indices_t(0,2), argument_t::types_t(0,1), input[index]); 184 // FunctionModel::arguments_t args; 185 // args += firstarg,secondarg; 186 // const double result = compound.derivative( args )[0] 181 187 // CPPUNIT_ASSERT( 182 188 // Helpers::isEqual( … … 197 203 params += d,a,c,D; 198 204 compound.setParameters(params); 199 argument_t arg(argument_t::indices_t(0,1), argument_t::types_t(0,1), c); 200 { 201 const double result = 202 compound.parameter_derivative( 203 FunctionModel::arguments_t(1,arg), 205 argument_t firstarg(argument_t::indices_t(0,1), argument_t::types_t(0,1), c); 206 argument_t secondarg(argument_t::indices_t(0,2), argument_t::types_t(0,1), c); 207 FunctionModel::arguments_t args; 208 args += firstarg,secondarg; 209 { 210 const double result = 211 compound.parameter_derivative( 212 args, 204 213 0)[0]; 205 214 CPPUNIT_ASSERT( … … 214 223 const double result = 215 224 compound.parameter_derivative( 216 FunctionModel::arguments_t(1,arg),225 args, 217 226 1)[0]; 218 227 CPPUNIT_ASSERT( … … 227 236 const double result = 228 237 compound.parameter_derivative( 229 FunctionModel::arguments_t(1,arg),238 args, 230 239 2)[0]; 231 240 CPPUNIT_ASSERT( … … 240 249 const double result = 241 250 compound.parameter_derivative( 242 FunctionModel::arguments_t(1,arg),251 args, 243 252 3)[0]; 244 253 CPPUNIT_ASSERT(
Note:
See TracChangeset
for help on using the changeset viewer.