AtomSet Class Reference

#include <atomset.h>

List of all members.


Detailed Description

Stores the atoms of a molecular system.

Each atom has an index which starts at 0. This class can accomodate as many atoms as RAM can hold.

Atomic properties that can be/are stored:

Diatomic properties that can be/are stored: Atoms with atomic number between 1 and maxElements (54) can be stored. Other atomic numbers are assigned a zero for the unknown atom type "?"

Definition at line 42 of file atomset.h.

Public Types

enum  ChargeType { None, Mulliken, Stockholder }

Public Member Functions

 AtomSet ()
 ~AtomSet ()
 The default destructor.
void clear ()
 Removes all atoms.
void reserve (const unsigned int size)
 Resizes all the vectors to accomodate the requested number of atoms.
void addAtom (const Point3D< double > &location, const unsigned int atomicNumber, const QColor color, const int index=-1)
 Adds an atom of type atomicNumber with coordinates location and color color at position index.
void addAtom (const Point3D< double > &location, const unsigned int atomicNumber, const int index=-1)
 Adds an atom.
void addAtom (const double x, const double y, const double z, const unsigned int atomicNumber, const QColor color, const int index=-1)
 Adds an atom with cartesian coordinates and a special color.
void addAtom (const double x, const double y, const double z, const unsigned int atomicNumber, const int index=-1)
 Adds an atom with cartesian coordinates.
void removeAtom (const unsigned int index)
 Removes the atom at position index.
void setX (const unsigned int index, const double x)
 Sets the x-coordinate of the atom at position index.
void setY (const unsigned int index, const double y)
 Sets the y-coordinate of the atom at position index.
void setZ (const unsigned int index, const double z)
 Sets the z-coordinate of the atom at position index.
void setColor (const unsigned int index, const QColor color)
 Sets the color of the atom at position index.
void setCharges (const vector< double > &charges, const ChargeType type, const QString scf=QString::null, const QString density=QString::null)
 Sets the charges on all atoms.
void clearCharges (const ChargeType type)
 Clears the charges of a specific type.
void setForces (const unsigned int index, const double dx, const double dy, const double dz)
 Sets the forces on the atom at position index.
void changeBond (const double amount, const unsigned int movingAtom, const unsigned int secondAtom, const bool includeNeighbours=false)
 Changes the bond length between two atoms.
void changeAngle (const double amount, const unsigned int movingAtom, const unsigned int centralAtom, const unsigned int lastAtom, const bool includeNeighbours=false)
 Changes the angle between two bonds.
void changeTorsion (const double amount, const unsigned int movingAtom, const unsigned int secondAtom, const unsigned int thirdAtom, const unsigned int fourthAtom, const bool includeNeighbours=false)
 Changes the torsion angle between two bonds.
void transferCoordinates (const AtomSet *source)
 Copies the coordinates from another AtomSet and resets the properties by default.
unsigned int count () const
 Returns the number of atoms.
Point3D< double > coordinates (const unsigned int index) const
 Returns the coordinates of the atom at position index.
double x (const unsigned int index) const
 Returns the x-coordinate of the atom at position index.
double y (const unsigned int index) const
 Returns the y-coordinate of the atom at position index.
double z (const unsigned int index) const
 Returns the z-coordinate of the atom at position index.
unsigned int atomicNumber (const unsigned int index) const
 Returns the atomic number of the atom at position index.
QColor color (const unsigned int index) const
 Returns the color of the atom at position index.
vector< unsigned int > usedAtomicNumbers () const
 Returns a vector containing a sorted list of the atomic numbers present in the set.
void bonds (vector< unsigned int > *&first, vector< unsigned int > *&second)
 Returns a list of the bonds between the atoms.
unsigned int numberOfBonds (const unsigned int index) const
 Returns the number of bonds an atom has.
bool isLinear () const
 Returns true if the atoms form a linear molecule.
