Avogadro
1.1.0
|
Simple frame-based animation for Molecule primitives. More...
#include <avogadro/animation.h>
Public Slots | |
void | setFps (int fps) |
void | setLoopCount (int loops) |
void | setFrame (int i) |
void | setDynamicBonds (bool enable) |
void | start () |
void | pause () |
void | stop () |
Signals | |
void | frameChanged (int) |
Public Member Functions | |
Animation (QObject *parent=0) | |
virtual | ~Animation () |
void | setMolecule (Molecule *molecule) |
void | setFrames (std::vector< std::vector< Eigen::Vector3d > * > frames) |
int | fps () const |
int | loopCount () const |
int | numFrames () const |
bool | dynamicBonds () const |
Simple frame-based animation for Molecule primitives.
The animation class supports simple frame-based animations for molecules. It can handle trajectories, vibrations, geometry optimizations and many other common molecular animations.
It assumes constant atom lists throughout. If you want more complicated animations, you can accomplish this using your own Extension.
An Animation object works by changing conformers inside a Molecule. Consequently, you can either read in the conformers from a file, or call Animation::setFrames() to set the coordinates for the animation. The latter works well for generated coordinates, for example, vibrations.
Avogadro::Animation::Animation | ( | QObject * | parent = 0 | ) |
Constructor.
parent | The object parent. Should be the widget viewing the animation or a child of that widget (e.g., an Extension). |
References QTimeLine::setCurveShape().
Avogadro::Animation::~Animation | ( | ) | [virtual] |
Deconstructor.
bool Avogadro::Animation::dynamicBonds | ( | ) | const |
int Avogadro::Animation::fps | ( | ) | const |
Referenced by setFps().
void Avogadro::Animation::frameChanged | ( | int | ) | [signal] |
This signal is emitted when the current frame is changed (i.e. setFrame() called)
Referenced by setFrame(), start(), and stop().
int Avogadro::Animation::loopCount | ( | ) | const |
References QTimeLine::loopCount.
int Avogadro::Animation::numFrames | ( | ) | const |
References Avogadro::Molecule::numConformers().
Referenced by setFrames(), and start().
void Avogadro::Animation::pause | ( | ) | [slot] |
Pause the animation.
References QTimeLine::stop().
void Avogadro::Animation::setDynamicBonds | ( | bool | enable | ) | [slot] |
Enable/disable dynamic bond detection. For QM reactions for example.
void Avogadro::Animation::setFps | ( | int | fps | ) | [slot] |
Set the number of frames per second.
References fps().
void Avogadro::Animation::setFrame | ( | int | i | ) | [slot] |
Set the current frame.
References Avogadro::Molecule::addBond(), Avogadro::Molecule::atom(), Avogadro::Molecule::atoms(), OpenBabel::OBMol::BeginModify(), Avogadro::Molecule::bonds(), OpenBabel::OBMol::ConnectTheDots(), OpenBabel::OBMol::EndModify(), FOR_BONDS_OF_MOL, frameChanged(), Avogadro::Primitive::id(), Avogadro::Molecule::lock(), QReadWriteLock::lockForWrite(), OpenBabel::OBMol::NewAtom(), Avogadro::Molecule::numConformers(), Avogadro::Atom::OBAtom(), Avogadro::Molecule::removeBond(), Avogadro::Bond::setBegin(), Avogadro::Molecule::setConformer(), Avogadro::Bond::setEnd(), Avogadro::Bond::setOrder(), QReadWriteLock::unlock(), and Avogadro::Molecule::update().
void Avogadro::Animation::setFrames | ( | std::vector< std::vector< Eigen::Vector3d > * > | frames | ) |
Set the frames for the animation. By default, the conformers in the molecule are used as animation frames. However, for trajectory files that don't contain any topology, it is needed to read in the the molecule topology before the trajectory. The trajectory frames can be used to call setFrames() later.
References Avogadro::Molecule::conformer(), Avogadro::Molecule::numConformers(), numFrames(), and QTimeLine::setFrameRange().
void Avogadro::Animation::setLoopCount | ( | int | loops | ) | [slot] |
Set the loop count. (0 = repeat forever)
References QTimeLine::setLoopCount().
void Avogadro::Animation::setMolecule | ( | Molecule * | molecule | ) |
Set the molecule to animate.
References Avogadro::Molecule::conformer(), Avogadro::Molecule::numConformers(), and QTimeLine::setFrameRange().
void Avogadro::Animation::start | ( | ) | [slot] |
Start the animation (at current frame).
References QObject::connect(), frameChanged(), Avogadro::Molecule::lock(), QReadWriteLock::lockForWrite(), numFrames(), Avogadro::Molecule::setAllConformers(), QTimeLine::setCurrentTime(), QTimeLine::setDuration(), setFrame(), QTimeLine::setFrameRange(), QTimeLine::setUpdateInterval(), QTimeLine::start(), and QReadWriteLock::unlock().
void Avogadro::Animation::stop | ( | ) | [slot] |
Stop the animation (and return to first frame).
References QObject::disconnect(), frameChanged(), Avogadro::Molecule::lock(), QReadWriteLock::lockForWrite(), Avogadro::Molecule::setAllConformers(), QTimeLine::setCurrentTime(), setFrame(), QTimeLine::stop(), and QReadWriteLock::unlock().