RDKit
Open-source cheminformatics and machine learning.
UFF/Builder.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2018 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 #include <RDGeneral/export.h>
11 #ifndef RD_UFFBUILDER_H
12 #define RD_UFFBUILDER_H
13 
14 #include <vector>
15 #include <string>
16 #include <boost/shared_array.hpp>
17 #include <boost/scoped_ptr.hpp>
18 #ifdef RDK_THREADSAFE_SSS
19 #include <mutex>
20 #endif
21 #include <boost/noncopyable.hpp>
22 
23 namespace ForceFields {
24 class ForceField;
25 namespace UFF {
26 class AtomicParams;
27 }
28 } // namespace ForceFields
29 
30 namespace RDKit {
31 class ROMol;
32 namespace UFF {
33 typedef std::vector<const ForceFields::UFF::AtomicParams *> AtomicParamVect;
34 
35 //! Builds and returns a UFF force field for a molecule
36 /*!
37 
38  \param mol the molecule to use
39  \param vdwThresh the threshold to be used in adding van der Waals terms
40  to the force field. Any non-bonded contact whose current
41  distance is greater than \c vdwThresh * the minimum 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 vdwThresh = 100.0, int confId = -1,
54  bool ignoreInterfragInteractions = true);
55 
56 //! Builds and returns a UFF force field for a molecule
57 /*!
58 
59  \param mol the molecule to use
60  \param params a vector with pointers to the ForceFields::UFF::AtomicParams
61  structures to be used
62  \param vdwThresh the threshold to be used in adding van der Waals terms
63  to the force field. Any non-bonded contact whose current
64  distance is greater than \c vdwThresh * the minimum 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, const AtomicParamVect &params, double vdwThresh = 100.0,
77  int confId = -1, bool ignoreInterfragInteractions = true);
78 
79 namespace Tools {
81  : private boost::noncopyable {
82  public:
83  static const std::string &string() { return ds_string; }
84  static const ROMol *query();
85 
86  private:
88  static void create();
89  static const std::string ds_string;
90  static boost::scoped_ptr<const ROMol> ds_instance;
91 #ifdef RDK_THREADSAFE_SSS
92  static std::once_flag ds_flag;
93 #endif
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 RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms,
99  int i, int j);
101  boost::shared_array<std::uint8_t> &res, unsigned int pos,
102  std::uint8_t value);
104  boost::shared_array<std::uint8_t> &res, unsigned int pos);
105 RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array<std::uint8_t>
108  const AtomicParamVect &params,
109  ForceFields::ForceField *field);
111  const AtomicParamVect &params,
112  ForceFields::ForceField *field);
114  const ROMol &mol, int confId, const AtomicParamVect &params,
116  boost::shared_array<std::uint8_t> neighborMatrix, double vdwThresh = 100.0,
117  bool ignoreInterfragInteractions = true);
119  const ROMol &mol, const AtomicParamVect &params,
121  const std::string &torsionBondSmarts = DefaultTorsionBondSmarts::string());
123  const ROMol &mol, const AtomicParamVect &params,
124  ForceFields::ForceField *field);
125 } // namespace Tools
126 } // namespace UFF
127 } // namespace RDKit
128 
129 #endif
A class to store forcefields and handle minimization.
Definition: ForceField.h:80
static const std::string & string()
Definition: UFF/Builder.h:83
#define RDKIT_FORCEFIELDHELPERS_EXPORT
Definition: export.h:307
RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array< std::uint8_t > buildNeighborMatrix(const ROMol &mol)
RDKIT_FORCEFIELDHELPERS_EXPORT void addNonbonded(const ROMol &mol, int confId, const AtomicParamVect &params, ForceFields::ForceField *field, boost::shared_array< std::uint8_t > neighborMatrix, double vdwThresh=100.0, bool ignoreInterfragInteractions=true)
RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(boost::shared_array< std::uint8_t > &res, unsigned int pos, std::uint8_t value)
RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell(boost::shared_array< std::uint8_t > &res, unsigned int pos)
RDKIT_FORCEFIELDHELPERS_EXPORT void addTorsions(const ROMol &mol, const AtomicParamVect &params, ForceFields::ForceField *field, const std::string &torsionBondSmarts=DefaultTorsionBondSmarts::string())
RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol, const AtomicParamVect &params, ForceFields::ForceField *field)
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, int i, int j)
RDKIT_FORCEFIELDHELPERS_EXPORT void addInversions(const ROMol &mol, const AtomicParamVect &params, ForceFields::ForceField *field)
RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol, const AtomicParamVect &params, ForceFields::ForceField *field)
std::vector< const ForceFields::UFF::AtomicParams * > AtomicParamVect
Definition: UFF/AtomTyper.h:28
RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField * constructForceField(ROMol &mol, double vdwThresh=100.0, int confId=-1, bool ignoreInterfragInteractions=true)
Builds and returns a UFF force field for a molecule.
Std stuff.
Definition: Abbreviations.h:17