Open Babel  3.0
Public Member Functions | List of all members
OBTetrahedralStereo::Config Struct Reference

#include <openbabel/stereo/tetrahedral.h>

Public Member Functions

 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 center
 
union {
   unsigned long   from
 
   unsigned long   towards
 
}; 
 
OBStereo::Refs refs
 
OBStereo::Winding winding
 
OBStereo::View view
 
bool specified
 

Detailed Description

Stereochemical configuration for tetrahedral stereocenters.

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:

tetrahedral.png

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

Constructor & Destructor Documentation

◆ Config() [1/2]

Config ( )
inline

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

◆ Config() [2/2]

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
_centerThe center (chiral) atom id.
from_or_towardsThe atom id from which to view or view towards (see view).
_refsThe 3 reference ids.
_windingThe winding for the 3 ids in _refs.
_viewSpecify viewing from or towards the atom with from_or_towards id.

Member Function Documentation

◆ operator==()

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.

◆ operator!=()

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

◆ center

unsigned long center

◆ from

unsigned long from

◆ towards

unsigned long towards

◆ @16

union { ... }

This anonymous union helps to keep code clean. Both the from and towards data members contain the same OBStereo::Ref (same memory address) but can be used interchangeably to match the context of the code. The real viewing direction is specified by the view data member.

◆ refs

◆ winding

◆ view

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

Referenced by OBTetrahedralConfig::Convert(), and OBSmartsMatcher::match().

◆ specified

bool specified

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

Referenced by OpenBabel::CanonicalLabels(), OBTetrahedralConfig::Convert(), OBMol::CopySubstructure(), OBBuilder::CorrectStereoAtoms(), OpenBabel::findMetalloceneBonds(), and OBSmartsMatcher::match().


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