RDKit
Open-source cheminformatics and machine learning.
MMFF/Builder.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2013-2022 Paolo Tosco and other RDKit contributors
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #include <RDGeneral/export.h>
11 #ifndef RD_MMFFBUILDER_H
12 #define RD_MMFFBUILDER_H
13 
14 #include <vector>
15 #include <string>
16 #include <boost/shared_array.hpp>
17 #include <boost/scoped_ptr.hpp>
18 #ifdef RDK_BUILD_THREADSAFE_SSS
19 #include <mutex>
20 #endif
21 #include <boost/noncopyable.hpp>
22 #include <tuple>
23 #include <cstdint>
24 
25 namespace ForceFields {
26 class ForceField;
27 }
28 
29 namespace RDKit {
30 class ROMol;
31 namespace MMFF {
32 class MMFFMolProperties;
33 
34 //! Builds and returns a MMFF force field for a molecule
35 /*!
36 
37  \param mol the molecule to use
38  \param nonBondedThresh the threshold to be used in adding non-bonded terms
39  to the force field. Any non-bonded contact whose
40  current
41  distance is greater than \c nonBondedThresh * the minimum
42  value
43  for that contact will not be included.
44  \param confId the optional conformer id, if this isn't provided, the
45  molecule's
46  default confId will be used.
47  \param ignoreInterfragInteractions if true, nonbonded terms will not be added
48  between
49  fragments
50 
51  \return the new force field. The client is responsible for free'ing this.
52 */
54  ROMol &mol, double nonBondedThresh = 100.0, int confId = -1,
55  bool ignoreInterfragInteractions = true);
56 
57 //! Builds and returns a MMFF force field for a molecule
58 /*!
59 
60  \param mol the molecule to use
61  \param mmffMolProperties pointer to a MMFFMolProperties object
62  \param nonBondedThresh the threshold to be used in adding non-bonded terms
63  to the force field. Any non-bonded contact whose current
64  distance is greater than \c nonBondedThresh * the minimum
65  value
66  for that contact will not be included.
67  \param confId the optional conformer id, if this isn't provided, the
68  molecule's
69  default confId will be used.
70  \param ignoreInterfragInteractions if true, nonbonded terms will not be added
71  between
72  fragments
73 
74  \return the new force field. The client is responsible for free'ing this.
75 */
77  ROMol &mol, MMFFMolProperties *mmffMolProperties,
78  double nonBondedThresh = 100.0, int confId = -1,
79  bool ignoreInterfragInteractions = true);
80 
81 namespace Tools {
83  : private boost::noncopyable {
84  public:
85  static const std::string &string() { return ds_string; }
86  static const ROMol *query();
87 
88  private:
90  static void create();
91  static const std::string ds_string;
92  static boost::scoped_ptr<const ROMol> ds_instance;
93 #ifdef RDK_BUILD_THREADSAFE_SSS
94  static std::once_flag ds_flag;
95 #endif
96 };
97 
98 enum { RELATION_1_2 = 0, RELATION_1_3 = 1, RELATION_1_4 = 2, RELATION_1_X = 3 };
99 // these functions are primarily exposed so they can be tested.
100 RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms,
101  int i, int j);
103  boost::shared_array<std::uint8_t> &res, unsigned int pos,
104  std::uint8_t value);
106  boost::shared_array<std::uint8_t> &res, unsigned int pos);
107 RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array<std::uint8_t>
110  const ROMol &mol, MMFFMolProperties *mmffMolProperties,
111  ForceFields::ForceField *field);
113  const ROMol &mol, MMFFMolProperties *mmffMolProperties,
114  ForceFields::ForceField *field);
116  const ROMol &mol, MMFFMolProperties *mmffMolProperties,
117  ForceFields::ForceField *field);
119  MMFFMolProperties *mmffMolProperties,
120  ForceFields::ForceField *field);
122  const ROMol &mol, MMFFMolProperties *mmffMolProperties,
124  const std::string &torsionBondSmarts = DefaultTorsionBondSmarts::string());
126  const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties,
128  boost::shared_array<std::uint8_t> neighborMatrix,
129  double nonBondedThresh = 100.0, bool ignoreInterfragInteractions = true);
131  const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties,
133  boost::shared_array<std::uint8_t> neighborMatrix,
134  double nonBondedThresh = 100.0, bool ignoreInterfragInteractions = true);
135 } // namespace Tools
136 } // namespace MMFF
137 } // namespace RDKit
138 
139 #endif
A class to store forcefields and handle minimization.
Definition: ForceField.h:79
static const std::string & string()
Definition: MMFF/Builder.h:85
#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