Open Babel  3.0
Public Types | List of all members
OBStereo Class Reference

#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< RefRefs
 
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)
 

Detailed Description

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.

See also
OBStereoBase OBStereoFacade
Since
version 2.3

Member Typedef Documentation

◆ Ref

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.

See also
OBAtom::GetId() OBStereo

◆ Refs

typedef std::vector<Ref> Refs

A list (std::vector) of Ref variables.

◆ RefIter

typedef Refs::iterator RefIter

Iterator (std::iterator) for a Refs list.

◆ ConstRefIter

typedef Refs::const_iterator ConstRefIter

Iterator (std::iterator) for a const Refs list.

Member Enumeration Documentation

◆ Type

enum Type

The various types of stereochemistry

Enumerator
CisTrans 

cis/trans double bond

ExtendedCisTrans 

allene, biphenyl, ...

SquarePlanar 

Square-planar stereochemistry.

Tetrahedral 

tetrahedral

ExtendedTetrahedral 

extended tetrahedral

TrigonalBipyramidal 

Trigonal-bipyramidal stereochemistry.

Octahedral 

Octahedral stereochemistry.

◆ BondDirection

Bond directions used by StereoFrom0D() to translate to internal CisTransStereo representation.

Enumerator
NotStereo 
UpBond 
DownBond 
UnknownDir 

◆ Shape

enum Shape

Shapes used by OBTetraPlanarStereo subclasses for setting/getting reference ids.

SPshapes.png
See also
OBTetraPlanarStereo
Enumerator
ShapeU 
ShapeZ 
Shape4 

◆ View

enum View

Views used by OBTetraNonPlanarStereo subclasses for setting/getting reference ids.

See also
OBTetraNonPlanarStereo
Enumerator
ViewFrom 

view from the atom (id parameter) towards the center atom

ViewTowards 

view from center atom towards the atom (id paramater)

◆ Winding

enum Winding

Windings used by OBTetraNonPlanar subclasses for setting/getting reference ids.

See also
OBTetraNonPlanar
Enumerator
Clockwise 

Clockwise winding.

AntiClockwise 

AntiClockwise winding (or CounterClockwise)

UnknownWinding 

The configuration is specified as unknown (squiggly line in depiction)

◆ anonymous enum

anonymous enum

Special case Ref values.

Enumerator
NoRef 

No Ref set (invalid Ref)

ImplicitRef 

Implicit Ref (i.e. hydrogen, N lone pair, ...).

Member Function Documentation

◆ MakeRefs()

static Refs MakeRefs ( Ref  ref1,
Ref  ref2,
Ref  ref3,
Ref  ref4 = NoRef 
)
inlinestatic

Create a Refs list filled with ref1, ref2, ref3 & ref4. ref4 is not added to the returned Refs if it is equal to NoRef.

Returns
A Refs list containing the specified Ref values.

◆ ContainsSameRefs()

static bool ContainsSameRefs ( const Refs refs1,
const Refs refs2 
)
static

Check if refs1 and refs2 contain the same Ref values regardless of their order.

OBStereo::ContainsSameRefs(OBStereo::MakeRefs(1, 2, 3), OBStereo::MakeRefs(3, 2, 1)) // true
OBStereo::ContainsSameRefs(OBStereo::MakeRefs(1, 2, 3), OBStereo::MakeRefs(3, 4, 1)) // false
Returns
True if refs1 and refs2 contain the same Ref values.

Referenced by OBTetrahedralConfig::operator==(), OBCisTransConfig::operator==(), and OBSquarePlanarConfig::operator==().

◆ ContainsRef()

static bool ContainsRef ( const Refs refs,
unsigned long  ref 
)
static

◆ NumInversions()

static int NumInversions ( const Refs refs)
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:

permutation inversion vector sum
-------------------------------------
123 0 0 0 0 (even) -> clockwise
132 0 1 0 1 (odd) -> anti-clockwise
213 1 0 0 1 (odd) -> anti-clockwise
231 1 1 0 2 (even) -> clockwise
312 2 0 0 2 (even) -> clockwise
321 2 1 0 3 (odd) -> anti-clockwise

Referenced by OBTetrahedralConfig::operator==().

◆ Permutate()

static void Permutate ( Refs refs,
unsigned int  i,
unsigned int  j 
)
static

Permutate element i with j in refs.

Parameters
refsThe sequence with N elements to permutate.
iElement i (0...N-1) will be mutated to j and vice versa.
jElement j (0...N-1) will be mutated to i and vice versa.
Note
This method does nothing if i equals j.

Referenced by OBTetraNonPlanarStereo::ChangeView(), OBTetraNonPlanarStereo::ChangeWinding(), OBTetraNonPlanarStereo::Invert(), OBTetraPlanarStereo::ToConfig(), and OBTetraNonPlanarStereo::ToConfig().

◆ Permutated()

static Refs Permutated ( const Refs refs,
unsigned int  i,
unsigned int  j 
)
static

Get refs with element i and j permutated.

Parameters
refsThe sequence with N elements to permutate.
iElement i (0...N-1) will be mutated to j and vice versa.
jElement j (0...N-1) will be mutated to i and vice versa.
Returns
refs with elements i and j permutated.
Note
This method does nothing if i equals j.

The documentation for this class was generated from the following file: