Changeset dbcc47 for src


Ignore:
Timestamp:
Feb 27, 2013, 12:43:09 PM (12 years ago)
Author:
Frederik Heber <heber@…>
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:
3d2559
Parents:
863456
git-author:
Frederik Heber <heber@…> (12/14/12 15:58:28)
git-committer:
Frederik Heber <heber@…> (02/27/13 12:43:09)
Message:

Arguments for PairPotential_Angle were used in wrong order.

Location:
src/Potentials/Specifics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Potentials/Specifics/PairPotential_Angle.cpp

    r863456 rdbcc47  
    133133      arguments, getParticleTypes()),
    134134      "PairPotential_Angle::operator() - types don't match with ones in arguments.");
    135   const argument_t &r_ij = arguments[0];
    136   const argument_t &r_ik = arguments[1];
    137   const argument_t &r_jk = arguments[2];
     135  const argument_t &r_ij = arguments[0]; // 01
     136  const argument_t &r_ik = arguments[2]; // 12
     137  const argument_t &r_jk = arguments[1]; // 02
    138138  const result_t result =
    139139      params[spring_constant]
     
    154154      "PairPotential_Angle::operator() - types don't match with ones in arguments.");
    155155  derivative_components_t result;
    156   const argument_t &r_ij = arguments[0];
    157   const argument_t &r_ik = arguments[1];
    158   const argument_t &r_jk = arguments[2];
     156  const argument_t &r_ij = arguments[0]; //01
     157  const argument_t &r_ik = arguments[2]; //12
     158  const argument_t &r_jk = arguments[1]; //02
    159159  result.push_back( 2. * params[spring_constant] * ( function_theta(r_ij.distance, r_ik.distance, r_jk.distance) - params[equilibrium_distance]) );
    160160  ASSERT( result.size() == 1,
     
    174174      arguments, getParticleTypes()),
    175175      "PairPotential_Angle::operator() - types don't match with ones in arguments.");
    176   const argument_t &r_ij = arguments[0];
    177   const argument_t &r_ik = arguments[1];
    178   const argument_t &r_jk = arguments[2];
     176  const argument_t &r_ij = arguments[0]; //01
     177  const argument_t &r_ik = arguments[2]; //12
     178  const argument_t &r_jk = arguments[1]; //02
    179179  switch (index) {
    180180    case spring_constant:
  • src/Potentials/Specifics/unittests/PairPotential_AngleUnitTest.cpp

    r863456 rdbcc47  
    6060CPPUNIT_TEST_SUITE_REGISTRATION( PairPotential_AngleTest );
    6161
     62const double spring_constant = .5;
     63const double offset = .1;
    6264
    6365void PairPotential_AngleTest::setUp()
     
    7274  FunctionModel::arguments_t tempvector(3);
    7375  tempvector[0] = argument_t( std::make_pair(0,1), std::make_pair(0,1), 1.);
    74   tempvector[1] = argument_t( std::make_pair(0,2), std::make_pair(0,1), 1.);
    75   tempvector[2] = argument_t( std::make_pair(1,2), std::make_pair(1,1), 0.);
     76  tempvector[1] = argument_t( std::make_pair(1,2), std::make_pair(1,1), 0.);
     77  tempvector[2] = argument_t( std::make_pair(0,2), std::make_pair(0,1), 1.);
    7678  for (angles_t::const_iterator iter = angles.begin(); iter != angles.end(); ++iter) {
    77     tempvector[2].distance = sqrt(-(2.*(*iter)-2.));//1.+1.-x/(2.*1.*1.)
     79    tempvector[1].distance = sqrt(-(2.*(*iter)-2.));//1.+1.-x/(2.*1.*1.)
    7880    input += tempvector;
    7981  }
    8082  output +=
    81       .5*0.25+.1,
    82       .5*0.16+.1,
    83       .5*0.09+.1,
    84       .5*0.04+.1,
    85       .5*0.01+.1,
    86       .5*0.+.1,
    87       .5*0.01+.1,
    88       .5*0.04+.1,
    89       .5*0.09+.1,
    90       .5*0.16+.1,
    91       .5*0.25+.1;
     83      spring_constant*0.25+offset,
     84      spring_constant*0.16+offset,
     85      spring_constant*0.09+offset,
     86      spring_constant*0.04+offset,
     87      spring_constant*0.01+offset,
     88      spring_constant*0.+offset,
     89      spring_constant*0.01+offset,
     90      spring_constant*0.04+offset,
     91      spring_constant*0.09+offset,
     92      spring_constant*0.16+offset,
     93      spring_constant*0.25+offset;
    9294
    9395  CPPUNIT_ASSERT_EQUAL( input.size(), output.size() );
     
    107109        (0)(1)(1)
    108110      ;
    109   PairPotential_Angle angle(types, .5,0.,.1);
     111  PairPotential_Angle angle(types, spring_constant,0.,offset);
    110112  for (size_t index = 0; index < input.size(); ++index) {
     113    const PairPotential_Angle::results_t result =
     114        angle( input[index] );
    111115    CPPUNIT_ASSERT(
    112116        Helpers::isEqual(
    113117            output[index],
    114             angle( input[index] )[0]
     118            result[0]
    115119        )
    116120    );
     
    126130        (0)(1)(1)
    127131      ;
    128   PairPotential_Angle angle(types, .5,0.,.1);
     132  PairPotential_Angle angle(types, spring_constant,0.,offset);
    129133  CPPUNIT_ASSERT(
    130134      Helpers::isEqual(
     
    147151        (0)(1)(1)
    148152      ;
    149   PairPotential_Angle angle(types, .5,0.,.1);
     153  PairPotential_Angle angle(types, spring_constant,0.,offset);
    150154  CPPUNIT_ASSERT(
    151155      Helpers::isEqual(
Note: See TracChangeset for help on using the changeset viewer.