AvogadroLibs  1.96.0
Classes | Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RWMolecule Class Reference

The RWMolecule class is an editable molecule class that automatically populates an undo stack. More...

#include <avogadro/qtgui/rwmolecule.h>

Inheritance diagram for RWMolecule:

Classes

class  UndoCommand
 

Public Types

typedef RWAtom AtomType
 
typedef PersistentAtom< RWMoleculePersistentAtomType
 
typedef RWBond BondType
 
typedef PersistentBond< RWMoleculePersistentBondType
 

Public Slots

void emitChanged (unsigned int change)
 Force the molecule to emit the changed() signal. More...
 

Signals

void changed (unsigned int change)
 Indicates that the molecule has changed. More...
 

Public Member Functions

 RWMolecule (Molecule &mol, QObject *parent=nullptr)
 
Moleculemolecule ()
 
const Moleculemolecule () const
 
AtomType addAtom (unsigned char atomicNumber, bool usingPositions=true)
 
AtomType addAtom (unsigned char atomicNumber, const Vector3 &position3d)
 
AtomType atom (Index atomId) const
 
AtomType atomByUniqueId (Index atomUId) const
 
Index atomCount () const
 
Index atomCount (unsigned char atomicNumber) const
 
void clearAtoms ()
 
void adjustHydrogens (Index atomId)
 
void adjustHydrogens (const Core::Array< Index > &atomIds)
 
const Core::Array< unsigned char > & atomicNumbers () const
 
unsigned char atomicNumber (Index atomId) const
 
bool setAtomicNumbers (const Core::Array< unsigned char > &nums)
 
bool setAtomicNumber (Index atomId, unsigned char atomicNumber)
 
const Core::Array< Vector3 > & atomPositions3d () const
 
Vector3 atomPosition3d (Index atomId) const
 
std::string label (Index atomId) const
 
bool setLabel (Index atomId, const std::string &label, const QString &undoText=QStringLiteral("Change Atom Label"))
 
bool setAtomPositions3d (const Core::Array< Vector3 > &pos, const QString &undoText=QStringLiteral("Change Atom Positions"))
 
bool setAtomPosition3d (Index atomId, const Vector3 &pos, const QString &undoText=QStringLiteral("Change Atom Position"))
 
void setAtomSelected (Index atomId, bool selected)
 
bool atomSelected (Index atomId) const
 
bool setAtomPosition2d (Index, const Vector2 &)
 
Vector2 atomPosition2d (Index)
 
const Core::Array< Vector2 > & atomPositions2d () const
 
Core::AtomHybridization hybridization (Index atomId) const
 
bool setHybridization (Index atomId, Core::AtomHybridization hyb)
 
signed char formalCharge (Index atomId) const
 
bool setFormalCharge (Index atomId, signed char charge)
 
Vector3ub color (Index atomId) const
 
bool setColor (Index atomId, Vector3ub color)
 
bool setLayer (Index atomId, size_t layer)
 
size_t layer (Index atomId) const
 
BondType bond (Index bondId) const
 
BondType bond (Index atom1, Index atom2) const
 
BondType bond (const AtomType &atom1, const AtomType &atom2) const
 
BondType bondByUniqueId (Index bondUid) const
 
Index bondUniqueId (Index bondId) const
 
Index bondUniqueId (const BondType &bond) const
 
Index bondCount () const
 
void clearBonds ()
 
Core::Array< BondTypebonds (const AtomType &atom) const
 
Core::Array< BondTypebonds (const Index &atomId) const
 
const Core::Array< unsigned char > & bondOrders () const
 
unsigned char bondOrder (Index bondId) const
 
bool setBondOrders (const Core::Array< unsigned char > &orders)
 
bool setBondOrder (Index bondId, unsigned char order)
 
const Core::Array< std::pair< Index, Index > > & bondPairs () const
 
std::pair< Index, IndexbondPair (Index bondId) const
 
bool setBondPairs (const Core::Array< std::pair< Index, Index >> &pairs)
 
bool setBondPair (Index bondId, const std::pair< Index, Index > &pair)
 
void addUnitCell ()
 
void removeUnitCell ()
 
void modifyMolecule (const Molecule &newMolecule, Molecule::MoleculeChanges changes, const QString &undoText=QStringLiteral("Modify Molecule"))
 
void appendMolecule (const Molecule &addMolecule, const QString &undoText=QStringLiteral("Append Molecule"))
 