bool isChanged () const
 Returns true if the AtomSet has changed.
double dx (const unsigned int index) const
 Returns the x-component of the force on the atom at position index.
double dy (const unsigned int index) const
 Returns the y-component of the force on the atom at position index.
double dz (const unsigned int index) const
 Returns the z-component of the force on the atom at position index.
double bond (const unsigned int atom1, const unsigned int atom2) const
 Returns the distance between the two atoms.
double angle (const unsigned int atom1, const unsigned int atom2, const unsigned int atom3) const
 Returns the value of the valence angle 1-2-3.
double torsion (const unsigned int atom1, const unsigned int atom2, const unsigned int atom3, const unsigned int atom4) const
 Returns the value of the torsion angle 1-2-3-4.
double charge (const ChargeType type, const unsigned int index) const
 Returns the charge on the atom at position index for a specific charge type.
bool hasCharges (const ChargeType type) const
 Returns whether charges of the specified type are present.
QString chargesSCF (const ChargeType type) const
 Returns the SCF method used to determine the charges.
QString chargesDensity (const ChargeType type) const
 Returns the density used to determine the charges.
bool hasForces () const
 Returns whether forces are present.
Point3D< float > rotationCenter () const
 Returns the optimal center of rotation for the molecule.
bool needsExtendedFormat ()
 Returns true if the coordinates need to be written in BRABO's extended format in order to prevent clipping.
void loadCML (const QDomElement *root)
 Reads all atom data from a QDomElement.
void saveCML (QDomElement *root)
 Saves all atom data to a QDomElement.

Static Public Member Functions

static unsigned int atomToNum (const QString &atom)
 Returns the atomic number corresponding to the element atom.
static QString numToAtom (const unsigned int atom)
 Returns the element corresponding to the atomic number atom.
static float vanderWaals (const unsigned int atom)
 Returns the Van der Waals radius for the atomic number atom.
static QColor stdColor (const unsigned int atom)
 Returns the standard color for the atomic number atom.

Static Public Attributes

static const unsigned int maxElements = 54

Private Member Functions

void setChanged (const bool state=true)
 Sets the 'changed' property of the AtomSet.
void setGeometryChanged ()
 Indicates the geometry has changed.
bool addBondList (const unsigned int callingAtom, const unsigned int startAtom, const unsigned int endAtom1, const unsigned int endAtom2, std::vector< unsigned int > *result)
 Returns all direct and indirectly bonded atoms to startAtom in result.
void clearProperties ()
 Deletes all properties. This includes the forces and charges.
void updateBoxDimensions ()
 Calculates the dimensions of the smallest box (in the XYZ coordinate system) including all atoms.
void addBonds (const vector< unsigned int > *atomList1, const vector< unsigned int > *atomList2)
 Calculates all bonds between the atoms in the 2 provided lists and adds them to the bonds1 and bonds2 vectors.

Private Attributes

unsigned int numAtoms
 the number of atoms
bool changed
 = true if anything changed
vector< Point3D< double > > coords
 cartesian coordinates of the atoms with the atomic numbers as the ID's
vector< QColor > colors
 colors of the atoms
vector< Point3D< double > > * forces
 forces on the atoms
vector< unsigned int > bonds1
 the first part of the bonds array
vector< unsigned int > bonds2
 the second part of the bonds array
vector< double > * chargesMulliken
 Contains the Mulliken charges if present.
vector< double > * chargesStockholder
 Contains the stockholder charges if present.
QString chargesMullikenSCF
 The type of SCF method used for calculating the Mulliken charges (e.g. RHF/6-31G).
QString chargesMullikenDensity
 The density used to calculate the Mulliken charges.
QString chargesStockholderSCF
 The type of SCF method used for calculating the stockholder charges (e.g. RHF/6-31G).
QString chargesStockholderDensity
 The density used to calculate the stockholder charges.
