Ignore:
Timestamp:
Aug 9, 2013, 2:20:37 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:
e2037e
Parents:
1413f4
git-author:
Frederik Heber <heber@…> (07/08/13 07:20:55)
git-committer:
Frederik Heber <heber@…> (08/09/13 14:20:37)
Message:

Renamed PairPotential_Angle -> ThreeBodyPotential_Angle and also UnitTest.

Location:
src/Potentials/Specifics
Files:
1 edited
4 moved

Legend:

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

    r1413f4 r484e2a  
    2424
    2525/*
    26  * PairPotential_Angle.cpp
     26 * ThreeBodyPotential_Angle.cpp
    2727 *
    2828 *  Created on: Oct 11, 2012
     
    3838#include "CodePatterns/MemDebug.hpp"
    3939
    40 #include "PairPotential_Angle.hpp"
     40#include "ThreeBodyPotential_Angle.hpp"
    4141
    4242#include <boost/assign/list_of.hpp> // for 'map_list_of()'
     
    5555
    5656// static definitions
    57 const PairPotential_Angle::ParameterNames_t
    58 PairPotential_Angle::ParameterNames =
     57const ThreeBodyPotential_Angle::ParameterNames_t
     58ThreeBodyPotential_Angle::ParameterNames =
    5959      boost::assign::list_of<std::string>
    6060      ("spring_constant")
    6161      ("equilibrium_distance")
    6262    ;
    63 const std::string PairPotential_Angle::potential_token("harmonic_angle");
    64 
    65 PairPotential_Angle::PairPotential_Angle() :
     63const std::string ThreeBodyPotential_Angle::potential_token("harmonic_angle");
     64
     65ThreeBodyPotential_Angle::ThreeBodyPotential_Angle() :
    6666  EmpiricalPotential(),
    6767  params(parameters_t(MAXPARAMS, 0.))
     
    7272}
    7373
    74 PairPotential_Angle::PairPotential_Angle(
     74ThreeBodyPotential_Angle::ThreeBodyPotential_Angle(
    7575    const ParticleTypes_t &_ParticleTypes
    7676    ) :
     
    8383}
    8484
    85 PairPotential_Angle::PairPotential_Angle(
     85ThreeBodyPotential_Angle::ThreeBodyPotential_Angle(
    8686    const ParticleTypes_t &_ParticleTypes,
    8787    const double _spring_constant,
     
    9494}
    9595
    96 void PairPotential_Angle::setParameters(const parameters_t &_params)
     96void ThreeBodyPotential_Angle::setParameters(const parameters_t &_params)
    9797{
    9898  const size_t paramsDim = _params.size();
    9999  ASSERT( paramsDim <= getParameterDimension(),
    100       "PairPotential_Angle::setParameters() - we need not more than "
     100      "ThreeBodyPotential_Angle::setParameters() - we need not more than "
    101101      +toString(getParameterDimension())+" parameters.");
    102102  for(size_t i=0;i<paramsDim;++i)
     
    107107  check_params.resize(paramsDim); // truncate to same size
    108108  ASSERT( check_params == _params,
    109       "PairPotential_Angle::setParameters() - failed, mismatch in to be set "
     109      "ThreeBodyPotential_Angle::setParameters() - failed, mismatch in to be set "
    110110      +toString(_params)+" and set "+toString(check_params)+" params.");
    111111#endif
    112112}
    113113
    114 PairPotential_Angle::result_t
    115 PairPotential_Angle::function_theta(
     114ThreeBodyPotential_Angle::result_t
     115ThreeBodyPotential_Angle::function_theta(
    116116    const double &r_ij,
    117117    const double &r_jk,
     
    130130}
    131131
    132 PairPotential_Angle::results_t
    133 PairPotential_Angle::operator()(
     132ThreeBodyPotential_Angle::results_t
     133ThreeBodyPotential_Angle::operator()(
    134134    const arguments_t &arguments
    135135    ) const
    136136{
    137137  ASSERT( arguments.size() == 3,
    138       "PairPotential_Angle::operator() - requires exactly three arguments.");
     138      "ThreeBodyPotential_Angle::operator() - requires exactly three arguments.");
    139139  ASSERT( ParticleTypeChecker::checkArgumentsAgainstParticleTypes(
    140140      arguments, getParticleTypes()),
    141       "PairPotential_Angle::operator() - types don't match with ones in arguments.");
     141      "ThreeBodyPotential_Angle::operator() - types don't match with ones in arguments.");
    142142  const argument_t &r_ij = arguments[0]; // 01
    143143  const argument_t &r_jk = arguments[2]; // 12
     
    149149}
    150150
    151 PairPotential_Angle::derivative_components_t
    152 PairPotential_Angle::derivative(
     151ThreeBodyPotential_Angle::derivative_components_t
     152ThreeBodyPotential_Angle::derivative(
    153153    const arguments_t &arguments
    154154    ) const
    155155{
    156156  ASSERT( arguments.size() == 3,
    157       "PairPotential_Angle::operator() - requires exactly three arguments.");
     157      "ThreeBodyPotential_Angle::operator() - requires exactly three arguments.");
    158158  ASSERT( ParticleTypeChecker::checkArgumentsAgainstParticleTypes(
    159159      arguments, getParticleTypes()),
    160       "PairPotential_Angle::operator() - types don't match with ones in arguments.");
     160      "ThreeBodyPotential_Angle::operator() - types don't match with ones in arguments.");
    161161  derivative_components_t result;
    162162  const argument_t &r_ij = arguments[0]; //01
     
    165165  result.push_back( 2. * params[spring_constant] * ( function_theta(r_ij.distance, r_jk.distance, r_ik.distance) - params[equilibrium_distance]) );
    166166  ASSERT( result.size() == 1,
    167       "PairPotential_Angle::operator() - we did not create exactly one component.");
     167      "ThreeBodyPotential_Angle::operator() - we did not create exactly one component.");
    168168  return result;
    169169}
    170170
    171 PairPotential_Angle::results_t
    172 PairPotential_Angle::parameter_derivative(
     171ThreeBodyPotential_Angle::results_t
     172ThreeBodyPotential_Angle::parameter_derivative(
    173173    const arguments_t &arguments,
    174174    const size_t index
     
    176176{
    177177  ASSERT( arguments.size() == 3,
    178       "PairPotential_Angle::parameter_derivative() - requires exactly three arguments.");
     178      "ThreeBodyPotential_Angle::parameter_derivative() - requires exactly three arguments.");
    179179  ASSERT( ParticleTypeChecker::checkArgumentsAgainstParticleTypes(
    180180      arguments, getParticleTypes()),
    181       "PairPotential_Angle::operator() - types don't match with ones in arguments.");
     181      "ThreeBodyPotential_Angle::operator() - types don't match with ones in arguments.");
    182182  const argument_t &r_ij = arguments[0]; //01
    183183  const argument_t &r_jk = arguments[2]; //12
     
    200200    }
    201201    default:
    202       ASSERT(0, "PairPotential_Angle::parameter_derivative() - derivative to unknown parameter desired.");
     202      ASSERT(0, "ThreeBodyPotential_Angle::parameter_derivative() - derivative to unknown parameter desired.");
    203203      break;
    204204  }
     
    206206
    207207FunctionModel::extractor_t
    208 PairPotential_Angle::getSpecificExtractor() const
     208ThreeBodyPotential_Angle::getSpecificExtractor() const
    209209{
    210210  Fragment::charges_t charges;
     
    221221}
    222222
    223 FunctionModel::filter_t PairPotential_Angle::getSpecificFilter() const
     223FunctionModel::filter_t ThreeBodyPotential_Angle::getSpecificFilter() const
    224224{
    225225  FunctionModel::filter_t returnfunction =
     
    234234
    235235void
    236 PairPotential_Angle::setParametersToRandomInitialValues(
     236ThreeBodyPotential_Angle::setParametersToRandomInitialValues(
    237237    const TrainingData &data)
    238238{
    239   params[PairPotential_Angle::spring_constant] = 1e+0*rand()/(double)RAND_MAX;// 0.2;
    240   params[PairPotential_Angle::equilibrium_distance] = -0.3;//2e+0*rand()/(double)RAND_MAX - 1.;// 1.;
    241 }
    242 
     239  params[ThreeBodyPotential_Angle::spring_constant] = 1e+0*rand()/(double)RAND_MAX;// 0.2;
     240  params[ThreeBodyPotential_Angle::equilibrium_distance] = -0.3;//2e+0*rand()/(double)RAND_MAX - 1.;// 1.;
     241}
     242
  • src/Potentials/Specifics/ThreeBodyPotential_Angle.hpp

    r1413f4 r484e2a  
    11/*
    2  * PairPotential_Angle.hpp
     2 * ThreeBodyPotential_Angle.hpp
    33 *
    44 *  Created on: Oct 11, 2012
     
    66 */
    77
    8 #ifndef PAIRPOTENTIAL_ANGLE_HPP_
    9 #define PAIRPOTENTIAL_ANGLE_HPP_
     8#ifndef THREEBODYPOTENTIAL_ANGLE_HPP_
     9#define THREEBODYPOTENTIAL_ANGLE_HPP_
    1010
    1111
     
    2727 *
    2828 */
    29 class PairPotential_Angle :
     29class ThreeBodyPotential_Angle :
    3030  public EmpiricalPotential
    3131{
    3232  //!> grant unit test access to internal parts
    33   friend class PairPotential_AngleTest;
     33  friend class ThreeBodyPotential_AngleTest;
    3434  //!> grant PotentialFactory access to default cstor
    3535  friend class PotentialFactory;
     
    4848   *
    4949   */
    50   PairPotential_Angle();
     50  ThreeBodyPotential_Angle();
    5151
    5252public:
    53   PairPotential_Angle(const ParticleTypes_t &_ParticleTypes);
    54   PairPotential_Angle(
     53  ThreeBodyPotential_Angle(const ParticleTypes_t &_ParticleTypes);
     54  ThreeBodyPotential_Angle(
    5555      const ParticleTypes_t &_ParticleTypes,
    5656      const double _spring_constant,
    5757      const double _equilibrium_distance);
    58   virtual ~PairPotential_Angle() {}
     58  virtual ~ThreeBodyPotential_Angle() {}
    5959
    6060  /** Setter for parameters as required by FunctionModel interface.
     
    204204};
    205205
    206 #endif /* PAIRPOTENTIAL_ANGLE_HPP_ */
     206#endif /* THREEBODYPOTENTIAL_ANGLE_HPP_ */
  • src/Potentials/Specifics/unittests/Makefile.am

    r1413f4 r484e2a  
    55        ../Potentials/Specifics/unittests/ConstantPotentialUnitTest.cpp \
    66        ../Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.cpp \
    7         ../Potentials/Specifics/unittests/PairPotential_AngleUnitTest.cpp \
    87        ../Potentials/Specifics/unittests/PairPotential_HarmonicUnitTest.cpp \
    98        ../Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.cpp \
    10         ../Potentials/Specifics/unittests/PairPotential_MorseUnitTest.cpp
     9        ../Potentials/Specifics/unittests/PairPotential_MorseUnitTest.cpp \
     10        ../Potentials/Specifics/unittests/ThreeBodyPotential_AngleUnitTest.cpp
    1111
    1212POTENTIALSSPECIFICSTESTSHEADERS = \
    1313        ../Potentials/Specifics/unittests/ConstantPotentialUnitTest.hpp \
    1414        ../Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.hpp \
    15         ../Potentials/Specifics/unittests/PairPotential_AngleUnitTest.hpp \
    1615        ../Potentials/Specifics/unittests/PairPotential_HarmonicUnitTest.hpp \
    1716        ../Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.hpp \
    18         ../Potentials/Specifics/unittests/PairPotential_MorseUnitTest.hpp
     17        ../Potentials/Specifics/unittests/PairPotential_MorseUnitTest.hpp \
     18        ../Potentials/Specifics/unittests/ThreeBodyPotential_AngleUnitTest.hpp
    1919
    2020POTENTIALSSPECIFICSTESTS = \
    2121        ConstantPotentialUnitTest \
    2222        ManyBodyPotential_TersoffUnitTest \
    23         PairPotential_AngleUnitTest \
    2423        PairPotential_HarmonicUnitTest \
    2524        PairPotential_LennardJonesUnitTest \
    26         PairPotential_MorseUnitTest
     25        PairPotential_MorseUnitTest \
     26        ThreeBodyPotential_AngleUnitTest
    2727
    2828TESTS += $(POTENTIALSSPECIFICSTESTS)
     
    5050ManyBodyPotential_TersoffUnitTest_LDADD = ${POTENTIALSSPECIFICSLIBS}
    5151
    52 PairPotential_AngleUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    53         ../Potentials/Specifics/unittests/PairPotential_AngleUnitTest.cpp \
    54         ../Potentials/Specifics/unittests/PairPotential_AngleUnitTest.hpp
    55 PairPotential_AngleUnitTest_LDADD = ${POTENTIALSSPECIFICSLIBS}
    56 
    5752PairPotential_HarmonicUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    5853        ../Potentials/Specifics/unittests/PairPotential_HarmonicUnitTest.cpp \
     
    7065PairPotential_MorseUnitTest_LDADD = ${POTENTIALSSPECIFICSLIBS}
    7166
     67ThreeBodyPotential_AngleUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     68        ../Potentials/Specifics/unittests/ThreeBodyPotential_AngleUnitTest.cpp \
     69        ../Potentials/Specifics/unittests/ThreeBodyPotential_AngleUnitTest.hpp
     70ThreeBodyPotential_AngleUnitTest_LDADD = ${POTENTIALSSPECIFICSLIBS}
     71
    7272
    7373#AUTOMAKE_OPTIONS = parallel-tests
  • src/Potentials/Specifics/unittests/ThreeBodyPotential_AngleUnitTest.cpp

    r1413f4 r484e2a  
    2323
    2424/*
    25  * PairPotential_AngleUnitTest.cpp
     25 * ThreeBodyPotential_AngleUnitTest.cpp
    2626 *
    2727 *  Created on: Oct 16, 2012
     
    4040#include <cppunit/ui/text/TestRunner.h>
    4141
    42 #include "PairPotential_AngleUnitTest.hpp"
     42#include "ThreeBodyPotential_AngleUnitTest.hpp"
    4343
    4444#include <boost/assign.hpp>
     
    4747
    4848#include "FunctionApproximation/FunctionArgument.hpp"
    49 #include "Potentials/Specifics/PairPotential_Angle.hpp"
     49#include "Potentials/Specifics/ThreeBodyPotential_Angle.hpp"
    5050#include "Potentials/helpers.hpp"
    5151
     
    5959
    6060// Registers the fixture into the 'registry'
    61 CPPUNIT_TEST_SUITE_REGISTRATION( PairPotential_AngleTest );
     61CPPUNIT_TEST_SUITE_REGISTRATION( ThreeBodyPotential_AngleTest );
    6262
    6363const double spring_constant = .5;
    6464
    65 void PairPotential_AngleTest::setUp()
     65void ThreeBodyPotential_AngleTest::setUp()
    6666{
    6767  // failing asserts should be thrown
     
    9797
    9898
    99 void PairPotential_AngleTest::tearDown()
     99void ThreeBodyPotential_AngleTest::tearDown()
    100100{
    101101}
     
    103103/** UnitTest for operator()
    104104 */
    105 void PairPotential_AngleTest::operatorTest()
     105void ThreeBodyPotential_AngleTest::operatorTest()
    106106{
    107   PairPotential_Angle::ParticleTypes_t types =
    108       boost::assign::list_of<PairPotential_Angle::ParticleType_t>
     107  ThreeBodyPotential_Angle::ParticleTypes_t types =
     108      boost::assign::list_of<ThreeBodyPotential_Angle::ParticleType_t>
    109109        (0)(1)(1)
    110110      ;
    111   PairPotential_Angle angle(types, spring_constant,0.);
     111  ThreeBodyPotential_Angle angle(types, spring_constant,0.);
    112112  for (size_t index = 0; index < input.size(); ++index) {
    113     const PairPotential_Angle::results_t result =
     113    const ThreeBodyPotential_Angle::results_t result =
    114114        angle( input[index] );
    115115    CPPUNIT_ASSERT(
     
    124124/** UnitTest for derivative()
    125125 */
    126 void PairPotential_AngleTest::derivativeTest()
     126void ThreeBodyPotential_AngleTest::derivativeTest()
    127127{
    128   PairPotential_Angle::ParticleTypes_t types =
    129       boost::assign::list_of<PairPotential_Angle::ParticleType_t>
     128  ThreeBodyPotential_Angle::ParticleTypes_t types =
     129      boost::assign::list_of<ThreeBodyPotential_Angle::ParticleType_t>
    130130        (0)(1)(1)
    131131      ;
    132   PairPotential_Angle angle(types, spring_constant,0.);
     132  ThreeBodyPotential_Angle angle(types, spring_constant,0.);
    133133  CPPUNIT_ASSERT(
    134134      Helpers::isEqual(
     
    145145/** UnitTest for parameter_derivative()
    146146 */
    147 void PairPotential_AngleTest::parameter_derivativeTest()
     147void ThreeBodyPotential_AngleTest::parameter_derivativeTest()
    148148{
    149   PairPotential_Angle::ParticleTypes_t types =
    150       boost::assign::list_of<PairPotential_Angle::ParticleType_t>
     149  ThreeBodyPotential_Angle::ParticleTypes_t types =
     150      boost::assign::list_of<ThreeBodyPotential_Angle::ParticleType_t>
    151151        (0)(1)(1)
    152152      ;
    153   PairPotential_Angle angle(types, spring_constant,0.);
     153  ThreeBodyPotential_Angle angle(types, spring_constant,0.);
    154154  CPPUNIT_ASSERT(
    155155      Helpers::isEqual(
  • src/Potentials/Specifics/unittests/ThreeBodyPotential_AngleUnitTest.hpp

    r1413f4 r484e2a  
    11/*
    2  * PairPotential_AngleUnitTest.hpp
     2 * ThreeBodyPotential_AngleUnitTest.hpp
    33 *
    44 *  Created on: Oct 16, 2012
     
    66 */
    77
    8 #ifndef PAIRPOTENTIAL_ANGLEUNITTEST_HPP_
    9 #define PAIRPOTENTIAL_ANGLEUNITTEST_HPP_
     8#ifndef THREEBODYPOTENTIAL_ANGLEUNITTEST_HPP_
     9#define THREEBODYPOTENTIAL_ANGLEUNITTEST_HPP_
    1010
    1111// include config.h
     
    1919#include "FunctionApproximation/FunctionModel.hpp"
    2020
    21 class PairPotential_Angle;
     21class ThreeBodyPotential_Angle;
    2222
    2323/********************************************** Test classes **************************************/
    2424
    25 class PairPotential_AngleTest : public CppUnit::TestFixture
     25class ThreeBodyPotential_AngleTest : public CppUnit::TestFixture
    2626{
    27     CPPUNIT_TEST_SUITE( PairPotential_AngleTest) ;
     27    CPPUNIT_TEST_SUITE( ThreeBodyPotential_AngleTest) ;
    2828    CPPUNIT_TEST ( operatorTest );
    2929    CPPUNIT_TEST ( derivativeTest );
     
    4444};
    4545
    46 #endif /* PAIRPOTENTIAL_ANGLEUNITTEST_HPP_ */
     46#endif /* THREEBODYPOTENTIAL_ANGLEUNITTEST_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.