RDKit: Builder.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
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
25namespace ForceFields {
26class ForceField;
27}
28
29namespace RDKit {
30class ROMol;
31namespace MMFF {
32class 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*/
53 RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField *constructForceField(
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*/
76 RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField *constructForceField(
77 ROMol &mol, MMFFMolProperties *mmffMolProperties,
78 double nonBondedThresh = 100.0, int confId = -1,
79 bool ignoreInterfragInteractions = true);
80
81 namespace Tools {
82 class RDKIT_FORCEFIELDHELPERS_EXPORT DefaultTorsionBondSmarts
83 : private boost::noncopyable {
84 public:
85 static const std::string &string() { return ds_string; }
86 static const ROMol *query();
87
88 private:
89 DefaultTorsionBondSmarts() {}
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);
102 RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(
103 boost::shared_array<std::uint8_t> &res, unsigned int pos,
104 std::uint8_t value);
105 RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell(
106 boost::shared_array<std::uint8_t> &res, unsigned int pos);
107 RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array<std::uint8_t>
108buildNeighborMatrix(const ROMol &mol);
109 RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(
110 const ROMol &mol, MMFFMolProperties *mmffMolProperties,
111 ForceFields::ForceField *field);
112 RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(
113 const ROMol &mol, MMFFMolProperties *mmffMolProperties,
114 ForceFields::ForceField *field);
115 RDKIT_FORCEFIELDHELPERS_EXPORT void addStretchBend(
116 const ROMol &mol, MMFFMolProperties *mmffMolProperties,
117 ForceFields::ForceField *field);
118 RDKIT_FORCEFIELDHELPERS_EXPORT void addOop(const ROMol &mol,
119 MMFFMolProperties *mmffMolProperties,
120 ForceFields::ForceField *field);
121 RDKIT_FORCEFIELDHELPERS_EXPORT void addTorsions(
122 const ROMol &mol, MMFFMolProperties *mmffMolProperties,
123 ForceFields::ForceField *field,
124 const std::string &torsionBondSmarts = DefaultTorsionBondSmarts::string());
125 RDKIT_FORCEFIELDHELPERS_EXPORT void addVdW(
126 const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties,
127 ForceFields::ForceField *field,
128 boost::shared_array<std::uint8_t> neighborMatrix,
129 double nonBondedThresh = 100.0, bool ignoreInterfragInteractions = true);
130 RDKIT_FORCEFIELDHELPERS_EXPORT void addEle(
131 const ROMol &mol, int confId, MMFFMolProperties *mmffMolProperties,
132 ForceFields::ForceField *field,
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
ForceFields::ForceField
A class to store forcefields and handle minimization.
Definition ForceField.h:79
RDKit::MMFF::MMFFMolProperties
Definition MMFF/AtomTyper.h:76
RDKit::MMFF::Tools::DefaultTorsionBondSmarts::string
static const std::string & string()
Definition MMFF/Builder.h:85
RDKit::MMFF::Tools::DefaultTorsionBondSmarts::query
static const ROMol * query()
RDKit::ROMol
Definition ROMol.h:199
export.h
RDKIT_FORCEFIELDHELPERS_EXPORT
#define RDKIT_FORCEFIELDHELPERS_EXPORT
Definition export.h:209
ForceFields
Definition TorsionAngleContribs.h:21
RDKit::MMFF::Tools
Definition MMFF/Builder.h:81
RDKit::MMFF::Tools::setTwoBitCell
RDKIT_FORCEFIELDHELPERS_EXPORT void setTwoBitCell(boost::shared_array< std::uint8_t > &res, unsigned int pos, std::uint8_t value)
RDKit::MMFF::Tools::addStretchBend
RDKIT_FORCEFIELDHELPERS_EXPORT void addStretchBend(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKit::MMFF::Tools::addTorsions
RDKIT_FORCEFIELDHELPERS_EXPORT void addTorsions(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field, const std::string &torsionBondSmarts=DefaultTorsionBondSmarts::string())
RDKit::MMFF::Tools::RELATION_1_4
@ RELATION_1_4
Definition MMFF/Builder.h:98
RDKit::MMFF::Tools::RELATION_1_3
@ RELATION_1_3
Definition MMFF/Builder.h:98
RDKit::MMFF::Tools::RELATION_1_X
@ RELATION_1_X
Definition MMFF/Builder.h:98
RDKit::MMFF::Tools::RELATION_1_2
@ RELATION_1_2
Definition MMFF/Builder.h:98
RDKit::MMFF::Tools::addBonds
RDKIT_FORCEFIELDHELPERS_EXPORT void addBonds(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKit::MMFF::Tools::getTwoBitCell
RDKIT_FORCEFIELDHELPERS_EXPORT std::uint8_t getTwoBitCell(boost::shared_array< std::uint8_t > &res, unsigned int pos)
RDKit::MMFF::Tools::twoBitCellPos
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int twoBitCellPos(unsigned int nAtoms, int i, int j)
RDKit::MMFF::Tools::addOop
RDKIT_FORCEFIELDHELPERS_EXPORT void addOop(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKit::MMFF::Tools::addAngles
RDKIT_FORCEFIELDHELPERS_EXPORT void addAngles(const ROMol &mol, MMFFMolProperties *mmffMolProperties, ForceFields::ForceField *field)
RDKit::MMFF::Tools::addVdW
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::MMFF::Tools::addEle
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::MMFF::Tools::buildNeighborMatrix
RDKIT_FORCEFIELDHELPERS_EXPORT boost::shared_array< std::uint8_t > buildNeighborMatrix(const ROMol &mol)
RDKit::MMFF
Definition MMFF/AtomTyper.h:27
RDKit::MMFF::constructForceField
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.
RDKit
Std stuff.
Definition Abbreviations.h:19