RDKit: Builder.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
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_BUILD_THREADSAFE_SSS
19#include <mutex>
20#endif
21#include <boost/noncopyable.hpp>
22
23namespace ForceFields {
24class ForceField;
25namespace UFF {
26class AtomicParams;
27}
28} // namespace ForceFields
29
30namespace RDKit {
31class ROMol;
32namespace UFF {
33typedef 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*/
52 RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField *constructForceField(
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*/
75 RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField *constructForceField(
76 ROMol &mol, const AtomicParamVect &params, double vdwThresh = 100.0,
77 int confId = -1, bool ignoreInterfragInteractions = true);
78
79namespace Tools {
80 class RDKIT_FORCEFIELDHELPERS_EXPORT DefaultTorsionBondSmarts
81 : private boost::noncopyable {
82 public:
83 static const std::string &string() { return ds_string; }
84 static const ROMol *query();
85
86 private:
87 DefaultTorsionBondSmarts() {}
88 static void create();
89 static const std::string ds_string;
90 static boost::scoped_ptr<const ROMol> ds_instance;
91#ifdef RDK_BUILD_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);
100 RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(
101 boost::shared_array<std::uint8_t> &res, unsigned int pos,
102 std::uint8_t value);
103 RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell(
104 boost::shared_array<std::uint8_t> &res, unsigned int pos);
105 RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array<std::uint8_t>
106buildNeighborMatrix(const ROMol &mol);
107 RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol,
108 const AtomicParamVect &params,
109 ForceFields::ForceField *field);
110 RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol,
111 const AtomicParamVect &params,
112 ForceFields::ForceField *field);
113 RDKIT_FORCEFIELDHELPERS_EXPORT void addNonbonded(
114 const ROMol &mol, int confId, const AtomicParamVect &params,
115 ForceFields::ForceField *field,
116 boost::shared_array<std::uint8_t> neighborMatrix, double vdwThresh = 100.0,
117 bool ignoreInterfragInteractions = true);
118 RDKIT_FORCEFIELDHELPERS_EXPORT void addTorsions(
119 const ROMol &mol, const AtomicParamVect &params,
120 ForceFields::ForceField *field,
121 const std::string &torsionBondSmarts = DefaultTorsionBondSmarts::string());
122 RDKIT_FORCEFIELDHELPERS_EXPORT void addInversions(
123 const ROMol &mol, const AtomicParamVect &params,
124 ForceFields::ForceField *field);
125} // namespace Tools
126} // namespace UFF
127} // namespace RDKit
128
129#endif
ForceFields::ForceField
A class to store forcefields and handle minimization.
Definition ForceField.h:79
ForceFields::UFF::AtomicParams
class to store atomic parameters for the Universal Force Field
Definition UFF/Params.h:68
RDKit::ROMol
Definition ROMol.h:199
RDKit::UFF::Tools::DefaultTorsionBondSmarts::query
static const ROMol * query()
RDKit::UFF::Tools::DefaultTorsionBondSmarts::string
static const std::string & string()
Definition UFF/Builder.h:83
export.h
RDKIT_FORCEFIELDHELPERS_EXPORT
#define RDKIT_FORCEFIELDHELPERS_EXPORT
Definition export.h:209
ForceFields::UFF
Definition UFF/AtomTyper.h:19
ForceFields
Definition TorsionAngleContribs.h:21
RDKit::UFF::Tools
Definition UFF/AtomTyper.h:48
RDKit::UFF::Tools::buildNeighborMatrix
RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array< std::uint8_t > buildNeighborMatrix(const ROMol &mol)
RDKit::UFF::Tools::addNonbonded
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::UFF::Tools::setTwoBitCell
RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(boost::shared_array< std::uint8_t > &res, unsigned int pos, std::uint8_t value)
RDKit::UFF::Tools::getTwoBitCell
RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell(boost::shared_array< std::uint8_t > &res, unsigned int pos)
RDKit::UFF::Tools::addTorsions
RDKIT_FORCEFIELDHELPERS_EXPORT void addTorsions(const ROMol &mol, const AtomicParamVect &params, ForceFields::ForceField *field, const std::string &torsionBondSmarts=DefaultTorsionBondSmarts::string())
RDKit::UFF::Tools::addAngles
RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol, const AtomicParamVect &params, ForceFields::ForceField *field)
RDKit::UFF::Tools::twoBitCellPos
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, int i, int j)
RDKit::UFF::Tools::addInversions
RDKIT_FORCEFIELDHELPERS_EXPORT void addInversions(const ROMol &mol, const AtomicParamVect &params, ForceFields::ForceField *field)
RDKit::UFF::Tools::addBonds
RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol, const AtomicParamVect &params, ForceFields::ForceField *field)
RDKit::UFF::Tools::RELATION_1_4
@ RELATION_1_4
Definition UFF/Builder.h:96
RDKit::UFF::Tools::RELATION_1_X
@ RELATION_1_X
Definition UFF/Builder.h:96
RDKit::UFF::Tools::RELATION_1_3
@ RELATION_1_3
Definition UFF/Builder.h:96
RDKit::UFF::Tools::RELATION_1_2
@ RELATION_1_2
Definition UFF/Builder.h:96
RDKit::UFF
Definition UFF/AtomTyper.h:27
RDKit::UFF::constructForceField
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.
RDKit::UFF::AtomicParamVect
std::vector< const ForceFields::UFF::AtomicParams * > AtomicParamVect
Definition UFF/AtomTyper.h:28
RDKit
Std stuff.
Definition Abbreviations.h:19