#include <openbabel/atom.h>
Inheritance diagram for OBAtom:
Public Member Functions | |
OBAtom () | |
virtual | ~OBAtom () |
OBAtom & | operator= (OBAtom &) |
bool | Clear () |
double | GetDistance (int index) |
double | GetDistance (OBAtom *) |
double | GetAngle (int b, int c) |
double | GetAngle (OBAtom *b, OBAtom *c) |
virtual OBBase * | DoTransformations (const std::map< std::string, std::string > *) |
template<class T> | |
T * | CastAndClear (bool clear=true) |
Methods to set atomic information | |
void | SetIdx (int idx) |
void | SetHyb (int hyb) |
void | SetAtomicNum (int atomicnum) |
void | SetIsotope (unsigned int iso) |
void | SetImplicitValence (int val) |
void | IncrementImplicitValence () |
void | DecrementImplicitValence () |
void | SetFormalCharge (int fcharge) |
void | SetSpinMultiplicity (short spin) |
void | SetType (const char *type) |
void | SetType (std::string &type) |
void | SetPartialCharge (double pcharge) |
void | SetVector (const vector3 &v) |
void | SetVector (const double x, const double y, const double z) |
void | SetCoordPtr (double **c) |
void | SetVector () |
void | SetResidue (OBResidue *res) |
void | SetParent (OBMol *ptr) |
void | SetAromatic () |
void | UnsetAromatic () |
void | SetClockwiseStereo () |
void | SetAntiClockwiseStereo () |
void | SetPositiveStereo () |
void | SetNegativeStereo () |
void | UnsetStereo () |
void | SetInRing () |
void | SetChiral () |
void | ClearCoordPtr () |
Methods to retrieve atomic information | |
int | GetFormalCharge () const |
unsigned int | GetAtomicNum () const |
unsigned short int | GetIsotope () const |
int | GetSpinMultiplicity () const |
double | GetAtomicMass () const |
double | GetExactMass () const |
unsigned int | GetIdx () const |
unsigned int | GetCoordinateIdx () const |
unsigned int | GetCIdx () const |
unsigned int | GetValence () const |
unsigned int | GetHyb () const |
unsigned int | GetImplicitValence () const |
unsigned int | GetHvyValence () const |
unsigned int | GetHeteroValence () const |
char * | GetType () |
double | GetX () |
double | GetY () |
double | GetZ () |
double | x () |
double | y () |
double | z () |
double * | GetCoordinate () |
vector3 & | GetVector () |
const vector3 & | GetVector () const |
double | GetPartialCharge () |
OBResidue * | GetResidue () |
OBMol * | GetParent () |
bool | GetNewBondVector (vector3 &v, double length) |
OBBond * | GetBond (OBAtom *) |
OBAtom * | GetNextAtom () |
Iterator methods | |
OBBondIterator | BeginBonds () |
OBBondIterator | EndBonds () |
OBBond * | BeginBond (OBBondIterator &i) |
OBBond * | NextBond (OBBondIterator &i) |
OBAtom * | BeginNbrAtom (OBBondIterator &i) |
OBAtom * | NextNbrAtom (OBBondIterator &i) |
Addition of residue/bond info. for an atom | |
void | NewResidue () |
void | AddResidue (OBResidue *res) |
void | DeleteResidue () |
void | AddBond (OBBond *bond) |
void | InsertBond (OBBondIterator &i, OBBond *bond) |
bool | DeleteBond (OBBond *bond) |
void | ClearBond () |
Builder utilities | |
bool | HtoMethyl () |
bool | SetHybAndGeom (int) |
void | ForceNoH () |
bool | HasNoHForced () |
Property information | |
unsigned int | CountFreeOxygens () const |
unsigned int | ImplicitHydrogenCount () const |
unsigned int | ExplicitHydrogenCount (bool ExcludeIsotopes=false) const |
unsigned int | MemberOfRingCount () const |
unsigned int | MemberOfRingSize () const |
unsigned int | CountRingBonds () const |
double | SmallestBondAngle () |
double | AverageBondAngle () |
unsigned int | BOSum () const |
unsigned int | KBOSum () const |
bool | HasResidue () |
bool | IsHydrogen () |
bool | IsCarbon () |
bool | IsNitrogen () |
bool | IsOxygen () |
bool | IsSulfur () |
bool | IsPhosphorus () |
bool | IsAromatic () const |
bool | IsInRing () const |
bool | IsInRingSize (int) const |
bool | IsHeteroatom () |
bool | IsNotCorH () |
bool | IsConnected (OBAtom *) |
bool | IsOneThree (OBAtom *) |
bool | IsOneFour (OBAtom *) |
bool | IsCarboxylOxygen () |
bool | IsPhosphateOxygen () |
bool | IsSulfateOxygen () |
bool | IsNitroOxygen () |
bool | IsAmideNitrogen () |
bool | IsPolarHydrogen () |
bool | IsNonPolarHydrogen () |
bool | IsAromaticNOxide () |
bool | IsChiral () |
bool | IsAxial () |
bool | IsClockwise () |
bool | IsAntiClockwise () |
bool | IsPositiveStereo () |
bool | IsNegativeStereo () |
bool | HasChiralitySpecified () |
bool | HasChiralVolume () |
bool | IsHbondAcceptor () |
bool | IsHbondDonor () |
bool | IsHbondDonorH () |
bool | HasAlphaBetaUnsat (bool includePandS=true) |
bool | HasBondOfOrder (unsigned int bo) |
int | CountBondsOfOrder (unsigned int bo) |
bool | HasNonSingleBond () |
bool | HasSingleBond () |
bool | HasDoubleBond () |
bool | HasAromaticBond () |
bool | MatchesSMARTS (const char *) |
Generic data handling methods (via OBGenericData) | |
bool | HasData (const std::string &) |
bool | HasData (const char *) |
bool | HasData (const unsigned int type) |
void | DeleteData (unsigned int type) |
void | DeleteData (OBGenericData *) |
void | DeleteData (std::vector< OBGenericData * > &) |
void | SetData (OBGenericData *d) |
unsigned int | DataSize () const |
OBGenericData * | GetData (const unsigned int type) |
OBGenericData * | GetData (const std::string &) |
OBGenericData * | GetData (const char *) |
std::vector< OBGenericData * > & | GetData () |
std::vector< OBGenericData * > | GetData (DataOrigin source) |
OBDataIterator | BeginData () |
OBDataIterator | EndData () |
Static Public Member Functions | |
static const char * | ClassDescription () |
Public Attributes | |
bool | Visit |
Protected Member Functions | |
int | GetFlag () const |
void | SetFlag (int flag) |
bool | HasFlag (int flag) |
Protected Attributes | |
char | _ele |
char | _impval |
char | _type [6] |
short | _fcharge |
unsigned short | _isotope |
short | _spinmultiplicity |
unsigned int | _idx |
OBMol * | _parent |
std::vector< OBBond * > | _vbond |
unsigned int | _cidx |
unsigned short | _hyb |
unsigned short | _flags |
double | _pcharge |
double ** | _c |
vector3 | _v |
OBResidue * | _residue |
std::vector< OBGenericData * > | _vdata |
To understand the OBAtom class it is important to state a key decision on which the design was based. The OBAtom class not only holds data, but facilitates extraction of data perceived from both the atom and the molecule. This prevents the OBMol class from becoming overly large and complicated.
A number of data extraction methods perform what is called `Lazy Evaluation,' which is essentially on-the-fly evaluation. For example, when an atom is queried as to whether it is cyclic or what it's hybridization state is the information is perceived automatically. The perception of a particular trait is actually performed on the entire molecule the first time it is requested of an atom or bond, and stored for subsequent requests for the same trait of additional atoms or bonds.The OBAtom class is similar to OBMol and the whole of Open Babel in that data access and modification is done through Get and Set methods.
The following code demonstrates how to print out the atom numbers, element numbers, and coordinates of a molecule:
OBMol mol; FOR_ATOMS_OF_MOL(atom, mol) { cout << atom->GetIdx() << ` `; cout << atom->GetAtomicNum() << ` `; cout << atom->GetVector() << endl; }
OBMol mol; OBAtom *atom; atom = mol.GetAtom(1); FOR_NBORS_OF_ATOM(nbr, atom) { cout << "atom #" << atom->GetIdx() << " is attached to atom #" << nbr->GetIdx() << endl; }
should produce an output like
atom #1 is attached to atom #2
OBAtom | ( | ) |
Constructor.
~OBAtom | ( | ) | [virtual] |
Destructor.
int GetFlag | ( | ) | const [inline, protected] |
void SetFlag | ( | int | flag | ) | [inline, protected] |
Sets the bitwise flag
.
bool HasFlag | ( | int | flag | ) | [inline, protected] |
flag
bool Clear | ( | ) | [virtual] |
Clear all data. Calls OBBase::Clear() to handle any generic data.
Reimplemented from OBBase.
void SetIdx | ( | int | idx | ) | [inline] |
Set atom index (i.e., in an OBMol).
void SetHyb | ( | int | hyb | ) | [inline] |
Set atom hybridization (i.e., 1 = sp, 2 = sp2, 3 = sp3 ...).
void SetAtomicNum | ( | int | atomicnum | ) | [inline] |
Set atomic number.
void SetIsotope | ( | unsigned int | iso | ) |
Set isotope number (actual atomic weight is tabulated automatically, 0 = most abundant).
void SetImplicitValence | ( | int | val | ) | [inline] |
Set the implicit valence to val
.
void IncrementImplicitValence | ( | ) | [inline] |
Increase the implicit valence by one.
void DecrementImplicitValence | ( | ) | [inline] |
Decrease the implicit valence by one.
void SetFormalCharge | ( | int | fcharge | ) | [inline] |
Set the formal charge of the atom to fcharge
.
void SetSpinMultiplicity | ( | short | spin | ) | [inline] |
Set the atomic spin to spin
. See _spinmultiplicity.
void SetType | ( | const char * | type | ) |
Set the atomic type symbol (see OBTypeTable and OBAtomTyper for more).
void SetType | ( | std::string & | type | ) |
Set the atomic type symbol (see OBTypeTable and OBAtomTyper for more).
void SetPartialCharge | ( | double | pcharge | ) | [inline] |
Set the partial charge to pcharge
.
void SetVector | ( | const double | x, | |
const double | y, | |||
const double | z | |||
) |
Set the coordinate vector for this atom based on x
y
& z
.
void SetCoordPtr | ( | double ** | c | ) | [inline] |
Set the position of this atom from a pointer-driven array of coordinates.
void SetVector | ( | ) |
Set the position of this atom based on the internal pointer array (i.e. from SetCoordPtr() ).
void SetAromatic | ( | ) | [inline] |
Mark atom as being aromatic.
void UnsetAromatic | ( | ) | [inline] |
Clear aromatic information from the atom.
void SetClockwiseStereo | ( | ) | [inline] |
Mark atom as having SMILES clockwise stereochemistry (i.e., "@@").
void SetAntiClockwiseStereo | ( | ) | [inline] |
Mark atom as having SMILES anticlockwise stereochemistry (i.e., "@").
void SetPositiveStereo | ( | ) | [inline] |
Mark an atom as having + chiral volume.
void SetNegativeStereo | ( | ) | [inline] |
Mark an atom as having - chiral volume.
void UnsetStereo | ( | ) | [inline] |
Clear all stereochemistry information.
void SetInRing | ( | ) | [inline] |
Mark an atom as belonging to at least one ring.
void SetChiral | ( | ) | [inline] |
Mark an atom as being chiral with unknown stereochemistry.
void ClearCoordPtr | ( | ) | [inline] |
Clear the internal coordinate pointer.
int GetFormalCharge | ( | ) | const [inline] |
unsigned int GetAtomicNum | ( | ) | const [inline] |
unsigned short int GetIsotope | ( | ) | const [inline] |
int GetSpinMultiplicity | ( | ) | const [inline] |
double GetAtomicMass | ( | ) | const |
double GetExactMass | ( | ) | const |
unsigned int GetIdx | ( | ) | const [inline] |
unsigned int GetCoordinateIdx | ( | ) | const [inline] |
unsigned int GetCIdx | ( | ) | const [inline] |
unsigned int GetValence | ( | ) | const [inline] |
unsigned int GetHyb | ( | ) | const |
unsigned int GetImplicitValence | ( | ) | const |
unsigned int GetHvyValence | ( | ) | const |
unsigned int GetHeteroValence | ( | ) | const |
char * GetType | ( | ) |
double GetX | ( | ) | [inline] |
double GetY | ( | ) | [inline] |
double GetZ | ( | ) | [inline] |
double x | ( | ) | [inline] |
double y | ( | ) | [inline] |
double z | ( | ) | [inline] |
double* GetCoordinate | ( | ) | [inline] |
const vector3 & GetVector | ( | ) | const |
double GetPartialCharge | ( | ) |
OBResidue * GetResidue | ( | ) |
OBMol* GetParent | ( | ) | [inline] |
bool GetNewBondVector | ( | vector3 & | v, | |
double | length | |||
) |
Create a vector for a new bond from this atom, with length given by the supplied parameter
OBAtom * GetNextAtom | ( | ) |
OBBondIterator BeginBonds | ( | ) | [inline] |
OBBondIterator EndBonds | ( | ) | [inline] |
OBBond * BeginBond | ( | OBBondIterator & | i | ) |
Set the iterator i
to the beginning of the bonds
OBBond * NextBond | ( | OBBondIterator & | i | ) |
Increment the iterator i
OBAtom * BeginNbrAtom | ( | OBBondIterator & | i | ) |
Set the iterator i
to the beginning of the bonds
OBAtom * NextNbrAtom | ( | OBBondIterator & | i | ) |
Increment the iterator i
double GetDistance | ( | int | index | ) |
double GetAngle | ( | int | b, | |
int | c | |||
) |
void NewResidue | ( | ) | [inline] |
If no residue has been set for this atom, create a new one.
void AddResidue | ( | OBResidue * | res | ) | [inline] |
Add (set) the residue for this atom.
void DeleteResidue | ( | ) | [inline] |
Delete any residue associated with this atom.
void AddBond | ( | OBBond * | bond | ) | [inline] |
Add a bond to the internal list. Does not update the bond.
void InsertBond | ( | OBBondIterator & | i, | |
OBBond * | bond | |||
) | [inline] |
Insert bond
into the internal list at the position from i
Does not modify the bond.
bool DeleteBond | ( | OBBond * | bond | ) |
Find bond
and remove it from the internal list. Does not update the bond.
void ClearBond | ( | ) | [inline] |
Clear all bonding information in this atom (does not delete them).
bool HtoMethyl | ( | ) |
If this is a hydrogen atom, transform into a methyl group.
bool SetHybAndGeom | ( | int | ) |
Change the hybridization of this atom and modify the geometry accordingly
void ForceNoH | ( | ) | [inline] |
Mark that atom has no hydrogens attached.
bool HasNoHForced | ( | ) | [inline] |
unsigned int CountFreeOxygens | ( | ) | const |
unsigned int ImplicitHydrogenCount | ( | ) | const |
unsigned int ExplicitHydrogenCount | ( | bool | ExcludeIsotopes = false |
) | const |
unsigned int MemberOfRingCount | ( | ) | const |
unsigned int MemberOfRingSize | ( | ) | const |
unsigned int CountRingBonds | ( | ) | const |
double SmallestBondAngle | ( | ) |
double AverageBondAngle | ( | ) |
unsigned int BOSum | ( | ) | const |
unsigned int KBOSum | ( | ) | const |
bool HasResidue | ( | ) | [inline] |
bool IsHydrogen | ( | ) | [inline] |
bool IsCarbon | ( | ) | [inline] |
bool IsNitrogen | ( | ) | [inline] |
bool IsOxygen | ( | ) | [inline] |
bool IsSulfur | ( | ) | [inline] |
bool IsPhosphorus | ( | ) | [inline] |
bool IsAromatic | ( | ) | const |
bool IsInRing | ( | ) | const |
bool IsInRingSize | ( | int | ) | const |
bool IsHeteroatom | ( | ) |
bool IsNotCorH | ( | ) |
bool IsOneThree | ( | OBAtom * | ) |
bool IsOneFour | ( | OBAtom * | ) |
bool IsCarboxylOxygen | ( | ) |
bool IsPhosphateOxygen | ( | ) |
bool IsSulfateOxygen | ( | ) |
bool IsNitroOxygen | ( | ) |
bool IsAmideNitrogen | ( | ) |
Returns true if nitrogen is part of an amide.
bool IsPolarHydrogen | ( | ) |
bool IsNonPolarHydrogen | ( | ) |
bool IsAromaticNOxide | ( | ) |
bool IsChiral | ( | ) |
bool IsAxial | ( | ) |
bool IsClockwise | ( | ) | [inline] |
bool IsAntiClockwise | ( | ) | [inline] |
bool IsPositiveStereo | ( | ) | [inline] |
bool IsNegativeStereo | ( | ) | [inline] |
bool HasChiralitySpecified | ( | ) | [inline] |
bool HasChiralVolume | ( | ) | [inline] |
bool IsHbondAcceptor | ( | ) |
bool IsHbondDonor | ( | ) |
bool IsHbondDonorH | ( | ) |
bool HasAlphaBetaUnsat | ( | bool | includePandS = true |
) |
includePandS | Whether to include phosphorus and sulfur neighbors in this determination (or to exclude them) |
bool HasBondOfOrder | ( | unsigned int | bo | ) |
bo
int CountBondsOfOrder | ( | unsigned int | bo | ) |
bo
bool HasNonSingleBond | ( | ) |
bool HasSingleBond | ( | ) | [inline] |
bool HasDoubleBond | ( | ) | [inline] |
bool HasAromaticBond | ( | ) | [inline] |
bool MatchesSMARTS | ( | const char * | ) |
virtual OBBase* DoTransformations | ( | const std::map< std::string, std::string > * | ) | [inline, virtual, inherited] |
Perform a set of transformations specified by the user
Typically these are program options to filter or modify an object For example, see OBMol::DoTransformations() and OBMol::ClassDescription()
Reimplemented in OBMol.
static const char* ClassDescription | ( | ) | [inline, static, inherited] |
Reimplemented in OBMol.
T* CastAndClear | ( | bool | clear = true |
) | [inline, inherited] |
By default clears the object. Called from ReadMolecule of most format classes.
bool HasData | ( | const std::string & | ) | [inherited] |
bool HasData | ( | const char * | ) | [inherited] |
bool HasData | ( | const unsigned int | type | ) | [inherited] |
void DeleteData | ( | unsigned int | type | ) | [inherited] |
Delete any data matching the given OBGenericDataType.
void DeleteData | ( | OBGenericData * | ) | [inherited] |
Delete the given generic data from this object.
void DeleteData | ( | std::vector< OBGenericData * > & | ) | [inherited] |
Delete all of the given generic data from this object.
void SetData | ( | OBGenericData * | d | ) | [inline, inherited] |
Adds a data object; does nothing if d==NULL.
unsigned int DataSize | ( | ) | const [inline, inherited] |
OBGenericData * GetData | ( | const unsigned int | type | ) | [inherited] |
OBGenericData * GetData | ( | const std::string & | ) | [inherited] |
OBGenericData * GetData | ( | const char * | ) | [inherited] |
std::vector<OBGenericData*>& GetData | ( | ) | [inline, inherited] |
std::vector< OBGenericData * > GetData | ( | DataOrigin | source | ) | [inherited] |
OBDataIterator BeginData | ( | ) | [inline, inherited] |
OBDataIterator EndData | ( | ) | [inline, inherited] |
char _ele [protected] |
atomic number (type char to minimize space -- allows for 0..255 elements)
char _impval [protected] |
implicit valence
char _type[6] [protected] |
atomic type
short _fcharge [protected] |
formal charge
unsigned short _isotope [protected] |
isotope (0 = most abundant)
short _spinmultiplicity [protected] |
atomic spin, e.g., 2 for radical 1 or 3 for carbene
unsigned int _cidx [protected] |
index into coordinate array
unsigned short _hyb [protected] |
hybridization
unsigned short _flags [protected] |
bitwise flags (e.g. aromaticity)
double _pcharge [protected] |
partial charge
double** _c [protected] |
coordinate array in double*
bool Visit |
Used internally by graph traversal algorithms.
std::vector<OBGenericData*> _vdata [protected, inherited] |
Custom data.