# Visualization Library A lightweight C++ OpenGL middleware for 2D/3D graphics | [Home] [Tutorials] [All Classes] [Grouped Classes]

# vlMolecule::Molecule Class Reference

The Molecule class is used to manage and render 3D molecular structures. More...

`#include <Molecule.hpp>`

Inheritance diagram for vlMolecule::Molecule:

List of all members.

## Public Member Functions
virtual const char * | className ()
| Returns the name of the class.
| Molecule ()
| ~Molecule ()
| Molecule (const Molecule &other)
Molecule & | operator= (const Molecule &other)
void | reset ()
void | setMoleculeName (const std::string &name)
const std::string | moleculeName () const
unsigned int | id () const
void | setId (unsigned int id)
vl::KeyValues * | tags ()
const vl::KeyValues * | tags () const
const std::vector< vl::ref < Atom > > & | atoms () const
std::vector< vl::ref< Atom > > & | atoms ()
int | atomCount () const
Atom * | atom (int index) const
void | addAtom (Atom *atom)
void | eraseAtom (Atom *atom)
void | eraseAtom (int index)
void | eraseAllAtoms ()
const std::vector< vl::ref < Bond > > & | bonds () const
std::vector< vl::ref< Bond > > & | bonds ()
int | bondCount () const
Bond * | bond (int index) const
Bond * | bond (Atom *a1, Atom *a2)
void | addBond (Bond *bond)
Bond * | addBond (Atom *a1, Atom *a2)
void | eraseBond (Bond *bond)
void | eraseBond (int bond)
void | eraseBond (Atom *a1, Atom *a2)
void | eraseBond (int a1, int a2)
void | eraseAllBonds ()
void | computeAtomAdjacency ()
void | incidentBonds (std::vector< Bond * > &inc_bonds, Atom *atom)
const std::vector< vl::ref < Atom > > & | cycle (int i) const
| Returns the i-th cycle.
std::vector< vl::ref< Atom > > & | cycle (int i)
| Returns the i-th cycle.
const std::vector< std::vector < vl::ref< Atom > > > & | cycles () const
| Returns the list of cycles.
std::vector< std::vector < vl::ref< Atom > > > & | cycles ()
| Returns the list of cycles.
void | prepareForRendering ()
| Generates the geometry representing the current molecule, atom and bond settings.
const vl::ActorTree * | actorTree () const
| The vl::ActorTree node containing the Actor[s] representing the molecule.
vl::ActorTree * | actorTree ()
| The vl::ActorTree node containing the Actor[s] representing the molecule.
void | setCPKAtomColors ()
| Sets all the atoms' color to their CPK color.
void | setAtomColors (const vl::fvec4 &color)
| Sets all the atoms' color to the specified color.
void | setCalculatedAtomRadii (float percentage=1.0f)
| Sets all the atoms' radii to their calculated atom radii.
void | setEmpiricalAtomRadii (float percentage=1.0f)
| Sets all the atoms' radii to their empirical atom radii.
void | setCovalentAtomRadii (float percentage=1.0f)
| Sets all the atoms' radii to their covalent atom radii.
void | setVanDerWaalsAtomRadii (float percentage=1.0f)
| Sets all the atoms' radii to their van der Waals atom radii.
void | setAtomRadii (float radius)
| Sets all the atoms' radii to the specified one.
void | setBondRadii (float radius)
| Sets all the bonds' radii to the specified one.
void | setAtomTypeVisible (EAtomType type, bool visible)
void | setMoleculeStyle (EMoleculeStyle style)
| The rendering style of the molecule.
EMoleculeStyle | moleculeStyle () const
| The rendering style of the molecule.
void | setAtomDetail (int detail)
| Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2).
int | atomDetail () const
| Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2).
void | setBondDetail (int detail)
| Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20).
int | bondDetail () const
| Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20).
float | ringOffset () const
void | setRingOffset (float offset)
void | setAromaticBondsColor (const vl::fvec4 &color)
void | setAromaticRingColor (const vl::fvec4 &color)
const vl::fvec4 & | aromaticRingColor () const
float | lineWidth () const
bool | smoothLines () const
void | setLineWidth (float w)
void | setSmoothLines (bool smooth)
vl::Transform * | transformTree ()
| The transform tree used by the generated bonds, atoms and labels.
const vl::Transform * | transformTree () const
| The transform tree used by the generated bonds, atoms and labels.
vl::Text * | atomLabelTemplate ()
| The text settings to be used to render the atom labels.
const vl::Text * | atomLabelTemplate () const
| The text settings to be used to render the atom labels.
void | setShowAtomNames (bool show)
| Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().
bool | showAtomNames () const
| Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().
const vl::Effect * | atomLabelEffect () const
| The vl::Effect used to render the atom labels.
vl::Effect * | atomLabelEffect ()
| The vl::Effect used to render the atom labels.
## Protected Member Functions
void | prepareAtomInsert (int bonus=100)
void | prepareBondInsert (int bonus=100)
void | wireframeStyle ()
void | atomsStyle ()
void | ballAndStickStyle ()
void | sticksStyle ()
void | generateRings ()
void | generateAtomLabels ()
void | generateAtomLabel (const Atom *atom, vl::Transform *tr)
## Protected Attributes
vl::fvec4 | mAromaticRingColor
vl::ref< vl::ActorTree > | mActorTree
vl::ref< vl::Transform > | mTransformTree
std::vector< vl::ref< Atom > > | mAtoms
std::vector< vl::ref< Bond > > | mBonds
std::vector< std::vector < vl::ref< Atom > > > | mCycles
std::string | mMoleculeName
vl::ref< vl::KeyValues > | mTags
vl::ref< vl::Text > | mAtomLabelTemplate
vl::ref< vl::Effect > | mAtomLabelEffect
unsigned int | mId
EMoleculeStyle | mMoleculeStyle
int | mAtomDetail
int | mBondDetail
float | mRingOffset
float | mLineWidth
bool | mSmoothLines
bool | mShowAtomNames

