Avogadro
1.1.0
|
The molecule contains all of the molecular primitives. More...
#include <avogadro/molecule.h>
Public Slots | |
void | updateMolecule () |
Signals | |
void | moleculeChanged () |
void | primitiveAdded (Primitive *primitive) |
void | primitiveUpdated (Primitive *primitive) |
void | primitiveRemoved (Primitive *primitive) |
void | atomAdded (Atom *atom) |
void | atomUpdated (Atom *atom) |
void | atomRemoved (Atom *atom) |
void | bondAdded (Bond *bond) |
void | bondUpdated (Bond *bond) |
void | bondRemoved (Bond *bond) |
Public Member Functions | |
Molecule (QObject *parent=0) | |
Molecule (const Molecule &other) | |
virtual | ~Molecule () |
void | update () |
void | addHydrogens (Atom *atom=0, const QList< unsigned long > &atomIds=QList< unsigned long >(), const QList< unsigned long > &bondIds=QList< unsigned long >()) |
void | removeHydrogens (Atom *atom=0) |
void | setDipoleMoment (const Eigen::Vector3d &moment) |
Eigen::Vector3d | dipoleMoment (bool *estimate=0) const |
void | calculatePartialCharges () const |
void | calculateAromaticity () const |
void | calculateGroupIndices () const |
Bond * | bond (unsigned long id1, unsigned long id2) |
Bond * | bond (const Atom *, const Atom *) |
unsigned long | conformerSize () |
bool | addConformer (const std::vector< Eigen::Vector3d > &conformer, unsigned int index) |
std::vector< Eigen::Vector3d > * | addConformer (unsigned int index) |
std::vector< Eigen::Vector3d > * | conformer (unsigned int index) |
const std::vector< std::vector < Eigen::Vector3d > * > & | conformers () const |
bool | setConformer (unsigned int index) |
bool | setAllConformers (const std::vector< std::vector< Eigen::Vector3d > * > conformers, bool deleteExisting=true) |
void | clearConformers () |
unsigned int | numConformers () const |
unsigned int | currentConformer () const |
const std::vector< double > & | energies () const |
double | energy (int index=-1) const |
void | setEnergy (double energy) |
void | setEnergy (int index, double energy) |
void | setEnergies (const std::vector< double > &energies) |
void | clear () |
QReadWriteLock * | lock () const |
Molecule parameters | |
These methods set and get Molecule parameters. | |
void | setFileName (const QString &name) |
QString | fileName () const |
Atom properties | |
Atom * | addAtom () |
Atom * | addAtom (unsigned long id) |
Atom * | addAtom (int atomicNum, const Eigen::Vector3d &pos) |
Atom * | addAtom (const Atom &other) |
void | removeAtom (Atom *atom) |
void | removeAtom (unsigned long id) |
Atom * | atom (int index) const |
Atom * | atomById (unsigned long id) const |
QList< Atom * > | atoms () const |
void | setAtomPos (unsigned long id, const Eigen::Vector3d &vec) |
void | setAtomPos (unsigned long id, const Eigen::Vector3d *vec) |
const Eigen::Vector3d * | atomPos (unsigned long id) const |
unsigned int | numAtoms () const |
Bond properties | |
Bond * | addBond () |
Bond * | addBond (unsigned long id) |
Bond * | addBond (unsigned long beginAtomId, unsigned long endAtomId, short order=1) |
Bond * | addBond (Atom *beginAtom, Atom *endAtom, short order=1) |
void | removeBond (Bond *bond) |
void | removeBond (unsigned long id) |
Bond * | bond (int index) const |
Bond * | bondById (unsigned long id) const |
QList< Bond * > | bonds () const |
unsigned int | numBonds () const |
Residue properties | |
Residue * | addResidue () |
Residue * | addResidue (unsigned long id) |
void | removeResidue (Residue *residue) |
void | removeResidue (unsigned long id) |
Residue * | residue (int index) |
const Residue * | residue (int index) const |
Residue * | residueById (unsigned long id) const |
QList< Residue * > | residues () const |
unsigned int | numResidues () const |
Ring properties | |
These functions are used to change and retrieve the properties of the Ring objects in the Molecule.
| |
Fragment * | addRing () |
Fragment * | addRing (unsigned long id) |
void | removeRing (Fragment *ring) |
void | removeRing (unsigned long id) |
QList< Fragment * > | rings () |
unsigned int | numRings () const |
Cube properties | |
Cube * | addCube () |
Cube * | addCube (unsigned long id) |
void | removeCube (Cube *cube) |
void | removeCube (unsigned long id) |
Cube * | cube (int index) const |
Cube * | cubeById (unsigned long id) const |
QList< Cube * > | cubes () const |
unsigned int | numCubes () const |
Mesh properties | |
Mesh * | addMesh () |
Mesh * | addMesh (unsigned long id) |
void | removeMesh (Mesh *mesh) |
void | removeMesh (unsigned long id) |
Mesh * | mesh (int index) const |
Mesh * | meshById (unsigned long id) const |
QList< Mesh * > | meshes () const |
unsigned int | numMeshes () const |
ZMatrix properties | |
ZMatrix * | addZMatrix () |
void | removeZMatrix (ZMatrix *zmatrix) |
ZMatrix * | zMatrix (int index) const |
QList< ZMatrix * > | zMatrices () const |
unsigned int | numZMatrices () const |
OpenBabel translation functions | |
These functions are used to exchange information with OpenBabel. | |
OpenBabel::OBMol | OBMol () const |
bool | setOBMol (OpenBabel::OBMol *obmol) |
OpenBabel::OBUnitCell * | OBUnitCell () const |
bool | setOBUnitCell (OpenBabel::OBUnitCell *obunitcell) |
Molecule geometry information and manipulation | |
These functions can be used to retrieve several aspects of Molecule geometry and to manipulate some aspects. | |
const Eigen::Vector3d | center () const |
const Eigen::Vector3d | normalVector () const |
double | radius () const |
const Atom * | farthestAtom () const |
void | translate (const Eigen::Vector3d &) |
Operators | |
Overloaded operators. | |
Molecule & | operator= (const Molecule &other) |
Molecule & | operator+= (const Molecule &other) |
Misc. | |
Functions that don't neatly fit into the above categories. | |
PrimitiveList | copyAtomsAndBonds (const QList< Atom * > &atoms, const QList< Bond * > &bonds) |
PrimitiveList | copyAtomsAndBonds (const PrimitiveList &atomsAndBonds) |
Protected Member Functions | |
void | computeGeomInfo () const |
Protected Attributes | |
MoleculePrivate *const | d_ptr |
QString | m_fileName |
std::vector< Eigen::Vector3d > * | m_atomPos |
std::vector< std::vector < Eigen::Vector3d > * > | m_atomConformers |
unsigned int | m_currentConformer |
bool | m_estimatedDipoleMoment |
Eigen::Vector3d * | m_dipoleMoment |
bool | m_invalidPartialCharges |
bool | m_invalidAromaticity |
std::vector< Atom * > | m_atoms |
std::vector< Bond * > | m_bonds |
QList< Atom * > | m_atomList |
QList< Bond * > | m_bondList |
QReadWriteLock * | m_lock |
The molecule contains all of the molecular primitives.
The Molecule class contains the core data of the molecule. It is the central model, holding all information displayed by our various views and manipulated by tools and extensions. It typically contains Atom and Bond objects, but may also contain Cube, Mesh, Fragment, Residue and other objects.
Avogadro::Molecule::Molecule | ( | QObject * | parent = 0 | ) |
Constructor.
parent | The object parent. |
References QObject::connect(), QDir::homePath(), QObject::tr(), and Avogadro::Primitive::updated().
Avogadro::Molecule::Molecule | ( | const Molecule & | other | ) |
Copy constructor.
other | Molecule to make a copy of. |
References QObject::connect(), and Avogadro::Primitive::updated().
Avogadro::Molecule::~Molecule | ( | ) | [virtual] |
Destructor.
References QObject::blockSignals(), clear(), and QObject::disconnect().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Create a new Atom object and return a pointer to it.
Referenced by addAtom(), addHydrogens(), Avogadro::ZMatrix::addRow(), copyAtomsAndBonds(), operator+=(), and setOBMol().
Atom * Avogadro::Molecule::addAtom | ( | unsigned long | id | ) |
Create a new Atom object with the specified id and return a pointer to it. Used when you need to recreate an Atom with the same unique id.
References atom(), atomAdded(), QObject::connect(), Avogadro::Primitive::id(), m_atomConformers, QList::push_back(), Avogadro::Primitive::setId(), Avogadro::Primitive::setIndex(), QList::size(), and Avogadro::Primitive::updated().
Atom * Avogadro::Molecule::addAtom | ( | int | atomicNum, |
const Eigen::Vector3d & | pos | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Create a new Atom object of the specified element at the given position, and return a pointer to it.
atomicNum | Atomic number |
pos | Cartesian position |
References addAtom(), and Avogadro::Atom::m_atomicNumber.
Atom * Avogadro::Molecule::addAtom | ( | const Atom & | other | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Create a new Atom object and copy the Atom object other's data into it. A pointer to the new atom in this is returned.
other | The atom to copy into the new atom |
References addAtom().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Create a new Bond object and return a pointer to it.
Referenced by addBond(), addHydrogens(), Avogadro::ZMatrix::addRow(), copyAtomsAndBonds(), operator+=(), Avogadro::Animation::setFrame(), and setOBMol().
Bond * Avogadro::Molecule::addBond | ( | unsigned long | id | ) |
Create a new Bond object with the specified id and return a pointer to it. Used when you need to recreate a Bond with the same unique id.
References bond(), bondAdded(), QObject::connect(), Avogadro::Primitive::id(), QList::push_back(), Avogadro::Primitive::setId(), Avogadro::Primitive::setIndex(), QList::size(), and Avogadro::Primitive::updated().
Bond * Avogadro::Molecule::addBond | ( | unsigned long | beginAtomId, |
unsigned long | endAtomId, | ||
short | order = 1 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Create a new bond between two atoms of the specified order. A pointer to the new Bond is returned.
beginAtomId | ID of the beginning atom of the bond |
endAtomId | ID of the ending atom of the bond |
order | Bond order of the new bond (default 1) |
References addBond(), and Avogadro::Bond::setAtoms().
Bond * Avogadro::Molecule::addBond | ( | Atom * | beginAtom, |
Atom * | endAtom, | ||
short | order = 1 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Create a new bond between two atoms of the specified order. A pointer to the new Bond is returned.
beginAtom | Pointer to the beginning atom of the bond |
endAtom | Pointer to the ending atom of the bond |
order | Bond order of the new bond (default 1) |
References addBond(), and Avogadro::Bond::setAtoms().
bool Avogadro::Molecule::addConformer | ( | const std::vector< Eigen::Vector3d > & | conformer, |
unsigned int | index | ||
) |
Add a new conformer to the Molecule. If the index is an already existing conformer, this conformer will be overwritten. If there is a gap between the currently last index and the new index, new conformers will be created to make sure all indexes have a valid conformer. For example, if there is only one conformer and this method is called with index
9, a total of nine conformers are added (0 existed, 1-9 are created).
conformer | A vector of Vector3d with all atom positions. |
index | The index of the conformer to add. |
References conformer(), Avogadro::Primitive::index(), and m_atomConformers.
Referenced by setOBMol().
vector< Vector3d > * Avogadro::Molecule::addConformer | ( | unsigned int | index | ) |
Add a new conformer and return a pointer to it. If the index is an already existing conformer, no new conformer will be created and a pointer to the already existing conformer is returned. If there is a gap between the currently last index and the new index, new conformers will be created to make sure all indexes have a valid conformer. For example, if there is only one conformer and this method is called with index
9, a total of nine conformers are added (0 existed, 1-9 are created) and a pointer to the last one is returned.
index | The index of the new conformer. |
References Avogadro::Primitive::index(), and m_atomConformers.
Create a new Cube object and return a pointer to it.
Referenced by setOBMol().
Cube * Avogadro::Molecule::addCube | ( | unsigned long | id | ) |
Create a new Cube object with the specified id and return a pointer to it. Used when you need to recreate a Cube with the same unique id.
References QObject::connect(), cube(), Avogadro::Primitive::id(), primitiveAdded(), Avogadro::Primitive::setId(), Avogadro::Primitive::setIndex(), and Avogadro::Primitive::updated().
void Avogadro::Molecule::addHydrogens | ( | Atom * | atom = 0 , |
const QList< unsigned long > & | atomIds = QList<unsigned long>() , |
||
const QList< unsigned long > & | bondIds = QList<unsigned long>() |
||
) |
Add hydrogens to the molecule.
atom | If supplied only add hydrogens to the specified atom. |
atomIds | Unique Atom IDs when adding hydrogens in undo/redo. |
bondIds | Unique Bond IDs when adding hydrogens in undo/redo. |
References addAtom(), addBond(), OpenBabel::OBMol::AddHydrogens(), QList::at(), atom(), OpenBabel::OBAtom::BeginNbrAtom(), bond(), OpenBabel::OBMol::GetAtom(), OpenBabel::OBAtom::GetAtomicNum(), OpenBabel::OBAtom::GetIdx(), OpenBabel::OBAtom::GetPartialCharge(), Avogadro::Primitive::index(), QList::isEmpty(), OpenBabel::OBAtom::IsHydrogen(), OpenBabel::OBMol::NumAtoms(), numAtoms(), OBMol(), Avogadro::Bond::setBegin(), Avogadro::Bond::setEnd(), OpenBabel::OBAtom::SetHyb(), OpenBabel::OBAtom::SetImplicitValence(), OpenBabel::OBMol::SetImplicitValencePerceived(), Avogadro::Atom::setOBAtom(), Avogadro::Atom::setPartialCharge(), and QList::size().
Create a new Mesh object and return a pointer to it.
Mesh * Avogadro::Molecule::addMesh | ( | unsigned long | id | ) |
Create a new Mesh object with the specified id and return a pointer to it. Used when you need to recreate a Mesh with the same unique id.
References QObject::connect(), Avogadro::Primitive::id(), mesh(), primitiveAdded(), Avogadro::Primitive::setId(), Avogadro::Primitive::setIndex(), and Avogadro::Primitive::updated().
Create a new Residue object and return a pointer to it.
Referenced by operator+=(), operator=(), and setOBMol().
Residue * Avogadro::Molecule::addResidue | ( | unsigned long | id | ) |
Create a new Residue object with the specified id and return a pointer to it. Used when you need to recreate a Residue with the same unique id.
References QObject::connect(), Avogadro::Primitive::id(), primitiveAdded(), residue(), Avogadro::Primitive::setId(), Avogadro::Primitive::setIndex(), and Avogadro::Primitive::updated().
Create a new ring object and return a pointer to it.
Referenced by rings().
Fragment * Avogadro::Molecule::addRing | ( | unsigned long | id | ) |
Create a new Ring object with the specified id and return a pointer to it. Used when you need to recreate a Ring with the same unique id.
References QObject::connect(), Avogadro::Primitive::id(), Avogadro::Primitive::setId(), Avogadro::Primitive::setIndex(), and Avogadro::Primitive::updated().
Create a new ZMatrix object and return a pointer to it.
Atom * Avogadro::Molecule::atom | ( | int | index | ) | const [inline] |
Referenced by addAtom(), addHydrogens(), calculateGroupIndices(), calculatePartialCharges(), clear(), Avogadro::GLWidget::computeClickedAtom(), Avogadro::GLWidget::computeClickedPrimitive(), computeGeomInfo(), dipoleMoment(), OBMol(), operator+=(), operator=(), rings(), Avogadro::Animation::setFrame(), setOBMol(), and translate().
void Avogadro::Molecule::atomAdded | ( | Atom * | atom | ) | [signal] |
Atom * Avogadro::Molecule::atomById | ( | unsigned long | id | ) | const [inline] |
Referenced by Avogadro::Residue::addAtom(), Avogadro::Bond::beginAtom(), bond(), Avogadro::Bond::endAtom(), Avogadro::Bond::length(), OBMol(), operator+=(), Avogadro::Residue::removeAtom(), removeAtom(), removeHydrogens(), Avogadro::Bond::setAtoms(), Avogadro::Bond::setBegin(), Avogadro::Bond::setEnd(), and Avogadro::ZMatrix::update().
const Eigen::Vector3d * Avogadro::Molecule::atomPos | ( | unsigned long | id | ) | const [inline] |
Get the position vector of the supplied Atom.
id | Unique id of the Atom. |
Referenced by Avogadro::Bond::beginPos(), Avogadro::Bond::endPos(), Avogadro::Bond::midPos(), Avogadro::Atom::OBAtom(), and Avogadro::Atom::pos().
void Avogadro::Molecule::atomRemoved | ( | Atom * | atom | ) | [signal] |
Emitted when an Atom is removed.
Referenced by removeAtom().
QList< Atom * > Avogadro::Molecule::atoms | ( | ) | const |
void Avogadro::Molecule::atomUpdated | ( | Atom * | atom | ) | [signal] |
Emitted when an Atom is updated.
Referenced by translate().
Bond * Avogadro::Molecule::bond | ( | int | index | ) | const [inline] |
Referenced by addBond(), addHydrogens(), Avogadro::Atom::bond(), bond(), calculateAromaticity(), clear(), Avogadro::GLWidget::computeClickedBond(), Avogadro::GLWidget::computeClickedPrimitive(), OBMol(), operator+=(), operator=(), removeAtom(), removeBond(), Avogadro::ZMatrix::setBond(), and setOBMol().
Bond * Avogadro::Molecule::bond | ( | unsigned long | id1, |
unsigned long | id2 | ||
) |
References atomById(), bond(), bondById(), Avogadro::Atom::bonds(), bonds(), and Avogadro::Bond::otherAtom().
Bond * Avogadro::Molecule::bond | ( | const Atom * | a1, |
const Atom * | a2 | ||
) |
References bond(), and Avogadro::Primitive::id().
void Avogadro::Molecule::bondAdded | ( | Bond * | bond | ) | [signal] |
Bond * Avogadro::Molecule::bondById | ( | unsigned long | id | ) | const [inline] |
Referenced by bond(), Avogadro::Atom::formalCharge(), and Avogadro::Atom::neighbors().
void Avogadro::Molecule::bondRemoved | ( | Bond * | bond | ) | [signal] |
Emitted when a Bond is removed.
Referenced by removeBond().
QList< Bond * > Avogadro::Molecule::bonds | ( | ) | const |
Referenced by bond(), Avogadro::Engine::bonds(), copyAtomsAndBonds(), and Avogadro::Animation::setFrame().
void Avogadro::Molecule::bondUpdated | ( | Bond * | bond | ) | [signal] |
void Avogadro::Molecule::calculateAromaticity | ( | ) | const |
Calculate the aromaticity of the bonds.
References bond(), OpenBabel::OBMol::GetBond(), OpenBabel::OBBond::IsAromatic(), OpenBabel::OBMol::NumBonds(), numBonds(), OBMol(), and Avogadro::Bond::setAromaticity().
Referenced by Avogadro::Bond::isAromatic().
void Avogadro::Molecule::calculateGroupIndices | ( | ) | const |
Calculate the indices of atoms in groups of atoms of the same element.
References QVector::at(), atom(), numAtoms(), QVector::push_back(), QVector::resize(), Avogadro::Atom::setGroupIndex(), and QVector::size().
Referenced by Avogadro::Atom::groupIndex().
void Avogadro::Molecule::calculatePartialCharges | ( | ) | const |
Calculate the partial charges on each atom.
References atom(), OpenBabel::OBMol::GetAtom(), OpenBabel::OBAtom::GetPartialCharge(), numAtoms(), OBMol(), and Avogadro::Atom::setPartialCharge().
Referenced by Avogadro::Atom::partialCharge().
const Eigen::Vector3d Avogadro::Molecule::center | ( | ) | const |
References computeGeomInfo().
void Avogadro::Molecule::clear | ( | ) |
Remove all elements of the molecule.
References atom(), bond(), QList::clear(), clearConformers(), cube(), QObject::deleteLater(), mesh(), primitiveRemoved(), and residue().
Referenced by operator=(), setOBMol(), and ~Molecule().
void Avogadro::Molecule::clearConformers | ( | ) |
Clear all conformers from the molecule, leaving just conformer zero. This conformer will also be set as current conformer.
References m_atomConformers.
Referenced by clear(), and setAllConformers().
void Avogadro::Molecule::computeGeomInfo | ( | ) | const [protected] |
Compute all the geometry information for the Molecule. This allows several relatively expensive calculations to be cached by the Molecule instead of being recalculated every time the Molecule is drawn.
FIXME This leads to the dipole moment always getting invalidated as the geometry information must be computed on load
References atom(), Avogadro::Primitive::id(), numAtoms(), and Avogadro::Atom::pos().
Referenced by center(), farthestAtom(), normalVector(), radius(), and setOBMol().
vector< Vector3d > * Avogadro::Molecule::conformer | ( | unsigned int | index | ) |
index | The index of the conformer to retrieve. |
References m_atomConformers.
Referenced by addConformer(), Avogadro::Animation::setFrames(), Avogadro::Animation::setMolecule(), and setOBMol().
const std::vector< std::vector< Eigen::Vector3d > * > & Avogadro::Molecule::conformers | ( | ) | const |
Get const reference to all conformers.
References m_atomConformers.
Referenced by setAllConformers(), and Avogadro::MoleculeFile::writeConformers().
unsigned long Avogadro::Molecule::conformerSize | ( | ) | [inline] |
Get the current conformer size to accommodate all atoms. Since atom positions are indexed by their uniaue id, this is not the same as the number of atoms
Molecule *molecule; ... // create a correctly sized conformer and initialize its elements std::vector<Eigen::Vector3d> newConformer(molecule->conformerSize(), Eigen::Vector3d::Zero()) // change the atom posistions in the conformer foreach (Atom *atom, molecule->atoms()) { newConformer[atom->id()] = ...; } // add the conformer to the end of the current list (i.e. index = numConformers()) molecule->addConformer(newConformer, molecule->numConformers())
PrimitiveList Avogadro::Molecule::copyAtomsAndBonds | ( | const QList< Atom * > & | atoms, |
const QList< Bond * > & | bonds | ||
) |
Copy the atoms and bonds in the argument lists into new atoms and bonds in this.
atoms | Atoms to copy into this. |
bonds | Bonds to copy into this. |
References addAtom(), addBond(), Avogadro::PrimitiveList::append(), QList::constBegin(), QList::constEnd(), QList::first(), Avogadro::Primitive::id(), QVector::insert(), QList::isEmpty(), QVector::push_back(), QVector::reserve(), and QList::size().
Referenced by copyAtomsAndBonds().
PrimitiveList Avogadro::Molecule::copyAtomsAndBonds | ( | const PrimitiveList & | atomsAndBonds | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Copy the atoms and bonds in the argument lists into new atoms and bonds in this.
atomsAndBonds | Atoms and bonds to copy into this. |
References QList::append(), atoms(), Avogadro::Primitive::AtomType, bonds(), Avogadro::Primitive::BondType, QList::constBegin(), QList::constEnd(), copyAtomsAndBonds(), QList::reserve(), QList::size(), and Avogadro::PrimitiveList::subList().
Cube * Avogadro::Molecule::cube | ( | int | index | ) | const |
Referenced by addCube(), clear(), OBMol(), and setOBMol().
Cube * Avogadro::Molecule::cubeById | ( | unsigned long | id | ) | const |
References cubes(), and QList::size().
QList< Cube * > Avogadro::Molecule::cubes | ( | ) | const |
Referenced by cubeById(), and removeCube().
unsigned int Avogadro::Molecule::currentConformer | ( | ) | const |
Eigen::Vector3d Avogadro::Molecule::dipoleMoment | ( | bool * | estimate = 0 | ) | const |
Calculate the dipole moment vector for this molecule. If not known, Avogadro will estimate it based on partial charges.
A | boolean to indicate if the dipole is estimated or not |
References atom(), atoms(), OpenBabel::OBForceField::FindForceField(), OpenBabel::OBForceField::GetPartialCharges(), OpenBabel::OBPairData::GetValue(), OBMol(), Avogadro::Atom::partialCharge(), Avogadro::Atom::pos(), and OpenBabel::OBForceField::Setup().
const std::vector< double > & Avogadro::Molecule::energies | ( | ) | const |
References numConformers().
Referenced by setEnergies(), setEnergy(), and setOBMol().
double Avogadro::Molecule::energy | ( | int | index = -1 | ) | const |
Get the energy of the supplied conformer (in kJ/mol), defaults to returning the energy of the current conformer.
index | The conformer, defaults to the current conformer. |
References Avogadro::Primitive::index().
Referenced by OBMol(), and setEnergy().
const Atom * Avogadro::Molecule::farthestAtom | ( | ) | const |
References computeGeomInfo().
QString Avogadro::Molecule::fileName | ( | ) | const |
QReadWriteLock * Avogadro::Molecule::lock | ( | ) | const |
Provides locking, should be used before reading/writing to the Molecule.
Referenced by Avogadro::Animation::setFrame(), Avogadro::Animation::start(), and Avogadro::Animation::stop().
Mesh * Avogadro::Molecule::mesh | ( | int | index | ) | const |
Mesh * Avogadro::Molecule::meshById | ( | unsigned long | id | ) | const |
References meshes(), and QList::size().
QList< Mesh * > Avogadro::Molecule::meshes | ( | ) | const |
Referenced by meshById(), and removeMesh().
void Avogadro::Molecule::moleculeChanged | ( | ) | [signal] |
Emitted when the Molecule changes in a big way, e.g. thousands of atoms added/removed. Typically functions should respond by building up their interpretation of the Molecule from the beginning.
Referenced by updateMolecule().
const Eigen::Vector3d Avogadro::Molecule::normalVector | ( | ) | const |
References computeGeomInfo().
unsigned int Avogadro::Molecule::numAtoms | ( | ) | const |
References QList::size().
Referenced by addHydrogens(), calculateGroupIndices(), calculatePartialCharges(), computeGeomInfo(), and setOBMol().
unsigned int Avogadro::Molecule::numBonds | ( | ) | const |
References QList::size().
Referenced by calculateAromaticity().
unsigned int Avogadro::Molecule::numConformers | ( | ) | const |
References m_atomConformers.
Referenced by energies(), Avogadro::Animation::numFrames(), setEnergy(), Avogadro::Animation::setFrame(), Avogadro::Animation::setFrames(), and Avogadro::Animation::setMolecule().
unsigned int Avogadro::Molecule::numCubes | ( | ) | const |
unsigned int Avogadro::Molecule::numMeshes | ( | ) | const |
unsigned int Avogadro::Molecule::numResidues | ( | ) | const |
unsigned int Avogadro::Molecule::numRings | ( | ) | const |
unsigned int Avogadro::Molecule::numZMatrices | ( | ) | const |
OpenBabel::OBMol Avogadro::Molecule::OBMol | ( | ) | const |
Get access to an OpenBabel::OBMol, this is a copy of the internal data structure in OpenBabel form, you must call setOBMol in order to save any changes you make to this object.
References OpenBabel::OBResidue::AddAtom(), OpenBabel::OBMol::AddBond(), OpenBabel::OBGridData::ANGSTROM, atom(), atomById(), Avogadro::Atom::atomicNumber(), Avogadro::Residue::atomId(), Avogadro::Fragment::atoms(), Avogadro::Bond::beginAtomId(), OpenBabel::OBMol::BeginModify(), bond(), Avogadro::Residue::chainID(), cube(), Avogadro::Bond::customLabel(), QByteArray::data(), Avogadro::Cube::dimensions(), QObject::dynamicPropertyNames(), Avogadro::Bond::endAtomId(), OpenBabel::OBMol::EndModify(), energy(), OpenBabel::etab, OpenBabel::fileformatInput, OpenBabel::OBMol::GetAtom(), OpenBabel::OBMol::GetBond(), OpenBabel::OBAtom::GetIdx(), Avogadro::Primitive::index(), QString::isEmpty(), KCAL_TO_KJ, Avogadro::Cube::min(), Avogadro::Fragment::name(), OpenBabel::OBMol::NewAtom(), OpenBabel::OBMol::NewResidue(), Avogadro::Residue::number(), OpenBabel::OBMol::NumBonds(), Avogadro::Atom::OBAtom(), OBUnitCell(), Avogadro::Bond::order(), QObject::property(), residue(), OpenBabel::OBResidue::SetAtomID(), OpenBabel::OBGridData::SetAttribute(), OpenBabel::OBPairData::SetAttribute(), OpenBabel::OBResidue::SetChain(), OpenBabel::OBMol::SetData(), SetData, OpenBabel::OBMol::SetEnergy(), OpenBabel::OBResidue::SetHetAtom(), OpenBabel::OBGridData::SetLimits(), OpenBabel::OBResidue::SetName(), OpenBabel::OBResidue::SetNum(), OpenBabel::OBGridData::SetNumberOfPoints(), OpenBabel::OBGridData::SetOrigin(), OpenBabel::OBMol::SetPartialChargesPerceived(), OpenBabel::OBResidue::SetSerialNum(), OpenBabel::OBGridData::SetUnit(), OpenBabel::OBPairData::SetValue(), OpenBabel::OBGridData::SetValues(), Avogadro::Cube::spacing(), QString::toLatin1(), QString::toStdString(), and QString::toUpper().
Referenced by addHydrogens(), calculateAromaticity(), calculatePartialCharges(), dipoleMoment(), Avogadro::MoleculeFile::replaceMolecule(), rings(), Avogadro::MoleculeFile::writeConformers(), and Avogadro::MoleculeFile::writeMolecule().
OpenBabel::OBUnitCell * Avogadro::Molecule::OBUnitCell | ( | ) | const |
Get access to the OpenBabel unit cell, if any
Referenced by OBMol(), operator=(), and setOBMol().
Addition operator used to add elements from the other Molecule to this one.
References Avogadro::Residue::addAtom(), addAtom(), addBond(), addResidue(), QList::at(), atom(), atomById(), Avogadro::Residue::atomIds(), Avogadro::Fragment::atoms(), Avogadro::Bond::beginAtomId(), bond(), Avogadro::Residue::chainID(), Avogadro::Residue::chainNumber(), Avogadro::Bond::endAtomId(), Avogadro::Primitive::id(), Avogadro::Primitive::index(), Avogadro::Fragment::name(), Avogadro::Residue::number(), primitiveAdded(), QList::push_back(), residue(), residues(), Avogadro::Residue::setAtomIds(), Avogadro::Bond::setBegin(), Avogadro::Residue::setChainID(), Avogadro::Residue::setChainNumber(), Avogadro::Bond::setEnd(), Avogadro::Fragment::setName(), and Avogadro::Residue::setNumber().
Assignment operator used to set this Molecule equal to other.
References Avogadro::Residue::addAtom(), Avogadro::Atom::addBond(), addResidue(), atom(), Avogadro::Residue::atomIds(), Avogadro::Fragment::atoms(), Avogadro::Bond::beginAtom(), bond(), Avogadro::Residue::chainID(), Avogadro::Residue::chainNumber(), clear(), Avogadro::Bond::endAtom(), m_atomConformers, Avogadro::Fragment::name(), Avogadro::Residue::number(), OBUnitCell(), primitiveAdded(), QList::push_back(), residue(), residues(), Avogadro::Residue::setAtomIds(), Avogadro::Residue::setChainID(), Avogadro::Residue::setChainNumber(), Avogadro::Primitive::setId(), Avogadro::Primitive::setIndex(), Avogadro::Fragment::setName(), and Avogadro::Residue::setNumber().
void Avogadro::Molecule::primitiveAdded | ( | Primitive * | primitive | ) | [signal] |
Emitted when a child primitive is added.
primitive | pointer to the primitive that was added |
Referenced by addCube(), addMesh(), addResidue(), operator+=(), and operator=().
void Avogadro::Molecule::primitiveRemoved | ( | Primitive * | primitive | ) | [signal] |
Emitted when a child primitive is removed.
primitive | pointer to the primitive that was removed. |
Referenced by clear(), removeCube(), removeMesh(), and removeResidue().
void Avogadro::Molecule::primitiveUpdated | ( | Primitive * | primitive | ) | [signal] |
Emitted when a child primitive is updated.
primitive | pointer to the primitive that was updated |
double Avogadro::Molecule::radius | ( | ) | const |
References computeGeomInfo().
void Avogadro::Molecule::removeAtom | ( | Atom * | atom | ) |
Remove the supplied Atom.
References atomRemoved(), bond(), Avogadro::Atom::bonds(), QObject::deleteLater(), QObject::disconnect(), Avogadro::Primitive::id(), Avogadro::Primitive::index(), QObject::parent(), QList::removeAt(), removeBond(), Avogadro::Primitive::setIndex(), QList::size(), and Avogadro::Primitive::updated().
Referenced by removeAtom(), and removeHydrogens().
void Avogadro::Molecule::removeAtom | ( | unsigned long | id | ) |
Delete the Atom with the unique id specified.
References atomById(), and removeAtom().
void Avogadro::Molecule::removeBond | ( | Bond * | bond | ) |
Remove the supplied Bond.
References Avogadro::Primitive::id(), and QObject::parent().
Referenced by removeAtom(), and Avogadro::Animation::setFrame().
void Avogadro::Molecule::removeBond | ( | unsigned long | id | ) |
Remove the Bond with the unique id specified.
References Avogadro::Bond::beginAtomId(), bond(), bondRemoved(), QObject::deleteLater(), QObject::disconnect(), Avogadro::Bond::endAtomId(), Avogadro::Primitive::id(), Avogadro::Primitive::index(), QList::removeAt(), QList::size(), and Avogadro::Primitive::updated().
void Avogadro::Molecule::removeCube | ( | Cube * | cube | ) |
Remove the supplied Cube.
References QObject::deleteLater(), QObject::disconnect(), Avogadro::Primitive::id(), Avogadro::Primitive::index(), QObject::parent(), primitiveRemoved(), and Avogadro::Primitive::updated().
Referenced by removeCube().
void Avogadro::Molecule::removeCube | ( | unsigned long | id | ) |
Remove the Cube with the unique id specified.
References cubes(), removeCube(), and QList::size().
void Avogadro::Molecule::removeHydrogens | ( | Atom * | atom = 0 | ) |
Remove all hydrogens from the molecule.
atom | If supplied only remove hydrogens connected to the specified atom. |
References atomById(), Avogadro::Primitive::id(), Avogadro::Atom::isHydrogen(), Avogadro::Atom::neighbors(), and removeAtom().
void Avogadro::Molecule::removeMesh | ( | Mesh * | mesh | ) |
Remove the supplied Mesh.
References QObject::deleteLater(), QObject::disconnect(), Avogadro::Primitive::id(), Avogadro::Primitive::index(), QObject::parent(), primitiveRemoved(), and Avogadro::Primitive::updated().
Referenced by removeMesh().
void Avogadro::Molecule::removeMesh | ( | unsigned long | id | ) |
Remove the Mesh with the unique id specified.
References meshes(), removeMesh(), and QList::size().
void Avogadro::Molecule::removeResidue | ( | Residue * | residue | ) |
Remove the supplied residue.
References QObject::deleteLater(), QObject::disconnect(), Avogadro::Primitive::id(), Avogadro::Primitive::index(), QObject::parent(), primitiveRemoved(), and Avogadro::Primitive::updated().
Referenced by removeResidue().
void Avogadro::Molecule::removeResidue | ( | unsigned long | id | ) |
Remove the residue with the unique id specified.
References removeResidue(), residues(), and QList::size().
void Avogadro::Molecule::removeRing | ( | Fragment * | ring | ) |
Remove the supplied ring.
References QObject::deleteLater(), QObject::disconnect(), Avogadro::Primitive::id(), Avogadro::Primitive::index(), QObject::parent(), and Avogadro::Primitive::updated().
Referenced by removeRing(), and rings().
void Avogadro::Molecule::removeRing | ( | unsigned long | id | ) |
Remove the ring with the unique id specified.
References removeRing(), rings(), and QList::size().
void Avogadro::Molecule::removeZMatrix | ( | ZMatrix * | zmatrix | ) |
Remove the supplied ZMatrix.
Residue * Avogadro::Molecule::residue | ( | int | index | ) |
Referenced by addResidue(), clear(), OBMol(), operator+=(), operator=(), and setOBMol().
Residue * Avogadro::Molecule::residueById | ( | unsigned long | id | ) | const |
References residues(), and QList::size().
Referenced by Avogadro::Atom::residue().
QList< Residue * > Avogadro::Molecule::residues | ( | ) | const |
Referenced by operator+=(), operator=(), removeResidue(), residueById(), and setOBMol().
QList< Fragment * > Avogadro::Molecule::rings | ( | ) |
References OpenBabel::OBRing::_path, Avogadro::Fragment::addAtom(), addRing(), atom(), OpenBabel::OBMol::GetSSSR(), OBMol(), and removeRing().
Referenced by removeRing().
bool Avogadro::Molecule::setAllConformers | ( | const std::vector< std::vector< Eigen::Vector3d > * > | conformers, |
bool | deleteExisting = true |
||
) |
Replace all conformers in the Molecule. This will first clear all conformers. If the number of specified conformers
is 0, this method behaves like clearConformers(). In any case, the current conformer is set to the first one (index 0).
conformer | A vector of conformers (vector of Vector3d) |
deleteExisting | Whether to free the memory from the existing conformers |
References clearConformers(), conformers(), and m_atomConformers.
Referenced by Avogadro::Animation::start(), and Avogadro::Animation::stop().
void Avogadro::Molecule::setAtomPos | ( | unsigned long | id, |
const Eigen::Vector3d & | vec | ||
) |
Set the Atom position.
References Avogadro::Primitive::id().
Referenced by setAtomPos(), Avogadro::Atom::setOBAtom(), and Avogadro::Atom::setPos().
void Avogadro::Molecule::setAtomPos | ( | unsigned long | id, |
const Eigen::Vector3d * | vec | ||
) |
Set the Atom position.
References setAtomPos().
bool Avogadro::Molecule::setConformer | ( | unsigned int | index | ) |
Change the conformer to the one at the specified index. Conformers are indexed from 0 to numConformers() - 1. When the index is invalid (i.e. >= numConformers()), this method returns false.
References Avogadro::Primitive::index(), and m_atomConformers.
Referenced by Avogadro::Animation::setFrame(), and setOBMol().
void Avogadro::Molecule::setDipoleMoment | ( | const Eigen::Vector3d & | moment | ) |
void Avogadro::Molecule::setEnergies | ( | const std::vector< double > & | energies | ) |
Set the energies for all conformers (in kJ/mol).
energies | The vector of all energy values |
References energies().
Referenced by setOBMol().
void Avogadro::Molecule::setEnergy | ( | double | energy | ) |
Set the energy for the current conformer (in kJ/mol).
energy | The value for this conformer |
References energies(), and numConformers().
Referenced by setOBMol().
void Avogadro::Molecule::setEnergy | ( | int | index, |
double | energy | ||
) |
Set the energy for the specified conformer (in kJ/mol).
index | the index of the confomer |
energy | The energy for this conformer |
References energy(), Avogadro::Primitive::index(), and numConformers().
void Avogadro::Molecule::setFileName | ( | const QString & | name | ) |
Set the filename of the molecule.
References QObject::name().
Referenced by Avogadro::MoleculeFile::readMolecule().
bool Avogadro::Molecule::setOBMol | ( | OpenBabel::OBMol * | obmol | ) |
Copy as much data as possible from the supplied OpenBabel::OBMol to the Avogadro Molecule object.
Copy these residues!
References Avogadro::Residue::addAtom(), addAtom(), Avogadro::Fragment::addBond(), addBond(), addConformer(), addCube(), addResidue(), QList::append(), atom(), atoms(), OpenBabel::OBMol::BeginAtom(), OpenBabel::OBMol::BeginBond(), OpenBabel::OBMol::BeginResidue(), QObject::blockSignals(), bond(), clear(), computeGeomInfo(), conformer(), OpenBabel::OBGenericDataType::ConformerData, QHash::contains(), cube(), OpenBabel::OBGenericDataType::DOSData, OpenBabel::OBGenericDataType::ElectronicData, OpenBabel::OBGenericDataType::ElectronicTransitionData, energies(), OpenBabel::OBMol::GetAllData(), OpenBabel::OBOrbitalData::GetAlphaOrbitals(), OpenBabel::OBPairData::GetAttribute(), OpenBabel::OBOrbitalData::GetBetaOrbitals(), OpenBabel::OBMol::GetCoordinates(), OpenBabel::OBVectorData::GetData(), OpenBabel::OBMol::GetData(), OpenBabel::OBConformerData::GetEnergies(), OpenBabel::OBMol::GetEnergy(), OpenBabel::OBConformerData::GetForces(), OpenBabel::OBAtom::GetIdx(), OpenBabel::OBBond::GetIdx(), OpenBabel::OBGridData::GetMaxVector(), OpenBabel::OBGridData::GetNumberOfPoints(), OpenBabel::OBGridData::GetOriginVector(), OpenBabel::OBGridData::GetValues(), OpenBabel::OBGenericDataType::GridData, OpenBabel::OBMol::HasData(), Avogadro::Primitive::id(), Avogadro::Primitive::index(), OpenBabel::OBOrbitalData::IsOpenShell(), KCAL_TO_KJ, QObject::name(), OpenBabel::OBMol::NextAtom(), OpenBabel::OBMol::NextBond(), OpenBabel::OBMol::NextResidue(), numAtoms(), OpenBabel::OBMol::NumConformers(), OBUnitCell(), OpenBabel::OBGenericDataType::PairData, QObject::property(), residue(), residues(), Avogadro::Residue::setAtomId(), Avogadro::Bond::setAtoms(), Avogadro::Residue::setChainID(), Avogadro::Residue::setChainNumber(), OpenBabel::OBMol::SetConformer(), setConformer(), Avogadro::Bond::setCustomLabel(), Avogadro::Cube::setData(), setEnergies(), setEnergy(), Avogadro::Atom::setForceVector(), Avogadro::Cube::setLimits(), Avogadro::Fragment::setName(), Avogadro::Residue::setNumber(), Avogadro::Atom::setOBAtom(), QObject::setProperty(), OpenBabel::OBGenericDataType::UnitCell, update(), QHash::value(), OpenBabel::OBGenericDataType::VibrationData, OpenBabel::vector3::x(), OpenBabel::vector3::y(), and OpenBabel::vector3::z().
Referenced by Avogadro::MoleculeFile::molecule(), and Avogadro::MoleculeFile::readMolecule().
bool Avogadro::Molecule::setOBUnitCell | ( | OpenBabel::OBUnitCell * | obunitcell | ) |
Copy as much data as possible from the supplied OpenBabel::OBUnitCell to this Avogadro Molecule object.
References OpenBabel::OBGenericDataType::UnitCell.
void Avogadro::Molecule::translate | ( | const Eigen::Vector3d & | offset | ) |
Translate the Molecule using the supplied vector.
References atom(), atomUpdated(), and Avogadro::Primitive::id().
void Avogadro::Molecule::update | ( | ) |
Call to trigger an update signal, causing the molecule to be redrawn.
Reimplemented from Avogadro::Primitive.
References Avogadro::Primitive::updated().
Referenced by Avogadro::Animation::setFrame(), and setOBMol().
void Avogadro::Molecule::updateMolecule | ( | ) | [slot] |
Signal that the molecule has been changed in some large way, emits the moleculeChanged and updated signals. This indicates that anything listening to this signal should tear town its cache/model and rebuild it.
References moleculeChanged(), and Avogadro::Primitive::updated().
QList< ZMatrix * > Avogadro::Molecule::zMatrices | ( | ) | const |
ZMatrix * Avogadro::Molecule::zMatrix | ( | int | index | ) | const |
std::vector< std::vector<Eigen::Vector3d>* > Avogadro::Molecule::m_atomConformers [protected] |
Vector containing pointers to various conformers.
Referenced by addAtom(), addConformer(), clearConformers(), conformer(), conformers(), numConformers(), operator=(), setAllConformers(), and setConformer().