void editUnitCell (Matrix3 cellMatrix, Core::CrystalTools::Options opts)
 
void wrapAtomsToCell ()
 
void rotateCellToStandardOrientation ()
 
void setCellVolume (double newVolume, Core::CrystalTools::Options options)
 
void buildSupercell (unsigned int a, unsigned int b, unsigned int c)
 
void niggliReduceCell ()
 
bool reduceCellToPrimitive (double cartTol=1e-5)
 
bool conventionalizeCell (double cartTol=1e-5)
 
bool symmetrizeCell (double cartTol=1e-5)
 
bool fillUnitCell (unsigned short hallNumber, double cartTol=1e-5)
 
bool reduceCellToAsymmetricUnit (unsigned short hallNumber, double cartTol=1e-5)
 
void beginMergeMode (const QString &undoName=QStringLiteral("Draw"))
 
void endMergeMode ()
 
void setInteractive (bool b)
 Begin or end an interactive edit. More...
 
bool isInteractive () const
 
const Core::Array< Vector3 > & forceVectors () const
 
bool setForceVector (Index atomId, const Vector3 &pos, const QString &undoText=QStringLiteral("Change Force Vectors"))
 
Index atomUniqueId (Index atomId) const
 
Index atomUniqueId (const AtomType &atom) const
 
bool removeAtom (Index atomId)
 
bool removeAtom (const AtomType &atom)
 
BondType addBond (Index atom1, Index atom2, unsigned char order=1)
 
BondType addBond (const AtomType &atom1, const AtomType &atom2, unsigned char order=1)
 
bool removeBond (Index bondId)
 
bool removeBond (const BondType &bond)
 
bool removeBond (Index atom1, Index atom2)
 
bool removeBond (const AtomType &atom1, const AtomType &atom2)
 
QUndoStack & undoStack ()
 
const QUndoStack & undoStack () const
 

Protected Member Functions

Index findAtomUniqueId (Index atomId) const
 
Index findBondUniqueId (Index bondId) const
 

Protected Attributes

Moleculem_molecule
 m_molecule still stored all data, this class acts upon it and builds an undo/redo stack that can be used to offer undo and redo.
 
bool m_interactive
 
QUndoStack m_undoStack
 

Detailed Description

This class implements the molecule API and composes a QUndoStack (undoStack()). New undo commands are automatically generated and push each time a non-const method is called.

An interactive mode is supported that causes "noisy" commands, such as atom position changes, to be merged into a single command, saving memory keeping the stack usable during interactive editing of the molecule. Use setInteractive(bool) to toggle interactive mode.

Similarly, multiple sequences of commands can be compressed into a single named action using the QUndoStack's macro capability. Call undoStack().beginMacro(tr("User Description Of Change")) to begin a macro, and undoStack().endMacro() when finished.

Member Typedef Documentation

◆ AtomType

typedef RWAtom AtomType

Typedef for Atom class.

◆ PersistentAtomType

Typedef for PersistentAtom class.

◆ BondType

typedef RWBond BondType

Typedef for Bond class.

◆ PersistentBondType

Typedef for PersistentBond class.

Constructor & Destructor Documentation

◆ RWMolecule()

RWMolecule ( Molecule mol,
QObject *  parent = nullptr 
)
explicit

Construct a molecule with the atoms/bonds of mol.

Member Function Documentation

◆ addAtom() [1/2]

AtomType addAtom ( unsigned char  atomicNumber,
bool  usingPositions = true 
)

Add a new atom to the molecule.

Parameters
atomicNumberThe atomic number of the new atom.
usingPositionsWhether or not to use positions for this atom. Default is true. Set to false if the atom will not be using coordinates.
Returns
The new Atom object.

◆ addAtom() [2/2]

AtomType addAtom ( unsigned char  atomicNumber,
const Vector3 &  position3d 
)

Add a new atom to the molecule and set its position.

Parameters
atomicNumberThe atomic number of the new atom.
position3dThe position of the atom.
Returns
The new Atom object.

◆ atom()

RWMolecule::AtomType atom ( Index  atomId) const

Obtain an atom object.

Parameters
atomIdThe index of the atom to return.
Returns
The requested atom object. Will be invalid if atomId >= atomCount().

◆ atomByUniqueId()

RWMolecule::AtomType atomByUniqueId ( Index  atomUId) const

Obtain an atom object from it's unique id.

Parameters
atomUIdThe unique of the requested atom.
Returns
The requested atom object. Will be invalid if atomUId is not in use.

