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