Point3D< double > * boxMax
 The first point of the smallest box surrounding the atoms (have to use pointers because point3d.h cannot be included).
Point3D< double > * boxMin
 The second point of the smallest box surrounding the atoms.
bool dirtyBox
 If true the box needs to be recalculated.


Member Enumeration Documentation

enum AtomSet::ChargeType
 

Enumerator:
None 
Mulliken 
Stockholder 

Definition at line 49 of file atomset.h.


Constructor & Destructor Documentation

AtomSet::AtomSet  ) 
 

Definition at line 70 of file atomset.cpp.

AtomSet::~AtomSet  ) 
 

The default destructor.

Definition at line 84 of file atomset.cpp.


Member Function Documentation

void AtomSet::clear  ) 
 

Removes all atoms.

Definition at line 93 of file atomset.cpp.

void AtomSet::reserve const unsigned int  size  ) 
 

Resizes all the vectors to accomodate the requested number of atoms.

Definition at line 106 of file atomset.cpp.

void AtomSet::addAtom const Point3D< double > &  location,
const unsigned int  atomicNumber,
const QColor  color,
const int  index = -1
 

Adds an atom of type atomicNumber with coordinates location and color color at position index.

If index is negative (the default) the atom is added at the end.

Warning:
Implies resetting all properties (forces, charges, etc.)

Definition at line 123 of file atomset.cpp.

void AtomSet::addAtom const Point3D< double > &  location,
const unsigned int  atomicNumber,
const int  index = -1
 

Adds an atom.

Definition at line 170 of file atomset.cpp.

void AtomSet::addAtom const double  x,
const double  y,
const double  z,
const unsigned int  atomicNumber,
const QColor  color,
const int  index = -1
 

Adds an atom with cartesian coordinates and a special color.

Definition at line 177 of file atomset.cpp.

void AtomSet::addAtom const double  x,
const double  y,
const double  z,
const unsigned int  atomicNumber,
const int  index = -1
 

Adds an atom with cartesian coordinates.

Definition at line 184 of file atomset.cpp.

void AtomSet::removeAtom const unsigned int  index  ) 
 

Removes the atom at position index.

Warning:
Implies resetting all properties (forces, charges, etc.)

Definition at line 191 of file atomset.cpp.

void AtomSet::setX const unsigned int  index,
const double  x
 

Sets the x-coordinate of the atom at position index.

Warning:
Implies resetting all properties (forces, charges, etc.)

Definition at line 217 of file atomset.cpp.

void AtomSet::setY const unsigned int  index,
const double  y
 

Sets the y-coordinate of the atom at position index.

Warning:
Implies resetting all properties (forces, charges, etc.)

Definition at line 229 of file atomset.cpp.

void AtomSet::setZ const unsigned int  index,
const double  z
 

Sets the z-coordinate of the atom at position index.

Warning:
Implies resetting all properties (forces, charges, etc.)

Definition at line 241 of file atomset.cpp.

void AtomSet::setColor const unsigned int  index,
const QColor  color
 

Sets the color of the atom at position index.

Definition at line 253 of file atomset.cpp.

void AtomSet::setCharges const vector< double > &  charges,
const ChargeType  type,
const QString  scf = QString::null,
const QString  density = QString::null
 

Sets the charges on all atoms.

Parameters:
[in] charges,: the vector containing all charges. It's size has to be equal to count() or no charges will be assigned.
[in] type,: The type of charges to be added/updated.
[in] scf,: The method with which the charges were calculated.
[in] density,: The density from which the charges were calculated.

Definition at line 264 of file atomset.cpp.

void AtomSet::clearCharges const ChargeType  type  ) 
 

Clears the charges of a specific type.

Definition at line 303 of file atomset.cpp.

void AtomSet::setForces const unsigned int  index,
const double  dx,
const double  dy,
const double  dz
 

Sets the forces on the atom at position index.

Definition at line 326 of file atomset.cpp.