◆ atomUniqueId() [1/2]

Index atomUniqueId ( Index  atomId) const
Returns
The unique id of the atom.

◆ atomUniqueId() [2/2]

Index atomUniqueId ( const AtomType atom) const
Returns
The unique id of the atom.

◆ atomCount() [1/2]

Index atomCount ( ) const
Returns
The number of atoms in the molecule.

◆ atomCount() [2/2]

Index atomCount ( unsigned char  atomicNumber) const
Returns
The number of atoms in the molecule with the atomic number atomicNumber.

◆ removeAtom() [1/2]

bool removeAtom ( Index  atomId)

Delete the specified atom from this molecule.

Returns
True on success, false otherwise.
Note
This also removes all bonds connected to the atom.

◆ removeAtom() [2/2]

bool removeAtom ( const AtomType atom)

Delete the specified atom from this molecule.

Returns
True on success, false otherwise.
Note
This also removes all bonds connected to the atom.

◆ clearAtoms()

void clearAtoms ( )

Delete all atoms from this molecule.

Note
This also removes all bonds.

◆ adjustHydrogens() [1/2]

void adjustHydrogens ( Index  atomId)

Adjust hydrogens for an atom.

Parameters
atomIdThe index of the atom.
Note
Checks to make sure the atom is valid before adjusting the hydrogens.

◆ adjustHydrogens() [2/2]

void adjustHydrogens ( const Core::Array< Index > &  atomIds)

Adjust hydrogens for multiple atoms.

Parameters
atomIdsThe indices for the atoms.
Note
Checks to make sure the atoms are valid before adjusting the hydrogens.

◆ atomicNumbers()

const Core::Array< unsigned char > & atomicNumbers ( ) const
Returns
An array containing atomic numbers for all atoms in the molecule, indexed by atom index.

◆ atomicNumber()

unsigned char atomicNumber ( Index  atomId) const

Get the atomic number for the requested atom.

Parameters
atomIdThe index of the atom.
Returns
The atomic number of the atom indexed at atomId, or Avogadro::InvalidElement if atomId is invalid.

◆ setAtomicNumbers()

bool setAtomicNumbers ( const Core::Array< unsigned char > &  nums)

Replace the current array of atomic numbers.

Parameters
numsThe new atomic number array. Must be of length atomCount().
Returns
True on success, false otherwise.

◆ setAtomicNumber()

bool setAtomicNumber ( Index  atomId,
unsigned char  atomicNumber 
)

Set the atomic number of a single atom.

Parameters
atomIdThe index of the atom to modify.
atomicNumberThe new atomic number.
Returns
True on success, false otherwise.

◆ atomPositions3d()

const Core::Array< Vector3 > & atomPositions3d ( ) const
Returns
An array containing 3D coordinates for all atoms in the molecule, indexed by atom index.
Note
May be empty if position information has not been set for any atoms.

◆ atomPosition3d()

Vector3 atomPosition3d ( Index  atomId) const

Get the 3D position of a single atom.

Parameters
atomIdThe index of the atom.
Returns
The position of the atom, or Vector3::Zero() if no position information has been set.

◆ setAtomPositions3d()

bool setAtomPositions3d ( const Core::Array< Vector3 > &  pos,
const QString &  undoText = QStringLiteral("Change Atom Positions") 
)

Replace the current array of 3D atomic coordinates.

Parameters
posThe new coordinate array. Must be of length atomCount().
undoTextThe undo text to be displayed for undo commands.
Returns
True on success, false otherwise.

◆ setAtomPosition3d()

bool setAtomPosition3d ( Index  atomId,
const Vector3 &  pos,
const QString &  undoText = QStringLiteral("Change Atom Position") 
)

Set the 3D position of a single atom.

Parameters
atomIdThe index of the atom to modify.
posThe new position of the atom.
undoTextThe undo text to be displayed for undo commands.
Returns
True on success, false otherwise.

◆ setAtomSelected()

void setAtomSelected ( Index  atomId,
bool  selected 
)

Set whether the specified atom is selected or not.

◆ atomSelected()

bool atomSelected ( Index  atomId) const

Query whether the supplied atom index has been selected.

◆ hybridization()

Core::AtomHybridization hybridization ( Index  atomId) const

Get the hybridization for the requested atom.

Parameters
atomIdThe index of the atom.
Returns
The hybridization of the atom indexed at atomId, or 0 if atomId is invalid.

◆ setHybridization()

