Scine::Swoose  2.1.0
This is the SCINE module Swoose.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
DihedralTerm.h
Go to the documentation of this file.
1 
8 #ifndef MOLECULARMECHANICS_DIHEDRALTERM_H
9 #define MOLECULARMECHANICS_DIHEDRALTERM_H
10 
11 #include "../Topology/DihedralType.h"
12 #include "Dihedral.h"
13 #include "InteractionTermBase.h"
15 #include <Utils/Typenames.h>
16 
17 namespace Scine {
18 
19 namespace Utils {
20 class AtomicSecondDerivativeCollection;
21 class Tensor33;
22 } // namespace Utils
23 
24 namespace MolecularMechanics {
30  public:
31  using AtomIndex = int;
32 
34  DihedralTerm(AtomIndex firstAtom, AtomIndex secondAtom, AtomIndex thirdAtom, AtomIndex fourthAtom,
35  const Dihedral& dihedral, const DihedralType& typeOfDihedral);
37  ~DihedralTerm();
38 
42  double evaluateDihedralTerm(const Utils::PositionCollection& positions,
43  Utils::AtomicSecondDerivativeCollection& derivatives) const;
44 
48  static double getTheta(const Eigen::Vector3d& A, const Eigen::Vector3d& B, const Eigen::Vector3d& G);
53 
57  int getFirstAtom() const;
58 
62  int getSecondAtom() const;
63 
67  int getThirdAtom() const;
68 
72  int getFourthAtom() const;
73 
74  private:
77  void setSecondDerivative(Utils::AutomaticDifferentiation::Second3D& h, const Utils::Tensor33& tensor, double derFirst,
78  double derSecond) const;
79 
80  AtomIndex firstAtom_, secondAtom_, thirdAtom_, fourthAtom_;
81  Dihedral dihedral_;
82  DihedralType typeOfDihedral_;
83 };
84 
85 } // namespace MolecularMechanics
86 } // namespace Scine
87 
88 #endif // MOLECULARMECHANICS_DIHEDRALTERM_H
Class evaluating dihedral interaction for four given atoms.
Definition: DihedralTerm.h:29
int getFirstAtom() const
Getter for first atom.
Definition: DihedralTerm.cpp:161
int getFourthAtom() const
Getter for fourth atom.
Definition: DihedralTerm.cpp:173
Class treating a dihedral interaction, based solely on the angle (in rad), i.e. in 1 dimension...
Definition: Dihedral.h:19
Unique descriptor a dihedral for given atom types. (useful for maps/unordered_maps) ...
Definition: DihedralType.h:24
DihedralTerm(AtomIndex firstAtom, AtomIndex secondAtom, AtomIndex thirdAtom, AtomIndex fourthAtom, const Dihedral &dihedral, const DihedralType &typeOfDihedral)
Constructor from four atom in indices and instances of Dihedral and DihedralType classes.
Definition: DihedralTerm.cpp:17
DihedralType getTypeOfDihedral() const
Getter for the corresponding instance of the DihedralType class.
Definition: DihedralTerm.cpp:157
Base class for all interaction terms.
Definition: InteractionTermBase.h:18
double evaluateDihedralTerm(const Utils::PositionCollection &positions, Utils::AtomicSecondDerivativeCollection &derivatives) const
Evaluates energy contribution and adds the derivatives.
Definition: DihedralTerm.cpp:29
int getSecondAtom() const
Getter for second atom.
Definition: DihedralTerm.cpp:165
int getThirdAtom() const
Getter for third atom.
Definition: DihedralTerm.cpp:169
static double getTheta(const Eigen::Vector3d &A, const Eigen::Vector3d &B, const Eigen::Vector3d &G)
Calculate and return the dihedral angle theta from the three essential vectors A, B and G describing ...
Definition: DihedralTerm.cpp:138