#include <openbabel/builder.h>
Public Member Functions | |
void | LoadFragments () |
bool | Build (OBMol &mol) |
Static Public Member Functions | |
static vector3 | GetNewBondVector (OBAtom *atom) |
static vector3 | GetNewBondVector (OBAtom *atom, double length) |
static bool | Connect (OBMol &mol, int a, int b, vector3 &newpos, int bondOrder=1) |
static bool | Connect (OBMol &mol, int a, int b, int bondOrder=1) |
static bool | Swap (OBMol &mol, int a, int b, int c, int d) |
static void | CorrectStereoBonds (OBMol &mol) |
static void | CorrectStereoAtoms (OBMol &mol) |
static OBBitVec | GetFragment (OBAtom *atom) |
static void | AddNbrs (OBBitVec &fragment, OBAtom *atom) |
Class for 3D structure generation.
Below is and example which explain the basics.
// // code to read molecule from smiles goes here... // OBBuilder builder; builder.Build(mol); // // code to write molecule to 3D file format goes here... //
void LoadFragments | ( | ) |
Get the position for a new neighbour on atom.
atom | Atom for which we want a new neighbour location. |
Referenced by OBMol::AddHydrogens(), OBBuilder::Build(), and OBBuilder::Connect().
bool Build | ( | OBMol & | mol | ) |
The mol object contains all connectivity information (atomic numbers, bonds, bond orders, ..) but no 3D coordinates. Build generates these coordinates and assigns them.
mol | Molecule with the connectivity (from smiles for example). The coordinates are also changed in this mol. |
Atoms a and b are part of two fragments that are not connected in mol. Connect will translate and rotate the fragment that contains b so that a and b are seperated by a bond. This bond is also added.
mol | The molecule to be modified | |
a | Index for atom in fragment that should not be rotated. | |
b | Index for atom in fragment that should be rotated. | |
newpos | Direction for new bond between a and b | |
bondOrder | Bond order of the new bond between a and b. |
Referenced by OBBuilder::Build(), OBBuilder::Connect(), and OBBuilder::Swap().
bool Connect | ( | OBMol & | mol, | |
int | a, | |||
int | b, | |||
int | bondOrder = 1 | |||
) | [static] |
Atoms a and b are part of two fragments that are not connected in mol. Connect will translate and rotate the fragment that contains b so that a and b are seperated by a bond. This bond is also added.
mol | The molecule to be modified | |
a | Index for atom in fragment that should not be rotated. | |
b | Index for atom in fragment that should be rotated. | |
bondOrder | Bond order of the new bond bewtween a and b. |
bool Swap | ( | OBMol & | mol, | |
int | a, | |||
int | b, | |||
int | c, | |||
int | d | |||
) | [static] |
Swap group b, bonded to a with group d, bonded to c. The bonds a-b and b-c cannot be part of a ring. Atoms a and b will not be moved. Atoms b, d and their connected atoms (after deleting bonds ab and cd) will be translated/rotated.
Example:
\ / / b d \ / Swap(a,b,c,d) \ / a---x ----> a---x / \ / / \ / x c---d x c---b \
This function can also be used to invert chiral centers if a and c are the same atom.
Example
Referenced by OBBuilder::CorrectStereoAtoms().
void CorrectStereoBonds | ( | OBMol & | mol | ) | [static] |
Atoms a and b must be bonded and this bond cannot be part of a ring. The bond will be broken and the smiles fragment will be inserted bewteen the two remaining fragments. The fragment that contains a will not be translated or rotated. Parameters c and d are the index in the smiles to which atoms a and b will be connected respectivly.
Currently only corrects double bond chemistry comming from smiles. (OBBond::IsUp() / OBBond::IsDown())
Referenced by OBBuilder::Build().
void CorrectStereoAtoms | ( | OBMol & | mol | ) | [static] |
Currently only corrects atom chirality comming from smiles. (OBAtom::IsClockwize() / OBBond::IsAntiClockwise())
Referenced by OBBuilder::Build().
Get the fragment to which this atom belongs.
atom | Atom in the fragment. |
Referenced by OBBuilder::Build(), and OBBuilder::Connect().
Referenced by OBBuilder::GetFragment().