bool setHybridization ( Index  atomId,
Core::AtomHybridization  hyb 
)

Set the hybridization of a single atom.

Parameters
atomIdThe index of the atom to modify.
hybThe new hybridization.
Returns
True on success, false otherwise.

◆ formalCharge()

signed char formalCharge ( Index  atomId) const

Get the formal charge for the requested atom.

Parameters
atomIdThe index of the atom.
Returns
The formal charge of the atom indexed at atomId, or 0 if atomId is invalid.

◆ setFormalCharge()

bool setFormalCharge ( Index  atomId,
signed char  charge 
)

Set the formal charge of a single atom.

Parameters
atomIdThe index of the atom to modify.
chargeThe new formal charge.
Returns
True on success, false otherwise.

◆ color()

Vector3ub color ( Index  atomId) const

Get the color for the requested atom.

Parameters
atomIdThe index of the atom.
Returns
The color of the atom indexed at atomId, or (0, 0, 0) if atomId is invalid. If no color is set for the given atomId, the default color for the atomic number of the atomId is returned.

◆ setColor()

bool setColor ( Index  atomId,
Vector3ub  color 
)

Set the color of a single atom.

Parameters
atomIdThe index of the atom to modify.
colorThe new color.
Returns
True on success, false otherwise.

◆ addBond() [1/2]

BondType addBond ( Index  atom1,
Index  atom2,
unsigned char  order = 1 
)

Create a new bond in the molecule.

Parameters
atom1The first atom in the bond.
atom2The second order in the bond.
orderThe bond order.
Returns
The new bond object. Will be invalid if atom1 or atom2 does not exist.

◆ addBond() [2/2]

RWMolecule::BondType addBond ( const AtomType atom1,
const AtomType atom2,
unsigned char  order = 1 
)

Create a new bond in the molecule.

Parameters
atom1The first atom in the bond.
atom2The second order in the bond.
orderThe bond order.
Returns
The new bond object. Will be invalid if atom1 or atom2 does not exist.

◆ bond() [1/3]

RWMolecule::BondType bond ( Index  bondId) const

Get a bond object.

Parameters
bondIdThe index of the requested bond.
Returns
The requested bond object. Will be invalid if bondId >= bondCount().

◆ bond() [2/3]

BondType bond ( Index  atom1,
Index  atom2 
) const

Get a bond object.

Parameters
atom1The index of one atom in the bond.
atom2The index of the other atom in bond.
Returns
The requested bond object. Will be invalid if atom1 or atom2 do not exist.

◆ bond() [3/3]

RWMolecule::BondType bond ( const AtomType atom1,
const AtomType atom2 
) const

Get a bond object.

Parameters
atom1One atom in the bond.
atom2The other atom in bond.
Returns
The requested bond object. Will be invalid if atom1 or atom2 are invalid.

◆ bondByUniqueId()

RWMolecule::BondType bondByUniqueId ( Index  bondUid) const

Get a bond object from its unique id.

Parameters
bondUidThe unique id of the bond.
Returns
The requested bond object. Will be invalid if bondUid is not in use.

◆ bondUniqueId() [1/2]

Index bondUniqueId ( Index  bondId) const

Get the unique id of a bond.

Parameters
bondIdThe index of the requested bond.
Returns
The unique id currently assigned to the bond at index bondId

◆ bondUniqueId() [2/2]

Index bondUniqueId ( const BondType bond) const

Get the unique id of a bond.

Parameters
bondThe requested bond object.
Returns
The unique id currently assigned to bond.

◆ bondCount()

Index bondCount ( ) const
Returns
The number of bonds in the molecule.

◆ removeBond() [1/4]

bool removeBond ( Index  bondId)

Remove the requested bond.

Returns
True on success, false otherwise.

◆ removeBond() [2/4]

bool removeBond ( const BondType bond)

Remove the requested bond.

Returns
True on success, false otherwise.

◆ removeBond() [3/4]

bool removeBond ( Index  atom1,
Index  atom2 
)

Remove the requested bond.

Returns
True on success, false otherwise.

◆ removeBond() [4/4]

bool removeBond ( const AtomType atom1,
const AtomType atom2 
)

Remove the requested bond.

Returns
True on success, false otherwise.

◆ clearBonds()

void clearBonds ( )

Remove all bonds from the molecule.

◆ bonds() [1/2]

Core::Array< RWMolecule::BondType > bonds ( const AtomType atom) const

Find bonds connected to an atom.

