Open Babel: Config Struct Reference

Public Member Functions

# Config Struct Reference

`#include <cistrans.h>`

List of all members.

## Public Member Functions
| Config ()
| Config (unsigned long _begin, unsigned long _end, const OBStereo::Refs &_refs, OBStereo::Shape _shape=OBStereo::ShapeU)
bool | operator== (const Config &other) const
bool | operator!= (const Config &other) const
| Config ()
| Config (unsigned long _center, const OBStereo::Refs &_refs, OBStereo::Shape _shape=OBStereo::ShapeU)
bool | operator== (const Config &other) const
bool | operator!= (const Config &other) const
| Config ()
| Config (unsigned long _center, unsigned long from_or_towards, const OBStereo::Refs &_refs, OBStereo::Winding _winding=OBStereo::Clockwise, OBStereo::View _view=OBStereo::ViewFrom)
bool | operator== (const Config &other) const
bool | operator!= (const Config &other) const
## Public Attributes
unsigned long | from
unsigned long | towards
Data members defining stereochemistry.
unsigned long | begin
unsigned long | end
OBStereo::Refs | refs
OBStereo::Shape | shape
bool | specified
unsigned long | center
union {
unsigned long from
unsigned long towards
}; |
OBStereo::Winding | winding
OBStereo::View | view

## Detailed Description

The config struct represents the stereochemistry in a well defined way. For cis/trans stereo bonds, the following data members define the spacial arrengement of the atoms.

- OBStereo::Ref `begin:` The begin atom for the double bond.
- OBStereo::Ref `end:` The end atom for the double bond.
- OBStereo::Refs `refs:` The 4 atoms connected to the double bond.
- OBStereo::Shape `shape:` The shape formed by the `refs` by connecting them in the same order as they occur in `refs`.

Only `begin` and `end` are specific for OBCisTransStereo::Config. The other data members occur in all OBTetraPlanarStereo derived classes.

The config struct represents the stereochemistry in a well defined way. For squareplanar stereocenters, the following data members define the spacial arrengement of the atoms.

- OBStereo::Ref `center:` The central atom.
- OBStereo::Refs `refs:` The 4 atoms connected to the double bond.
- OBStereo::Shape `shape:` The shape formed by the `refs` by connecting them in the same order as they occur in `refs`.

Only `center` are specific for OBSquarePlanarStereo::Config. The other data members occur in all OBTetraPlanarStereo derived classes.

The config struct represents the stereochemistry in a well defined way. For tetrahedral stereo centers, the following data members define the special orientation of the atoms:

- OBStereo::Ref `center:` Atom id of the stereogenic center atom.
- OBStereo::Ref `from/towards`: Atom id (or OBStereo::ImplicitRef) for the atom to view from/towards.
- OBStereo::Refs `refs:` The three remaining atom ids (may also contain one OBStereo::NoRef element if from/towards is set to a real atom id).
- OBStereo::View `view:` Specify the viewing from or towards the atom with `from/towards` id.
- OBStereo::Winding `winding:` Clockwise or AntiClockwise (order in the Refs `refs` list)

Only `center` is specific for OBTetrahedralStereo::Config. The other data members occur in all OBTetraNonPlanarStereo derived classes.

## Constructor & Destructor Documentation

Config | ( | ) | `[inline]`

Default constructor. Initializes `begin` and `end` to OBStereo::NoRef and `shape` to OBStereo::ShapeU.

Config | ( | unsigned long | _begin,
|  | unsigned long | _end,
|  | const OBStereo::Refs & | _refs,
|  | OBStereo::Shape | _shape = `OBStereo::ShapeU`
| ) |  | `[inline]`

Constructor with all parameters.

Parameters:

  _begin | The double bond begin atom id.
  _end | The double bond end atom id.
  _refs | The 4 reference ids.
  _shape | The shape for the 4 reference ids.

Config | ( | ) | `[inline]`

Default constructor. Initializes `center` to OBStereo::NoRef and `shape` to OBStereo::ShapeU.

