Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Cluster Class Reference

Collaboration diagram for Cluster:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class represents a cluster of atoms.

Author:
John Schneiderman

Definition at line 37 of file cluster.h.

Public Member Functions

void addAtom (const Atom &atom)
void calculateCentreMass ()
void calculateKineticEnergy ()
void calculatePotentialEnergy ()
void clear ()
 Cluster (const Cluster &cluster)
 Cluster ()
double kineticEnergyTotal () const
Clusteroperator= (const Cluster &rhs)
const Atomoperator[] (int index) const
Atomoperator[] (int index)
Coordinate positionCentreMass () const
double potentialEnergyTotal () const
void read (string baseName)
void setKineticEnergyTotal (double kineticEnergyTotal)
void setPositionCentreMass (Coordinate positionCentreMass)
void setPotentialEnergyTotal (double potentialEnergyTotal)
void setVelocityCentreMass (Coordinate velocityCentreMass)
int size () const
Coordinate velocityCentreMass () const
void write (string baseName)

Static Public Attributes

static const int PRECISION = 10
static const int WIDTH = 18

Private Attributes

vector< Atomm_atoms
double m_kineticEnergyTotal
Coordinate m_positionCentreMass
double m_potentialEnergyTotal
Coordinate m_velocityCentreMass

Friends

ostream & operator<< (ostream &outStream, const Cluster &cluster)
bool operator== (const Cluster &lhs, const Cluster &rhs)


Constructor & Destructor Documentation

Cluster::Cluster  ) 
 

A default constructor.

Definition at line 30 of file cluster.cpp.

References m_kineticEnergyTotal, and m_potentialEnergyTotal.

Cluster::Cluster const Cluster cluster  ) 
 

Copy constructor.

Parameters:
cluster is the cluster to copy into *this.

Definition at line 35 of file cluster.cpp.


Member Function Documentation

void Cluster::addAtom const Atom atom  ) 
 

Adds an atom into the cluster.

Parameters:
atom this is the atom to add to the cluster.

Definition at line 233 of file cluster.cpp.

References m_atoms.

Referenced by FCC_Lattice::createLattice().

void Cluster::calculateCentreMass  ) 
 

The cluster's positional and velocity centre of mass are calculated.

Definition at line 129 of file cluster.cpp.

References m_atoms, m_positionCentreMass, m_velocityCentreMass, and size().

Referenced by FCC_Lattice::createLattice(), MDLJ_Simulation::run(), and MCLJ_Simulation::run().

Here is the call graph for this function:

void Cluster::calculateKineticEnergy  ) 
 

Calculates the kinetic energy of the cluster and for each atom.

Definition at line 116 of file cluster.cpp.

References m_atoms, and m_kineticEnergyTotal.

Referenced by MDLJ_Simulation::run().

void Cluster::calculatePotentialEnergy  ) 
 

Calculates the potential energy of the cluster and for each atom.

Definition at line 80 of file cluster.cpp.

References m_atoms, m_potentialEnergyTotal, Coordinate::x, Coordinate::y, and Coordinate::z.

Referenced by MDLJ_Simulation::run(), and MCLJ_Simulation::run().

void Cluster::clear  ) 
 

Clears the cluster.

Definition at line 197 of file cluster.cpp.

References m_atoms, m_kineticEnergyTotal, m_positionCentreMass, m_potentialEnergyTotal, and m_velocityCentreMass.

Referenced by FCC_Lattice::createLattice(), interactiveRun(), nonInteractiveRun(), and operator=().

double Cluster::kineticEnergyTotal  )  const
 

An accessor for the total kinetic energy.

Returns:
Total kinetic energy in the cluster.

Definition at line 45 of file cluster.cpp.

References m_kineticEnergyTotal.

Referenced by operator=(), and MDLJ_Simulation::run().

Cluster & Cluster::operator= const Cluster rhs  ) 
 

Assignment operator for a cluster.

Parameters:
rhs is the cluster to assign to *this.
Returns:
*this.

Definition at line 208 of file cluster.cpp.

References clear(), kineticEnergyTotal(), m_atoms, m_kineticEnergyTotal, m_positionCentreMass, m_potentialEnergyTotal, m_velocityCentreMass, positionCentreMass(), potentialEnergyTotal(), size(), and velocityCentreMass().