Parameters
atomThe atom of interest.
Returns
An array of bond objects that are attached to the specified atom.

◆ bonds() [2/2]

Core::Array< RWMolecule::BondType > bonds ( const Index atomId) const

Find bonds connected to an atom.

Parameters
atomIdThe index for the atom of interest.
Returns
An array of bond objects that are attached to the specified atom.

◆ bondOrders()

const Core::Array< unsigned char > & bondOrders ( ) const
Returns
An array of bond orders for all bonds in the molecule, indexed by bond index.

◆ bondOrder()

unsigned char bondOrder ( Index  bondId) const

Get the order of a bond.

Parameters
bondIdThe id of the bond.
Returns
The bond order.

◆ setBondOrders()

bool setBondOrders ( const Core::Array< unsigned char > &  orders)

Replace the current array of bond orders.

Parameters
ordersThe new array.
Returns
True on success, false on failure.

◆ setBondOrder()

bool setBondOrder ( Index  bondId,
unsigned char  order 
)

Set the order of a bond in the molecule.

Parameters
bondIdThe bond's index.
orderThe new order of the bond.
Returns
True on success, false on failure.

◆ bondPairs()

const Core::Array< std::pair< Index, Index > > & bondPairs ( ) const
Returns
An array of all bonded atoms in the molecule, indexed by bond index. Each bond pair is represented by a pair of atom indices.

◆ bondPair()

std::pair< Index, Index > bondPair ( Index  bondId) const

Get the set of bonded atoms corresponding to bondId.

Parameters
bondIdThe index of the requested bond.
Returns
The bonded atom pair, represented as a pair of atom indices.

◆ setBondPairs()

bool setBondPairs ( const Core::Array< std::pair< Index, Index >> &  pairs)

Replace the current array of bonded atoms.

Parameters
pairsThe array.
Returns
True on success, false on failure.
Note
The bonded atoms are represented as a pair of bond indices.
If needed, the elements in pairs will be modified to ensure that the first atom index is less than the second.

◆ setBondPair()

bool setBondPair ( Index  bondId,
const std::pair< Index, Index > &  pair 
)

Set the bonded atoms for a bond.

Parameters
bondIdThe bond to modify.
pairThe new bond pair.
Returns
True on success, false otherwise.
Note
If needed, pair will be modified to ensure that the first atom index is less than the second.

◆ addUnitCell()

void addUnitCell ( )

Add a default unit cell to the molecule. Does nothing if there already is a unit cell. Changes are emitted.

◆ removeUnitCell()

void removeUnitCell ( )

Remove the unit cell from the molecule. Does nothing if there is no unit cell. Changes are emitted.

◆ modifyMolecule()

void modifyMolecule ( const Molecule newMolecule,
Molecule::MoleculeChanges  changes,
const QString &  undoText = QStringLiteral("Modify Molecule") 
)

Generic edit that changes the current molecule to be newMolecule. Also sets the text for the undo command to be undoText. Changes are emitted.

Parameters
newMoleculeThe new molecule to be set.
changesThe changes to be emitted.
undoTextThe text description for the undo command.

◆ appendMolecule()

void appendMolecule ( const Molecule addMolecule,
const QString &  undoText = QStringLiteral("Append Molecule") 
)

Generic edit that adds newMolecule to the current molecule. Also sets the text for the undo command to be undoText. Changes are emitted.

Parameters
addMoleculeThe new molecule to be set.
undoTextThe text description for the undo command.

◆ editUnitCell()

void editUnitCell ( Matrix3  cellMatrix,
Core::CrystalTools::Options  opts 
)

Edit the unit cell by replacing the current cell matrix with a new cell matrix. Changes are emitted.

Parameters
cellMatrixThe new cell matrix to be set.
optsIf TransformAtoms is specified, the atoms in molecule are adjusted so that their fractional (lattice) coordinates are preserved. This option is ignored if the input molecule has no unit cell.

◆ wrapAtomsToCell()

void wrapAtomsToCell ( )

Wrap atoms to the unit cell. Changes are emitted.

◆ rotateCellToStandardOrientation()

void rotateCellToStandardOrientation ( )

Rotate cell to standard orientation. Changes are emitted.

◆ setCellVolume()

void setCellVolume ( double  newVolume,
Core::CrystalTools::Options  options 
)

Scale a cell's volume. Changes are emitted.

Parameters
newVolumeThe new volume to be set.
optionsIf CrystalTools::TransformAtoms is set, then the atoms will be transformed during the scaling.

