19#include <boost/smart_ptr.hpp>
20#include <boost/dynamic_bitset.hpp>
73 std::vector<int> &mapping);
86 const ROMol &mol, std::vector<std::vector<int>> &frags);
109 const ROMol &mol, std::vector<std::unique_ptr<ROMol>> &molFrags,
110 bool sanitizeFrags =
true, std::vector<int> *frags =
nullptr,
111 std::vector<std::vector<int>> *fragsMolAtomMapping =
nullptr,
112 bool copyConformers =
true);
133 const ROMol &mol,
bool sanitizeFrags =
true,
134 std::vector<int> *frags =
nullptr,
135 std::vector<std::vector<int>> *fragsMolAtomMapping =
nullptr,
136 bool copyConformers =
true);
156 bool sanitizeFrags =
true,
157 const std::vector<T> *whiteList =
nullptr,
158 bool negateList =
false);
179 std::map<T, std::unique_ptr<ROMol>> &molFrags,
bool sanitizeFrags =
true,
180 const std::vector<T> *whiteList =
nullptr,
bool negateList =
false);
230 bool addCoords =
false,
232 bool addResidueInfo =
false) {
234 std::unique_ptr<RWMol> res{
new RWMol(mol)};
235 addHs(*res, ps, onlyOnAtoms);
236 return static_cast<ROMol *
>(res.release());
240inline void addHs(
RWMol &mol,
bool explicitOnly =
false,
bool addCoords =
false,
242 bool addResidueInfo =
false) {
244 addHs(mol, ps, onlyOnAtoms);
260 unsigned int otherIdx);
294removeHs(
const ROMol &mol,
bool implicitOnly,
bool updateExplicitCount =
false,
295 bool sanitize =
true);
301 bool sanitize =
true);
337 bool sanitize =
true);
342 bool sanitize =
true);
349 bool sanitize =
true);
377 bool mergeUnmappedOnly =
false,
378 bool mergeIsotopes =
false);
382 bool mergeUnmappedOnly =
false,
383 bool mergeIsotopes =
false);
512 const ROMol &mol,
const std::vector<unsigned int> &newOrder);
522 SANITIZE_CLEANUP = 0x1,
523 SANITIZE_PROPERTIES = 0x2,
524 SANITIZE_SYMMRINGS = 0x4,
525 SANITIZE_KEKULIZE = 0x8,
526 SANITIZE_FINDRADICALS = 0x10,
527 SANITIZE_SETAROMATICITY = 0x20,
528 SANITIZE_SETCONJUGATION = 0x40,
529 SANITIZE_SETHYBRIDIZATION = 0x80,
530 SANITIZE_CLEANUPCHIRALITY = 0x100,
531 SANITIZE_ADJUSTHS = 0x200,
532 SANITIZE_CLEANUP_ORGANOMETALLICS = 0x400,
533 SANITIZE_CLEANUPATROPISOMERS = 0x800,
534 SANITIZE_ALL = 0xFFFFFFF
574 RWMol &mol,
unsigned int &operationThatFailed,
575 unsigned int sanitizeOps = SanitizeFlags::SANITIZE_ALL);
603 const ROMol &mol,
unsigned int sanitizeOps = SanitizeFlags::SANITIZE_ALL);
658 int (*func)(
RWMol &) =
nullptr);
765 bool canonical =
true,
766 unsigned int maxBackTracks = 100);
795 bool markAtomsBonds =
true,
796 bool canonical =
true,
797 unsigned int maxBackTracks = 100);
868 std::vector<std::vector<int>> &res,
869 bool includeDativeBonds =
false,
870 bool includeHydrogenBonds =
false);
873 std::vector<std::vector<int>> *res =
nullptr,
874 bool includeDativeBonds =
false,
875 bool includeHydrogenBonds =
false);
887 bool includeDativeBonds =
false,
888 bool includeHydrogenBonds =
false);
929 ROMol &mol, std::vector<std::vector<int>> &res,
931 bool recalcSSSR =
true,
bool includeDativeBonds =
false,
932 bool includeHydrogenBonds =
false);
937 bool recalcSSSR =
true,
bool includeDativeBonds =
false,
938 bool includeHydrogenBonds =
false) {
939 std::vector<std::vector<int>> res;
940 return symmetrizeSSSR(mol, res, algorithm, recalcSSSR, includeDativeBonds,
941 includeHydrogenBonds);
946 bool includeDativeBonds,
947 bool includeHydrogenBonds =
false) {
948 bool recalcSSSR =
true;
950 includeDativeBonds, includeHydrogenBonds);
954 bool includeHydrogenBonds =
false) {
955 std::vector<std::vector<int>> res;
956 bool recalcSSSR =
true;
958 includeDativeBonds, includeHydrogenBonds);
985 const ROMol &mol,
bool useBO =
false,
int emptyVal = 0,
bool force =
false,
986 const char *propNamePrefix =
nullptr,
987 const boost::dynamic_bitset<> *bondsToUse =
nullptr);
1012 const ROMol &mol,
bool useBO =
false,
bool useAtomWts =
false,
1013 bool force =
false,
const char *propNamePrefix =
nullptr);
1039 const ROMol &mol,
const std::vector<int> &activeAtoms,
1040 const std::vector<const Bond *> &bonds,
bool useBO =
false,
1041 bool useAtomWts =
false);
1065 const ROMol &mol,
int confId = -1,
bool useAtomWts =
false,
1066 bool force =
false,
const char *propNamePrefix =
nullptr);
1116 unsigned int size()
const {
return d_hybridizations.size(); }
1119 std::vector<int> d_hybridizations;
1149 ROMol &mol,
int confId = -1,
bool replaceExistingTags =
true);
1163 ROMol &mol,
int confId = -1,
bool replaceExistingTags =
true);
1174 ROMol &mol,
int confId = -1,
bool replaceExistingTags =
true);
1186 bool onlyWedgeFlags =
false);
1194 bool onlyWedgeFlags =
false);
1230 ROMol &mol,
bool cleanIt =
false,
bool force =
false,
1231 bool flagPossibleStereoCenters =
false);
1264 bool cleanIt =
false);
1273 ROMol &mol,
bool replaceExistingTags =
true);
1279 const ROMol &mol,
const std::string_view &prop);
1327 bool onlyHeavy =
false);
1338 bool onlyHeavy =
false);
1353 const ROMol &mol,
bool separateIsotopes =
false,
1354 bool abbreviateHIsotopes =
true);
1359 RWMol &mol,
const boost::dynamic_bitset<> &atomsToUse,
1360 boost::dynamic_bitset<> bondsToUse,
bool markAtomsBonds =
true,
1361 bool canonical =
true,
unsigned int maxBackTracks = 100);
1381 bool addAsQueries =
true,
1382 bool addCoords =
true);
1399 bool markedOnly =
true);
1445 RWMol &mol,
unsigned int atomIdx,
unsigned int val,
bool addAsQuery =
true,
1446 bool addCoords =
true);
1461 bool markedOnly =
true);
#define BETTER_ENUM(Enum, Underlying,...)
RDKIT_GRAPHMOL_EXPORT const int ci_LOCAL_INF
The class for representing atoms.
HybridizationType
store hybridization
class for representing a bond
used by various file parsing classes to indicate a parse error
unsigned int size() const
Atom::HybridizationType operator[](int idx)
~Hybridizations()=default
Hybridizations(const Hybridizations &)
Hybridizations(const ROMol &mol)
RWMol is a molecule class that is intended to be edited.
#define RDKIT_GRAPHMOL_EXPORT
RDKIT_GRAPHMOL_EXPORT std::vector< int > hapticBondEndpoints(const Bond *bond)
RDKIT_GRAPHMOL_EXPORT bool isAttachmentPoint(const Atom *atom, bool markedOnly=true)
returns whether an atom is eligible to be collapsed as an attachment point
RDKIT_GRAPHMOL_EXPORT void KekulizeFragment(RWMol &mol, const boost::dynamic_bitset<> &atomsToUse, boost::dynamic_bitset<> bondsToUse, bool markAtomsBonds=true, bool canonical=true, unsigned int maxBackTracks=100)
not recommended for use in other code
RDKIT_GRAPHMOL_EXPORT unsigned int addExplicitAttachmentPoint(RWMol &mol, unsigned int atomIdx, unsigned int val, bool addAsQuery=true, bool addCoords=true)
Groups a variety of molecular query and transformation operations.
RDKIT_GRAPHMOL_EXPORT void cleanUp(RWMol &mol)
RDKIT_GRAPHMOL_EXPORT void assignStereochemistry(ROMol &mol, bool cleanIt=false, bool force=false, bool flagPossibleStereoCenters=false)
Assign stereochemistry tags to atoms and bonds.
RDKIT_GRAPHMOL_EXPORT void findRingFamilies(const ROMol &mol, bool includeDativeBonds=false, bool includeHydrogenBonds=false)
RDKIT_GRAPHMOL_EXPORT ROMol * renumberAtoms(const ROMol &mol, const std::vector< unsigned int > &newOrder)
returns a copy of a molecule with the atoms renumbered
RDKIT_GRAPHMOL_EXPORT std::string getMolFormula(const ROMol &mol, bool separateIsotopes=false, bool abbreviateHIsotopes=true)
RDKIT_GRAPHMOL_EXPORT void cleanupAtropisomers(RWMol &mol, Hybridizations &hybridizations)
RDKIT_GRAPHMOL_EXPORT void assignChiralTypesFromBondDirs(ROMol &mol, int confId=-1, bool replaceExistingTags=true)
Use bond directions to assign ChiralTypes to a molecule's atoms.
RDKIT_GRAPHMOL_EXPORT int setAromaticity(RWMol &mol, AromaticityModel model=AROMATICITY_DEFAULT, int(*func)(RWMol &)=nullptr)
Sets up the aromaticity for a molecule.
RDKIT_GRAPHMOL_EXPORT void sanitizeMol(RWMol &mol, unsigned int &operationThatFailed, unsigned int sanitizeOps=SanitizeFlags::SANITIZE_ALL)
carries out a collection of tasks for cleaning up a molecule and ensuring that it makes "chemical sen...
RDKIT_GRAPHMOL_EXPORT double getExactMolWt(const ROMol &mol, bool onlyHeavy=false)
RDKIT_GRAPHMOL_EXPORT bool needsHs(const ROMol &mol)
returns whether or not a molecule needs to have Hs added to it.
RDKIT_GRAPHMOL_EXPORT void fastFindRings(const ROMol &mol)
use a DFS algorithm to identify ring bonds and atoms in a molecule
RDKIT_GRAPHMOL_EXPORT std::pair< bool, bool > hasQueryHs(const ROMol &mol)
returns a pair of booleans (hasQueryHs, hasUnmergaebleQueryHs)
RDKIT_GRAPHMOL_EXPORT std::map< T, boost::shared_ptr< ROMol > > getMolFragsWithQuery(const ROMol &mol, T(*query)(const ROMol &, const Atom *), bool sanitizeFrags=true, const std::vector< T > *whiteList=nullptr, bool negateList=false)
splits a molecule into pieces based on labels assigned using a query
constexpr auto useLegacyRingFindingEnvVar
RDKIT_GRAPHMOL_EXPORT int getFormalCharge(const ROMol &mol)
sums up all atomic formal charges and returns the result
AromaticityModel
Possible aromaticity models.
@ AROMATICITY_CUSTOM
use a function
@ AROMATICITY_DEFAULT
future proofing
RDKIT_GRAPHMOL_EXPORT void cleanUpOrganometallics(RWMol &mol)
RDKIT_GRAPHMOL_EXPORT double * getDistanceMat(const ROMol &mol, bool useBO=false, bool useAtomWts=false, bool force=false, const char *propNamePrefix=nullptr)
Computes the molecule's topological distance matrix.
RDKIT_GRAPHMOL_EXPORT ROMol * hapticBondsToDative(const ROMol &mol)
Replaces haptic bond with explicit dative bonds.
RDKIT_GRAPHMOL_EXPORT void setTerminalAtomCoords(ROMol &mol, unsigned int idx, unsigned int otherIdx)
RDKIT_GRAPHMOL_EXPORT bool getUseLegacyRingFinding()
returns whether or not the legacy symmetric SSSR code is used during sanitization
RDKIT_GRAPHMOL_EXPORT void removeStereochemistry(ROMol &mol)
RDKIT_GRAPHMOL_EXPORT void clearSingleBondDirFlags(ROMol &mol, bool onlyWedgeFlags=false)
RDKIT_GRAPHMOL_EXPORT ROMol * adjustQueryProperties(const ROMol &mol, const AdjustQueryParameters *params=nullptr)
returns a copy of a molecule with query properties adjusted
RDKIT_GRAPHMOL_EXPORT unsigned getNumAtomsWithDistinctProperty(const ROMol &mol, const std::string_view &prop)
returns the number of atoms which have a particular property set
RDKIT_GRAPHMOL_EXPORT void assignChiralTypesFromMolParity(ROMol &mol, bool replaceExistingTags=true)
Uses the molParity atom property to assign ChiralType to a molecule's atoms.
RDKIT_GRAPHMOL_EXPORT ROMol * mergeQueryHs(const ROMol &mol, bool mergeUnmappedOnly=false, bool mergeIsotopes=false)
RDKIT_GRAPHMOL_EXPORT void expandAttachmentPoints(RWMol &mol, bool addAsQueries=true, bool addCoords=true)
RDKIT_GRAPHMOL_EXPORT unsigned int getMolFrags(const ROMol &mol, std::vector< int > &mapping)
find fragments (disconnected components of the molecular graph)
RDKIT_GRAPHMOL_EXPORT void adjustHs(RWMol &mol)
adjust the number of implicit and explicit Hs for special cases
RDKIT_GRAPHMOL_EXPORT ROMol * dativeBondsToHaptic(const ROMol &mol)
Replaces explicit dative bonds with haptic.
RDKIT_GRAPHMOL_EXPORT void assignStereochemistryFrom3D(ROMol &mol, int confId=-1, bool replaceExistingTags=true)
Uses a conformer to assign ChiralTypes to a molecule's atoms and stereo flags to its bonds.
RDKIT_GRAPHMOL_EXPORT bool KekulizeIfPossible(RWMol &mol, bool markAtomsBonds=true, bool canonical=true, unsigned int maxBackTracks=100)
RDKIT_GRAPHMOL_EXPORT int countAtomElec(const Atom *at)
RDKIT_GRAPHMOL_EXPORT void detectBondStereochemistry(ROMol &mol, int confId=-1)
RDKIT_GRAPHMOL_EXPORT void setMMFFAromaticity(RWMol &mol)
sets the aromaticity model for a molecule to MMFF94
RDKIT_GRAPHMOL_EXPORT ROMol * removeHs(const ROMol &mol, bool implicitOnly, bool updateExplicitCount=false, bool sanitize=true)
returns a copy of a molecule with hydrogens removed
RDKIT_GRAPHMOL_EXPORT void parseAdjustQueryParametersFromJSON(MolOps::AdjustQueryParameters &p, const std::string &json)
updates an AdjustQueryParameters object from a JSON string
RDKIT_GRAPHMOL_EXPORT void removeAllHs(RWMol &mol, bool sanitize=true)
removes all Hs from a molecule
RDKIT_GRAPHMOL_EXPORT void clearAllBondDirFlags(ROMol &mol)
RDKIT_GRAPHMOL_EXPORT void setUseLegacyRingFinding(bool val)
sets whether or not the legacy symmetric SSSR code is used
RDKIT_GRAPHMOL_EXPORT void setBondStereoFromDirections(ROMol &mol)
RDKIT_GRAPHMOL_EXPORT unsigned int getAttachmentPointLabelNumber(const Atom *atom)
returns the positive integer from a valid _AP<n> attachment-point label
RDKIT_GRAPHMOL_EXPORT double * get3DDistanceMat(const ROMol &mol, int confId=-1, bool useAtomWts=false, bool force=false, const char *propNamePrefix=nullptr)
Computes the molecule's 3D distance matrix.
RDKIT_GRAPHMOL_EXPORT bool atomHasConjugatedBond(const Atom *at)
returns whether or not the given Atom is involved in a conjugated bond
RDKIT_GRAPHMOL_EXPORT int symmetrizeSSSR(ROMol &mol, std::vector< std::vector< int > > &res, SymmetrizeSSSRAlgorithm algorithm=SymmetrizeSSSRAlgorithm::DEFAULT, bool recalcSSSR=true, bool includeDativeBonds=false, bool includeHydrogenBonds=false)
symmetrize the molecule's Smallest Set of Smallest Rings
RDKIT_GRAPHMOL_EXPORT std::vector< std::unique_ptr< MolSanitizeException > > detectChemistryProblems(const ROMol &mol, unsigned int sanitizeOps=SanitizeFlags::SANITIZE_ALL)
Identifies chemistry problems (things that don't make chemical sense) in a molecule.
RDKIT_GRAPHMOL_EXPORT void clearDirFlags(ROMol &mol, bool onlyWedgeFlags=false)
constexpr bool useLegacyRingFindingDefaultVal
RDKIT_GRAPHMOL_EXPORT void cleanupChirality(RWMol &mol)
RDKIT_GRAPHMOL_EXPORT double * getAdjacencyMatrix(const ROMol &mol, bool useBO=false, int emptyVal=0, bool force=false, const char *propNamePrefix=nullptr, const boost::dynamic_bitset<> *bondsToUse=nullptr)
returns a molecule's adjacency matrix
RDKIT_GRAPHMOL_EXPORT void assignRadicals(RWMol &mol)
Called by the sanitizer to assign radical counts to atoms.
RDKIT_GRAPHMOL_EXPORT void findPotentialStereoBonds(ROMol &mol, bool cleanIt=false)
finds bonds that could be cis/trans in a molecule and mark them as Bond::STEREOANY.
RDKIT_GRAPHMOL_EXPORT void addHs(RWMol &mol, const AddHsParameters ¶ms, const UINT_VECT *onlyOnAtoms=nullptr)
adds Hs to a molecule as explicit Atoms
RDKIT_GRAPHMOL_EXPORT void setHybridization(ROMol &mol)
calculates and sets the hybridization of all a molecule's Stoms
constexpr std::string_view attachmentPointLabelPrefix
prefix used for numbered explicit attachment-point atom labels
RDKIT_GRAPHMOL_EXPORT int findSSSR(const ROMol &mol, std::vector< std::vector< int > > &res, bool includeDativeBonds=false, bool includeHydrogenBonds=false)
finds a molecule's Smallest Set of Smallest Rings
RDKIT_GRAPHMOL_EXPORT void collapseAttachmentPoints(RWMol &mol, bool markedOnly=true)
RDKIT_GRAPHMOL_EXPORT bool isMarkedAttachmentPoint(const Atom *atom)
returns whether an atom is a marked explicit attachment point
RDKIT_GRAPHMOL_EXPORT void assignChiralTypesFrom3D(ROMol &mol, int confId=-1, bool replaceExistingTags=true)
Uses a conformer to assign ChiralTypes to a molecule's atoms.
RDKIT_GRAPHMOL_EXPORT std::list< int > getShortestPath(const ROMol &mol, int aid1, int aid2)
Find the shortest path between two atoms.
RDKIT_GRAPHMOL_EXPORT double getAvgMolWt(const ROMol &mol, bool onlyHeavy=false)
RDKIT_GRAPHMOL_EXPORT void setConjugation(ROMol &mol)
flags the molecule's conjugated bonds
RDKIT_GRAPHMOL_EXPORT void setDoubleBondNeighborDirections(ROMol &mol, const Conformer *conf=nullptr)
Sets bond directions based on double bond stereochemistry.
RDKIT_GRAPHMOL_EXPORT void Kekulize(RWMol &mol, bool markAtomsBonds=true, bool canonical=true, unsigned int maxBackTracks=100)
Kekulizes the molecule.
@ ADJUST_IGNORENONDUMMIES
std::vector< double > INVAR_VECT
INVAR_VECT::iterator INVAR_VECT_I
INVAR_VECT::const_iterator INVAR_VECT_CI
std::vector< UINT > UINT_VECT
Parameters controlling the behavior of MolOps::adjustQueryProperties.
bool adjustSingleBondsBetweenAromaticAtoms
static AdjustQueryParameters noAdjustments()
returns an AdjustQueryParameters object with all adjustments disabled
std::uint32_t makeAtomsGenericFlags
std::uint32_t adjustHeavyDegreeFlags
bool useStereoCareForBonds
std::uint32_t adjustDegreeFlags
bool setMDLFiveRingAromaticity
std::uint32_t adjustRingCountFlags
bool adjustSingleBondsToDegreeOneNeighbors
std::uint32_t adjustRingChainFlags
std::uint32_t makeBondsGenericFlags
bool adjustConjugatedFiveRings
bool removeDefiningBondStereo
bool removeWithWedgedBond
bool removeDummyNeighbors
bool removeNontetrahedralNeighbors
bool removeAndTrackIsotopes
bool removeOnlyHNeighbors