RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MolOps.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2021 Greg Landrum and Rational Discovery LLC
3// Copyright (c) 2014, Novartis Institutes for BioMedical Research Inc.
4//
5// @@ All Rights Reserved @@
6// This file is part of the RDKit.
7// The contents are covered by the terms of the BSD license
8// which is included in the file license.txt, found at the root
9// of the RDKit source tree.
10//
11#include <RDGeneral/export.h>
12#ifndef _RD_MOL_OPS_H_
13#define _RD_MOL_OPS_H_
14
15#include <vector>
16#include <map>
17#include <list>
19#include <boost/smart_ptr.hpp>
20#include <boost/dynamic_bitset.hpp>
22#include <RDGeneral/types.h>
23#include "SanitException.h"
25
26RDKIT_GRAPHMOL_EXPORT extern const int ci_LOCAL_INF;
27namespace RDKit {
28class ROMol;
29class RWMol;
30class Atom;
31class Bond;
32class Conformer;
33typedef std::vector<double> INVAR_VECT;
34typedef INVAR_VECT::iterator INVAR_VECT_I;
35typedef INVAR_VECT::const_iterator INVAR_VECT_CI;
36
37//! \brief Groups a variety of molecular query and transformation operations.
38namespace MolOps {
39
40//! return the number of electrons available on an atom to donate for
41/// aromaticity
42/*!
43 The result is determined using the default valency, number of lone pairs,
44 number of bonds and the formal charge. Note that the atom may not donate
45 all of these electrons to a ring for aromaticity (also used in Conjugation
46 and hybridization code).
47
48 \param at the atom of interest
49
50 \return the number of electrons
51*/
53
54//! sums up all atomic formal charges and returns the result
56
57//! returns whether or not the given Atom is involved in a conjugated bond
59
60//! find fragments (disconnected components of the molecular graph)
61/*!
62
63 \param mol the molecule of interest
64 \param mapping used to return the mapping of Atoms->fragments.
65 On return \c mapping will be <tt>mol->getNumAtoms()</tt> long
66 and will contain the fragment assignment for each Atom
67
68 \return the number of fragments found.
69
70*/
71RDKIT_GRAPHMOL_EXPORT unsigned int getMolFrags(const ROMol &mol,
72 std::vector<int> &mapping);
73//! find fragments (disconnected components of the molecular graph)
74/*!
75
76 \param mol the molecule of interest
77 \param frags used to return the Atoms in each fragment
78 On return \c mapping will be \c numFrags long, and each entry
79 will contain the indices of the Atoms in that fragment.
80
81 \return the number of fragments found.
82
83*/
85 const ROMol &mol, std::vector<std::vector<int>> &frags);
86
87//! splits a molecule into its component fragments
88/// (disconnected components of the molecular graph)
89/*!
90
91 \param mol the molecule of interest
92 \param sanitizeFrags toggles sanitization of the fragments after
93 they are built
94 \param frags used to return the mapping of Atoms->fragments.
95 if provided, \c frags will be <tt>mol->getNumAtoms()</tt> long
96 on return and will contain the fragment assignment for each Atom
97 \param fragsMolAtomMapping used to return the Atoms in each fragment
98 On return \c mapping will be \c numFrags long, and each entry
99 will contain the indices of the Atoms in that fragment.
100 \param copyConformers toggles copying conformers of the fragments after
101 they are built
102 \return a vector of the fragments as smart pointers to ROMols
103
104*/
105RDKIT_GRAPHMOL_EXPORT std::vector<boost::shared_ptr<ROMol>> getMolFrags(
106 const ROMol &mol, bool sanitizeFrags = true,
107 std::vector<int> *frags = nullptr,
108 std::vector<std::vector<int>> *fragsMolAtomMapping = nullptr,
109 bool copyConformers = true);
110
111//! splits a molecule into pieces based on labels assigned using a query
112/*!
113
114 \param mol the molecule of interest
115 \param query the query used to "label" the molecule for fragmentation
116 \param sanitizeFrags toggles sanitization of the fragments after
117 they are built
118 \param whiteList if provided, only labels in the list will be kept
119 \param negateList if true, the white list logic will be inverted: only labels
120 not in the list will be kept
121
122 \return a map of the fragments and their labels
123
124*/
125template <typename T>
126RDKIT_GRAPHMOL_EXPORT std::map<T, boost::shared_ptr<ROMol>>
127getMolFragsWithQuery(const ROMol &mol, T (*query)(const ROMol &, const Atom *),
128 bool sanitizeFrags = true,
129 const std::vector<T> *whiteList = nullptr,
130 bool negateList = false);
131
132#if 0
133 //! finds a molecule's minimum spanning tree (MST)
134 /*!
135 \param mol the molecule of interest
136 \param mst used to return the MST as a vector of bond indices
137 */
138 RDKIT_GRAPHMOL_EXPORT void findSpanningTree(const ROMol &mol,std::vector<int> &mst);
139#endif
140
141//! \name Dealing with hydrogens
142//{@
143
144//! returns a copy of a molecule with hydrogens added in as explicit Atoms
145/*!
146 \param mol the molecule to add Hs to
147 \param explicitOnly (optional) if this \c true, only explicit Hs will be
148 added
149 \param addCoords (optional) If this is true, estimates for the atomic
150 coordinates
151 of the added Hs will be used.
152 \param onlyOnAtoms (optional) if provided, this should be a vector of
153 IDs of the atoms that will be considered for H addition.
154 \param addResidueInfo (optional) if this is true, add residue info to
155 hydrogen atoms (useful for PDB files).
156
157 \return the new molecule
158
159 <b>Notes:</b>
160 - it makes no sense to use the \c addCoords option if the molecule's
161 heavy
162 atoms don't already have coordinates.
163 - the caller is responsible for <tt>delete</tt>ing the pointer this
164 returns.
165 */
167 bool addCoords = false,
168 const UINT_VECT *onlyOnAtoms = nullptr,
169 bool addResidueInfo = false);
170//! \overload
171/// modifies the molecule in place
173 bool addCoords = false,
174 const UINT_VECT *onlyOnAtoms = nullptr,
175 bool addResidueInfo = false);
176
177//! Sets Cartesian coordinates for a terminal atom.
178//! Useful for growing an atom off a molecule with sensible
179//! coordinates based on the geometry of the neighbor.
180/*!
181 NOTE: this sets appropriate coordinates in all of the molecule's conformers.
182 \param mol the molecule the atoms belong to
183 \param idx index of the terminal atom whose coordinates are set
184 \param otherIdx index of the bonded neighbor atom
185*/
186
188 unsigned int otherIdx);
189
190//! returns a copy of a molecule with hydrogens removed
191/*!
192 \param mol the molecule to remove Hs from
193 \param implicitOnly (optional) if this \c true, only implicit Hs will be
194 removed
195 \param updateExplicitCount (optional) If this is \c true, when explicit Hs
196 are removed
197 from the graph, the heavy atom to which they are bound will have its
198 counter of
199 explicit Hs increased.
200 \param sanitize: (optional) If this is \c true, the final molecule will be
201 sanitized
202
203 \return the new molecule
204
205 <b>Notes:</b>
206 - Hydrogens which aren't connected to a heavy atom will not be
207 removed. This prevents molecules like <tt>"[H][H]"</tt> from having
208 all atoms removed.
209 - Labelled hydrogen (e.g. atoms with atomic number=1, but mass > 1),
210 will not be removed.
211 - two coordinate Hs, like the central H in C[H-]C, will not be removed
212 - Hs connected to dummy atoms will not be removed
213 - Hs that are part of the definition of double bond Stereochemistry
214 will not be removed
215 - Hs that are not connected to anything else will not be removed
216 - Hs that have a query defined (i.e. hasQuery() returns true) will not
217 be removed
218
219 - the caller is responsible for <tt>delete</tt>ing the pointer this
220 returns.
221*/
222
224 bool implicitOnly = false,
225 bool updateExplicitCount = false,
226 bool sanitize = true);
227//! \overload
228/// modifies the molecule in place
230 bool updateExplicitCount = false,
231 bool sanitize = true);
233 bool removeDegreeZero = false; /**< hydrogens that have no bonds */
234 bool removeHigherDegrees = false; /**< hydrogens with two (or more) bonds */
235 bool removeOnlyHNeighbors =
236 false; /**< hydrogens with bonds only to other hydrogens */
237 bool removeIsotopes = false; /**< hydrogens with non-default isotopes */
238 bool removeAndTrackIsotopes = false; /**< removes hydrogens with non-default
239 isotopes and keeps track of the heavy atom the isotopes were attached to in
240 the private _isotopicHs atom property, so they are re-added by AddHs() as the
241 original isotopes if possible*/
242 bool removeDummyNeighbors =
243 false; /**< hydrogens with at least one dummy-atom neighbor */
244 bool removeDefiningBondStereo =
245 false; /**< hydrogens defining bond stereochemistry */
246 bool removeWithWedgedBond = true; /**< hydrogens with wedged bonds to them */
247 bool removeWithQuery = false; /**< hydrogens with queries defined */
248 bool removeMapped = true; /**< mapped hydrogens */
249 bool removeInSGroups = true; /**< part of a SubstanceGroup.
250 An H atom will only be removed if it doesn't cause any SGroup to become empty,
251 and if it doesn't play a special role in the SGroup (XBOND, attach point
252 or a CState) */
253 bool showWarnings = true; /**< display warnings for Hs that are not removed */
254 bool removeNonimplicit = true; /**< DEPRECATED equivalent of !implicitOnly */
255 bool updateExplicitCount =
256 false; /**< DEPRECATED equivalent of updateExplicitCount */
257 bool removeHydrides = true; /**< Removing Hydrides */
258 bool removeNontetrahedralNeighbors =
259 false; /**< remove Hs which are bonded to atoms with specified
260 non-tetrahedral stereochemistry */
261};
262//! \overload
263/// modifies the molecule in place
265 bool sanitize = true);
266//! \overload
267/// The caller owns the pointer this returns
269 const RemoveHsParameters &ps,
270 bool sanitize = true);
271
272//! removes all Hs from a molecule
273RDKIT_GRAPHMOL_EXPORT void removeAllHs(RWMol &mol, bool sanitize = true);
274//! \overload
275/// The caller owns the pointer this returns
277 bool sanitize = true);
278
279//! returns a copy of a molecule with hydrogens removed and added as queries
280//! to the heavy atoms to which they are bound.
281/*!
282 This is really intended to be used with molecules that contain QueryAtoms
283
284 \param mol the molecule to remove Hs from
285
286 \return the new molecule
287
288 <b>Notes:</b>
289 - Atoms that do not already have hydrogen count queries will have one
290 added, other H-related queries will not be touched. Examples:
291 - C[H] -> [C;!H0]
292 - [C;H1][H] -> [C;H1]
293 - [C;H2][H] -> [C;H2]
294 - Hydrogens which aren't connected to a heavy atom will not be
295 removed. This prevents molecules like <tt>"[H][H]"</tt> from having
296 all atoms removed.
297 - the caller is responsible for <tt>delete</tt>ing the pointer this
298 returns.
299 - By default all hydrogens are removed, however if
300 mergeUnmappedOnly is true, any hydrogen participating
301 in an atom map will be retained
302
303*/
305 bool mergeUnmappedOnly = false,
306 bool mergeIsotopes = false);
307//! \overload
308/// modifies the molecule in place
310 bool mergeUnmappedOnly = false,
311 bool mergeIsotopes = false);
312
313//! returns a pair of booleans (hasQueryHs, hasUnmergaebleQueryHs)
314/*!
315 This is really intended to be used with molecules that contain QueryAtoms
316 such as when checking smarts patterns for explicit hydrogens
317
318
319 \param mol the molecule to check for query Hs from
320 \return std::pair if pair.first is true if the molecule has query hydrogens,
321 if pair.second is true, the queryHs cannot be removed my mergeQueryHs
322*/
323RDKIT_GRAPHMOL_EXPORT std::pair<bool, bool> hasQueryHs(const ROMol &mol);
324
334
335//! Parameters controlling the behavior of MolOps::adjustQueryProperties
336/*!
337
338 Note that some of the options here are either directly contradictory or make
339 no sense when combined with each other. We generally assume that client code
340 is doing something sensible and don't attempt to detect possible conflicts or
341 problems.
342
343*/
345 bool adjustDegree = true; /**< add degree queries */
346 std::uint32_t adjustDegreeFlags = ADJUST_IGNOREDUMMIES | ADJUST_IGNORECHAINS;
347
348 bool adjustRingCount = false; /**< add ring-count queries */
349 std::uint32_t adjustRingCountFlags =
351
352 bool makeDummiesQueries = true; /**< convert dummy atoms without isotope
353 labels to any-atom queries */
354
355 bool aromatizeIfPossible = true; /**< perceive and set aromaticity */
356
357 bool makeBondsGeneric =
358 false; /**< convert bonds to generic queries (any bonds) */
359 std::uint32_t makeBondsGenericFlags = ADJUST_IGNORENONE;
360
361 bool makeAtomsGeneric =
362 false; /**< convert atoms to generic queries (any atoms) */
363 std::uint32_t makeAtomsGenericFlags = ADJUST_IGNORENONE;
364
365 bool adjustHeavyDegree = false; /**< adjust the heavy-atom degree instead of
366 overall degree */
367 std::uint32_t adjustHeavyDegreeFlags =
369
370 bool adjustRingChain = false; /**< add ring-chain queries */
371 std::uint32_t adjustRingChainFlags = ADJUST_IGNORENONE;
372
373 bool useStereoCareForBonds =
374 false; /**< remove stereochemistry info from double bonds that do not have
375 the stereoCare property set */
376
377 bool adjustConjugatedFiveRings =
378 false; /**< sets bond queries in conjugated five-rings to
379 SINGLE|DOUBLE|AROMATIC */
380
381 bool setMDLFiveRingAromaticity =
382 false; /**< uses the 5-ring aromaticity behavior of the (former) MDL
383 software as documented in the Chemical Representation Guide */
384
385 bool adjustSingleBondsToDegreeOneNeighbors =
386 false; /**< sets single bonds between aromatic or conjugated atoms and
387 degree one neighbors to SINGLE|AROMATIC */
388
389 bool adjustSingleBondsBetweenAromaticAtoms =
390 false; /**< sets non-ring single bonds between two aromatic or conjugated
391 atoms to SINGLE|AROMATIC */
392
393 //! \brief returns an AdjustQueryParameters object with all adjustments
394 //! disabled
397 res.adjustDegree = false;
398 res.makeDummiesQueries = false;
399 res.aromatizeIfPossible = false;
400 return res;
401 }
403};
404
405//! updates an AdjustQueryParameters object from a JSON string
407 MolOps::AdjustQueryParameters &p, const std::string &json);
408
409//! returns a copy of a molecule with query properties adjusted
410/*!
411 \param mol the molecule to adjust
412 \param params controls the adjustments made
413
414 \return the new molecule, the caller owns the memory
415*/
417 const ROMol &mol, const AdjustQueryParameters *params = nullptr);
418//! \overload
419/// modifies the molecule in place
421 RWMol &mol, const AdjustQueryParameters *params = nullptr);
422
423//! returns a copy of a molecule with the atoms renumbered
424/*!
425
426 \param mol the molecule to work with
427 \param newOrder the new ordering of the atoms (should be numAtoms long)
428 for example: if newOrder is [3,2,0,1], then atom 3 in the original
429 molecule will be atom 0 in the new one
430
431 \return the new molecule
432
433 <b>Notes:</b>
434 - the caller is responsible for <tt>delete</tt>ing the pointer this
435 returns.
436
437*/
439 const ROMol &mol, const std::vector<unsigned int> &newOrder);
440
441//! @}
442
443//! \name Sanitization
444/// {
445
462
463//! \brief carries out a collection of tasks for cleaning up a molecule and
464//! ensuring that it makes "chemical sense"
465/*!
466 This functions calls the following in sequence
467 -# MolOps::cleanUp()
468 -# mol.updatePropertyCache()
469 -# MolOps::symmetrizeSSSR()
470 -# MolOps::Kekulize()
471 -# MolOps::assignRadicals()
472 -# MolOps::setAromaticity()
473 -# MolOps::setConjugation()
474 -# MolOps::setHybridization()
475 -# MolOps::cleanupChirality()
476 -# MolOps::adjustHs()
477 -# mol.updatePropertyCache()
478
479 \param mol : the RWMol to be cleaned
480
481 \param operationThatFailed : the first (if any) sanitization operation that
482 fails is set here.
483 The values are taken from the \c SanitizeFlags
484 enum. On success, the value is \c
485 SanitizeFlags::SANITIZE_NONE
486
487 \param sanitizeOps : the bits here are used to set which sanitization
488 operations are carried out. The elements of the \c
489 SanitizeFlags enum define the operations.
490
491 <b>Notes:</b>
492 - If there is a failure in the sanitization, a \c MolSanitizeException
493 will be thrown.
494 - in general the user of this function should cast the molecule following
495 this function to a ROMol, so that new atoms and bonds cannot be added to
496 the molecule and screw up the sanitizing that has been done here
497*/
499 unsigned int &operationThatFailed,
500 unsigned int sanitizeOps = SANITIZE_ALL);
501//! \overload
503
504//! \brief Identifies chemistry problems (things that don't make chemical
505//! sense) in a molecule
506/*!
507 This functions uses the operations in sanitizeMol but does not change
508 the input structure and returns a list of the problems encountered instead
509 of stopping at the first failure,
510
511 The problems this looks for come from the sanitization operations:
512 -# mol.updatePropertyCache() : Unreasonable valences
513 -# MolOps::Kekulize() : Unkekulizable ring systems, aromatic atoms not
514 in rings, aromatic bonds to non-aromatic atoms.
515
516 \param mol : the ROMol to be cleaned
517
518 \param sanitizeOps : the bits here are used to set which sanitization
519 operations are carried out. The elements of the \c
520 SanitizeFlags enum define the operations.
521
522 \return a vector of \c MolSanitizeException values that indicate what
523 problems were encountered
524
525*/
527std::vector<std::unique_ptr<MolSanitizeException>> detectChemistryProblems(
528 const ROMol &mol, unsigned int sanitizeOps = SANITIZE_ALL);
529
530//! Possible aromaticity models
531/*!
532- \c AROMATICITY_DEFAULT at the moment always uses \c AROMATICITY_RDKIT
533- \c AROMATICITY_RDKIT is the standard RDKit model (as documented in the RDKit
534Book)
535- \c AROMATICITY_SIMPLE only considers 5- and 6-membered simple rings (it
536does not consider the outer envelope of fused rings)
537- \c AROMATICITY_MDL
538- \c AROMATICITY_CUSTOM uses a caller-provided function
539*/
540typedef enum {
541 AROMATICITY_DEFAULT = 0x0, ///< future proofing
545 AROMATICITY_CUSTOM = 0xFFFFFFF ///< use a function
547
548//! Sets up the aromaticity for a molecule
549/*!
550
551 This is what happens here:
552 -# find all the simple rings by calling the findSSSR function
553 -# loop over all the Atoms in each ring and mark them if they are
554 candidates
555 for aromaticity. A ring atom is a candidate if it can spare electrons
556 to the ring and if it's from the first two rows of the periodic table.
557 -# based on the candidate atoms, mark the rings to be either candidates
558 or non-candidates. A ring is a candidate only if all its atoms are
559 candidates
560 -# apply Hueckel rule to each of the candidate rings to check if the ring
561 can be
562 aromatic
563
564 \param mol the RWMol of interest
565 \param model the aromaticity model to use
566 \param func a custom function for assigning aromaticity (only used when
567 model=\c AROMATICITY_CUSTOM)
568
569 \return >0 on success, <= 0 otherwise
570
571 <b>Assumptions:</b>
572 - Kekulization has been done (i.e. \c MolOps::Kekulize() has already
573 been called)
574
575*/
578 int (*func)(RWMol &) = nullptr);
579
580//! Designed to be called by the sanitizer to handle special cases before
581/// anything is done.
582/*!
583
584 Currently this:
585 - modifies nitro groups, so that the nitrogen does not have an
586 unreasonable valence of 5, as follows:
587 - the nitrogen gets a positive charge
588 - one of the oxygens gets a negative chage and the double bond to
589 this oxygen is changed to a single bond The net result is that nitro groups
590 can be counted on to be: \c "[N+](=O)[O-]"
591 - modifies halogen-oxygen containing species as follows:
592 \c [Cl,Br,I](=O)(=O)(=O)O -> [X+3]([O-])([O-])([O-])O
593 \c [Cl,Br,I](=O)(=O)O -> [X+3]([O-])([O-])O
594 \c [Cl,Br,I](=O)O -> [X+]([O-])O
595 - converts the substructure [N,C]=P(=O)-* to [N,C]=[P+](-[O-])-*
596
597 \param mol the molecule of interest
598
599*/
601
602//! Designed to be called by the sanitizer to handle special cases for
603//! organometallic species before valence is perceived
604/*!
605
606 \b Note that this function is experimental and may either change in behavior
607 or be replaced with something else in future releases.
608
609 Currently this:
610 - replaces single bonds between "hypervalent" organic atoms and metals with
611 dative bonds (this is following an IUPAC recommendation:
612 https://iupac.qmul.ac.uk/tetrapyrrole/TP8.html)
613
614 \param mol the molecule of interest
615
616*/
618
619//! Called by the sanitizer to assign radical counts to atoms
621
622//! adjust the number of implicit and explicit Hs for special cases
623/*!
624
625 Currently this:
626 - modifies aromatic nitrogens so that, when appropriate, they have an
627 explicit H marked (e.g. so that we get things like \c "c1cc[nH]cc1"
628
629 \param mol the molecule of interest
630
631 <b>Assumptions</b>
632 - this is called after the molecule has been sanitized,
633 aromaticity has been perceived, and the implicit valence of
634 everything has been calculated.
635
636*/
638
639//! Kekulizes the molecule
640/*!
641
642 \param mol the molecule of interest
643
644 \param markAtomsBonds if this is set to true, \c isAromatic boolean
645 settings on both the Bonds and Atoms are turned to false following the
646 Kekulization, otherwise they are left alone in their original state.
647
648 \param maxBackTracks the maximum number of attempts at back-tracking. The
649 algorithm uses a back-tracking procedure to revisit a previous setting of
650 double bond if we hit a wall in the kekulization process
651
652 <b>Notes:</b>
653 - this does not modify query bonds which have bond type queries (like
654 those which come from SMARTS) or rings containing them.
655 - even if \c markAtomsBonds is \c false the \c BondType for all modified
656 aromatic bonds will be changed from \c RDKit::Bond::AROMATIC to \c
657 RDKit::Bond::SINGLE or RDKit::Bond::DOUBLE during Kekulization.
658
659*/
661 unsigned int maxBackTracks = 100);
662//! Kekulizes the molecule if possible. If the kekulization fails the molecule
663//! will not be modified
664/*!
665
666 \param mol the molecule of interest
667
668 \param markAtomsBonds if this is set to true, \c isAromatic boolean
669 settings on both the Bonds and Atoms are turned to false following the
670 Kekulization, otherwise they are left alone in their original state.
671
672 \param maxBackTracks the maximum number of attempts at back-tracking. The
673 algorithm uses a back-tracking procedure to revisit a previous setting of
674 double bond if we hit a wall in the kekulization process
675
676 \returns whether or not the kekulization succeeded
677
678 <b>Notes:</b>
679 - even if \c markAtomsBonds is \c false the \c BondType for all aromatic
680 bonds will be changed from \c RDKit::Bond::AROMATIC to \c
681 RDKit::Bond::SINGLE or RDKit::Bond::DOUBLE during Kekulization.
682
683*/
685 bool markAtomsBonds = true,
686 unsigned int maxBackTracks = 100);
687
688//! flags the molecule's conjugated bonds
690
691//! calculates and sets the hybridization of all a molecule's Stoms
693
694//! @}
695
696//! \name Ring finding and SSSR
697//! @{
698
699//! finds a molecule's Smallest Set of Smallest Rings
700/*!
701 Currently this implements a modified form of Figueras algorithm
702 (JCICS - Vol. 36, No. 5, 1996, 986-991)
703
704 \param mol the molecule of interest
705 \param res used to return the vector of rings. Each entry is a vector with
706 atom indices. This information is also stored in the molecule's
707 RingInfo structure, so this argument is optional (see overload)
708 \param includeDativeBonds - determines whether or not dative bonds are used in
709 the ring finding.
710
711 \return number of smallest rings found
712
713 Base algorithm:
714 - The original algorithm starts by finding representative degree 2
715 nodes.
716 - Representative because if a series of deg 2 nodes are found only
717 one of them is picked.
718 - The smallest ring around each of them is found.
719 - The bonds that connect to this degree 2 node are them chopped off,
720 yielding
721 new deg two nodes
722 - The process is repeated on the new deg 2 nodes.
723 - If no deg 2 nodes are found, a deg 3 node is picked. The smallest ring
724 with it is found. A bond from this is "carefully" (look in the paper)
725 selected and chopped, yielding deg 2 nodes. The process is same as
726 above once this is done.
727
728 Our Modifications:
729 - If available, more than one smallest ring around a representative deg 2
730 node will be computed and stored
731 - Typically 3 rings are found around a degree 3 node (when no deg 2s are
732 available)
733 and all the bond to that node are chopped.
734 - The extra rings that were found in this process are removed after all
735 the nodes have been covered.
736
737 These changes were motivated by several factors:
738 - We believe the original algorithm fails to find the correct SSSR
739 (finds the correct number of them but the wrong ones) on some sample
740 mols
741 - Since SSSR may not be unique, a post-SSSR step to symmetrize may be
742 done. The extra rings this process adds can be quite useful.
743*/
745 std::vector<std::vector<int>> &res,
746 bool includeDativeBonds = false);
747//! \overload
749 std::vector<std::vector<int>> *res = nullptr,
750 bool includeDativeBonds = false);
751
752//! use a DFS algorithm to identify ring bonds and atoms in a molecule
753/*!
754 \b NOTE: though the RingInfo structure is populated by this function,
755 the only really reliable calls that can be made are to check if
756 mol.getRingInfo().numAtomRings(idx) or mol.getRingInfo().numBondRings(idx)
757 return values >0
758*/
760
762
763//! symmetrize the molecule's Smallest Set of Smallest Rings
764/*!
765 SSSR rings obatined from "findSSSR" can be non-unique in some case.
766 For example, cubane has five SSSR rings, not six as one would hope.
767
768 This function adds additional rings to the SSSR list if necessary
769 to make the list symmetric, e.g. all atoms in cubane will be part of the
770 same number of SSSRs. This function choses these extra rings from the extra
771 rings computed and discarded during findSSSR. The new ring are chosen such
772 that:
773 - replacing a same sized ring in the SSSR list with an extra ring yields
774 the same union of bond IDs as the original SSSR list
775
776 \param mol - the molecule of interest
777 \param res used to return the vector of rings. Each entry is a vector with
778 atom indices. This information is also stored in the molecule's
779 RingInfo structure, so this argument is optional (see overload)
780 \param includeDativeBonds - determines whether or not dative bonds are used in
781 the ring finding.
782
783 \return the total number of rings = (new rings + old SSSRs)
784
785 <b>Notes:</b>
786 - if no SSSR rings are found on the molecule - MolOps::findSSSR() is called
787 first
788*/
790 std::vector<std::vector<int>> &res,
791 bool includeDativeBonds = false);
792//! \overload
794 bool includeDativeBonds = false);
795
796//! @}
797
798//! \name Shortest paths and other matrices
799//! @{
800
801//! returns a molecule's adjacency matrix
802/*!
803 \param mol the molecule of interest
804 \param useBO toggles use of bond orders in the matrix
805 \param emptyVal sets the empty value (for non-adjacent atoms)
806 \param force forces calculation of the matrix, even if already
807 computed
808 \param propNamePrefix used to set the cached property name
809
810 \return the adjacency matrix.
811
812 <b>Notes</b>
813 - The result of this is cached in the molecule's local property
814 dictionary, which will handle deallocation. The caller should <b>not</b> \c
815 delete this pointer.
816
817*/
819 const ROMol &mol, bool useBO = false, int emptyVal = 0, bool force = false,
820 const char *propNamePrefix = nullptr,
821 const boost::dynamic_bitset<> *bondsToUse = nullptr);
822
823//! Computes the molecule's topological distance matrix
824/*!
825 Uses the Floyd-Warshall all-pairs-shortest-paths algorithm.
826
827 \param mol the molecule of interest
828 \param useBO toggles use of bond orders in the matrix
829 \param useAtomWts sets the diagonal elements of the result to
830 6.0/(atomic number) so that the matrix can be used to calculate
831 Balaban J values. This does not affect the bond weights.
832 \param force forces calculation of the matrix, even if already
833 computed
834 \param propNamePrefix used to set the cached property name
835
836 \return the distance matrix.
837
838 <b>Notes</b>
839 - The result of this is cached in the molecule's local property
840 dictionary, which will handle deallocation. The caller should <b>not</b> \c
841 delete this pointer.
842
843
844*/
846 const ROMol &mol, bool useBO = false, bool useAtomWts = false,
847 bool force = false, const char *propNamePrefix = nullptr);
848
849//! Computes the molecule's topological distance matrix
850/*!
851 Uses the Floyd-Warshall all-pairs-shortest-paths algorithm.
852
853 \param mol the molecule of interest
854 \param activeAtoms only elements corresponding to these atom indices
855 will be included in the calculation
856 \param bonds only bonds found in this list will be included in the
857 calculation
858 \param useBO toggles use of bond orders in the matrix
859 \param useAtomWts sets the diagonal elements of the result to
860 6.0/(atomic number) so that the matrix can be used to calculate
861 Balaban J values. This does not affect the bond weights.
862
863 \return the distance matrix.
864
865 <b>Notes</b>
866 - The results of this call are not cached, the caller <b>should</b> \c
867 delete
868 this pointer.
869
870
871*/
873 const ROMol &mol, const std::vector<int> &activeAtoms,
874 const std::vector<const Bond *> &bonds, bool useBO = false,
875 bool useAtomWts = false);
876
877//! Computes the molecule's 3D distance matrix
878/*!
879
880 \param mol the molecule of interest
881 \param confId the conformer to use
882 \param useAtomWts sets the diagonal elements of the result to
883 6.0/(atomic number)
884 \param force forces calculation of the matrix, even if already
885 computed
886 \param propNamePrefix used to set the cached property name
887 (if set to an empty string, the matrix will not be
888 cached)
889
890 \return the distance matrix.
891
892 <b>Notes</b>
893 - If propNamePrefix is not empty the result of this is cached in the
894 molecule's local property dictionary, which will handle deallocation.
895 In other cases the caller is responsible for freeing the memory.
896
897*/
899 const ROMol &mol, int confId = -1, bool useAtomWts = false,
900 bool force = false, const char *propNamePrefix = nullptr);
901//! Find the shortest path between two atoms
902/*!
903 Uses the Bellman-Ford algorithm
904
905 \param mol molecule of interest
906 \param aid1 index of the first atom
907 \param aid2 index of the second atom
908
909 \return an std::list with the indices of the atoms along the shortest
910 path
911
912 <b>Notes:</b>
913 - the starting and end atoms are included in the path
914 - if no path is found, an empty path is returned
915
916*/
917RDKIT_GRAPHMOL_EXPORT std::list<int> getShortestPath(const ROMol &mol, int aid1,
918 int aid2);
919
920//! @}
921
922//! \name Stereochemistry
923//! @{
924
925// class to hold hybridizations
926
928 public:
930 throw FileParseException("not to be called without a mol parameter");
931 };
934 throw FileParseException("not to be called without a mol parameter");
935 };
936
937 ~Hybridizations() = default;
938
940 return static_cast<Atom::HybridizationType>(d_hybridizations[idx]);
941 }
942 // Atom::HybridizationType &operator[](unsigned int idx) {
943 // return static_cast<Atom::HybridizationType>(d_hybridizations[idx]);
944 // d_hybridizations[d_hybridizations[idx]];
945 // }
946
947 // // void clear() { d_hybridizations.clear(); }
948 // // void resize(unsigned int sz) { d_hybridizations.resize(sz); }
949 unsigned int size() const { return d_hybridizations.size(); }
950
951 private:
952 std::vector<int> d_hybridizations;
953};
954
955//! removes bogus chirality markers (those on non-sp3 centers):
957
961
962//! \brief Uses a conformer to assign ChiralTypes to a molecule's atoms
963/*!
964 \param mol the molecule of interest
965 \param confId the conformer to use
966 \param replaceExistingTags if this flag is true, any existing atomic chiral
967 tags will be replaced
968
969 If the conformer provided is not a 3D conformer, nothing will be done.
970
971
972 NOTE that this does not check to see if atoms are chiral centers (i.e. all
973 substituents are different), it merely sets the chiral type flags based on
974 the coordinates and atom ordering. Use \c assignStereochemistryFrom3D() if
975 you want chiral flags only on actual stereocenters.
976*/
978 ROMol &mol, int confId = -1, bool replaceExistingTags = true);
979
980//! \brief Uses a conformer to assign ChiralTypes to a molecule's atoms and
981//! stereo flags to its bonds
982/*!
983
984 \param mol the molecule of interest
985 \param confId the conformer to use
986 \param replaceExistingTags if this flag is true, any existing info about
987 stereochemistry will be replaced
988
989 If the conformer provided is not a 3D conformer, nothing will be done.
990*/
992 ROMol &mol, int confId = -1, bool replaceExistingTags = true);
993
994//! \brief Use bond directions to assign ChiralTypes to a molecule's atoms and
995//! stereo flags to its bonds
996/*!
997
998 \param mol the molecule of interest
999 \param confId the conformer to use
1000 \param replaceExistingTags if this flag is true, any existing info about
1001 stereochemistry will be replaced
1002*/
1004 ROMol &mol, int confId = -1, bool replaceExistingTags = true);
1005
1006//! \deprecated: this function will be removed in a future release. Use
1007//! setDoubleBondNeighborDirections() instead
1009 int confId = -1);
1010//! Sets bond directions based on double bond stereochemistry
1012 ROMol &mol, const Conformer *conf = nullptr);
1013//! removes directions from single bonds. Wiggly bonds will have the property
1014//! _UnknownStereo set on them
1016 bool onlyWedgeFlags = false);
1017
1018//! removes directions from all bonds. Wiggly bonds and cross bonds will have
1019//! the property _UnknownStereo set on them
1022 bool onlyWedgeFlags = false);
1023
1024//! Assign CIS/TRANS bond stereochemistry tags based on neighboring
1025//! directions
1027
1028//! Assign stereochemistry tags to atoms and bonds.
1029/*!
1030 If useLegacyStereoPerception is true, it also does the CIP stereochemistry
1031 assignment for the molecule's atoms (R/S) and double bonds (Z/E).
1032 This assignment is based on legacy code which is fast, but is
1033 known to incorrectly assign CIP labels in some cases.
1034 instead, to assign CIP labels based on an accurate, though slower,
1035 implementation of the CIP rules, call CIPLabeler::assignCIPLabels().
1036 Chiral atoms will have a property '_CIPCode' indicating their chiral code.
1037
1038 \param mol the molecule to use
1039 \param cleanIt if true, any existing values of the property `_CIPCode`
1040 will be cleared, atoms with a chiral specifier that aren't
1041 actually chiral (e.g. atoms with duplicate
1042 substituents or only 2 substituents, etc.) will have
1043 their chiral code set to CHI_UNSPECIFIED. Bonds with
1044 STEREOCIS/STEREOTRANS specified that have duplicate
1045 substituents based upon the CIP atom ranks will be
1046 marked STEREONONE.
1047 \param force causes the calculation to be repeated even if it has
1048 already been done
1049 \param flagPossibleStereoCenters set the _ChiralityPossible property on
1050 atoms that are possible stereocenters
1051
1052 <b>Notes:M</b>
1053 - Throughout we assume that we're working with a hydrogen-suppressed
1054 graph.
1055
1056*/
1058 ROMol &mol, bool cleanIt = false, bool force = false,
1059 bool flagPossibleStereoCenters = false);
1060//! Removes all stereochemistry information from atoms (i.e. R/S) and bonds
1061/// i.e. Z/E)
1062/*!
1063
1064 \param mol the molecule of interest
1065*/
1067
1068//! \brief finds bonds that could be cis/trans in a molecule and mark them as
1069//! Bond::STEREOANY.
1070/*!
1071 \param mol the molecule of interest
1072 \param cleanIt toggles removal of stereo flags from double bonds that can
1073 not have stereochemistry
1074
1075 This function finds any double bonds that can potentially be part of
1076 a cis/trans system. No attempt is made here to mark them cis or
1077 trans. No attempt is made to detect double bond stereo in ring systems.
1078
1079 This function is useful in the following situations:
1080 - when parsing a mol file; for the bonds marked here, coordinate
1081 information on the neighbors can be used to indentify cis or trans
1082 states
1083 - when writing a mol file; bonds that can be cis/trans but not marked as
1084 either need to be specially marked in the mol file
1085 - finding double bonds with unspecified stereochemistry so they
1086 can be enumerated for downstream 3D tools
1087
1088 The CIPranks on the neighboring atoms are checked in this function. The
1089 _CIPCode property if set to any on the double bond.
1090*/
1092 bool cleanIt = false);
1093//! \brief Uses the molParity atom property to assign ChiralType to a
1094//! molecule's atoms
1095/*!
1096 \param mol the molecule of interest
1097 \param replaceExistingTags if this flag is true, any existing atomic chiral
1098 tags will be replaced
1099*/
1101 ROMol &mol, bool replaceExistingTags = true);
1102
1103//! @}
1104
1105//! returns the number of atoms which have a particular property set
1107 const ROMol &mol, std::string prop);
1108
1109//! returns whether or not a molecule needs to have Hs added to it.
1111
1112//! \brief Replaces haptic bond with explicit dative bonds.
1113/*!
1114 *
1115 * @param mol the molecule of interest
1116 *
1117 * One way of showing haptic bonds (such as cyclopentadiene to iron in
1118 * ferrocene) is to use a dummy atom with a dative bond to the iron atom with
1119 * the bond labelled with the atoms involved in the organic end of the bond.
1120 * Another way is to have explicit dative bonds from the atoms of the haptic
1121 * group to the metal atom. This function converts the former representation to
1122 * the latter.
1123 */
1125
1126//! \overload modifies molecule in place.
1128
1129//! \brief Replaces explicit dative bonds with haptic.
1130/*!
1131 *
1132 * @param mol the molecule of interest
1133 *
1134 * Does the reverse of hapticBondsToDative. If there are multiple contiguous
1135 * atoms attached by dative bonds to an atom (probably a metal atom), the dative
1136 * bonds will be replaced by a dummy atom in their centre attached to the
1137 * (metal) atom by a dative bond, which is labelled with ENDPTS of the atoms
1138 * that had the original dative bonds.
1139 */
1141
1142//! \overload modifies molecule in place.
1144
1145namespace details {
1146//! not recommended for use in other code
1148 RWMol &mol, const boost::dynamic_bitset<> &atomsToUse,
1149 boost::dynamic_bitset<> bondsToUse, bool markAtomsBonds = true,
1150 unsigned int maxBackTracks = 100);
1151
1152// If the bond is dative, and it has a common_properties::MolFileBondEndPts
1153// prop, returns a vector of the indices of the atoms mentioned in the prop.
1154RDKIT_GRAPHMOL_EXPORT std::vector<int> hapticBondEndpoints(const Bond *bond);
1155
1156} // namespace details
1157
1158//! attachment points encoded as attachPt properties are added to the graph as
1159/// dummy atoms
1160/*!
1161 *
1162 * @param mol the molecule of interest
1163 * @param addAsQueries if true, the dummy atoms will be added as null queries
1164 * (i.e. they will match any atom in a substructure search)
1165 * @param addCoords if true and the molecule has one or more conformers,
1166 * positions for the attachment points will be added to the conformer(s).
1167 *
1168 */
1170 bool addAsQueries = true,
1171 bool addCoords = true);
1172//! dummy atoms in the graph are removed and replaced with attachment point
1173//! annotations on the attached atoms
1174/*!
1175 *
1176 * @param mol the molecule of interest
1177 * @param markedOnly if true, only dummy atoms with the _fromAttachPoint
1178 * property will be collapsed
1179 *
1180 * In order for a dummy atom to be considered for collapsing it must have:
1181 * - degree 1 with a single or unspecified bond
1182 * - the bond to it can not be wedged
1183 * - either no query or be an AtomNullQuery
1184 *
1185 */
1187 bool markedOnly = true);
1188
1189namespace details {
1190//! attachment points encoded as attachPt properties are added to the graph as
1191/// dummy atoms
1192/*!
1193 *
1194 * @param mol the molecule of interest
1195 * @param atomIdx the index of the atom to which the attachment point should be
1196 * added
1197 * @param val the attachment point value. Should be 1 or 2
1198 * @param addAsQueries if true, the dummy atoms will be added as null queries
1199 * (i.e. they will match any atom in a substructure search)
1200 * @param addCoords if true and the molecule has one or more conformers,
1201 * positions for the attachment points will be added to the conformer(s).
1202 *
1203 */
1205 RWMol &mol, unsigned int atomIdx, unsigned int val, bool addAsQuery = true,
1206 bool addCoords = true);
1207
1208//! returns whether or not an atom is an attachment point
1209/*!
1210 *
1211 * @param mol the molecule of interest
1212 * @param markedOnly if true, only dummy atoms with the _fromAttachPoint
1213 * property will be collapsed
1214 *
1215 * In order for a dummy atom to be considered for collapsing it must have:
1216 * - degree 1 with a single or unspecified bond
1217 * - the bond to it can not be wedged
1218 * - either no query or be an AtomNullQuery
1219 *
1220 */
1222 bool markedOnly = true);
1223
1224} // namespace details
1225
1226} // namespace MolOps
1227} // namespace RDKit
1228
1229#endif
RDKIT_GRAPHMOL_EXPORT const int ci_LOCAL_INF
The class for representing atoms.
Definition Atom.h:75
HybridizationType
store hybridization
Definition Atom.h:86
class for representing a bond
Definition Bond.h:47
The class for representing 2D or 3D conformation of a molecule.
Definition Conformer.h:46
used by various file parsing classes to indicate a parse error
unsigned int size() const
Definition MolOps.h:949
Atom::HybridizationType operator[](int idx)
Definition MolOps.h:939
Hybridizations(const Hybridizations &)
Definition MolOps.h:933
Hybridizations(const ROMol &mol)
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
#define RDKIT_GRAPHMOL_EXPORT
Definition export.h:233
RDKIT_GRAPHMOL_EXPORT void KekulizeFragment(RWMol &mol, const boost::dynamic_bitset<> &atomsToUse, boost::dynamic_bitset<> bondsToUse, bool markAtomsBonds=true, unsigned int maxBackTracks=100)
not recommended for use in other code
RDKIT_GRAPHMOL_EXPORT std::vector< int > hapticBondEndpoints(const Bond *bond)
RDKIT_GRAPHMOL_EXPORT bool isAttachmentPoint(const Atom *atom, bool markedOnly=true)
returns whether or not an atom is an attachment point
RDKIT_GRAPHMOL_EXPORT unsigned int addExplicitAttachmentPoint(RWMol &mol, unsigned int atomIdx, unsigned int val, bool addAsQuery=true, bool addCoords=true)
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 bool KekulizeIfPossible(RWMol &mol, bool markAtomsBonds=true, unsigned int maxBackTracks=100)
RDKIT_GRAPHMOL_EXPORT int findSSSR(const ROMol &mol, std::vector< std::vector< int > > &res, bool includeDativeBonds=false)
finds a molecule's Smallest Set of Smallest Rings
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 void assignChiralTypesFromBondDirs(ROMol &mol, int confId=-1, bool replaceExistingTags=true)
Use bond directions to assign ChiralTypes to a molecule's atoms and stereo flags to its bonds.
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 findRingFamilies(const ROMol &mol)
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
RDKIT_GRAPHMOL_EXPORT int getFormalCharge(const ROMol &mol)
sums up all atomic formal charges and returns the result
AromaticityModel
Possible aromaticity models.
Definition MolOps.h:540
@ AROMATICITY_RDKIT
Definition MolOps.h:542
@ AROMATICITY_MDL
Definition MolOps.h:544
@ AROMATICITY_CUSTOM
use a function
Definition MolOps.h:545
@ AROMATICITY_DEFAULT
future proofing
Definition MolOps.h:541
@ AROMATICITY_SIMPLE
Definition MolOps.h:543
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 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 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.
@ SANITIZE_SETAROMATICITY
Definition MolOps.h:453
@ SANITIZE_CLEANUPATROPISOMERS
Definition MolOps.h:459
@ SANITIZE_PROPERTIES
Definition MolOps.h:449
@ SANITIZE_CLEANUP_ORGANOMETALLICS
Definition MolOps.h:458
@ SANITIZE_SETCONJUGATION
Definition MolOps.h:454
@ SANITIZE_SYMMRINGS
Definition MolOps.h:450
@ SANITIZE_ADJUSTHS
Definition MolOps.h:457
@ SANITIZE_CLEANUPCHIRALITY
Definition MolOps.h:456
@ SANITIZE_FINDRADICALS
Definition MolOps.h:452
@ SANITIZE_KEKULIZE
Definition MolOps.h:451
@ SANITIZE_SETHYBRIDIZATION
Definition MolOps.h:455
@ SANITIZE_CLEANUP
Definition MolOps.h:448
RDKIT_GRAPHMOL_EXPORT int countAtomElec(const Atom *at)
RDKIT_GRAPHMOL_EXPORT void detectBondStereochemistry(ROMol &mol, int confId=-1)
RDKIT_GRAPHMOL_EXPORT void sanitizeMol(RWMol &mol, unsigned int &operationThatFailed, unsigned int sanitizeOps=SANITIZE_ALL)
carries out a collection of tasks for cleaning up a molecule and ensuring that it makes "chemical sen...
RDKIT_GRAPHMOL_EXPORT void cleanupAtropisomers(RWMol &)
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 setBondStereoFromDirections(ROMol &mol)
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, bool includeDativeBonds=false)
symmetrize the molecule's Smallest Set of Smallest Rings
RDKIT_GRAPHMOL_EXPORT void clearDirFlags(ROMol &mol, bool onlyWedgeFlags=false)
RDKIT_GRAPHMOL_EXPORT void cleanupChirality(RWMol &mol)
removes bogus chirality markers (those on non-sp3 centers):
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 Kekulize(RWMol &mol, bool markAtomsBonds=true, unsigned int maxBackTracks=100)
Kekulizes the molecule.
RDKIT_GRAPHMOL_EXPORT void assignRadicals(RWMol &mol)
Called by the sanitizer to assign radical counts to atoms.
RDKIT_GRAPHMOL_EXPORT std::vector< std::unique_ptr< MolSanitizeException > > detectChemistryProblems(const ROMol &mol, unsigned int sanitizeOps=SANITIZE_ALL)
Identifies chemistry problems (things that don't make chemical sense) in a molecule.
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 setHybridization(ROMol &mol)
calculates and sets the hybridization of all a molecule's Stoms
RDKIT_GRAPHMOL_EXPORT void collapseAttachmentPoints(RWMol &mol, bool markedOnly=true)
RDKIT_GRAPHMOL_EXPORT unsigned getNumAtomsWithDistinctProperty(const ROMol &mol, std::string prop)
returns the number of atoms which have a particular property set
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 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 ROMol * removeHs(const ROMol &mol, bool implicitOnly=false, bool updateExplicitCount=false, bool sanitize=true)
returns a copy of a molecule with hydrogens removed
RDKIT_GRAPHMOL_EXPORT ROMol * addHs(const ROMol &mol, bool explicitOnly=false, bool addCoords=false, const UINT_VECT *onlyOnAtoms=nullptr, bool addResidueInfo=false)
returns a copy of a molecule with hydrogens added in as explicit Atoms
AdjustQueryWhichFlags
Definition MolOps.h:325
@ ADJUST_IGNORERINGS
Definition MolOps.h:328
@ ADJUST_IGNORENONE
Definition MolOps.h:326
@ ADJUST_IGNOREMAPPED
Definition MolOps.h:331
@ ADJUST_IGNORENONDUMMIES
Definition MolOps.h:330
@ ADJUST_IGNOREDUMMIES
Definition MolOps.h:329
@ ADJUST_IGNORECHAINS
Definition MolOps.h:327
@ ADJUST_IGNOREALL
Definition MolOps.h:332
Std stuff.
std::vector< double > INVAR_VECT
Definition MolOps.h:33
bool rdvalue_is(const RDValue_cast_t)
INVAR_VECT::iterator INVAR_VECT_I
Definition MolOps.h:34
INVAR_VECT::const_iterator INVAR_VECT_CI
Definition MolOps.h:35
std::vector< UINT > UINT_VECT
Definition types.h:303
Parameters controlling the behavior of MolOps::adjustQueryProperties.
Definition MolOps.h:344
static AdjustQueryParameters noAdjustments()
returns an AdjustQueryParameters object with all adjustments disabled
Definition MolOps.h:395