/* * atom.hpp * * Created on: Aug 3, 2009 * Author: heber */ #ifndef ATOM_HPP_ #define ATOM_HPP_ using namespace std; /*********************************************** includes ***********************************/ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "atom_atominfo.hpp" #include "atom_bondedparticle.hpp" #include "atom_graphnode.hpp" #include "atom_particleinfo.hpp" #include "atom_trajectoryparticle.hpp" #include "tesselation.hpp" #include "types.hpp" /****************************************** forward declarations *****************************/ class Vector; class World; /********************************************** declarations *******************************/ /** Single atom. * Class incorporates position, type */ class atom : public TesselPoint, public TrajectoryParticle, public GraphNode, public BondedParticle, public virtual ParticleInfo, public virtual AtomInfo { friend atom* NewAtom(atomId_t); friend void DeleteAtom(atom*); public: atom *previous; //!< previous atom in molecule list atom *next; //!< next atom in molecule list atom *father; //!< In many-body bond order fragmentations points to originating atom int *sort; //!< sort criteria virtual atom *clone(); bool OutputIndexed(ofstream * const out, const int ElementNo, const int AtomNo, const char *comment = NULL) const; bool OutputArrayIndexed(ofstream * const out, const int *ElementNo, int *AtomNo, const char *comment = NULL) const; bool OutputXYZLine(ofstream *out) const; bool OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const; bool OutputTrajectoryXYZ(ofstream * const out, const int step) const; void OutputMPQCLine(ofstream * const out, const Vector *center, int *AtomNo) const; void InitComponentNr(); void EqualsFather ( const atom *ptr, const atom **res ) const; void CorrectFather(); atom *GetTrueFather(); bool Compare(const atom &ptr) const; double DistanceToVector(const Vector &origin) const; double DistanceSquaredToVector(const Vector &origin) const; bool IsInParallelepiped(const Vector offset, const double *parallelepiped) const; // getter and setter /** * returns the World that contains this atom. * Use this if you need to get the world without locking * the singleton for example. * */ World *getWorld(); void setWorld(World*); virtual atomId_t getId(); virtual bool changeId(atomId_t newId); /** * this function sets the Id without notifying the world. Only use it, if the world has already * gotten an ID for this Atom. */ virtual void setId(atomId_t); protected: /** * Protected constructor to ensure construction of atoms through the world. * see World::createAtom() */ atom(); /** * Protected copy-constructor to ensure construction of atoms by cloning. * see atom::clone() */ atom(class atom *pointer); /** * Protected destructor to ensure destruction of atoms through the world. * see World::destroyAtom() */ virtual ~atom(); private: World* world; atomId_t id; }; /** * internal method used by the world. Do not use if you don't know what you are doing. * You might get burned... * Use World::createAtom() instead. */ atom* NewAtom(atomId_t _id); /** * internal method used by the world. Do not use if you don't know what you are doing. * You might get burned... * Use World::destroyAtom() instead. */ void DeleteAtom(atom*); #endif /* ATOM_HPP_ */