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 #include <RDGeneral/export.h>
13 #ifndef RD_TORSIONANGLEM6_H
14 #define RD_TORSIONANGLEM6_H
15 
16 #include <ForceField/Contrib.h>
17 #include <boost/tuple/tuple.hpp>
18 #include <vector>
19 
20 namespace RDGeom {
21 class Point3D;
22 }
23 
24 namespace ForceFields {
25 class ForceField;
26 class ForceFieldContrib;
27 }
28 
29 namespace ForceFields {
30 namespace CrystalFF {
31 
32 //! the torsion term for multiplicity m = 1 - 6
34  public:
36  : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){};
37  //! Constructor
38  /*!
39  The torsion is between atom1 - atom2 - atom3 - atom4
40  (i.e the angle between bond atom1-atom2 and bond atom3-atom4
41  while looking down bond atom2-atom3)
42 
43  \param owner pointer to the owning ForceField
44  \param idx1 index of atom1 in the ForceField's positions
45  \param idx2 index of atom2 in the ForceField's positions
46  \param idx3 index of atom3 in the ForceField's positions
47  \param idx4 index of atom4 in the ForceField's positions
48  \param V list of 6 force constants
49  \param signs list of 6 signs (+1 or -1)
50  */
51  TorsionAngleContribM6(ForceFields::ForceField *owner, unsigned int idx1,
52  unsigned int idx2, unsigned int idx3, unsigned int idx4,
53  std::vector<double> V, 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 RDKIT_FORCEFIELDHELPERS_EXPORT double calcTorsionEnergyM6(const std::vector<double> &V,
68  const std::vector<int> &signs, const double cosPhi);
69 }
70 }
71 #endif
abstract base class for contributions to ForceFields
Definition: Contrib.h:18
RDKIT_FORCEFIELDHELPERS_EXPORT double calcTorsionEnergyM6(const std::vector< double > &V, const std::vector< int > &signs, const double cosPhi)
calculates and returns the torsional energy
the torsion term for multiplicity m = 1 - 6
virtual TorsionAngleContribM6 * copy() const
return a copy
#define RDKIT_FORCEFIELDHELPERS_EXPORT
Definition: export.h:255
A class to store forcefields and handle minimization.
Definition: ForceField.h:58