◆ buildSupercell()

void buildSupercell ( unsigned int  a,
unsigned int  b,
unsigned int  c 
)

Build a supercell. Changes are emitted.

Parameters
aThe final number of units along the A vector (at least 1).
bThe final number of units along the B vector (at least 1).
cThe final number of units along the C vector (at least 1).

◆ niggliReduceCell()

void niggliReduceCell ( )

Perform a Niggli reduction on the cell. Changes are emitted.

◆ reduceCellToPrimitive()

bool reduceCellToPrimitive ( double  cartTol = 1e-5)

Use spglib to reduce the cell to its primitive form. Changes are emitted.

Parameters
cartTolCartesian tolerance for primitive reduction.
Returns
True if the algorithm succeeded, and false if it failed.

◆ conventionalizeCell()

bool conventionalizeCell ( double  cartTol = 1e-5)

Use spglib to convert the cell to its conventional form. Changes are emitted.

Parameters
cartTolCartesian tolerance for conventionalization.
Returns
True if the algorithm succeeded, and false if it failed.

◆ symmetrizeCell()

bool symmetrizeCell ( double  cartTol = 1e-5)

Use spglib to symmetrize the cell. Changes are emitted.

Parameters
cartTolCartesian tolerance for symmetrization.
Returns
True if the algorithm succeeded, and false if it failed.

◆ fillUnitCell()

bool fillUnitCell ( unsigned short  hallNumber,
double  cartTol = 1e-5 
)

Fill unit cell using transforms for the space group. Changes are emitted.

Parameters
hallNumberThe hall number to be used for transforming the cell.
cartTolCartesian tolerance for comparing atom positions.
Returns
True if the algorithm succeeded, and false if it failed.

◆ reduceCellToAsymmetricUnit()

bool reduceCellToAsymmetricUnit ( unsigned short  hallNumber,
double  cartTol = 1e-5 
)

Use transforms to reduce a cell to its asymmetric unit. Changes are emitted.

Parameters
hallNumberThe hall number to be used for obtaining the transforms.
cartTolCartesian tolerance for comparing atom positions.
Returns
True if the algorithm succeeded, and false if it failed.

◆ beginMergeMode()

void beginMergeMode ( const QString &  undoName = QStringLiteral("Draw"))

Call this function when you wish to merge all undo commands. It turns on interactive mode to merge similar undo commands in a series (in order to save space), and it uses QUndoStack's beginMacro() to merge dissimilar undo commands together. You must call endMergeMode() to end the merging section (undo and redo are unavailable while merge mode is on).

Parameters
undoNameThe name of the undo command

◆ endMergeMode()

void endMergeMode ( )

Call this function when you wish merge mode to end. This will turn off interactive mode, and it will call QUndoStack's endMacro(). All of the undo commands pushed between beginMergeMode() and endMergeMode() will be merged into one undo command. beginMergeMode() should have been called before this is called.

◆ setInteractive()

void setInteractive ( bool  b)

If enabled, certain undo operations will be merged together. For instance, an editor dragging an atom through space in response to mouse movement will only generate a single undo command containing the initial and final positions and discard the intermediate states. If disabled, each intermediate action will appear in the undo log.

◆ isInteractive()

bool isInteractive ( ) const
Returns
True if interactive mode is enabled, false otherwise.
See also
setInteractive

◆ undoStack() [1/2]

QUndoStack & undoStack ( )
Returns
The QUndoStack for this molecule.

◆ undoStack() [2/2]

const QUndoStack & undoStack ( ) const
Returns
The QUndoStack for this molecule.

◆ forceVectors()

const Core::Array< Vector3 > & forceVectors ( ) const

Returns a vector of forces for the atoms in the molecule.

◆ setForceVector()

bool setForceVector ( Index  atomId,
const Vector3 &  pos,
const QString &  undoText = QStringLiteral("Change Force Vectors") 
)

Replace the current array of force vectors.

Parameters
posThe new force vector array. Must be of length atomCount().
undoTextThe undo text to be displayed for undo commands.
Returns
True on success, false otherwise.

◆ emitChanged

void emitChanged ( unsigned int  change)
slot
Parameters
changeSee changed().

◆ changed

void changed ( unsigned int  change)
signal
Parameters
changeUse the MoleculeChange enum to check what has changed.

The change variable indicates what has changed, i.e. if change & Atoms == true then atoms were changed in some way, and if change & Removed == true then one or more atoms were removed.


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