void AtomSet::changeBond const double  amount,
const unsigned int  movingAtom,
const unsigned int  secondAtom,
const bool  includeNeighbours = false
 

Changes the bond length between two atoms.

This is done by moving movingAtom with respect to secondAtom. If includeNeighbours = true the atoms bonded to movingAtom will be moved by the same amount.

Warning:
Implies resetting all properties (forces, charges, etc.)

Definition at line 339 of file atomset.cpp.

void AtomSet::changeAngle const double  amount,
const unsigned int  movingAtom,
const unsigned int  centralAtom,
const unsigned int  lastAtom,
const bool  includeNeighbours = false
 

Changes the angle between two bonds.

This is done between the bonds movingAtom-centralAtom and centralAtom-lastAtom by rotating movingAtom with respect to the other atoms. If includeNeighbours = true the atoms bonded to movingAtom will be rotated by the same amount.

Warning:
Implies resetting all properties (forces, charges, etc.)

Definition at line 386 of file atomset.cpp.

void AtomSet::changeTorsion const double  amount,
const unsigned int  movingAtom,
const unsigned int  secondAtom,
const unsigned int  thirdAtom,
const unsigned int  fourthAtom,
const bool  includeNeighbours = false
 

Changes the torsion angle between two bonds.

This is done between the bonds movingAtom-secondAtom and thirdAtom-fourthAtom by rotating movingAtom with respect to the central bond secondAtom-thirdAtom. If includeNeighbours = true the atoms bonded to movingAtom will be rotated by the same amount.

Warning:
Implies resetting all properties (forces, charges, etc.)

Definition at line 435 of file atomset.cpp.

void AtomSet::transferCoordinates const AtomSet source  ) 
 

Copies the coordinates from another AtomSet and resets the properties by default.

It resembles a limited copy constructor and only works when both sets contain the same amount of atoms. Atom types are not checked.

Warning:
Implies resetting all properties (forces, charges, etc.)

Definition at line 493 of file atomset.cpp.

unsigned int AtomSet::count  )  const
 

Returns the number of atoms.

Definition at line 510 of file atomset.cpp.

Point3D< double > AtomSet::coordinates const unsigned int  index  )  const
 

Returns the coordinates of the atom at position index.

Definition at line 517 of file atomset.cpp.

double AtomSet::x const unsigned int  index  )  const
 

Returns the x-coordinate of the atom at position index.

Definition at line 527 of file atomset.cpp.

double AtomSet::y const unsigned int  index  )  const
 

Returns the y-coordinate of the atom at position index.

Definition at line 537 of file atomset.cpp.

double AtomSet::z const unsigned int  index  )  const
 

Returns the z-coordinate of the atom at position index.

Definition at line 547 of file atomset.cpp.

unsigned int AtomSet::atomicNumber const unsigned int  index  )  const
 

Returns the atomic number of the atom at position index.

Definition at line 557 of file atomset.cpp.

QColor AtomSet::color const unsigned int  index  )  const
 

Returns the color of the atom at position index.

Definition at line 567 of file atomset.cpp.

vector< unsigned int > AtomSet::usedAtomicNumbers  )  const
 

Returns a vector containing a sorted list of the atomic numbers present in the set.

Only the known atoms are returned.

Definition at line 577 of file atomset.cpp.

void AtomSet::bonds vector< unsigned int > *&  first,
vector< unsigned int > *&  second
 

Returns a list of the bonds between the atoms.

Unknown atoms can never have bonds. This routine puts atoms in boxes of 4x4x4 Angstrom and only looks for bonds between neighbouring boxes.

Definition at line 600 of file atomset.cpp.

unsigned int AtomSet::numberOfBonds const unsigned int  index  )  const
 

Returns the number of bonds an atom has.

Definition at line 757 of file atomset.cpp.

bool AtomSet::isLinear  )  const
 

Returns true if the atoms form a linear molecule.