## Detailed Description

The Molecule class is used to manage and render 3D molecular structures.

See also:
  - Molecule Visualization Tutorial
  - Atom
  - Bond

## Constructor & Destructor Documentation

Molecule::Molecule | ( |  | ) |

vlMolecule::Molecule::~Molecule | ( |  | ) | `[inline]`

vlMolecule::Molecule::Molecule | ( | const Molecule & | other | ) | `[inline]`

## Member Function Documentation

virtual const char* vlMolecule::Molecule::className | ( |  | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::Object.

Molecule & Molecule::operator= | ( | const Molecule & | other | ) |

void Molecule::reset | ( |  | ) |

void vlMolecule::Molecule::setMoleculeName | ( | const std::string & | name | ) | `[inline]`

const std::string vlMolecule::Molecule::moleculeName | ( |  | ) | const`[inline]`

unsigned int vlMolecule::Molecule::id | ( |  | ) | const`[inline]`

void vlMolecule::Molecule::setId | ( | unsigned int | id | ) | `[inline]`

vl::KeyValues* vlMolecule::Molecule::tags | ( |  | ) | `[inline]`

const vl::KeyValues* vlMolecule::Molecule::tags | ( |  | ) | const`[inline]`

const std::vector< vl::ref<Atom> >& vlMolecule::Molecule::atoms | ( |  | ) | const`[inline]`

std::vector< vl::ref<Atom> >& vlMolecule::Molecule::atoms | ( |  | ) | `[inline]`

int vlMolecule::Molecule::atomCount | ( |  | ) | const`[inline]`

Atom * Molecule::atom | ( | int | index | ) | const

void Molecule::addAtom | ( | Atom * | atom | ) |

void Molecule::eraseAtom | ( | Atom * | atom | ) |

void Molecule::eraseAtom | ( | int | index | ) |

void Molecule::eraseAllAtoms | ( |  | ) |

const std::vector< vl::ref<Bond> >& vlMolecule::Molecule::bonds | ( |  | ) | const`[inline]`

std::vector< vl::ref<Bond> >& vlMolecule::Molecule::bonds | ( |  | ) | `[inline]`

int vlMolecule::Molecule::bondCount | ( |  | ) | const`[inline]`

Bond * Molecule::bond | ( | int | index | ) | const

Bond * Molecule::bond | ( | Atom * | a1,
|  | Atom * | a2 |
| ) |  |  |

void Molecule::addBond | ( | Bond * | bond | ) |

Bond * Molecule::addBond | ( | Atom * | a1,
|  | Atom * | a2 |
| ) |  |  |

void Molecule::eraseBond | ( | Bond * | bond | ) |

void Molecule::eraseBond | ( | int | bond | ) |

void Molecule::eraseBond | ( | Atom * | a1,
|  | Atom * | a2 |
| ) |  |  |

void Molecule::eraseBond | ( | int | a1,
|  | int | a2 |
| ) |  |  |

void Molecule::eraseAllBonds | ( |  | ) |

void Molecule::computeAtomAdjacency | ( |  | ) |

void Molecule::incidentBonds | ( | std::vector< Bond * > & | inc_bonds,
|  | Atom * | atom |
| ) |  |  |

const std::vector< vl::ref<Atom> >& vlMolecule::Molecule::cycle | ( | int | i | ) | const`[inline]`

Returns the i-th cycle.

std::vector< vl::ref<Atom> >& vlMolecule::Molecule::cycle | ( | int | i | ) | `[inline]`

Returns the i-th cycle.

const std::vector< std::vector< vl::ref<Atom> > >& vlMolecule::Molecule::cycles | ( |  | ) | const`[inline]`

Returns the list of cycles.

std::vector< std::vector< vl::ref<Atom> > >& vlMolecule::Molecule::cycles | ( |  | ) | `[inline]`

Returns the list of cycles.

void Molecule::prepareForRendering | ( |  | ) |

Generates the geometry representing the current molecule, atom and bond settings.

The actors, geometry, and transforms generated by this function can be found in actorTree() and transformTree().

const vl::ActorTree* vlMolecule::Molecule::actorTree | ( |  | ) | const`[inline]`

The vl::ActorTree node containing the Actor[s] representing the molecule.

vl::ActorTree* vlMolecule::Molecule::actorTree | ( |  | ) | `[inline]`

The vl::ActorTree node containing the Actor[s] representing the molecule.

void Molecule::setCPKAtomColors | ( |  | ) |

Sets all the atoms' color to their CPK color.

void Molecule::setAtomColors | ( | const vl::fvec4 & | color | ) |

Sets all the atoms' color to the specified color.

void Molecule::setCalculatedAtomRadii | ( | float | percentage = `1.0f` | ) |

Sets all the atoms' radii to their calculated atom radii.

void Molecule::setEmpiricalAtomRadii | ( | float | percentage = `1.0f` | ) |

Sets all the atoms' radii to their empirical atom radii.

void Molecule::setCovalentAtomRadii | ( | float | percentage = `1.0f` | ) |

Sets all the atoms' radii to their covalent atom radii.

void Molecule::setVanDerWaalsAtomRadii | ( | float | percentage = `1.0f` | ) |

Sets all the atoms' radii to their van der Waals atom radii.

void Molecule::setAtomRadii | ( | float | radius | ) |

Sets all the atoms' radii to the specified one.

void Molecule::setBondRadii | ( | float | radius | ) |

Sets all the bonds' radii to the specified one.

void Molecule::setAtomTypeVisible | ( | EAtomType | type,
|  | bool | visible |
| ) |  |  |

void vlMolecule::Molecule::setMoleculeStyle | ( | EMoleculeStyle | style | ) | `[inline]`

The rendering style of the molecule.

EMoleculeStyle vlMolecule::Molecule::moleculeStyle | ( |  | ) | const`[inline]`

The rendering style of the molecule.

void vlMolecule::Molecule::setAtomDetail | ( | int | detail | ) | `[inline]`

Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2).

