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_BUILD_THREADSAFE_SSS
21 #include <mutex>
22 #endif
23 #include <boost/noncopyable.hpp>
24 #include <boost/tuple/tuple.hpp>
25 #include <cstdint>
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 {
85  : private boost::noncopyable {
86  public:
87  static const std::string &string() { return ds_string; }
88  static const ROMol *query();
89 
90  private:
92  static void create();
93  static const std::string ds_string;
94  static boost::scoped_ptr<const ROMol> ds_instance;
95 #ifdef RDK_BUILD_THREADSAFE_SSS
96  static std::once_flag ds_flag;
97 #endif
98 };
99 
101 // these functions are primarily exposed so they can be tested.
102 RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms,
103  int i, int j);
105  boost::shared_array<std::uint8_t> &res, unsigned int pos,
106  std::uint8_t value);
108  boost::shared_array<std::uint8_t> &res, unsigned int pos);
109 RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array<std::uint8_t>
112  const ROMol &mol, MMFFMolProperties *mmffMolProperties,
113  ForceFields::ForceField *field);
115  const ROMol &mol, MMFFMolProperties *mmffMolProperties,
116  ForceFields::ForceField *field);
118  const ROMol &mol, MMFFMolProperties *mmffMolProperties,
119  ForceFields::ForceField *field);
121  MMFFMolProperties *mmffMolProperties,
122  ForceFields::ForceField *field);
124  const ROMol &mol, MMFFMolProperties *mmffMolProperties,
126  const std::string &torsionBondSmarts = DefaultTorsionBondSmarts::string());
128  const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties,
130  boost::shared_array<std::uint8_t> neighborMatrix,
131  double nonBondedThresh = 100.0, bool ignoreInterfragInteractions = true);
133  const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties,
135  boost::shared_array<std::uint8_t> neighborMatrix,
136  double nonBondedThresh = 100.0, bool ignoreInterfragInteractions = true);
137 } // namespace Tools
138 } // namespace MMFF
139 } // namespace RDKit
140 
141 #endif
A class to store forcefields and handle minimization.
Definition: ForceField.h:79
static const std::string & string()
Definition: MMFF/Builder.h:87
#define RDKIT_FORCEFIELDHELPERS_EXPORT
Definition: export.h:193
RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(boost::shared_array< std::uint8_t > &res, unsigned int pos, std::uint8_t value)
RDKIT_FORCEFIELDHELPERS_EXPORT void addStretchBend(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKIT_FORCEFIELDHELPERS_EXPORT void addTorsions(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field, const std::string &torsionBondSmarts=DefaultTorsionBondSmarts::string())
RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell(boost::shared_array< std::uint8_t > &res, unsigned int pos)
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, int i, int j)
RDKIT_FORCEFIELDHELPERS_EXPORT void addOop(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array< std::uint8_t > buildNeighborMatrix(const ROMol &mol)
RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKIT_FORCEFIELDHELPERS_EXPORT void addVdW(const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field, boost::shared_array< std::uint8_t > neighborMatrix, double nonBondedThresh=100.0, bool ignoreInterfragInteractions=true)
RDKIT_FORCEFIELDHELPERS_EXPORT void addEle(const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field, boost::shared_array< std::uint8_t > neighborMatrix, double nonBondedThresh=100.0, bool ignoreInterfragInteractions=true)
RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField * constructForceField(ROMol &mol, double nonBondedThresh=100.0, int confId=-1, bool ignoreInterfragInteractions=true)
Builds and returns a MMFF force field for a molecule.
Std stuff.
Definition: Abbreviations.h:19