Definition at line 786 of file atomset.cpp.

bool AtomSet::isChanged  )  const
 

Returns true if the AtomSet has changed.

Definition at line 817 of file atomset.cpp.

double AtomSet::dx const unsigned int  index  )  const
 

Returns the x-component of the force on the atom at position index.

Definition at line 824 of file atomset.cpp.

double AtomSet::dy const unsigned int  index  )  const
 

Returns the y-component of the force on the atom at position index.

Definition at line 835 of file atomset.cpp.

double AtomSet::dz const unsigned int  index  )  const
 

Returns the z-component of the force on the atom at position index.

Definition at line 846 of file atomset.cpp.

double AtomSet::bond const unsigned int  atom1,
const unsigned int  atom2
const
 

Returns the distance between the two atoms.

Definition at line 857 of file atomset.cpp.

double AtomSet::angle const unsigned int  atom1,
const unsigned int  atom2,
const unsigned int  atom3
const
 

Returns the value of the valence angle 1-2-3.

Definition at line 865 of file atomset.cpp.

double AtomSet::torsion const unsigned int  atom1,
const unsigned int  atom2,
const unsigned int  atom3,
const unsigned int  atom4
const
 

Returns the value of the torsion angle 1-2-3-4.

Definition at line 874 of file atomset.cpp.

double AtomSet::charge const ChargeType  type,
const unsigned int  index
const
 

Returns the charge on the atom at position index for a specific charge type.

Definition at line 884 of file atomset.cpp.

bool AtomSet::hasCharges const ChargeType  type  )  const
 

Returns whether charges of the specified type are present.

Definition at line 907 of file atomset.cpp.

QString AtomSet::chargesSCF const ChargeType  type  )  const
 

Returns the SCF method used to determine the charges.

If no charges of the specified type are available an empty string is returned.

Definition at line 918 of file atomset.cpp.

QString AtomSet::chargesDensity const ChargeType  type  )  const
 

Returns the density used to determine the charges.

If no charges of the specified type are available an empty string is returned.

Definition at line 931 of file atomset.cpp.

bool AtomSet::hasForces  )  const
 

Returns whether forces are present.

Definition at line 944 of file atomset.cpp.

Point3D< float > AtomSet::rotationCenter  )  const
 

Returns the optimal center of rotation for the molecule.

Definition at line 951 of file atomset.cpp.

bool AtomSet::needsExtendedFormat  ) 
 

Returns true if the coordinates need to be written in BRABO's extended format in order to prevent clipping.

This is needed as soon as one coordinate value is at least 100.0 or a negative value at least -10.0.

Definition at line 960 of file atomset.cpp.

void AtomSet::loadCML const QDomElement *  root  ) 
 

Reads all atom data from a QDomElement.

Definition at line 971 of file atomset.cpp.

void AtomSet::saveCML QDomElement *  root  ) 
 

Saves all atom data to a QDomElement.

The QDomElement passed as root should be the </molecule> tag.

Definition at line 1058 of file atomset.cpp.

unsigned int AtomSet::atomToNum const QString &  atom  )  [static]
 

Returns the atomic number corresponding to the element atom.

Definition at line 1126 of file atomset.cpp.

QString AtomSet::numToAtom const unsigned int  atom  )  [static]
 

Returns the element corresponding to the atomic number atom.

Definition at line 1191 of file atomset.cpp.

float AtomSet::vanderWaals const unsigned int  atom  )  [static]
 

Returns the Van der Waals radius for the atomic number atom.

Definition at line 1258 of file atomset.cpp.

QColor AtomSet::stdColor const unsigned int  atom  )  [static]
 

Returns the standard color for the atomic number atom.

Definition at line 1326 of file atomset.cpp.

void AtomSet::setChanged const bool  state = true  )  [private]
 

Sets the 'changed' property of the AtomSet.

Definition at line 1399 of file atomset.cpp.