Here is the call graph for this function:

const Atom & Cluster::operator[] int  index  )  const
 

Constant Subscript operator for the cluster.

Parameters:
index is the atom within the cluster to retreive. The first atom is located at 0.
Returns:
a cosntant refrence to the atom.

Definition at line 228 of file cluster.cpp.

References m_atoms.

Atom & Cluster::operator[] int  index  ) 
 

Subscript operator for the cluster.

Parameters:
index is the atom within the cluster to retreive. The first atom is located at 0.
Returns:
a refrence to the atom.

Definition at line 223 of file cluster.cpp.

References m_atoms.

Coordinate Cluster::positionCentreMass  )  const
 

An accessor for the centre of mass' position.

Returns:
The cluster's centre of mass' position.

Definition at line 50 of file cluster.cpp.

References m_positionCentreMass.

Referenced by RadialDensityHistogram::acquire(), MDLJ_Simulation::adjustPosCenMass(), FCC_Lattice::adjustPosCenMass(), and operator=().

double Cluster::potentialEnergyTotal  )  const
 

An accessor for the total potential energy.

Returns:
The total potential energy in the cluster.

Definition at line 40 of file cluster.cpp.

References m_potentialEnergyTotal.

Referenced by MDLJ_Simulation::calculateAccelerations(), operator=(), MDLJ_Simulation::run(), and MCLJ_Simulation::run().

void Cluster::read string  baseName  ) 
 

Reads in the position and velocity of a previous cluster.

Exceptions:
char* if it fails to read.
Parameters:
baseName is the base name for the position and velocity files. The position and velocity are read in as: baseName.pos and baseName.vel.

Definition at line 144 of file cluster.cpp.

References m_atoms, and Atom::properties.

Referenced by interactiveRun(), and nonInteractiveRun().

void Cluster::setKineticEnergyTotal double  kineticEnergyTotal  ) 
 

A modifier for the total kinetic energy.

Parameters:
kineticEnergyTotal is the value to set the cluster's total kinetic energy to.

Definition at line 65 of file cluster.cpp.

References m_kineticEnergyTotal.

Referenced by MDLJ_Simulation::calculateVelocities().

void Cluster::setPositionCentreMass Coordinate  positionCentreMass  ) 
 

A modifier for the centre of mass' position.

Parameters:
positionCentreMass is the value to set the cluster's positional centre of mass.

Definition at line 70 of file cluster.cpp.

References m_positionCentreMass.

Referenced by FCC_Lattice::createLattice().

void Cluster::setPotentialEnergyTotal double  potentialEnergyTotal  ) 
 

A modifier for the total potential energy.

Parameters:
potentialEnergyTotal is the value to set the cluster's total potential energy to.

Definition at line 60 of file cluster.cpp.

References m_potentialEnergyTotal.

Referenced by MDLJ_Simulation::calculateAccelerations().

void Cluster::setVelocityCentreMass Coordinate  velocityCentreMass  ) 
 

A modifier for the centre of mass' velocity.

Parameters:
velocityCentreMass is the value to set the cluster's velocity centre of mass.

Definition at line 75 of file cluster.cpp.

References m_velocityCentreMass.

int Cluster::size  )  const
 

Gives the current size of the cluster.

Returns:
the number of atoms in the cluster.

Definition at line 203 of file cluster.cpp.

References m_atoms.

Referenced by RadialDistributionFunction::acquire(), RadialDensityHistogram::acquire(), PotentialEnergyHistogram::acquire(), KineticEnergyHistogram::acquire(), MDLJ_Simulation::adjustPosCenMass(), FCC_Lattice::adjustPosCenMass(), MDLJ_Simulation::calculateAccelerations(), calculateCentreMass(), MDLJ_Simulation::calculatePositions(), MDLJ_Simulation::calculateVelocities(), interactiveRun(), operator<<(), operator=(), operator==(), MCLJ_Simulation::potentialEnergyDifference(), MDLJ_Simulation::run(), MCLJ_Simulation::run(), selectSimulation(), and MD_Simulation::writeAverages().

Coordinate Cluster::velocityCentreMass  )  const
 

