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