Scine::Swoose  2.1.0
This is the SCINE module Swoose.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
AngleTerm.h
Go to the documentation of this file.
1 
8 #ifndef MOLECULARMECHANICS_ANGLETERM_H
9 #define MOLECULARMECHANICS_ANGLETERM_H
10 
11 #include "../Topology/AngleType.h"
12 #include "Angle.h"
13 #include "InteractionTermBase.h"
15 #include <Utils/Typenames.h>
16 #include <Eigen/Core>
17 
18 namespace Scine {
19 
20 namespace Utils {
21 class AtomicSecondDerivativeCollection;
22 } // namespace Utils
23 
24 namespace MolecularMechanics {
30  public:
31  using AtomIndex = int;
32 
34  AngleTerm(AtomIndex firstAtom, AtomIndex secondAtom, AtomIndex thirdAtom, const Angle& angle, const AngleType& typeOfAngle);
36  ~AngleTerm();
37 
41  double evaluateAngleTerm(const Utils::PositionCollection& positions, Utils::AtomicSecondDerivativeCollection& derivatives) const;
45  AngleType getTypeOfAngle() const;
46 
50  int getFirstAtom() const;
51 
55  int getSecondAtom() const;
56 
60  int getThirdAtom() const;
61 
62  private:
63  friend class HydrogenBondTerm;
66  static void calculateDerivativesWithNormalFormula(const Utils::AutomaticDifferentiation::Second1D& angleDerivative,
67  const Eigen::Vector3d& a, const Eigen::Vector3d& b,
68  Utils::AutomaticDifferentiation::Second3D& angleContributionAtom1,
69  Utils::AutomaticDifferentiation::Second3D& angleContributionAtom2,
70  Utils::AutomaticDifferentiation::Second3D& angleContributionAtom3);
71  static void calculateDerivativesForCriticalAngles(const Utils::AutomaticDifferentiation::Second1D& angleDerivative,
72  const Eigen::Vector3d& a, const Eigen::Vector3d& b,
73  Utils::AutomaticDifferentiation::Second3D& angleContributionAtom1,
74  Utils::AutomaticDifferentiation::Second3D& angleContributionAtom2,
75  Utils::AutomaticDifferentiation::Second3D& angleContributionAtom3);
76 
77  AtomIndex firstAtom_, secondAtom_, thirdAtom_;
78  Angle angle_;
79  AngleType typeOfAngle_;
80  static constexpr double singularityCriterion_ = 0.00001;
81 };
82 
83 } // namespace MolecularMechanics
84 } // namespace Scine
85 
86 #endif // MOLECULARMECHANICS_ANGLETERM_H
AngleTerm(AtomIndex firstAtom, AtomIndex secondAtom, AtomIndex thirdAtom, const Angle &angle, const AngleType &typeOfAngle)
Constructor from three atom types and instances of Angle and AngleType classes.
Definition: AngleTerm.cpp:22
Class evaluating angle interaction for three given atoms.
Definition: AngleTerm.h:29
This class evaluates the energy and its derivatives for one hydrogen bond term.
Definition: HydrogenBondTerm.h:27
Base class for all interaction terms.
Definition: InteractionTermBase.h:18
Class treating an angle interaction,based solely on the angle (in rad), i.e. in 1 dimension...
Definition: Angle.h:19
int getThirdAtom() const
Getter for third atom.
Definition: AngleTerm.cpp:151
Describes a bond uniquely for given atom types. (useful for maps/unordered_maps)
Definition: AngleType.h:24
int getFirstAtom() const
Getter for first atom.
Definition: AngleTerm.cpp:143
int getSecondAtom() const
Getter for second atom.
Definition: AngleTerm.cpp:147
double evaluateAngleTerm(const Utils::PositionCollection &positions, Utils::AtomicSecondDerivativeCollection &derivatives) const
Evaluates energy contribution and adds the derivatives.
Definition: AngleTerm.cpp:28
AngleType getTypeOfAngle() const
Getter for angle type.
Definition: AngleTerm.cpp:139