RDKit
Open-source cheminformatics and machine learning.
Chirality.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2008-2021 Greg Landrum 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 /*! \file Chirality.h
11 
12 */
13 #include <RDGeneral/export.h>
14 #ifndef RD_CHIRALITY_20AUG2008_H
15 #define RD_CHIRALITY_20AUG2008_H
16 #include <RDGeneral/types.h>
17 #include <GraphMol/Bond.h>
18 #include <boost/dynamic_bitset.hpp>
19 #include <limits>
20 
21 namespace RDKit {
22 class Atom;
23 class Bond;
24 class ROMol;
25 
26 namespace Chirality {
27 /// @cond
28 /*!
29  \param mol the molecule to be altered
30  \param ranks used to return the set of ranks.
31  Should be at least mol.getNumAtoms() long.
32 
33  <b>Notes:</b>
34  - All atoms gain a property common_properties::_CIPRank with their overall
35  CIP ranking.
36 
37 */
38 RDKIT_GRAPHMOL_EXPORT void assignAtomCIPRanks(const ROMol &mol,
39  UINT_VECT &ranks);
40 
41 RDKIT_GRAPHMOL_EXPORT bool hasStereoBondDir(const Bond *bond);
42 
43 /**
44  * Returns the first neighboring bond that can be found which has a stereo
45  * bond direction set. If no such bond can be found, it returns null. No
46  * checks are made to ensure there aren't any other conflicting directed bonds.
47  */
48 RDKIT_GRAPHMOL_EXPORT const Bond *getNeighboringDirectedBond(const ROMol &mol,
49  const Atom *atom);
50 
51 /**
52  * This just translates the labels, setting/translating StereoAtoms or the
53  * label is not the responsibility of this function. If the passed label is not
54  * E/Z, it will be returned unchanged.
55  */
56 RDKIT_GRAPHMOL_EXPORT Bond::BondStereo translateEZLabelToCisTrans(
57  Bond::BondStereo label);
58 /// @endcond
59 
60 enum class StereoType {
63  Bond_Double, // single double bond and odd-numbered cumulenes
64  Bond_Cumulene_Even, // even-numbered cumulenes
66 };
67 
69 
70 enum class StereoSpecified {
71  Unspecified, // no information provided
72  Specified,
73  Unknown // deliberately marked as unknown
74 };
75 
77  // REVIEW: absolute stereo data member?
78 #ifdef _MSC_VER
79  static const unsigned NOATOM =
80  std::numeric_limits<unsigned>::max(); // used to mark missing atoms
81 #else
82  static const unsigned NOATOM; // used to mark missing atoms
83 #endif
86  unsigned centeredOn = NOATOM;
88  std::vector<unsigned> controllingAtoms; // all atoms around the atom or bond.
89  // Order is important
90  bool operator==(const StereoInfo &other) const {
91  return type == other.type && specified == other.specified &&
92  centeredOn == other.centeredOn && descriptor == other.descriptor &&
93  controllingAtoms == other.controllingAtoms;
94  }
95  bool operator!=(const StereoInfo &other) const { return !(*this == other); }
96 };
97 
98 //! identifies potential stereoatoms and stereobonds in a molecule
99 /*!
100  Note that this function is still somewhat experimental and the API
101  and results may change in a future release.
102 
103  \param mol the molecule to look for stereo in
104  \param cleanIt remove chirality/stereo specifications from atoms/bonds that
105  cannot be chiral/stereo
106 */
108  ROMol &mol, bool cleanIt, bool flagPossible = true);
109 //! overload
111  const ROMol &mol);
112 
113 /// @cond
114 namespace detail {
115 RDKIT_GRAPHMOL_EXPORT bool isAtomPotentialTetrahedralCenter(const Atom *atom);
116 RDKIT_GRAPHMOL_EXPORT bool isAtomPotentialStereoAtom(const Atom *atom);
117 RDKIT_GRAPHMOL_EXPORT bool isBondPotentialStereoBond(const Bond *bond);
118 RDKIT_GRAPHMOL_EXPORT StereoInfo getStereoInfo(const Bond *bond);
119 RDKIT_GRAPHMOL_EXPORT StereoInfo getStereoInfo(const Atom *atom);
120 
121 } // namespace detail
122 /// @endcond
123 
125 
126 } // namespace Chirality
127 } // namespace RDKit
128 #endif
The class for representing atoms.
Definition: Atom.h:68
class for representing a bond
Definition: Bond.h:46
BondStereo
the nature of the bond's stereochem (for cis/trans)
Definition: Bond.h:94
#define RDKIT_GRAPHMOL_EXPORT
Definition: export.h:209
RDKIT_GRAPHMOL_EXPORT std::vector< StereoInfo > findPotentialStereo(ROMol &mol, bool cleanIt, bool flagPossible=true)
identifies potential stereoatoms and stereobonds in a molecule
RDKIT_GRAPHMOL_EXPORT INT_VECT findStereoAtoms(const Bond *bond)
Std stuff.
Definition: Abbreviations.h:18
std::vector< int > INT_VECT
Definition: types.h:274
std::vector< UINT > UINT_VECT
Definition: types.h:293
static const unsigned NOATOM
Definition: Chirality.h:82
std::vector< unsigned > controllingAtoms
Definition: Chirality.h:88
StereoSpecified specified
Definition: Chirality.h:85
StereoDescriptor descriptor
Definition: Chirality.h:87
bool operator!=(const StereoInfo &other) const
Definition: Chirality.h:95
bool operator==(const StereoInfo &other) const
Definition: Chirality.h:90