An accessor for the centre of mass' velocity.

Returns:
The cluster's centre of mass' velocity.

Definition at line 55 of file cluster.cpp.

References m_velocityCentreMass.

Referenced by operator=().

void Cluster::write string  baseName  ) 
 

Writes out the position and velocity of the cluster.

Exceptions:
char* if it fails to write.
Parameters:
baseName is the base name for the position and velocity files. The position and velocity are wrote out as: baseName.pos and baseName.vel.

Definition at line 169 of file cluster.cpp.

References m_atoms, and PRECISION.

Referenced by createCluster(), interactiveRun(), and nonInteractiveRun().


Friends And Related Function Documentation

ostream& operator<< ostream &  outStream,
const Cluster cluster
[friend]
 

Outputs the contents of the cluster in the format of:
Positions:
x, y, z

Velocity:
x, y, z

Acceleration:
x, y, z

Potential Energies:
Each atoms' potential energy.

Kinetic Energies:
Each atoms' kinetic energy.
This is useful for debuging purposes.

Parameters:
outStream is the buffer to output to.
cluster is the cluster to output.
Returns:
a refrence to the outStream

Definition at line 238 of file cluster.cpp.

bool operator== const Cluster lhs,
const Cluster rhs
[friend]
 

Equivelant operator for the cluster.

Note:
we assume that all values have to be equal.
Parameters:
lhs is the left hand side cluster to compare to the rhs.
rhs is the right hand side cluster to compare to the lhs.
Returns:
True if lhs has the exact same contents as the rhs, false else wise.

Definition at line 261 of file cluster.cpp.


Member Data Documentation

vector<Atom> Cluster::m_atoms [private]
 

Parameters:
m_atoms is the atoms in the cluster.

Definition at line 199 of file cluster.h.

Referenced by addAtom(), calculateCentreMass(), calculateKineticEnergy(), calculatePotentialEnergy(), clear(), operator=(), operator[](), read(), size(), and write().

double Cluster::m_kineticEnergyTotal [private]
 

Parameters:
m_kineticEnergyTotal is the total kinetic energy in the cluster.

Definition at line 197 of file cluster.h.

Referenced by calculateKineticEnergy(), clear(), Cluster(), kineticEnergyTotal(), operator=(), operator==(), and setKineticEnergyTotal().

Coordinate Cluster::m_positionCentreMass [private]
 

Parameters:
m_positionCentreMass is the coordinates for the positional centre of mass.

Definition at line 191 of file cluster.h.

Referenced by calculateCentreMass(), clear(), operator=(), operator==(), positionCentreMass(), and setPositionCentreMass().

double Cluster::m_potentialEnergyTotal [private]
 

Parameters:
m_potentialEnergyTotal is the total potential energy in the cluster.

Definition at line 195 of file cluster.h.

Referenced by calculatePotentialEnergy(), clear(), Cluster(), operator=(), operator==(), potentialEnergyTotal(), and setPotentialEnergyTotal().

Coordinate Cluster::m_velocityCentreMass [private]
 

Parameters:
m_velocityCentreMass is the coordinates for the velocity centre of mass.

Definition at line 193 of file cluster.h.

Referenced by calculateCentreMass(), clear(), operator=(), operator==(), setVelocityCentreMass(), and velocityCentreMass().

const int Cluster::PRECISION = 10 [static]
 

Parameters:
PRECISION is how precise to be with all data.
Note:
This value are used through-out the programme.

Definition at line 44 of file cluster.h.

Referenced by operator<<(), MDLJ_Simulation::run(), MCLJ_Simulation::run(), RadialDistributionFunction::write(), RadialDensityHistogram::write(), PotentialEnergyHistogram::write(), KineticEnergyHistogram::write(), and write().

const int Cluster::WIDTH = 18 [static]
 

Parameters:
WIDTH is the output space between each number, including that number.
Note:
This value are used through-out the programme.

Definition at line 49 of file cluster.h.

Referenced by MDLJ_Simulation::run(), and MCLJ_Simulation::run().


The documentation for this class was generated from the following files:
Generated on Tue Mar 28 23:28:49 2006 for ClusterSim by  doxygen 1.4.4