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