void AtomSet::setGeometryChanged  )  [private]
 

Indicates the geometry has changed.

Definition at line 1406 of file atomset.cpp.

bool AtomSet::addBondList const unsigned int  callingAtom,
const unsigned int  startAtom,
const unsigned int  endAtom1,
const unsigned int  endAtom2,
std::vector< unsigned int > *  result
[private]
 

Returns all direct and indirectly bonded atoms to startAtom in result.

If any atom of this list (except startAtom) is bonded to endAtom, false is returned (indicates the presence of a ring-structure including the startAtom-endAtom bond. If true is returned the resulting list of bonded atoms is complete -> recursive !

Definition at line 1420 of file atomset.cpp.

void AtomSet::clearProperties  )  [private]
 

Deletes all properties. This includes the forces and charges.

Definition at line 1500 of file atomset.cpp.

void AtomSet::updateBoxDimensions  )  [private]
 

Calculates the dimensions of the smallest box (in the XYZ coordinate system) including all atoms.

Definition at line 1525 of file atomset.cpp.

void AtomSet::addBonds const vector< unsigned int > *  atomList1,
const vector< unsigned int > *  atomList2
[private]
 

Calculates all bonds between the atoms in the 2 provided lists and adds them to the bonds1 and bonds2 vectors.

Definition at line 1567 of file atomset.cpp.


Member Data Documentation

const unsigned int AtomSet::maxElements = 54 [static]
 

Definition at line 105 of file atomset.h.

unsigned int AtomSet::numAtoms [private]
 

the number of atoms

Definition at line 121 of file atomset.h.

bool AtomSet::changed [private]
 

= true if anything changed

Definition at line 122 of file atomset.h.

vector<Point3D<double> > AtomSet::coords [private]
 

cartesian coordinates of the atoms with the atomic numbers as the ID's

Definition at line 124 of file atomset.h.

vector<QColor> AtomSet::colors [private]
 

colors of the atoms

Definition at line 125 of file atomset.h.

vector<Point3D<double> >* AtomSet::forces [private]
 

forces on the atoms

Definition at line 126 of file atomset.h.

vector<unsigned int> AtomSet::bonds1 [private]
 

the first part of the bonds array

Definition at line 127 of file atomset.h.

vector<unsigned int> AtomSet::bonds2 [private]
 

the second part of the bonds array

Definition at line 128 of file atomset.h.

vector<double>* AtomSet::chargesMulliken [private]
 

Contains the Mulliken charges if present.

Definition at line 129 of file atomset.h.

vector<double>* AtomSet::chargesStockholder [private]
 

Contains the stockholder charges if present.

Definition at line 130 of file atomset.h.

QString AtomSet::chargesMullikenSCF [private]
 

The type of SCF method used for calculating the Mulliken charges (e.g. RHF/6-31G).

Definition at line 131 of file atomset.h.

QString AtomSet::chargesMullikenDensity [private]
 

The density used to calculate the Mulliken charges.

Definition at line 132 of file atomset.h.

QString AtomSet::chargesStockholderSCF [private]
 

The type of SCF method used for calculating the stockholder charges (e.g. RHF/6-31G).

Definition at line 133 of file atomset.h.

QString AtomSet::chargesStockholderDensity [private]
 

The density used to calculate the stockholder charges.

Definition at line 134 of file atomset.h.

Point3D<double>* AtomSet::boxMax [private]
 

The first point of the smallest box surrounding the atoms (have to use pointers because point3d.h cannot be included).

Definition at line 135 of file atomset.h.

Point3D<double>* AtomSet::boxMin [private]
 

The second point of the smallest box surrounding the atoms.

Definition at line 136 of file atomset.h.

bool AtomSet::dirtyBox [private]
 

If true the box needs to be recalculated.

Definition at line 137 of file atomset.h.


Generated on Fri May 19 14:31:57 2006 for Brabosphere by  doxygen 1.4.6-NO