RDKit
Open-source cheminformatics and machine learning.
TorsionAngleM6.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2015 Sereina Riniker
3 //
4 // Copyright (C) 2004-2006 Rational Discovery LLC
5 //
6 // @@ All Rights Reserved @@
7 // This file is part of the RDKit.
8 // The contents are covered by the terms of the BSD license
9 // which is included in the file license.txt, found at the root
10 // of the RDKit source tree.
11 //
12 #ifndef RD_TORSIONANGLEM6_H
13 #define RD_TORSIONANGLEM6_H
14 
15 #include <ForceField/Contrib.h>
16 #include <boost/tuple/tuple.hpp>
17 #include <vector>
18 
19 namespace RDGeom {
20 class Point3D;
21 }
22 
23 namespace ForceFields {
24 class ForceField;
25 class ForceFieldContrib;
26 }
27 
28 namespace ForceFields {
29 namespace CrystalFF {
30 
31 //! the torsion term for multiplicity m = 1 - 6
33  public:
35  : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){};
36  //! Constructor
37  /*!
38  The torsion is between atom1 - atom2 - atom3 - atom4
39  (i.e the angle between bond atom1-atom2 and bond atom3-atom4
40  while looking down bond atom2-atom3)
41 
42  \param owner pointer to the owning ForceField
43  \param idx1 index of atom1 in the ForceField's positions
44  \param idx2 index of atom2 in the ForceField's positions
45  \param idx3 index of atom3 in the ForceField's positions
46  \param idx4 index of atom4 in the ForceField's positions
47  \param V list of 6 force constants
48  \param signs list of 6 signs (+1 or -1)
49  */
50  TorsionAngleContribM6(ForceFields::ForceField *owner, unsigned int idx1,
51  unsigned int idx2, unsigned int idx3, unsigned int idx4,
52  const std::vector<double> &V,
53  const std::vector<int> &signs);
54  double getEnergy(double *pos) const;
55  void getGrad(double *pos, double *grad) const;
56  virtual TorsionAngleContribM6 *copy() const {
57  return new TorsionAngleContribM6(*this);
58  };
59 
60  private:
61  int d_at1Idx, d_at2Idx, d_at3Idx, d_at4Idx;
62  std::vector<double> d_V;
63  std::vector<int> d_sign;
64 };
65 
66 //! calculates and returns the torsional energy
67 double calcTorsionEnergyM6(const std::vector<double> &V,
68  const std::vector<int> &signs, const double cosPhi);
69 }
70 }
71 #endif
double calcTorsionEnergyM6(const std::vector< double > &V, const std::vector< int > &signs, const double cosPhi)
calculates and returns the torsional energy
virtual TorsionAngleContribM6 * copy() const
return a copy
abstract base class for contributions to ForceFields
Definition: Contrib.h:17
the torsion term for multiplicity m = 1 - 6
A class to store forcefields and handle minimization.
Definition: ForceField.h:57