/*************************************************************************************
* *
* ***** OpenThermo ***** *
* Calculation of thermodynamic functions from molecular data *
* Copyright 2008 Konstantin Tokarev <annulen@users.sourceforge.net> *
* and others *
* *
*************************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License. See COPYING for *
* more details *
* *
*************************************************************************************
* Module name : atom.hpp *
* Author : Tokarev. K *
* Last modification : 2008/08/05 *
* Description : This module contains declarations of class 'Atom', *
* which is used for storage of atomic symbols, coordinates, *
* weights and other properties *
* *
*************************************************************************************/
#ifndef ATOM_HPP
#define ATOM_HPP
#include <iostream>
#include "thermo.h" // Build options
class ColumnVector;
/**
* \class Atom atom.hpp
* \brief Representation of atom
* \author Konstantin Tokarev
*
* The Atom class is used or storage of element symbols, coordinates,
* weights and other atomic properties
*
* Instances of Atom class are used by Structure objects. Normally they
* are allocated and destroyed by top-level structure (usually Molecule object),
* nested structures (usually \link Rotor Rotors\endlink objects) contain pointers
* to the atoms owned by top-level structure.
*
* To initilalize Atom, use SetAtom function. Atom object will access to
* the BODR files and initialize weight and spin values internally.
*/
class Atom
{
public:
/// Constructor
Atom ();
/// Destructor
~Atom ();
/**
* Preload periodic table
*/
static bool InitializePeriodicTable();
/**
* Initialize atom with values of coordinates, element, and isotope
* \param x x coordinate in Angstroms
* \param y y coordinate in Angstroms
* \param z z coordinate in Angstroms
* \param Name element symbol
* \param i isotope number or special value:
* - \e -1 the most abundant isotope
* - \e 0 natural isotope mixture with spin of the most abundant isotope (default)
*/
void SetAtom (double x, double y, double z, char * Name, int i=0);
/// Get coordinates of atom in Angstroms
void GetCoordinates (double & x, double & y, double & z) const;
/// \overload
void GetCoordinates (ColumnVector &R) const;
/// Set coordinates of atom in Angstroms
void SetCoordinates (double x, double y, double z);
/** Get atomic weight in a.u.:
* \return for natural isotopic mixture average returns atomic weight,
* for specified isotope returns exact mass
* \sa SetAtom */
double GetWeight () const { return itsWeight; }
/// Get atomic weight in kg \sa GetWeight
double GetWeightSI () const { return itsWeight*(1e-3/Na); }
/// Get atomic number
int GetAtomicNumber () const { return itsAtomicNumber; }
/** Get isotope number
* \note for natural isotopic mixture returns 0
* \sa SetAtom */
int GetIsotopeNumber () const { return itsIsotopeNumber; }
/// Get element symbol of atom
const char * GetName () const { return itsName; }
/** Get absolute value of nuclear spin of atom
* \note for natural isotopic mixture returns spin of main isotope
* \sa SetAtom, \ref job */
double GetNuclearSpin () const;
/**
* Print line with information about atom. Consists of element symbol,
* XYZ coordinates in Angstroms, mass in a.u. and nuclear spin
*/
friend std::ostream & operator<< (std::ostream & theStream, Atom & theAtom);
// Debug
#ifdef OBJECT_COUNTERS
static int NumOfAtoms;
#endif
private:
int itsAtomicNumber;
int itsIsotopeNumber;
char itsName[ATOM_NAME_LENGTH];
double itsNuclearSpin;
double itsX, itsY, itsZ, itsWeight;
};
typedef Atom* AtomPtr;
#endif /* ATOM_HPP */