The Gnome Chemistry Utils: gcu::Atom Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# gcu::Atom Class Reference

`#include <gcu/atom.h>`

Inheritance diagram for gcu::Atom:

List of all members.

## Public Member Functions
| Atom ()
| Atom (int Z, double x, double y, double z=0.)
| Atom (Atom &a)
Atom & | operator= (Atom &a)
virtual | ~Atom ()
double | Distance (Atom *pAtom)
void | zoom (double ZoomFactor)
virtual bool | GetCoords (double *x, double *y, double *z=NULL)
void | SetCoords (double x, double y, double z=0)
int | GetZ ()
virtual void | SetZ (int Z)
void | SetCharge (char Charge)
char | GetCharge ()
const gchar * | GetSymbol ()
virtual void | AddBond (Bond *pBond)
virtual void | RemoveBond (Bond *pBond)
double | x ()
double | y ()
double | z ()
Bond * | GetFirstBond (map< Atom *, Bond * >::iterator &i)
Bond * | GetNextBond (map< Atom *, Bond * >::iterator &i)
Bond * | GetBond (Atom *pAtom)
int | GetBondsNumber ()
virtual xmlNodePtr | Save (xmlDocPtr xml)
virtual bool | Load (xmlNodePtr node)
virtual bool | LoadNode (xmlNodePtr node)
virtual bool | SaveNode (xmlDocPtr xml, xmlNodePtr node)
virtual void | Move (double x, double y, double z=0.)
virtual void | Transform2D (Matrix2D &m, double x, double y)
## Protected Attributes
int | m_Z
double | m_x
double | m_y
double | m_z
char | m_Charge
map< Atom *, Bond * > | m_Bonds

## Detailed Description

This class is used to represent atoms.

Definition at line 42 of file atom.h.

## Constructor & Destructor Documentation

gcu::Atom::Atom | ( |  | ) |

The default constructor. Creates an atom with atomic number set to 0.

gcu::Atom::Atom | ( | int | Z,
|  | double | x,
|  | double | y,
|  | double | z = `0.` |
| ) |  |  |

Parameters:

  | Z,: | the atomic number of the new atom.
  | x,: | the x coordinate of the new atom.
  | y,: | the y coordinate of the new atom.
  | z,: | the z coordinate of the new atom.

Creates an atom.

gcu::Atom::Atom | ( | Atom & | a | ) |

Parameters:

  | a,: | the Atom to duplicate.

Creates a new atom identical to a without any bond.

virtual gcu::Atom::~Atom | ( |  | ) | `[virtual]`

The destructor of Atom. It removes bonds but do not delete the associated Bond instances.

## Member Function Documentation

Atom& gcu::Atom::operator= | ( | Atom & | a | ) |

Parameters:

  | a,: | the Atom to copy.

Returns:
  an Atom identical to a without any bond.

double gcu::Atom::Distance | ( | Atom * | pAtom | ) |

Parameters:

  | pAtom,: | a pointer to an Atom.

Returns:
  the distance between the Atom at pAtom and this Atom.

void gcu::Atom::zoom | ( | double | ZoomFactor | ) |

Parameters:

  | ZoomFactor,: | the zoom factor.

Multiplies all three coordinates of this Atom by ZoomFactor.

virtual bool gcu::Atom::GetCoords | ( | double * | x,
|  | double * | y,
|  | double * | z = `NULL` |
| ) |  |  | `[virtual]`

Parameters:

  | x,: | a pointer to the double value which will receive the x coordiante of the Atom.
  | y,: | a pointer to the double value which will receive the y coordiante of the Atom.
  | z,: | a pointer to the double value which will receive the z coordiante of the Atom or NULL for 2D representations.

Retrieves the coordinates of this Atom.

Returns:
  true if successful and false if an error occurs (if x or y is NULL).

void gcu::Atom::SetCoords | ( | double | x,
|  | double | y,
|  | double | z = `0` |
| ) |  |  | `[inline]`

Parameters:

  | x,: | the new x coordinate of the Atom.
  | y,: | the new y coordinate of the Atom.
  | z,: | the new z coordinate of the Atom.

Changes the position of this Atom.

Definition at line 103 of file atom.h.

References m_x, m_y, m_z, and z().

int gcu::Atom::GetZ | ( |  | ) | `[inline]`

Returns:
  the atomic number of the atom.

Definition at line 107 of file atom.h.

References m_Z.

virtual void gcu::Atom::SetZ | ( | int | Z | ) | `[virtual]`

Parameters:

  | Z,: | the new atomic number of the Atom.

This method might be overrided by derived class since changing the atomic number generally changes most properties. The default behavior is just to change the atomic number and nothing else.

void gcu::Atom::SetCharge | ( | char | Charge | ) | `[inline]`

Parameters:

  | Charge,: | the new formal charge of the Atom.

Changes the formal charge of this Atom.

Definition at line 120 of file atom.h.

References m_Charge.

char gcu::Atom::GetCharge | ( |  | ) | `[inline]`

Returns:
  the formal charge of this Atom.

Definition at line 124 of file atom.h.

References m_Charge.

const gchar* gcu::Atom::GetSymbol | ( |  | ) |

Returns:
  the atomic symbol of this Atom or NULL if the element is unknown.

virtual void gcu::Atom::AddBond | ( | Bond * | pBond | ) | `[virtual]`

