Open Babel  3.0
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
OBTetrahedralStereo Class Reference

#include <openbabel/stereo/tetrahedral.h>

Inheritance diagram for OBTetrahedralStereo:
OBTetraNonPlanarStereo OBStereoBase OBGenericData

Classes

struct  Config
 

Public Member Functions

 OBTetrahedralStereo (OBMol *mol)
 
virtual ~OBTetrahedralStereo ()
 
OBGenericDataClone (OBBase *mol) const
 
void SetAttribute (const std::string &v)
 
void SetOrigin (const DataOrigin s)
 
virtual const std::string & GetAttribute () const
 
unsigned int GetDataType () const
 
virtual const std::string & GetValue () const
 
virtual DataOrigin GetOrigin () const
 
Tetrahedral stereochemistry
OBStereo::Type GetType () const
 
bool IsValid () const
 
void SetConfig (const Config &config)
 
Config GetConfig (OBStereo::Winding winding=OBStereo::Clockwise, OBStereo::View view=OBStereo::ViewFrom) const
 
Config GetConfig (unsigned long from_or_towards, OBStereo::Winding winding=OBStereo::Clockwise, OBStereo::View view=OBStereo::ViewFrom) const
 
bool operator== (const OBTetrahedralStereo &other) const
 
bool operator!= (const OBTetrahedralStereo &other) const
 
Geniric (for all OBStereo::Type) stereochemistry
OBMolGetMolecule () const
 
void SetSpecified (bool specified)
 
bool IsSpecified () const
 

Static Public Member Functions

template<typename ConfigType >
static ConfigType ToConfig (const ConfigType &cfg, unsigned long from_or_towards, OBStereo::Winding winding=OBStereo::Clockwise, OBStereo::View view=OBStereo::ViewFrom)
 
template<typename ConfigType >
static void ChangeWinding (ConfigType &cfg)
 
template<typename ConfigType >
static void ChangeView (ConfigType &cfg)
 
template<typename ConfigType >
static void Invert (ConfigType &cfg)
 

Protected Attributes

std::string _attr
 
unsigned int _type
 
DataOrigin _source
 

Detailed Description

Class for handling and storing tetrahedral atom stereochemistry.

The OBTetrahedralStereo class is used to represent tetrahedral atom stereo chemistry. Before continuing reading, it is recommeded to read the OBTetraNonPlanar documentation first. Since this class inherits OBTetraNonPlanerStereo it should be clear that the class stores the spacial arrangement of 4 non-planer atoms. However, for the tetrahedral case, one additional OBStereo::Ref is needed: the atom id for the center atom.

The stereochemistry is set, retrieved and internally stored using the OBTetrahedralStereo::Config struct. OBTetrahedralStereo functions as a wrapper around the Config struct and provides functions to get a copy of the Config struct converted to any view direction or atom and winding (OBTetrahedralStereo::GetConfig).

tetrahedral.png

Like all stereo classes, errors, warnings or info is reported using OBMessageHandler.

See also
OBStereo OBStereoBase OBTetraNonPlanarStereo OBStereoFacade
Since
version 2.3

Constructor & Destructor Documentation

◆ OBTetrahedralStereo()

Constructor.

◆ ~OBTetrahedralStereo()

virtual ~OBTetrahedralStereo ( )
virtual

Destructor.

Member Function Documentation

◆ GetType()

OBStereo::Type GetType ( ) const
inlinevirtual

Get the OBStereo::Type for this object.

Returns
OBStereo::Tetrahedral

Implements OBStereoBase.

◆ IsValid()

bool IsValid ( ) const
Returns
True if this object is valid. This object is valid if all (center, from and ref) atom ids are set.

Referenced by OpenBabel::CanonicalLabels().

◆ SetConfig()

void SetConfig ( const Config config)

Set the configuration using a Config struct.

Referenced by OpenBabel::CanonicalLabels(), OBMol::CopySubstructure(), and OBMol::operator+=().

◆ GetConfig() [1/2]

Config GetConfig ( OBStereo::Winding  winding = OBStereo::Clockwise,
OBStereo::View  view = OBStereo::ViewFrom 
) const

◆ GetConfig() [2/2]

Config GetConfig ( unsigned long  from_or_towards,
OBStereo::Winding  winding = OBStereo::Clockwise,
OBStereo::View  view = OBStereo::ViewFrom 
) const