int vlMolecule::Molecule::atomDetail | ( |  | ) | const`[inline]`

Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2).

void vlMolecule::Molecule::setBondDetail | ( | int | detail | ) | `[inline]`

Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20).

int vlMolecule::Molecule::bondDetail | ( |  | ) | const`[inline]`

Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20).

float vlMolecule::Molecule::ringOffset | ( |  | ) | const`[inline]`

void vlMolecule::Molecule::setRingOffset | ( | float | offset | ) | `[inline]`

void Molecule::setAromaticBondsColor | ( | const vl::fvec4 & | color | ) |

void vlMolecule::Molecule::setAromaticRingColor | ( | const vl::fvec4 & | color | ) | `[inline]`

const vl::fvec4& vlMolecule::Molecule::aromaticRingColor | ( |  | ) | const`[inline]`

float vlMolecule::Molecule::lineWidth | ( |  | ) | const`[inline]`

bool vlMolecule::Molecule::smoothLines | ( |  | ) | const`[inline]`

void vlMolecule::Molecule::setLineWidth | ( | float | w | ) | `[inline]`

void vlMolecule::Molecule::setSmoothLines | ( | bool | smooth | ) | `[inline]`

vl::Transform* vlMolecule::Molecule::transformTree | ( |  | ) | `[inline]`

