RDKit
Open-source cheminformatics and machine learning.
Stereo.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2016 Novartis Institutes for BioMedical Research
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 #pragma once
11 #include "StructChecker.h"
12 #include "Utilites.h"
13 
14 namespace RDKit {
15 namespace StructureCheck {
16 
17 // ??? stereo parity
18 static const int ODD = 1;
19 static const int EVEN = 2;
20 static const int UNMARKED = 3;
21 
22 static const int ALLENE_PARITY = -2;
23 static const int ILLEGAL_REPRESENTATION = -1;
24 static const int UNDEFINED_PARITY = 0;
25 static const int ODD_PARITY = 1;
26 static const int EVEN_PARITY = 2;
27 static inline int INVERT_PARITY(int p) { return ((p) == 0 ? (0) : (3 - (p))); }
28 
29 // bond color:
30 static const int CIS = 1;
31 static const int TRANS = 2;
32 
33 // return codes for DubiousStereochemistry()
34 static const int EITHER_BOND_FOUND = 1;
35 static const int STEREO_BOND_AT_NON_STEREO_ATOM = 2;
36 static const int ZEROED_Z_COORDINATES = 4;
37 static const int CONVERTED_TO_2D = 8;
38 /* DubiousStereochemistry:
39 * Checks if there is some ill-defined stereochemistry in the
40 * molecule *mp. The function returns a bit set integer which defines
41 * the problems encountered.
42 */
44 
45 /* FixDubious3DMolecule:
46 * Checks if the structure has 3D coordinates and/or flat sp3-carbons with
47 * stereo-bonds and
48 * converts the designation to 2D, clearing away any Z-component of the
49 * coordinates.
50 * Real 3D structures without stereo designations go through untouched.
51 */
52 int FixDubious3DMolecule(RWMol &mol);
53 
54 // Removes ill-defined stereodescriptors.
56 
57 /*
58 * Checks if all potential stereocenters are either completely undefined
59 * or attributed with hashes and wedges according to MDL rules.
60 */
61 bool CheckStereo(const ROMol &mol);
62 
63 /*
64 * Checks if any two atoms in *mp come closer than 10% of the
65 * average bond length or if an atom is too close the line
66 * between two bonded atoms.
67 */
68 bool AtomClash(RWMol &mol, double clash_limit);
69 
70 /*
71 * Computes the stereo parity of atom number iatom in *mp relative
72 * to its numbering. The immediate neighbours are defined by *nbp
73 * to speed up processing.
74 */
75 int AtomParity(const ROMol &mol, unsigned iatom, const Neighbourhood &nbp);
76 
77 /*
78 * Sets the color field of the defined double bonds in *mp to CIS,
79 * TRANS, or NONE depending on the ligands with the lowest numbering[].
80 * It returns the number of defined double bonds found.
81 */
82 int CisTransPerception(const ROMol &mol,
83  const std::vector<RDGeom::Point3D> &points,
84  const std::vector<unsigned> &numbering,
85  std::vector<unsigned> &bondColor);
86 }
87 }
static const int CIS
Definition: Stereo.h:30
static const int UNMARKED
Definition: Stereo.h:20
static const int ZEROED_Z_COORDINATES
Definition: Stereo.h:36
static const int EVEN_PARITY
Definition: Stereo.h:26
static int INVERT_PARITY(int p)
Definition: Stereo.h:27
static const int ODD
Definition: Stereo.h:18
static const int ALLENE_PARITY
Definition: Stereo.h:22
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:30
Contains the public API of the StructChecker.
void RemoveDubiousStereochemistry(RWMol &mol)
static const int TRANS
Definition: Stereo.h:31
static const int ODD_PARITY
Definition: Stereo.h:25
bool AtomClash(RWMol &mol, double clash_limit)
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:103
int CisTransPerception(const ROMol &mol, const std::vector< RDGeom::Point3D > &points, const std::vector< unsigned > &numbering, std::vector< unsigned > &bondColor)
static const int EVEN
Definition: Stereo.h:19
int FixDubious3DMolecule(RWMol &mol)
static const int CONVERTED_TO_2D
Definition: Stereo.h:37
static const int EITHER_BOND_FOUND
Definition: Stereo.h:34
int AtomParity(const ROMol &mol, unsigned iatom, const Neighbourhood &nbp)
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:29
int DubiousStereochemistry(RWMol &mol)
bool CheckStereo(const ROMol &mol)
static const int UNDEFINED_PARITY
Definition: Stereo.h:24
static const int ILLEGAL_REPRESENTATION
Definition: Stereo.h:23
static const int STEREO_BOND_AT_NON_STEREO_ATOM
Definition: Stereo.h:35