Ignore:
Timestamp:
Nov 4, 2016, 9:37:50 AM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_ChronosMutex, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
67044a
Parents:
c5e75f3
git-author:
Frederik Heber <heber@…> (10/03/16 18:26:30)
git-committer:
Frederik Heber <heber@…> (11/04/16 09:37:50)
Message:

Added HomologyGraph describing binding model to every EmpiricalPotential.

Location:
src/Potentials/Specifics
Files:
16 edited

Legend:

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

    rc5e75f3 rd5ca1a  
    6565Coordinator::ptr ConstantPotential::coordinator(Memory::ignore(new OneBody_Constant()));
    6666
     67static HomologyGraph generateBindingModel(const EmpiricalPotential::ParticleTypes_t &_ParticleTypes)
     68{
     69  // fill nodes
     70  ASSERT( _ParticleTypes.size() <= (size_t)1,
     71      "generateBindingModel() - ConstantPotential needs zero or one type.");
     72  HomologyGraph::nodes_t nodes;
     73  if (_ParticleTypes.size() == (size_t)1)
     74    nodes.insert( std::make_pair(FragmentNode(_ParticleTypes.front(), 0), 1) );
     75
     76  // there are no edges
     77  HomologyGraph::edges_t edges;
     78
     79  return HomologyGraph(nodes, edges);
     80}
     81
    6782ConstantPotential::ConstantPotential() :
    6883    EmpiricalPotential(),
    69     params(parameters_t(MAXPARAMS, 0.))
     84    params(parameters_t(MAXPARAMS, 0.)),
     85    bindingmodel(HomologyGraph())
    7086{
    7187  // have some decent defaults for parameter_derivative checking
     
    7793    ) :
    7894  EmpiricalPotential(_ParticleTypes),
    79   params(parameters_t(MAXPARAMS, 0.))
     95  params(parameters_t(MAXPARAMS, 0.)),
     96  bindingmodel(generateBindingModel(_ParticleTypes))
    8097{
    8198  // have some decent defaults for parameter_derivative checking
     
    87104    const double _energy_offset) :
    88105  EmpiricalPotential(_ParticleTypes),
    89   params(parameters_t(MAXPARAMS, 0.))
     106  params(parameters_t(MAXPARAMS, 0.)),
     107  bindingmodel(generateBindingModel(_ParticleTypes))
    90108{
    91109  params[energy_offset] = _energy_offset;
  • src/Potentials/Specifics/ConstantPotential.hpp

    rc5e75f3 rd5ca1a  
    184184  };
    185185
     186  /** Getter for the graph specifying the binding model of the potential.
     187   *
     188   * \return HomologyGraph of the binding model
     189   */
     190  const HomologyGraph& getBindingModel() const
     191  { return bindingmodel; }
     192
    186193private:
    187194  //!> parameter vector with parameters as in enum parameter_enum_t
     
    196203  //!> internal coordinator object for converting arguments_t
    197204  static Coordinator::ptr coordinator;
     205
     206  //!> binding model for this potential
     207  const HomologyGraph bindingmodel;
    198208};
    199209
  • src/Potentials/Specifics/FourBodyPotential_Improper.cpp

    rc5e75f3 rd5ca1a  
    3535#include "CodePatterns/MemDebug.hpp"
    3636
     37#include "CodePatterns/Assert.hpp"
     38
    3739#include "FourBodyPotential_Improper.hpp"
    3840
     
    5153Coordinator::ptr FourBodyPotential_Improper::coordinator(Memory::ignore(new FourBody_ImproperAngle()));
    5254
     55static HomologyGraph generateBindingModel(const EmpiricalPotential::ParticleTypes_t &_ParticleTypes)
     56{
     57  // fill nodes
     58  HomologyGraph::nodes_t nodes;
     59  {
     60    ASSERT( _ParticleTypes.size() == (size_t)4,
     61        "generateBindingModel() - FourBodyPotential_Improper needs four types.");
     62    std::pair<HomologyGraph::nodes_t::iterator, bool > inserter;
     63    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[0], 3), 1) );
     64    if (!inserter.second)
     65      ++(inserter.first->second);
     66    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[1], 1), 1) );
     67    if (!inserter.second)
     68      ++(inserter.first->second);
     69    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[2], 1), 1) );
     70    if (!inserter.second)
     71      ++(inserter.first->second);
     72    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[3], 1), 1) );
     73    if (!inserter.second)
     74      ++(inserter.first->second);
     75  }
     76
     77  // there are no edges
     78  HomologyGraph::edges_t edges;
     79  {
     80    std::pair<HomologyGraph::edges_t::iterator, bool > inserter;
     81    inserter = edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[0], _ParticleTypes[1]), 1) );
     82    if (!inserter.second)
     83      ++(inserter.first->second);
     84    inserter = edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[0], _ParticleTypes[2]), 1) );
     85    if (!inserter.second)
     86      ++(inserter.first->second);
     87    inserter = edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[0], _ParticleTypes[3]), 1) );
     88    if (!inserter.second)
     89      ++(inserter.first->second);
     90  }
     91
     92  return HomologyGraph(nodes, edges);
     93}
     94
    5395FourBodyPotential_Improper::FourBodyPotential_Improper() :
    54     FourBodyPotential_Torsion()
     96    FourBodyPotential_Torsion(),
     97    bindingmodel(HomologyGraph())
    5598{}
    5699
    57100FourBodyPotential_Improper::FourBodyPotential_Improper(
    58101    const ParticleTypes_t &_ParticleTypes) :
    59     FourBodyPotential_Torsion(_ParticleTypes)
     102    FourBodyPotential_Torsion(_ParticleTypes),
     103    bindingmodel(generateBindingModel(_ParticleTypes))
    60104{}
    61105
     
    67111        _ParticleTypes,
    68112        _spring_constant,
    69         _equilibrium_distance)
     113        _equilibrium_distance),
     114    bindingmodel(generateBindingModel(_ParticleTypes))
    70115{}
    71116
  • src/Potentials/Specifics/FourBodyPotential_Improper.hpp

    rc5e75f3 rd5ca1a  
    6060  virtual ~FourBodyPotential_Improper() {}
    6161
     62  /** Getter for the graph specifying the binding model of the potential.
     63   *
     64   * \return HomologyGraph of the binding model
     65   */
     66  const HomologyGraph& getBindingModel() const
     67  { return bindingmodel; }
     68
    6269private:
    6370  /** Function to obtain angle between planes from distances.
     
    9198  //!> internal coordinator object for converting arguments_t
    9299  static Coordinator::ptr coordinator;
     100
     101  //!> binding model for this potential
     102  const HomologyGraph bindingmodel;
    93103};
    94104
  • src/Potentials/Specifics/FourBodyPotential_Torsion.cpp

    rc5e75f3 rd5ca1a  
    6666Coordinator::ptr FourBodyPotential_Torsion::coordinator(Memory::ignore(new FourBody_TorsionAngle()));
    6767
     68static HomologyGraph generateBindingModel(const EmpiricalPotential::ParticleTypes_t &_ParticleTypes)
     69{
     70  // fill nodes
     71  HomologyGraph::nodes_t nodes;
     72  {
     73    ASSERT( _ParticleTypes.size() == (size_t)4,
     74        "generateBindingModel() - FourBodyPotential_Torsion needs four types.");
     75    std::pair<HomologyGraph::nodes_t::iterator, bool > inserter;
     76    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[0], 1), 1) );
     77    if (!inserter.second)
     78      ++(inserter.first->second);
     79    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[1], 2), 1) );
     80    if (!inserter.second)
     81      ++(inserter.first->second);
     82    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[2], 2), 1) );
     83    if (!inserter.second)
     84      ++(inserter.first->second);
     85    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[3], 1), 1) );
     86    if (!inserter.second)
     87      ++(inserter.first->second);
     88  }
     89
     90  // there are no edges
     91  HomologyGraph::edges_t edges;
     92  {
     93    std::pair<HomologyGraph::edges_t::iterator, bool > inserter;
     94    inserter = edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[0], _ParticleTypes[1]), 1) );
     95    if (!inserter.second)
     96      ++(inserter.first->second);
     97    inserter = edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[1], _ParticleTypes[2]), 1) );
     98    if (!inserter.second)
     99      ++(inserter.first->second);
     100    inserter = edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[2], _ParticleTypes[3]), 1) );
     101    if (!inserter.second)
     102      ++(inserter.first->second);
     103  }
     104
     105  return HomologyGraph(nodes, edges);
     106}
     107
    68108FourBodyPotential_Torsion::FourBodyPotential_Torsion() :
    69109  EmpiricalPotential(),
    70   params(parameters_t(MAXPARAMS, 0.))
     110  params(parameters_t(MAXPARAMS, 0.)),
     111  bindingmodel(HomologyGraph())
    71112{
    72113  // have some decent defaults for parameter_derivative checking
     
    79120    ) :
    80121  EmpiricalPotential(_ParticleTypes),
    81   params(parameters_t(MAXPARAMS, 0.))
     122  params(parameters_t(MAXPARAMS, 0.)),
     123  bindingmodel(generateBindingModel(_ParticleTypes))
    82124{
    83125  // have some decent defaults for parameter_derivative checking
     
    91133    const double _equilibrium_distance) :
    92134  EmpiricalPotential(_ParticleTypes),
    93   params(parameters_t(MAXPARAMS, 0.))
     135  params(parameters_t(MAXPARAMS, 0.)),
     136  bindingmodel(generateBindingModel(_ParticleTypes))
    94137{
    95138  params[spring_constant] = _spring_constant;
  • src/Potentials/Specifics/FourBodyPotential_Torsion.hpp

    rc5e75f3 rd5ca1a  
    191191  };
    192192
     193  /** Getter for the graph specifying the binding model of the potential.
     194   *
     195   * \return HomologyGraph of the binding model
     196   */
     197  const HomologyGraph& getBindingModel() const
     198  { return bindingmodel; }
     199
    193200protected:
    194201  virtual result_t function_theta(
     
    212219  //!> internal coordinator object for converting arguments_t
    213220  static Coordinator::ptr coordinator;
     221
     222  //!> binding model for this potential
     223  const HomologyGraph bindingmodel;
    214224};
    215225
  • src/Potentials/Specifics/ManyBodyPotential_Tersoff.cpp

    rc5e75f3 rd5ca1a  
    8282Coordinator::ptr ManyBodyPotential_Tersoff::coordinator(Memory::ignore(new OneBody_Constant()));
    8383
     84static HomologyGraph generateBindingModel(const EmpiricalPotential::ParticleTypes_t &_ParticleTypes)
     85{
     86  // fill nodes
     87  HomologyGraph::nodes_t nodes;
     88  {
     89    ASSERT( _ParticleTypes.size() == (size_t)2,
     90        "generateBindingModel() - ManyBodyPotential_Tersoff needs two types.");
     91    std::pair<HomologyGraph::nodes_t::iterator, bool > inserter;
     92    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[0], 1), 1) );
     93    if (!inserter.second)
     94      ++(inserter.first->second);
     95    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[1], 1), 1) );
     96    if (!inserter.second)
     97      ++(inserter.first->second);
     98  }
     99
     100  // there are no edges
     101  HomologyGraph::edges_t edges;
     102  {
     103    edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[0], _ParticleTypes[1]), 1) );
     104  }
     105
     106  return HomologyGraph(nodes, edges);
     107}
     108
    84109ManyBodyPotential_Tersoff::ManyBodyPotential_Tersoff() :
    85110    EmpiricalPotential(),
     
    91116    chi(1.),
    92117    omega(1.),
    93     triplefunction(&Helpers::NoOp_Triplefunction)
     118    triplefunction(&Helpers::NoOp_Triplefunction),
     119    bindingmodel(HomologyGraph())
    94120{}
    95121
     
    105131    chi(1.),
    106132    omega(1.),
    107     triplefunction(&Helpers::NoOp_Triplefunction)
     133    triplefunction(&Helpers::NoOp_Triplefunction),
     134    bindingmodel(generateBindingModel(_ParticleTypes))
    108135{
    109136  // have some decent defaults for parameter_derivative checking
     
    144171  chi(_chi),
    145172  omega(_mu),
    146   triplefunction(&Helpers::NoOp_Triplefunction)
     173  triplefunction(&Helpers::NoOp_Triplefunction),
     174  bindingmodel(generateBindingModel(_ParticleTypes))
    147175{
    148176//  Info info(__func__);
  • src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp

    rc5e75f3 rd5ca1a  
    213213  { triplefunction = _triplefunction;  }
    214214
     215  /** Getter for the graph specifying the binding model of the potential.
     216   *
     217   * \return HomologyGraph of the binding model
     218   */
     219  const HomologyGraph& getBindingModel() const
     220  { return bindingmodel; }
     221
    215222private:
    216223  /** This function represents the cutoff \f$ f_C \f$.
     
    363370  //!> internal coordinator object for converting arguments_t
    364371  static Coordinator::ptr coordinator;
     372
     373  //!> binding model for this potential
     374  const HomologyGraph bindingmodel;
    365375};
    366376
  • src/Potentials/Specifics/PairPotential_Harmonic.cpp

    rc5e75f3 rd5ca1a  
    6767Coordinator::ptr PairPotential_Harmonic::coordinator(Memory::ignore(new TwoBody_Length()));
    6868
     69static HomologyGraph generateBindingModel(const EmpiricalPotential::ParticleTypes_t &_ParticleTypes)
     70{
     71  // fill nodes
     72  HomologyGraph::nodes_t nodes;
     73  {
     74    ASSERT( _ParticleTypes.size() == (size_t)2,
     75        "generateBindingModel() - PairPotential_Harmonic needs two types.");
     76    std::pair<HomologyGraph::nodes_t::iterator, bool > inserter;
     77    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[0], 1), 1) );
     78    if (!inserter.second)
     79      ++(inserter.first->second);
     80    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[1], 1), 1) );
     81    if (!inserter.second)
     82      ++(inserter.first->second);
     83  }
     84
     85  // there are no edges
     86  HomologyGraph::edges_t edges;
     87  {
     88    edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[0], _ParticleTypes[1]), 1) );
     89  }
     90
     91  return HomologyGraph(nodes, edges);
     92}
     93
    6994PairPotential_Harmonic::PairPotential_Harmonic() :
    7095  EmpiricalPotential(),
    71   params(parameters_t(MAXPARAMS, 0.))
     96  params(parameters_t(MAXPARAMS, 0.)),
     97  bindingmodel(HomologyGraph())
    7298{
    7399  // have some decent defaults for parameter_derivative checking
     
    79105    const ParticleTypes_t &_ParticleTypes) :
    80106  EmpiricalPotential(_ParticleTypes),
    81   params(parameters_t(MAXPARAMS, 0.))
     107  params(parameters_t(MAXPARAMS, 0.)),
     108  bindingmodel(generateBindingModel(_ParticleTypes))
    82109{
    83110  // have some decent defaults for parameter_derivative checking
     
    91118    const double _equilibrium_distance) :
    92119  EmpiricalPotential(_ParticleTypes),
    93   params(parameters_t(MAXPARAMS, 0.))
     120  params(parameters_t(MAXPARAMS, 0.)),
     121  bindingmodel(generateBindingModel(_ParticleTypes))
    94122{
    95123  params[spring_constant] = _spring_constant;
  • src/Potentials/Specifics/PairPotential_Harmonic.hpp

    rc5e75f3 rd5ca1a  
    185185    MAXPARAMS
    186186  };
     187
     188  /** Getter for the graph specifying the binding model of the potential.
     189   *
     190   * \return HomologyGraph of the binding model
     191   */
     192  const HomologyGraph& getBindingModel() const
     193  { return bindingmodel; }
     194
    187195private:
    188196  //!> parameter vector with parameters as in enum parameter_enum_t
     
    197205  //!> internal coordinator object for converting arguments_t
    198206  static Coordinator::ptr coordinator;
     207
     208  //!> binding model for this potential
     209  const HomologyGraph bindingmodel;
    199210};
    200211
  • src/Potentials/Specifics/PairPotential_LennardJones.cpp

    rc5e75f3 rd5ca1a  
    6767Coordinator::ptr PairPotential_LennardJones::coordinator(Memory::ignore(new TwoBody_Length()));
    6868
     69static HomologyGraph generateBindingModel(const EmpiricalPotential::ParticleTypes_t &_ParticleTypes)
     70{
     71  // fill nodes
     72  HomologyGraph::nodes_t nodes;
     73  {
     74    ASSERT( _ParticleTypes.size() == (size_t)2,
     75        "generateBindingModel() - PairPotential_LennardJones needs two types.");
     76    std::pair<HomologyGraph::nodes_t::iterator, bool > inserter;
     77    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[0], 1), 1) );
     78    if (!inserter.second)
     79      ++(inserter.first->second);
     80    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[1], 1), 1) );
     81    if (!inserter.second)
     82      ++(inserter.first->second);
     83  }
     84
     85  // there are no edges
     86  HomologyGraph::edges_t edges;
     87
     88  return HomologyGraph(nodes, edges);
     89}
     90
    6991void PairPotential_LennardJones::setDefaultParameters()
    7092{
     
    7597PairPotential_LennardJones::PairPotential_LennardJones() :
    7698    EmpiricalPotential(),
    77     params(parameters_t(MAXPARAMS, 0.))
     99    params(parameters_t(MAXPARAMS, 0.)),
     100    bindingmodel(HomologyGraph())
    78101{
    79102  // have some decent defaults for parameter_derivative checking
     
    85108    ) :
    86109  EmpiricalPotential(_ParticleTypes),
    87   params(parameters_t(MAXPARAMS, 0.))
     110  params(parameters_t(MAXPARAMS, 0.)),
     111  bindingmodel(generateBindingModel(_ParticleTypes))
    88112{
    89113  // have some decent defaults for parameter_derivative checking
     
    97121    ) :
    98122  EmpiricalPotential(_ParticleTypes),
    99   params(parameters_t(MAXPARAMS, 0.))
     123  params(parameters_t(MAXPARAMS, 0.)),
     124  bindingmodel(generateBindingModel(_ParticleTypes))
    100125{
    101126  params[epsilon] = _epsilon;
  • src/Potentials/Specifics/PairPotential_LennardJones.hpp

    rc5e75f3 rd5ca1a  
    187187  };
    188188
     189  /** Getter for the graph specifying the binding model of the potential.
     190   *
     191   * \return HomologyGraph of the binding model
     192   */
     193  const HomologyGraph& getBindingModel() const
     194  { return bindingmodel; }
     195
    189196private:
    190197  /** Sets some sensible default parameter values.
     
    205212  //!> internal coordinator object for converting arguments_t
    206213  static Coordinator::ptr coordinator;
     214
     215  //!> binding model for this potential
     216  const HomologyGraph bindingmodel;
    207217};
    208218
  • src/Potentials/Specifics/PairPotential_Morse.cpp

    rc5e75f3 rd5ca1a  
    6969Coordinator::ptr PairPotential_Morse::coordinator(Memory::ignore(new TwoBody_Length()));
    7070
     71static HomologyGraph generateBindingModel(const EmpiricalPotential::ParticleTypes_t &_ParticleTypes)
     72{
     73  // fill nodes
     74  HomologyGraph::nodes_t nodes;
     75  {
     76    ASSERT( _ParticleTypes.size() == (size_t)2,
     77        "generateBindingModel() - PairPotential_Morse needs two types.");
     78    std::pair<HomologyGraph::nodes_t::iterator, bool > inserter;
     79    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[0], 1), 1) );
     80    if (!inserter.second)
     81      ++(inserter.first->second);
     82    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[1], 1), 1) );
     83    if (!inserter.second)
     84      ++(inserter.first->second);
     85  }
     86
     87  // there are no edges
     88  HomologyGraph::edges_t edges;
     89  {
     90    edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[0], _ParticleTypes[1]), 1) );
     91  }
     92
     93  return HomologyGraph(nodes, edges);
     94}
     95
    7196PairPotential_Morse::PairPotential_Morse() :
    7297  EmpiricalPotential(),
    73   params(parameters_t(MAXPARAMS, 0.))
     98  params(parameters_t(MAXPARAMS, 0.)),
     99  bindingmodel(HomologyGraph())
    74100{
    75101  // have some decent defaults for parameter_derivative checking
     
    83109    ) :
    84110  EmpiricalPotential(_ParticleTypes),
    85   params(parameters_t(MAXPARAMS, 0.))
     111  params(parameters_t(MAXPARAMS, 0.)),
     112  bindingmodel(generateBindingModel(_ParticleTypes))
    86113{
    87114  // have some decent defaults for parameter_derivative checking
     
    97124    const double _dissociation_energy) :
    98125  EmpiricalPotential(_ParticleTypes),
    99   params(parameters_t(MAXPARAMS, 0.))
     126  params(parameters_t(MAXPARAMS, 0.)),
     127  bindingmodel(generateBindingModel(_ParticleTypes))
    100128{
    101129  params[spring_constant] = _spring_constant;
  • src/Potentials/Specifics/PairPotential_Morse.hpp

    rc5e75f3 rd5ca1a  
    188188  };
    189189
     190  /** Getter for the graph specifying the binding model of the potential.
     191   *
     192   * \return HomologyGraph of the binding model
     193   */
     194  const HomologyGraph& getBindingModel() const
     195  { return bindingmodel; }
     196
    190197private:
    191198  //!> parameter vector with parameters as in enum parameter_enum_t
     
    200207  //!> internal coordinator object for converting arguments_t
    201208  static Coordinator::ptr coordinator;
     209
     210  //!> binding model for this potential
     211  const HomologyGraph bindingmodel;
    202212};
    203213
  • src/Potentials/Specifics/ThreeBodyPotential_Angle.cpp

    rc5e75f3 rd5ca1a  
    6767Coordinator::ptr ThreeBodyPotential_Angle::coordinator(Memory::ignore(new ThreeBody_Angle()));
    6868
     69static HomologyGraph generateBindingModel(const EmpiricalPotential::ParticleTypes_t &_ParticleTypes)
     70{
     71  // fill nodes
     72  HomologyGraph::nodes_t nodes;
     73  {
     74    ASSERT( _ParticleTypes.size() == (size_t)3,
     75        "generateBindingModel() - ThreeBodyPotential_Angle needs three types.");
     76    std::pair<HomologyGraph::nodes_t::iterator, bool > inserter;
     77    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[0], 1), 1) );
     78    if (!inserter.second)
     79      ++(inserter.first->second);
     80    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[1], 2), 1) );
     81    if (!inserter.second)
     82      ++(inserter.first->second);
     83    inserter = nodes.insert( std::make_pair(FragmentNode(_ParticleTypes[2], 1), 1) );
     84    if (!inserter.second)
     85      ++(inserter.first->second);
     86  }
     87
     88  // there are no edges
     89  HomologyGraph::edges_t edges;
     90  {
     91    std::pair<HomologyGraph::edges_t::iterator, bool > inserter;
     92    inserter = edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[0], _ParticleTypes[1]), 1) );
     93    if (!inserter.second)
     94      ++(inserter.first->second);
     95    inserter = edges.insert( std::make_pair( FragmentEdge(_ParticleTypes[1], _ParticleTypes[2]), 1) );
     96    if (!inserter.second)
     97      ++(inserter.first->second);
     98  }
     99
     100  return HomologyGraph(nodes, edges);
     101}
     102
    69103ThreeBodyPotential_Angle::ThreeBodyPotential_Angle() :
    70104  EmpiricalPotential(),
    71   params(parameters_t(MAXPARAMS, 0.))
     105  params(parameters_t(MAXPARAMS, 0.)),
     106  bindingmodel(HomologyGraph())
    72107{
    73108  // have some decent defaults for parameter_derivative checking
     
    80115    ) :
    81116  EmpiricalPotential(_ParticleTypes),
    82   params(parameters_t(MAXPARAMS, 0.))
     117  params(parameters_t(MAXPARAMS, 0.)),
     118  bindingmodel(generateBindingModel(_ParticleTypes))
    83119{
    84120  // have some decent defaults for parameter_derivative checking
     
    92128    const double _equilibrium_distance) :
    93129  EmpiricalPotential(_ParticleTypes),
    94   params(parameters_t(MAXPARAMS, 0.))
     130  params(parameters_t(MAXPARAMS, 0.)),
     131  bindingmodel(generateBindingModel(_ParticleTypes))
    95132{
    96133  params[spring_constant] = _spring_constant;
  • src/Potentials/Specifics/ThreeBodyPotential_Angle.hpp

    rc5e75f3 rd5ca1a  
    188188  };
    189189
     190  /** Getter for the graph specifying the binding model of the potential.
     191   *
     192   * \return HomologyGraph of the binding model
     193   */
     194  const HomologyGraph& getBindingModel() const
     195  { return bindingmodel; }
     196
    190197private:
    191198  result_t
     
    207214  //!> internal coordinator object for converting arguments_t
    208215  static Coordinator::ptr coordinator;
     216
     217  //!> binding model for this potential
     218  const HomologyGraph bindingmodel;
    209219};
    210220
Note: See TracChangeset for help on using the changeset viewer.