Open Babel
3.0
|
#include <openbabel/stereo/stereo.h>
Public Types | |
enum | Type { CisTrans = (1<<0), ExtendedCisTrans = (1<<1), SquarePlanar = (1<<2), Tetrahedral = (1<<3), ExtendedTetrahedral = (1<<4), TrigonalBipyramidal = (1<<5), Octahedral = (1<<6) } |
enum | BondDirection { NotStereo = 0, UpBond = 1, DownBond = 6, UnknownDir = 4 } |
enum | Shape { ShapeU = 1, ShapeZ = 2, Shape4 = 3 } |
enum | View { ViewFrom = 1, ViewTowards = 2 } |
enum | Winding { Clockwise = 1, AntiClockwise = 2, UnknownWinding = 3 } |
Ref & Refs types | |
enum | { NoRef = UINT_MAX, ImplicitRef = UINT_MAX - 1 } |
typedef unsigned long | Ref |
typedef std::vector< Ref > | Refs |
typedef Refs::iterator | RefIter |
typedef Refs::const_iterator | ConstRefIter |
Static Public Member Functions | |
Refs utility functions | |
static Refs | MakeRefs (Ref ref1, Ref ref2, Ref ref3, Ref ref4=NoRef) |
static bool | ContainsSameRefs (const Refs &refs1, const Refs &refs2) |
static bool | ContainsRef (const Refs &refs, unsigned long ref) |
Low-level functions used by implementation. | |
static int | NumInversions (const Refs &refs) |
static void | Permutate (Refs &refs, unsigned int i, unsigned int j) |
static Refs | Permutated (const Refs &refs, unsigned int i, unsigned int j) |
Placeholder for enums & Ref/Refs related functions.
The OBStereo struct contains a number of enums with predefined values. These are OBStereo::BondDirection, OBStereo::Type, OBStereo::Shape, OBStereo::View, OBStereo::Winding. There are enums which only apply to certain types of stereochemistry but having them in 1 place makes it easier to remember.
The OBStereo struct also contains typedefs and functions which are crucial to fully understand how to use the OBStereoBase derived classes (i.e. OBTetrahedralStereo, OBCisTransStereo, ...). Ref variables and Refs lists are a way to uniquely reference atoms in the molecule. In most cases these Ref variables are the same as the unique atom ids (OBAtom::GetId). However, 2 special cases are provided:
There are utility functions which make it easier to handle Refs. The most frequently used one is OBStereo::MakeRefs to create lists containing 3 or 4 Ref values. Formats and library use normally doesn't need the other functions.
typedef unsigned long Ref |
All stereo classes work with variables of the type Ref to uniquely identify atoms. In most cases these Ref variables are the same as the unique atom ids.
typedef Refs::iterator RefIter |
Iterator (std::iterator) for a Refs list.
typedef Refs::const_iterator ConstRefIter |
Iterator (std::iterator) for a const Refs list.
enum Type |
The various types of stereochemistry
enum BondDirection |
Bond directions used by StereoFrom0D() to translate to internal CisTransStereo representation.
Enumerator | |
---|---|
NotStereo | |
UpBond | |
DownBond | |
UnknownDir |
enum Shape |
Shapes used by OBTetraPlanarStereo subclasses for setting/getting reference ids.
Enumerator | |
---|---|
ShapeU | |
ShapeZ | |
Shape4 |
enum View |
Views used by OBTetraNonPlanarStereo subclasses for setting/getting reference ids.
Enumerator | |
---|---|
ViewFrom | view from the atom (id parameter) towards the center atom |
ViewTowards | view from center atom towards the atom (id paramater) |
enum Winding |
anonymous enum |
Create a Refs list filled with ref1
, ref2
, ref3
& ref4
. ref4
is not added to the returned Refs if it is equal to NoRef.
Check if refs1
and refs2
contain the same Ref values regardless of their order.
refs1
and refs2
contain the same Ref values. Referenced by OBTetrahedralConfig::operator==(), OBCisTransConfig::operator==(), and OBSquarePlanarConfig::operator==().
|
static |
refs
contains ref
. Referenced by OBTetrahedralConfig::operator==(), OBCisTransConfig::operator==(), and OBSquarePlanarConfig::operator==().
|
static |
Compute the inversion vector for refs
and return the sum of it's elements. The ith element in the inversion vector is the number of element to the right of element i with a lower value.
The number of inversions is the same as the number of interchanges of consecutive elements.
When working with 3 refs from a tetrahedral configuration:
Referenced by OBTetrahedralConfig::operator==().
|
static |
Permutate element i
with j
in refs
.
refs | The sequence with N elements to permutate. |
i | Element i (0...N-1) will be mutated to j and vice versa. |
j | Element j (0...N-1) will be mutated to i and vice versa. |
Referenced by OBTetraNonPlanarStereo::ChangeView(), OBTetraNonPlanarStereo::ChangeWinding(), OBTetraNonPlanarStereo::Invert(), OBTetraPlanarStereo::ToConfig(), and OBTetraNonPlanarStereo::ToConfig().
Get refs
with element i
and j
permutated.
refs | The sequence with N elements to permutate. |
i | Element i (0...N-1) will be mutated to j and vice versa. |
j | Element j (0...N-1) will be mutated to i and vice versa. |
refs
with elements i
and j
permutated.i
equals j
.