RDKit
Open-source cheminformatics and machine learning.
MMFF/Builder.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2013-2018 Paolo Tosco
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_MMFFBUILDER_H
14 #define RD_MMFFBUILDER_H
15 
16 #include <vector>
17 #include <string>
18 #include <boost/shared_array.hpp>
19 #include <boost/scoped_ptr.hpp>
20 #ifdef RDK_THREADSAFE_SSS
21 #include <mutex>
22 #endif
23 #include <boost/noncopyable.hpp>
24 #include <boost/tuple/tuple.hpp>
25 #include <boost/cstdint.hpp>
26 
27 namespace ForceFields {
28 class ForceField;
29 }
30 
31 namespace RDKit {
32 class ROMol;
33 namespace MMFF {
34 class MMFFMolProperties;
35 
36 //! Builds and returns a MMFF force field for a molecule
37 /*!
38 
39  \param mol the molecule to use
40  \param nonBondedThresh the threshold to be used in adding non-bonded terms
41  to the force field. Any non-bonded contact whose
42  current
43  distance is greater than \c nonBondedThresh * the minimum
44  value
45  for that contact will not be included.
46  \param confId the optional conformer id, if this isn't provided, the
47  molecule's
48  default confId will be used.
49  \param ignoreInterfragInteractions if true, nonbonded terms will not be added
50  between
51  fragments
52 
53  \return the new force field. The client is responsible for free'ing this.
54 */
56  ROMol &mol, double nonBondedThresh = 100.0, int confId = -1,
57  bool ignoreInterfragInteractions = true);
58 
59 //! Builds and returns a MMFF force field for a molecule
60 /*!
61 
62  \param mol the molecule to use
63  \param mmffMolProperties pointer to a MMFFMolProperties object
64  \param nonBondedThresh the threshold to be used in adding non-bonded terms
65  to the force field. Any non-bonded contact whose current
66  distance is greater than \c nonBondedThresh * the minimum
67  value
68  for that contact will not be included.
69  \param confId the optional conformer id, if this isn't provided, the
70  molecule's
71  default confId will be used.
72  \param ignoreInterfragInteractions if true, nonbonded terms will not be added
73  between
74  fragments
75 
76  \return the new force field. The client is responsible for free'ing this.
77 */
79  ROMol &mol, MMFFMolProperties *mmffMolProperties,
80  double nonBondedThresh = 100.0, int confId = -1,
81  bool ignoreInterfragInteractions = true);
82 
83 namespace Tools {
84 class RDKIT_FORCEFIELDHELPERS_EXPORT DefaultTorsionBondSmarts : private boost::noncopyable {
85  public:
86  static const std::string &string() { return ds_string; }
87  static const ROMol *query();
88 
89  private:
91  static void create();
92  static const std::string ds_string;
93  static boost::scoped_ptr<const ROMol> ds_instance;
94 #ifdef RDK_THREADSAFE_SSS
95  static std::once_flag ds_flag;
96 #endif
97 };
98 
99 enum { RELATION_1_2 = 0, RELATION_1_3 = 1, RELATION_1_4 = 2, RELATION_1_X = 3 };
100 // these functions are primarily exposed so they can be tested.
101 RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, int i, int j);
102 RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(boost::shared_array<boost::uint8_t> &res, unsigned int pos,
103  boost::uint8_t value);
104 RDKIT_FORCEFIELDHELPERS_EXPORT boost::uint8_t getTwoBitCell(boost::shared_array<boost::uint8_t> &res,
105  unsigned int pos);
106 RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array<boost::uint8_t> buildNeighborMatrix(const ROMol &mol);
107 RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol, MMFFMolProperties *mmffMolProperties,
108  ForceFields::ForceField *field);
109 RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol, MMFFMolProperties *mmffMolProperties,
110  ForceFields::ForceField *field);
111 RDKIT_FORCEFIELDHELPERS_EXPORT void addStretchBend(const ROMol &mol, MMFFMolProperties *mmffMolProperties,
112  ForceFields::ForceField *field);
113 RDKIT_FORCEFIELDHELPERS_EXPORT void addOop(const ROMol &mol, MMFFMolProperties *mmffMolProperties,
114  ForceFields::ForceField *field);
116  const ROMol &mol, MMFFMolProperties *mmffMolProperties,
118  const std::string &torsionBondSmarts = DefaultTorsionBondSmarts::string());
119 RDKIT_FORCEFIELDHELPERS_EXPORT void addVdW(const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties,
121  boost::shared_array<boost::uint8_t> neighborMatrix,
122  double nonBondedThresh = 100.0,
123  bool ignoreInterfragInteractions = true);
124 RDKIT_FORCEFIELDHELPERS_EXPORT void addEle(const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties,
126  boost::shared_array<boost::uint8_t> neighborMatrix,
127  double nonBondedThresh = 100.0,
128  bool ignoreInterfragInteractions = true);
129 }
130 }
131 }
132 
133 #endif
RDKIT_FORCEFIELDHELPERS_EXPORT boost::uint8_t getTwoBitCell(boost::shared_array< boost::uint8_t > &res, unsigned int pos)
RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField * constructForceField(ROMol &mol, MMFFMolProperties *mmffMolProperties, double nonBondedThresh=100.0, int confId=-1, bool ignoreInterfragInteractions=true)
Builds and returns a MMFF force field for a molecule.
RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, int i, int j)
RDKIT_FORCEFIELDHELPERS_EXPORT void addStretchBend(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKIT_FORCEFIELDHELPERS_EXPORT void addEle(const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field, boost::shared_array< boost::uint8_t > neighborMatrix, double nonBondedThresh=100.0, bool ignoreInterfragInteractions=true)
RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array< boost::uint8_t > buildNeighborMatrix(const ROMol &mol)
RDKIT_FORCEFIELDHELPERS_EXPORT void addOop(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
Std stuff.
Definition: Atom.h:30
RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(boost::shared_array< boost::uint8_t > &res, unsigned int pos, boost::uint8_t value)
RDKIT_FORCEFIELDHELPERS_EXPORT void addVdW(const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field, boost::shared_array< boost::uint8_t > neighborMatrix, double nonBondedThresh=100.0, bool ignoreInterfragInteractions=true)
RDKIT_FORCEFIELDHELPERS_EXPORT void addTorsions(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field, const std::string &torsionBondSmarts=DefaultTorsionBondSmarts::string())
#define RDKIT_FORCEFIELDHELPERS_EXPORT
Definition: export.h:255
A class to store forcefields and handle minimization.
Definition: ForceField.h:58
static const std::string & string()
Definition: MMFF/Builder.h:86
RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)