Get the configuration as Config struct viewing from/towards the specified id.

◆ operator==()

bool operator== ( const OBTetrahedralStereo other) const

Compare the stereochemistry stored in the Config struct with the stereochemistry specified in the Config struct from other.

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 OBTetrahedralStereo 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.

◆ Clone()

OBGenericData* Clone ( OBBase mol) const
virtual

Reimplemented from OBGenericData.

◆ ToConfig()

static ConfigType ToConfig ( const ConfigType &  cfg,
unsigned long  from_or_towards,
OBStereo::Winding  winding = OBStereo::Clockwise,
OBStereo::View  view = OBStereo::ViewFrom 
)
inlinestaticinherited

Convert a ConfigType struct from any View/Winding to the desired representation.

This is a template method which works on ConfigType structs from OBTetraNonPlanar subclasses. The subclasses can decide what data member are needed to store the stereogenic unit (i.e. 1 atom for tetrahedral, 3 for allene like, ...) and still use this generic method to handle the real stereochemistry.

A ConfigType struct should at least have the following data members:

class SomeNonPlanarStereo : public TetraNonPlanarStereo
{
public:
struct Config
{
// constructor(s) are recommended!
// subclass specific stereogenic unit
...
union {
unsigned long from;
unsigned long towards;
};
};
};
Parameters
cfgA ConfigType struct from a OBTetraNonPlanar subclass.
from_or_towardsThe desired from/towards reference id (see view)
windingThe desired winding.
viewThe desired viewing direction.
Returns
The ConfigType struct with desired from/towards, winding and view.

Referenced by OBTetrahedralConfig::operator==().

◆ ChangeWinding()

static void ChangeWinding ( ConfigType &  cfg)
inlinestaticinherited

Change the winding of the ConfigType struct while maintaining the stereochemistry.

◆ ChangeView()

static void ChangeView ( ConfigType &  cfg)
inlinestaticinherited

Change the view of the ConfigType struct while maintaining the stereochemistry.

◆ Invert()

static void Invert ( ConfigType &  cfg)
inlinestaticinherited

Invert the stereochemistry of the ConfigType struct.

◆ GetMolecule()

OBMol* GetMolecule ( ) const
inlineinherited

Get the molecule. This can be used by subclasses when more information is needed (e.g. OBCisTransStereo::GetCisRef, ...).

◆ SetSpecified()

void SetSpecified ( bool  specified)
inlineinherited

Set whether the stereochemistry is specified. Comparing a specified OBStereoBase derived class (or it's Config struct) with an unspecified one, always returns true.

◆ IsSpecified()

bool IsSpecified ( ) const
inlineinherited
Returns
True if the stereochemistry is specified.

◆ SetAttribute()

void SetAttribute ( const std::string &  v)
inlineinherited

◆ SetOrigin()

void SetOrigin ( const DataOrigin  s)
inlineinherited

◆ GetAttribute()

virtual const std::string& GetAttribute ( ) const
inlinevirtualinherited
Returns
The attribute (key), which can be used to retrieve this data

Referenced by OpenBabel::extract_thermochemistry(), and OBMoleculeFormat::MakeCombinedMolecule().

◆ GetDataType()

unsigned int GetDataType ( ) const
inlineinherited
Returns
the data type for this object as defined in OBGenericDataType

◆ GetValue()

virtual const std::string& GetValue ( ) const
inlinevirtualinherited

Base class returns a default value (the attribute type) but should never be called.

Reimplemented in OBPairData, and OBCommentData.

Referenced by OBDepict::AddAtomLabels(), OBDepict::DrawMolecule(), OBDescriptor::FilterCompare(), and OBDescriptor::GetValues().

◆ GetOrigin()

virtual DataOrigin GetOrigin ( ) const
inlinevirtualinherited

Member Data Documentation

◆ _attr

std::string _attr
protectedinherited

attribute tag (e.g., "UnitCell", "Comment" or "Author")

Referenced by OBRotamerList::Clone(), and OBNasaThermoData::OBNasaThermoData().

◆ _type

unsigned int _type
protectedinherited

attribute type – declared for each subclass

Referenced by OBRotamerList::Clone(), and OBNasaThermoData::OBNasaThermoData().

◆ _source

DataOrigin _source
protectedinherited

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