Parameters:

  | pBond,: | a pointer to the new Bond to this Atom.

Adds a Bond.

virtual void gcu::Atom::RemoveBond | ( | Bond * | pBond | ) | `[virtual]`

Parameters:

  | pBond,: | a pointer to the Bond to remove from this Atom.

Removes a Bond.

double gcu::Atom::x | ( |  | ) | `[inline]`

Returns:
  the x coordinate of this Atom.

Definition at line 144 of file atom.h.

References m_x.

double gcu::Atom::y | ( |  | ) | `[inline]`

Returns:
  the y coordinate of this Atom.

Definition at line 148 of file atom.h.

References m_y.

double gcu::Atom::z | ( |  | ) | `[inline]`

Returns:
  the z coordinate of this Atom.

Definition at line 152 of file atom.h.

References m_z.

Referenced by SetCoords().

Bond* gcu::Atom::GetFirstBond | ( | map< Atom *, Bond * >::iterator & | i | ) |

Parameters:

  | i,: | a C++ std::map iterator.

Use this function to retrieve the first Bond of this Atom and initialize the iterator.

Returns:
  the first Bond of this Atom or NULL if the Atom has is not bonded.

Bond* gcu::Atom::GetNextBond | ( | map< Atom *, Bond * >::iterator & | i | ) |

Parameters:

  | i,: | a C++ std::map iterator initialized by Atom::GetFirstBond.

Use this method to iterate through the list of Bond instances of this Atom.

Returns:
  the next Bond of this Atom or NULL.

Bond* gcu::Atom::GetBond | ( | Atom * | pAtom | ) |

Parameters:

  | pAtom,: | a pointer to an Atom instance.

Returns:
  a pointer to the Bond shared by pAtom and this Atom if it exists or NULL.

int gcu::Atom::GetBondsNumber | ( |  | ) | `[inline]`

Returns:
  the number of Bond instances shared by this Atom. It does not take multiplicity of bonds into account.

Definition at line 175 of file atom.h.

References m_Bonds.

virtual xmlNodePtr gcu::Atom::Save | ( | xmlDocPtr | xml | ) | `[virtual]`

Parameters:

  | xml,: | the xmlDoc used to save the document.

Returns:
  a pointer to the xmlNode representing this Atom or NULL if an error occured.

Reimplemented from gcu::Object.

virtual bool gcu::Atom::Load | ( | xmlNodePtr | node | ) | `[virtual]`

Parameters:

  | node,: | a pointer to the xmlNode containing the serialized Atom.

Loads an atom from an xmlNode.

Reimplemented from gcu::Object.

virtual bool gcu::Atom::LoadNode | ( | xmlNodePtr | node | ) | `[virtual]`

Parameters:

  | node,: | a pointer to the xmlNode containing the serialized Atom.

This virtual method is called at the end of the Atom::Load method. The default behavior is to do nothing. It might be overrided for derived class when it is not convenient to override the Atom::Load method.

Reimplemented in gcu::CrystalAtom.

virtual bool gcu::Atom::SaveNode | ( | xmlDocPtr | xml,
|  | xmlNodePtr | node |
| ) |  |  | `[virtual]`

Parameters:

  | xml,: | the xmlDoc used to save the document.
  | node,: | a pointer to the xmlNode to which this Atom is serialized.

This virtual method is called at the end of the Atom::Save method. The default behavior is to do nothing. It might be overrided for derived class when it is not convenient to override the Atom::Save method.

Reimplemented in gcu::CrystalAtom.

virtual void gcu::Atom::Move | ( | double | x,
|  | double | y,
|  | double | z = `0.` |
| ) |  |  | `[virtual]`

Parameters:

  | x,: | the x component of the transation vector.
  | y,: | the y component of the transation vector.
  | z,: | the z component of the transation vector.

Used to move an Atom.

Reimplemented from gcu::Object.

virtual void gcu::Atom::Transform2D | ( | Matrix2D & | m,
|  | double | x,
|  | double | y |
| ) |  |  | `[virtual]`

Parameters:

  | m,: | the 2D Matrix of the transformation.
  | x,: | the x component of the center of the transformation.
  | y,: | the y component of the center of the transformation.

Used to move and/or transform an atom.

Reimplemented from gcu::Object.

## Member Data Documentation

int gcu::Atom::m_Z`[protected]`

The atomic number of the Atom.

Definition at line 223 of file atom.h.

Referenced by GetZ().

double gcu::Atom::m_x`[protected]`

The x coordinate of the Atom.

Definition at line 227 of file atom.h.

Referenced by SetCoords(), and x().

double gcu::Atom::m_y`[protected]`

The x coordinate of the Atom.

Definition at line 231 of file atom.h.

Referenced by SetCoords(), and y().

double gcu::Atom::m_z`[protected]`

The x coordinate of the Atom.

Definition at line 235 of file atom.h.

Referenced by SetCoords(), and z().

char gcu::Atom::m_Charge`[protected]`

The charge of the Atom.

Definition at line 239 of file atom.h.

Referenced by GetCharge(), and SetCharge().

map<Atom*, Bond*> gcu::Atom::m_Bonds`[protected]`

The Bond instances of the Atom. The index of the map is a pointer to the other end of the Bond.

Definition at line 243 of file atom.h.

Referenced by GetBondsNumber().

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

- atom.h