source: molecuilder/src/atom.hpp@ 70b7aa

Last change on this file since 70b7aa was 70b7aa, checked in by Frederik Heber <heber@…>, 16 years ago

used forward declaration to untangle atom and bond declarations, molecule::CreateListOfBondsPerAtom() uses ActOnAllAtoms

  • a major problem is two classes depending on one another and we've often made constraints in order to accommodate for this. But there is an easier solution: Have forward declarations of the other class in each header file, only include the true other header file in each implementation (i.e. cpp file).
  • This was done with atom and bond class to allow for a new function atom::OutputBondOfAtom()
  • molecule::CreateListOfBondsPerAtom() uses ActOnAllAtoms with this new function.
  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 * atom.hpp
3 *
4 * Created on: Aug 3, 2009
5 * Author: heber
6 */
7
8#ifndef ATOM_HPP_
9#define ATOM_HPP_
10
11using namespace std;
12
13// include config.h
14#ifdef HAVE_CONFIG_H
15#include <config.h>
16#endif
17
18
19#include <iostream>
20#include <vector>
21
22#include "element.hpp"
23#include "tesselation.hpp"
24#include "vector.hpp"
25
26class bond;
27
28/** Single atom.
29 * Class incorporates position, type
30 */
31class atom : public TesselPoint {
32 public:
33 struct
34 {
35 vector<Vector> R; //!< position vector
36 vector<Vector> U; //!< velocity vector
37 vector<Vector> F; //!< last force vector
38 } Trajectory;
39
40 Vector x; //!< coordinate vector of atom, giving last position within cell
41 Vector v; //!< velocity vector of atom, giving last velocity within cell
42 Vector F; //!< Force vector of atom, giving last force within cell
43 element *type; //!< pointing to element
44 atom *previous; //!< previous atom in molecule list
45 atom *next; //!< next atom in molecule list
46 atom *father; //!< In many-body bond order fragmentations points to originating atom
47 atom *Ancestor; //!< "Father" in Depth-First-Search
48 //char *Name; //!< unique name used during many-body bond-order fragmentation, comes from TesselPoint
49 int FixedIon; //!< config variable that states whether forces act on the ion or not
50 int *sort; //!< sort criteria
51 //int nr; //!< continuous, unique number, comes from TesselPoint
52 int GraphNr; //!< unique number, given in DepthFirstSearchAnalysis()
53 int *ComponentNr;//!< belongs to this nonseparable components, given in DepthFirstSearchAnalysis() (if more than one, then is SeparationVertex)
54 int LowpointNr; //!< needed in DepthFirstSearchAnalysis() to detect nonseparable components, is the lowest possible number of an atom to reach via tree edges only followed by at most one back edge.
55 bool SeparationVertex; //!< whether this atom separates off subsets of atoms or not, determined in DepthFirstSearchAnalysis()
56 bool IsCyclic; //!< whether atom belong to as cycle or not, determined in DepthFirstSearchAnalysis()
57 unsigned char AdaptiveOrder; //!< current present bond order at site (0 means "not set")
58 bool MaxOrder; //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not
59
60 atom();
61 atom(class atom *pointer);
62 virtual ~atom();
63
64 bool Output(ofstream *out, int ElementNo, int AtomNo, const char *comment = NULL) const;
65 bool Output(ofstream *out, int *ElementNo, int *AtomNo, const char *comment = NULL);
66 bool OutputXYZLine(ofstream *out) const;
67 bool OutputTrajectory(ofstream *out, int *ElementNo, int *AtomNo, int step) const;
68 bool OutputTrajectoryXYZ(ofstream *out, int step) const;
69 bool OutputBondOfAtom(ofstream *out, int *NumberOfBondsPerAtom, bond ***ListOfBondsPerAtom) const;
70
71 void EqualsFather ( atom *ptr, atom **res );
72 void CorrectFather();
73 atom *GetTrueFather();
74 bool Compare(const atom &ptr);
75
76 bool IsInParallelepiped(Vector offset, double *parallelepiped);
77
78 ostream & operator << (ostream &ost);
79
80 private:
81};
82
83
84ostream & operator << (ostream &ost, const atom &a);
85
86#endif /* ATOM_HPP_ */
Note: See TracBrowser for help on using the repository browser.