Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/atom.cpp

    r97b825 r83f176  
     1/*
     2 * Project: MoleCuilder
     3 * Description: creates and alters molecular systems
     4 * Copyright (C)  2010 University of Bonn. All rights reserved.
     5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
     6 */
     7
    18/** \file atom.cpp
    29 *
     
    411 *
    512 */
     13
     14// include config.h
     15#ifdef HAVE_CONFIG_H
     16#include <config.h>
     17#endif
    618
    719#include "Helpers/MemDebug.hpp"
     
    168180bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const
    169181{
    170   AtomNo[getType()->Z]++;  // increment number
     182  AtomNo[getType()->getAtomicNumber()]++;  // increment number
    171183  if (out != NULL) {
    172184    const element *elemental = getType();
    173185    cout << "Looking for atom with element " << *elemental << endl;
    174186    ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
    175     *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     187    *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->getAtomicNumber()] << "\t"  << fixed << setprecision(9) << showpoint;
    176188    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    177189    *out << "\t" << FixedIon;
     
    194206{
    195207  if (out != NULL) {
    196     *out << getType()->symbol << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl;
     208    *out << getType()->getSymbol() << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl;
    197209    return true;
    198210  } else
     
    209221bool atom::OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const
    210222{
    211   AtomNo[getType()->Z]++;
    212   if (out != NULL) {
    213     *out << "Ion_Type" << ElementNo[getType()->Z] << "_" << AtomNo[getType()->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     223  AtomNo[getType()->getAtomicNumber()]++;
     224  if (out != NULL) {
     225    *out << "Ion_Type" << ElementNo[getType()->getAtomicNumber()] << "_" << AtomNo[getType()->getAtomicNumber()] << "\t"  << fixed << setprecision(9) << showpoint;
    214226    *out << Trajectory.R.at(step)[0] << "\t" << Trajectory.R.at(step)[1] << "\t" << Trajectory.R.at(step)[2];
    215227    *out << "\t" << FixedIon;
     
    232244{
    233245  if (out != NULL) {
    234     *out << getType()->symbol << "\t";
     246    *out << getType()->getSymbol() << "\t";
    235247    *out << Trajectory.R.at(step)[0] << "\t";
    236248    *out << Trajectory.R.at(step)[1] << "\t";
     
    250262  Vector recentered(getPosition());
    251263  recentered -= *center;
    252   *out << "\t\t" << getType()->symbol << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl;
     264  *out << "\t\t" << getType()->getSymbol() << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl;
    253265  if (AtomNo != NULL)
    254266    *AtomNo++;
     
    344356}
    345357
     358/** Makes the atom be contained in the new molecule \a *_mol.
     359 * Uses atom::removeFromMolecule() to delist from old molecule.
     360 * \param *_mol pointer to new molecule
     361 */
    346362void atom::setMolecule(molecule *_mol){
    347363  // take this atom from the old molecule
     
    353369}
    354370
    355 molecule* atom::getMolecule(){
     371/** Returns pointer to the molecule which atom belongs to.
     372 * \return containing molecule
     373 */
     374molecule* atom::getMolecule() const {
    356375  return mol;
    357376}
    358377
     378/** Erases the atom in atom::mol's list of atoms and sets it to zero.
     379 */
    359380void atom::removeFromMolecule(){
    360381  if(mol){
Note: See TracChangeset for help on using the changeset viewer.