The transform tree used by the generated bonds, atoms and labels.

const vl::Transform* vlMolecule::Molecule::transformTree | ( |  | ) | const`[inline]`

The transform tree used by the generated bonds, atoms and labels.

vl::Text* vlMolecule::Molecule::atomLabelTemplate | ( |  | ) | `[inline]`

The text settings to be used to render the atom labels.

const vl::Text* vlMolecule::Molecule::atomLabelTemplate | ( |  | ) | const`[inline]`

The text settings to be used to render the atom labels.

void vlMolecule::Molecule::setShowAtomNames | ( | bool | show | ) | `[inline]`

Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().

bool vlMolecule::Molecule::showAtomNames | ( |  | ) | const`[inline]`

Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().

const vl::Effect* vlMolecule::Molecule::atomLabelEffect | ( |  | ) | const`[inline]`

The vl::Effect used to render the atom labels.

vl::Effect* vlMolecule::Molecule::atomLabelEffect | ( |  | ) | `[inline]`

The vl::Effect used to render the atom labels.

void vlMolecule::Molecule::prepareAtomInsert | ( | int | bonus = `100` | ) | `[inline, protected]`

void vlMolecule::Molecule::prepareBondInsert | ( | int | bonus = `100` | ) | `[inline, protected]`

void Molecule::wireframeStyle | ( |  | ) | `[protected]`

void Molecule::atomsStyle | ( |  | ) | `[protected]`

void Molecule::ballAndStickStyle | ( |  | ) | `[protected]`

void Molecule::sticksStyle | ( |  | ) | `[protected]`

void Molecule::generateRings | ( |  | ) | `[protected]`

void Molecule::generateAtomLabels | ( |  | ) | `[protected]`

void Molecule::generateAtomLabel | ( | const Atom * | atom,
|  | vl::Transform * | tr |
| ) |  |  | `[protected]`

## Member Data Documentation

vl::fvec4 vlMolecule::Molecule::mAromaticRingColor`[protected]`

vl::ref<vl::ActorTree> vlMolecule::Molecule::mActorTree`[protected]`

vl::ref<vl::Transform> vlMolecule::Molecule::mTransformTree`[protected]`

std::vector< vl::ref<Atom> > vlMolecule::Molecule::mAtoms`[protected]`

std::vector< vl::ref<Bond> > vlMolecule::Molecule::mBonds`[protected]`

std::vector< std::vector< vl::ref<Atom> > > vlMolecule::Molecule::mCycles`[protected]`

std::string vlMolecule::Molecule::mMoleculeName`[protected]`

vl::ref<vl::KeyValues> vlMolecule::Molecule::mTags`[protected]`

vl::ref<vl::Text> vlMolecule::Molecule::mAtomLabelTemplate`[protected]`

vl::ref<vl::Effect> vlMolecule::Molecule::mAtomLabelEffect`[protected]`

unsigned int vlMolecule::Molecule::mId`[protected]`

EMoleculeStyle vlMolecule::Molecule::mMoleculeStyle`[protected]`

int vlMolecule::Molecule::mAtomDetail`[protected]`

int vlMolecule::Molecule::mBondDetail`[protected]`

float vlMolecule::Molecule::mRingOffset`[protected]`

float vlMolecule::Molecule::mLineWidth`[protected]`

bool vlMolecule::Molecule::mSmoothLines`[protected]`

bool vlMolecule::Molecule::mShowAtomNames`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlMolecule/Molecule.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlMolecule/Molecule.cpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlMolecule/Molecule_rendering.cpp

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Sun Nov 29 11:11:59 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.