Config | ( | unsigned long | _center,
|  | const OBStereo::Refs & | _refs,
|  | OBStereo::Shape | _shape = `OBStereo::ShapeU`
| ) |  | `[inline]`

Constructor with all parameters.

Parameters:

  _center | The atom id for the central atom.
  _refs | The 4 reference ids.
  _shape | The shape for the 4 reference ids.

Config | ( | ) | `[inline]`

Default constructor. Initializes the `from/torards` and `center` to OBStereo::NoRef, the `winding` to OBStereo::Clockwise and `view` to OBStereo::ViewFrom.

Config | ( | unsigned long | _center,
|  | unsigned long | from_or_towards,
|  | const OBStereo::Refs & | _refs,
|  | OBStereo::Winding | _winding = `OBStereo::Clockwise`,
|  | OBStereo::View | _view = `OBStereo::ViewFrom`
| ) |  | `[inline]`

Constructor with all parameters.

Parameters:

  _center | The center (chiral) atom id.
  from_or_towards | The atom id from which to view or view towards (see `view`).
  _refs | The 3 reference ids.
  _winding | The winding for the 3 ids in `_refs`.
  _view | Specify viewing from or towards the atom with `from_or_towards` id.

## Member Function Documentation

bool operator== | ( | const Config & | other ) | const

Equal to operator. Comparing OBCisTransStereo::Config structs is done using the information stored in the struct's data members (i.e. begin, end, refs and shape).

There are a number of cases resuling in false being returned:

- `begin` and `end` don't match (is checked using the 2 combinations)
- One of the Refs lists does not contain 4 elements.
- 2 or more OBStereo::ImplicitRef values in a single Config struct
- (The two `refs` don't share a single common element)

In the simplest case where both `refs` contain exactly the same elements (OBStereo::ContainsSameRefs()), coould include OBStereo::ImplicitRef), both Config struct are normalized to OBStereo::ShapeU starting with the same element. After this normalization, there are two possible orientations to overlay the shape on the double bond. From the illustration below, it can be seen only `refs`[2] has to be checked in order to conclude both Config structs have the same stereochemistry.

             1      4    1      4    1------4
              \    /     |      |           |
               C==C      |      |           |
              /    \     |      |           |
             2      3    2------3    2------3

                         1 2 3 4     1 2 3 4
                         |   |       |   |      <- in any case, refs[0] & refs[2] remain unchanged
                         1 2 3 4     1 4 3 2

When comparing a Config struct with explicit hydrogen(s) to one with implicit hydrogen(s), both `refs` are also normalized to OBStereo::ShapeU starting with the same common element. This shared element cannot be OBStereo::ImplicitRef. Depending on the position of the OBStereo::ImplicitRef element(s) in the `refs`, 3 cases are possible:

             refs[2] != OBStereo::ImplicitId:

               (analog to the case above where they contained the same elements )

               1 2 3 4
               |   |      <- refs[0] & refs[2] remain unchanged
               1 H 3 H

             else:

               1 2 3 4
               |     |    <- refs[0] & refs[3] remain unchanged
               1 H H 4

               1 2 3 4
               | |        <- refs[0] & refs[1] remain unchanged
               1 2 H H

In each case, the orientation of the U shape is also defined since there can be only one OBStereo::ImplicitRef for each side of the double bond.

Returns:
  True if both Config structs represent the stereochemistry.

bool operator!= | ( | const Config & | other ) | const`[inline]`

Not equal to operator. This is the inverse of the Equal to operator==.

Returns:
  True if the two Config structs represent a different stereochemistry.

bool operator== | ( | const Config & | other ) | const

Equal to operator. Comparing OBSquarePlanarStereo::Config structs is done using the information stored in the struct's data members (i.e. center, refs and shape).

There are a number of cases resuling in false being returned:

- `center` atom ids don't match
- One of the Refs lists does not contain 4 elements.
- 2 or more OBStereo::ImplicitRef values in a single Config struct
- (The two `refs` don't share a single common element)

In the simplest case where both `refs` contain exactly the same elements (OBStereo::ContainsSameRefs()), coould include OBStereo::ImplicitRef), both Config struct are normalized to OBStereo::ShapeU starting with the same element. After this normalization, there are two possible orientations to overlay the shape on the double bond. From the illustration below, it can be seen only `refs`[2] has to be checked in order to conclude both Config structs have the same stereochemistry.

             1   4    1      4    1------4
              \ /     |      |           |
               C      |      |           |
              / \     |      |           |
             2   3    2------3    2------3

                      1 2 3 4     1 2 3 4
                      |   |       |   |      <- in any case, refs[0] & refs[2] remain unchanged
                      1 2 3 4     1 4 3 2

When comparing a Config struct with explicit hydrogen(s) to one with implicit hydrogen(s), both `refs` are also normalized to OBStereo::ShapeU starting with the same common element. This shared element cannot be OBStereo::ImplicitRef. Depending on the position of the OBStereo::ImplicitRef element(s) in the `refs`, 3 cases are possible:

             refs[2] != OBStereo::ImplicitId:

               (analog to the case above where they contained the same elements )

               1 2 3 4
               |   |      <- refs[0] & refs[2] remain unchanged
               1 H 3 H

             else:

               1 2 3 4
               |     |    <- refs[0] & refs[3] remain unchanged
               1 H H 4

               1 2 3 4
               | |        <- refs[0] & refs[1] remain unchanged
               1 2 H H

In each case, the orientation of the U shape is also defined since there can be only one OBStereo::ImplicitRef for each side of the double bond.

Returns:
  True if both Config structs represent the stereochemistry.

bool operator!= | ( | const Config & | other ) | const`[inline]`

Not equal to operator. This is the inverse of the Equal to operator==.

Returns:
  True if the two Config structs represent a different stereochemistry.

bool operator== | ( | const Config & | other ) | const

Equal to operator. Comparing OBTetrahedralStereo::Config structs is done using the information stored in the struct's data members (i.e. `view`, `winding`, `from/towards` and `refs`).

There are a number of cases resuling in false being returned:

- The centers don't match.
- One of the Refs lists does not contain 3 elements.
- 2 or more OBStereo::ImplicitRef values in a single Config struct

When either Config struct is unspecified (i.e. the stereochemistry implied is accidental), true is returned.

It doesn't matter if the two Config structs use the same view, same from/towards Ref or the same winding. All needed conversions will be carried out automatically (see OBTetraNonPlanerStereo::ToConfig). These conversions ensure the spacial orientation of the 4 groups remains unchanged.

Another key feature is the ability to comapre Config structs regardless of implicit (OBStereo::ImplicitRef) or explicit hydrogens. This is best illustrated with some examples. In these examples the same ref has already been selected as from/towards atom and both use the same winding and view direction. We will focus on how the three remaining refs are interpreted.

             234 == 234 // true
             2H4 == 234 // 3 is missing, must be the implicit --> 234 == 234 // true
             2H4 == 243 // same as above, but now 234 == 243 // false
             234 == H34 // 2 is missing, must be implicit --> 234 == 234 // true

By comparing the second and third example above, it can be clearly seen that the value of 1 Ref can actually be ignored. It's position in the sequence (or the winding) is defined by the two explicit Ref values.

Returns:
  True if both Config structs represent the same stereochemistry.

bool operator!= | ( | const Config & | other ) | const`[inline]`

Not equal to operator. This is the inverse of the Equal to operator==.

Returns:
  True if the two Config structs represent a different stereochemistry.

## Member Data Documentation

unsigned long begin

unsigned long end

OBStereo::Refs refs

The 4 reference ids.

The 3 reference ids.

OBStereo::Shape shape

The shape of the 4 reference ids.

bool specified

True if the stereochemistry is specified. When false, the described special orientation is only accidental (i.e. unspecified).

Referenced by OpenBabel::CanonicalLabels().

unsigned long center

unsigned long from

unsigned long towards

union { ... }

OBStereo::Winding winding

OBStereo::View view

Specify viewing from or towards the atom with `from/towards` id.

The documentation for this struct was generated from the following files:

- cistrans.h
- squareplanar.h
- tetrahedral.h

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines