| [14de469] | 1 | /** \file molecules.hpp
 | 
|---|
 | 2 |  *
 | 
|---|
 | 3 |  * Class definitions of atom and molecule, element and periodentafel 
 | 
|---|
 | 4 |  */
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 | #ifndef MOLECULES_HPP_
 | 
|---|
 | 7 | #define MOLECULES_HPP_
 | 
|---|
 | 8 | 
 | 
|---|
 | 9 | using namespace std;
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | // GSL headers
 | 
|---|
 | 12 | #include <gsl/gsl_multimin.h>
 | 
|---|
 | 13 | #include <gsl/gsl_vector.h>
 | 
|---|
 | 14 | #include <gsl/gsl_matrix.h>
 | 
|---|
| [d52ea1b] | 15 | #include <gsl/gsl_eigen.h>
 | 
|---|
| [14de469] | 16 | #include <gsl/gsl_heapsort.h>
 | 
|---|
 | 17 | 
 | 
|---|
 | 18 | // STL headers
 | 
|---|
 | 19 | #include <map>
 | 
|---|
 | 20 | #include <set>
 | 
|---|
 | 21 | #include <deque>
 | 
|---|
| [d7e30c] | 22 | #include <list>
 | 
|---|
| [5e0d1f] | 23 | #include <vector>
 | 
|---|
| [14de469] | 24 | 
 | 
|---|
 | 25 | #include "helpers.hpp"
 | 
|---|
| [362b0e] | 26 | #include "parser.hpp"
 | 
|---|
| [68cb0f] | 27 | #include "periodentafel.hpp"
 | 
|---|
| [6d35e4] | 28 | #include "stackclass.hpp"
 | 
|---|
| [342f33f] | 29 | #include "vector.hpp"
 | 
|---|
| [14de469] | 30 | 
 | 
|---|
 | 31 | class atom;
 | 
|---|
 | 32 | class bond;
 | 
|---|
 | 33 | class config;
 | 
|---|
 | 34 | class molecule;
 | 
|---|
 | 35 | class MoleculeListClass;
 | 
|---|
 | 36 | class Verbose;
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | /******************************** Some definitions for easier reading **********************************/
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 | #define KeyStack deque<int>
 | 
|---|
 | 41 | #define KeySet set<int>
 | 
|---|
| [5de3c9] | 42 | #define NumberValuePair pair<int, double>
 | 
|---|
| [49de64] | 43 | #define Graph map <KeySet, NumberValuePair, KeyCompare >
 | 
|---|
 | 44 | #define GraphPair pair <KeySet, NumberValuePair >
 | 
|---|
| [14de469] | 45 | #define KeySetTestPair pair<KeySet::iterator, bool>
 | 
|---|
 | 46 | #define GraphTestPair pair<Graph::iterator, bool>
 | 
|---|
 | 47 | 
 | 
|---|
 | 48 | struct KeyCompare
 | 
|---|
 | 49 | {
 | 
|---|
 | 50 |   bool operator() (const KeySet SubgraphA, const KeySet SubgraphB) const;
 | 
|---|
 | 51 | };
 | 
|---|
| [6d35e4] | 52 | 
 | 
|---|
| [d7e30c] | 53 | struct Trajectory
 | 
|---|
 | 54 | {
 | 
|---|
| [5e0d1f] | 55 |   vector<Vector> R;  //!< position vector
 | 
|---|
 | 56 |   vector<Vector> U;  //!< velocity vector
 | 
|---|
 | 57 |   vector<Vector> F;  //!< last force vector
 | 
|---|
 | 58 |   atom *ptr;         //!< pointer to atom whose trajectory we contain
 | 
|---|
| [d7e30c] | 59 | };
 | 
|---|
 | 60 | 
 | 
|---|
| [14de469] | 61 | //bool operator < (KeySet SubgraphA, KeySet SubgraphB);   //note: this declaration is important, otherwise normal < is used (producing wrong order)
 | 
|---|
 | 62 | inline void InsertFragmentIntoGraph(ofstream *out, struct UniqueFragments *Fragment); // Insert a KeySet into a Graph
 | 
|---|
 | 63 | inline void InsertGraphIntoGraph(ofstream *out, Graph &graph1, Graph &graph2, int *counter);  // Insert all KeySet's in a Graph into another Graph 
 | 
|---|
 | 64 | int CompareDoubles (const void * a, const void * b);
 | 
|---|
 | 65 | 
 | 
|---|
| [6d35e4] | 66 | 
 | 
|---|
| [14de469] | 67 | /************************************* Class definitions ****************************************/
 | 
|---|
 | 68 | 
 | 
|---|
 | 69 | 
 | 
|---|
 | 70 | // some algebraic matrix stuff
 | 
|---|
 | 71 | #define RDET3(a) ((a)[0]*(a)[4]*(a)[8] + (a)[3]*(a)[7]*(a)[2] + (a)[6]*(a)[1]*(a)[5] - (a)[2]*(a)[4]*(a)[6] - (a)[5]*(a)[7]*(a)[0] - (a)[8]*(a)[1]*(a)[3])  //!< hard-coded determinant of a 3x3 matrix
 | 
|---|
 | 72 | #define RDET2(a0,a1,a2,a3) ((a0)*(a3)-(a1)*(a2))                      //!< hard-coded determinant of a 2x2 matrix
 | 
|---|
 | 73 | 
 | 
|---|
 | 74 | 
 | 
|---|
 | 75 | /** Parameter structure for least square minimsation.
 | 
|---|
 | 76 |  */
 | 
|---|
 | 77 | struct LSQ_params {
 | 
|---|
| [e9b8bb] | 78 |   Vector **vectors;
 | 
|---|
| [14de469] | 79 |   int num;
 | 
|---|
 | 80 | };
 | 
|---|
 | 81 | 
 | 
|---|
 | 82 | double LSQ(const gsl_vector * x, void * params);
 | 
|---|
 | 83 | 
 | 
|---|
 | 84 | /** Parameter structure for least square minimsation.
 | 
|---|
 | 85 |  */
 | 
|---|
 | 86 | struct lsq_params {
 | 
|---|
 | 87 |   gsl_vector *x;
 | 
|---|
 | 88 |   const molecule *mol;
 | 
|---|
 | 89 |   element *type;
 | 
|---|
 | 90 | };
 | 
|---|
 | 91 | 
 | 
|---|
 | 92 | 
 | 
|---|
 | 93 | 
 | 
|---|
 | 94 | /** Single atom.
 | 
|---|
 | 95 |  * Class incoporates position, type
 | 
|---|
 | 96 |  */
 | 
|---|
 | 97 | class atom {
 | 
|---|
 | 98 |   public:
 | 
|---|
| [e9b8bb] | 99 |     Vector x;       //!< coordinate array of atom, giving position within cell
 | 
|---|
 | 100 |     Vector v;       //!< velocity array of atom
 | 
|---|
| [14de469] | 101 |     element *type;  //!< pointing to element
 | 
|---|
 | 102 |     atom *previous; //!< previous atom in molecule list
 | 
|---|
 | 103 |     atom *next;     //!< next atom in molecule list
 | 
|---|
 | 104 |     atom *father;   //!< In many-body bond order fragmentations points to originating atom
 | 
|---|
 | 105 |     atom *Ancestor; //!< "Father" in Depth-First-Search
 | 
|---|
 | 106 |     char *Name;                 //!< unique name used during many-body bond-order fragmentation
 | 
|---|
| [943d02] | 107 |     int FixedIon;   //!< config variable that states whether forces act on the ion or not
 | 
|---|
| [14de469] | 108 |     int *sort;      //!< sort criteria
 | 
|---|
 | 109 |     int nr;         //!< continuous, unique number
 | 
|---|
 | 110 |     int GraphNr;      //!< unique number, given in DepthFirstSearchAnalysis()
 | 
|---|
 | 111 |     int *ComponentNr;//!< belongs to this nonseparable components, given in DepthFirstSearchAnalysis() (if more than one, then is SeparationVertex)
 | 
|---|
 | 112 |     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.
 | 
|---|
| [683914] | 113 |     bool SeparationVertex; //!< whether this atom separates off subsets of atoms or not, determined in DepthFirstSearchAnalysis()
 | 
|---|
 | 114 |     bool IsCyclic;        //!< whether atom belong to as cycle or not, determined in DepthFirstSearchAnalysis()
 | 
|---|
| [db942e] | 115 |     unsigned char AdaptiveOrder;  //!< current present bond order at site (0 means "not set")
 | 
|---|
| [362b0e] | 116 |     bool MaxOrder;  //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not
 | 
|---|
| [14de469] | 117 |   
 | 
|---|
 | 118 |   atom();
 | 
|---|
 | 119 |   ~atom();
 | 
|---|
 | 120 |   
 | 
|---|
 | 121 |   bool Output(int ElementNo, int AtomNo, ofstream *out) const;
 | 
|---|
 | 122 |   bool OutputXYZLine(ofstream *out) const;
 | 
|---|
 | 123 |   atom *GetTrueFather();
 | 
|---|
 | 124 |   bool Compare(atom &ptr);
 | 
|---|
 | 125 |   
 | 
|---|
 | 126 |   private:
 | 
|---|
 | 127 | };
 | 
|---|
 | 128 | 
 | 
|---|
 | 129 | ostream & operator << (ostream &ost, atom &a);
 | 
|---|
 | 130 | 
 | 
|---|
 | 131 | /** Bonds between atoms.
 | 
|---|
 | 132 |  * Class incorporates bonds between atoms in a molecule,
 | 
|---|
 | 133 |  * used to derive tge fragments in many-body bond order
 | 
|---|
 | 134 |  * calculations.
 | 
|---|
 | 135 |  */
 | 
|---|
 | 136 | class bond {
 | 
|---|
 | 137 |   public:
 | 
|---|
 | 138 |         atom *leftatom;         //!< first bond partner
 | 
|---|
 | 139 |         atom *rightatom;        //!< second bond partner
 | 
|---|
 | 140 |     bond *previous; //!< previous atom in molecule list
 | 
|---|
 | 141 |     bond *next;     //!< next atom in molecule list
 | 
|---|
 | 142 |         int HydrogenBond;       //!< Number of hydrogen atoms in the bond
 | 
|---|
 | 143 |         int BondDegree;         //!< single, double, triple, ... bond
 | 
|---|
 | 144 |     int nr;           //!< unique number in a molecule, updated by molecule::CreateAdjacencyList()
 | 
|---|
 | 145 |     bool Cyclic;      //!< flag whether bond is part of a cycle or not, given in DepthFirstSearchAnalysis()
 | 
|---|
 | 146 |     enum EdgeType Type;//!< whether this is a tree or back edge 
 | 
|---|
 | 147 |         
 | 
|---|
 | 148 |   atom * GetOtherAtom(atom *Atom) const;
 | 
|---|
 | 149 |   bond * GetFirstBond();
 | 
|---|
 | 150 |   bond * GetLastBond();
 | 
|---|
 | 151 |   
 | 
|---|
 | 152 |   bool MarkUsed(enum Shading color);
 | 
|---|
 | 153 |   enum Shading IsUsed();
 | 
|---|
 | 154 |   void ResetUsed();
 | 
|---|
 | 155 |   bool Contains(const atom *ptr);
 | 
|---|
 | 156 |   bool Contains(const int nr);
 | 
|---|
 | 157 |   
 | 
|---|
 | 158 |   bond();
 | 
|---|
 | 159 |   bond(atom *left, atom *right);
 | 
|---|
 | 160 |   bond(atom *left, atom *right, int degree);
 | 
|---|
 | 161 |   bond(atom *left, atom *right, int degree, int number);
 | 
|---|
 | 162 |   ~bond();
 | 
|---|
 | 163 |     
 | 
|---|
 | 164 |   private: 
 | 
|---|
 | 165 |     enum Shading Used;        //!< marker in depth-first search, DepthFirstSearchAnalysis()
 | 
|---|
 | 166 | };
 | 
|---|
 | 167 | 
 | 
|---|
 | 168 | ostream & operator << (ostream &ost, bond &b);
 | 
|---|
 | 169 | 
 | 
|---|
 | 170 | class MoleculeLeafClass;
 | 
|---|
 | 171 | 
 | 
|---|
 | 172 | /** The complete molecule.
 | 
|---|
 | 173 |  * Class incorporates number of types
 | 
|---|
 | 174 |  */
 | 
|---|
 | 175 | class molecule {
 | 
|---|
 | 176 |   public:
 | 
|---|
 | 177 |     double cell_size[6];//!< cell size
 | 
|---|
 | 178 |     periodentafel *elemente; //!< periodic table with each element
 | 
|---|
 | 179 |     atom *start;        //!< start of atom list
 | 
|---|
 | 180 |     atom *end;          //!< end of atom list
 | 
|---|
 | 181 |     bond *first;        //!< start of bond list
 | 
|---|
 | 182 |     bond *last;         //!< end of bond list
 | 
|---|
 | 183 |     bond ***ListOfBondsPerAtom; //!< pointer list for each atom and each bond it has
 | 
|---|
| [5e0d1f] | 184 |     map<atom *, struct Trajectory> Trajectories; //!< contains old trajectory points
 | 
|---|
 | 185 |     int MDSteps;        //!< The number of MD steps in Trajectories
 | 
|---|
| [14de469] | 186 |     int *NumberOfBondsPerAtom;  //!< Number of Bonds each atom has
 | 
|---|
 | 187 |     int AtomCount;                                      //!< number of atoms, brought up-to-date by CountAtoms()
 | 
|---|
 | 188 |     int BondCount;                                      //!< number of atoms, brought up-to-date by CountBonds()
 | 
|---|
 | 189 |     int ElementCount;       //!< how many unique elements are therein
 | 
|---|
 | 190 |     int ElementsInMolecule[MAX_ELEMENTS]; //!< list whether element (sorted by atomic number) is alread present or not
 | 
|---|
 | 191 |     int NoNonHydrogen;  //!< number of non-hydrogen atoms in molecule
 | 
|---|
 | 192 |     int NoNonBonds;     //!< number of non-hydrogen bonds in molecule
 | 
|---|
 | 193 |     int NoCyclicBonds;  //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
 | 
|---|
 | 194 |     double BondDistance;  //!< typical bond distance used in CreateAdjacencyList() and furtheron
 | 
|---|
 | 195 |   
 | 
|---|
 | 196 |   molecule(periodentafel *teil);
 | 
|---|
 | 197 |   ~molecule();
 | 
|---|
 | 198 |   
 | 
|---|
 | 199 |   /// remove atoms from molecule.
 | 
|---|
 | 200 |   bool AddAtom(atom *pointer);
 | 
|---|
 | 201 |   bool RemoveAtom(atom *pointer);
 | 
|---|
 | 202 |   bool CleanupMolecule();
 | 
|---|
 | 203 | 
 | 
|---|
 | 204 |   /// Add/remove atoms to/from molecule.
 | 
|---|
 | 205 |   atom * AddCopyAtom(atom *pointer);
 | 
|---|
 | 206 |   bool AddXYZFile(string filename);
 | 
|---|
 | 207 |   bool AddHydrogenReplacementAtom(ofstream *out, bond *Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bond **BondList, int NumBond, bool IsAngstroem);  
 | 
|---|
 | 208 |   bond * AddBond(atom *first, atom *second, int degree);
 | 
|---|
 | 209 |   bool RemoveBond(bond *pointer);
 | 
|---|
 | 210 |   bool RemoveBonds(atom *BondPartner);
 | 
|---|
 | 211 |     
 | 
|---|
 | 212 |   /// Find atoms.
 | 
|---|
 | 213 |   atom * FindAtom(int Nr) const; 
 | 
|---|
| [342f33f] | 214 |   atom * AskAtom(string text);
 | 
|---|
| [14de469] | 215 | 
 | 
|---|
 | 216 |   /// Count and change present atoms' coordination.
 | 
|---|
 | 217 |   void CountAtoms(ofstream *out);
 | 
|---|
 | 218 |   void CountElements();
 | 
|---|
 | 219 |   void CalculateOrbitals(class config &configuration);
 | 
|---|
| [e9b8bb] | 220 |   bool CenterInBox(ofstream *out, Vector *BoxLengths);
 | 
|---|
 | 221 |   void CenterEdge(ofstream *out, Vector *max); 
 | 
|---|
 | 222 |   void CenterOrigin(ofstream *out, Vector *max); 
 | 
|---|
 | 223 |   void CenterGravity(ofstream *out, Vector *max);
 | 
|---|
 | 224 |   void Translate(const Vector *x);
 | 
|---|
 | 225 |   void Mirror(const Vector *x);
 | 
|---|
 | 226 |   void Align(Vector *n);
 | 
|---|
| [14de469] | 227 |   void Scale(double **factor);
 | 
|---|
| [e9b8bb] | 228 |   void DetermineCenter(Vector ¢er);
 | 
|---|
 | 229 |   Vector * DetermineCenterOfGravity(ofstream *out);
 | 
|---|
 | 230 |   void SetBoxDimension(Vector *dim);
 | 
|---|
| [14de469] | 231 |   double * ReturnFullMatrixforSymmetric(double *cell_size);
 | 
|---|
 | 232 |   void ScanForPeriodicCorrection(ofstream *out);
 | 
|---|
| [d52ea1b] | 233 |         void PrincipalAxisSystem(ofstream *out, bool DoRotate);
 | 
|---|
 | 234 |         double VolumeOfConvexEnvelope(ofstream *out, bool IsAngstroem);
 | 
|---|
| [362b0e] | 235 |         bool VerletForceIntegration(char *file, double delta_t, bool IsAngstroem);
 | 
|---|
| [d52ea1b] | 236 |         
 | 
|---|
| [e9b8bb] | 237 |   bool CheckBounds(const Vector *x) const;
 | 
|---|
| [d7e30c] | 238 |   void GetAlignvector(struct lsq_params * par) const;
 | 
|---|
| [14de469] | 239 | 
 | 
|---|
 | 240 |   /// Initialising routines in fragmentation  
 | 
|---|
| [a251a3] | 241 |   void CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem);
 | 
|---|
| [14de469] | 242 |   void CreateListOfBondsPerAtom(ofstream *out);
 | 
|---|
 | 243 |   
 | 
|---|
 | 244 |   // Graph analysis
 | 
|---|
| [d52ea1b] | 245 |   MoleculeLeafClass * DepthFirstSearchAnalysis(ofstream *out, int *&MinimumRingSize);
 | 
|---|
| [fc850d] | 246 |   void CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> *BackEdgeStack, int *&MinimumRingSize);
 | 
|---|
| [14de469] | 247 |   bond * FindNextUnused(atom *vertex);
 | 
|---|
 | 248 |   void SetNextComponentNumber(atom *vertex, int nr);
 | 
|---|
 | 249 |   void InitComponentNumbers();
 | 
|---|
 | 250 |   void OutputComponentNumber(ofstream *out, atom *vertex);
 | 
|---|
 | 251 |   void ResetAllBondsToUnused();
 | 
|---|
 | 252 |   void ResetAllAtomNumbers();
 | 
|---|
 | 253 |   int CountCyclicBonds(ofstream *out);
 | 
|---|
| [4aa03a] | 254 |   bool CheckForConnectedSubgraph(ofstream *out, KeySet *Fragment);
 | 
|---|
| [342f33f] | 255 |   string GetColor(enum Shading color);
 | 
|---|
| [14de469] | 256 | 
 | 
|---|
 | 257 |   molecule *CopyMolecule();
 | 
|---|
 | 258 |   
 | 
|---|
 | 259 |   /// Fragment molecule by two different approaches:
 | 
|---|
| [362b0e] | 260 |   int FragmentMolecule(ofstream *out, int Order, config *configuration);
 | 
|---|
| [958457] | 261 |   bool CheckOrderAtSite(ofstream *out, bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
 | 
|---|
| [db942e] | 262 |   bool StoreAdjacencyToFile(ofstream *out, char *path);
 | 
|---|
 | 263 |   bool CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms);
 | 
|---|
 | 264 |   bool ParseOrderAtSiteFromFile(ofstream *out, char *path);
 | 
|---|
 | 265 |   bool StoreOrderAtSiteFile(ofstream *out, char *path);
 | 
|---|
| [d52ea1b] | 266 |   bool ParseKeySetFile(ofstream *out, char *filename, Graph *&FragmentList);
 | 
|---|
| [2459b1] | 267 |   bool StoreKeySetFile(ofstream *out, Graph &KeySetList, char *path);
 | 
|---|
 | 268 |   bool StoreForcesFile(ofstream *out, MoleculeListClass *BondFragments, char *path, int *SortIndex);
 | 
|---|
| [bf46da] | 269 |   bool CreateMappingLabelsToConfigSequence(ofstream *out, int *&SortIndex);
 | 
|---|
| [b0a0c3] | 270 |   bool ScanBufferIntoKeySet(ofstream *out, char *buffer, KeySet &CurrentSet);
 | 
|---|
| [db942e] | 271 |   void BreadthFirstSearchAdd(ofstream *out, molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
 | 
|---|
| [14de469] | 272 |   /// -# BOSSANOVA
 | 
|---|
| [fc850d] | 273 |   void FragmentBOSSANOVA(ofstream *out, Graph *&FragmentList, KeyStack &RootStack, int *MinimumRingSize);
 | 
|---|
| [2459b1] | 274 |         int PowerSetGenerator(ofstream *out, int Order, struct UniqueFragments &FragmentSearch, KeySet RestrictedKeySet);
 | 
|---|
| [14de469] | 275 |   bool BuildInducedSubgraph(ofstream *out, const molecule *Father);
 | 
|---|
| [183f35] | 276 |   molecule * StoreFragmentFromKeySet(ofstream *out, KeySet &Leaflet, bool IsAngstroem);
 | 
|---|
| [14de469] | 277 |   void SPFragmentGenerator(ofstream *out, struct UniqueFragments *FragmentSearch, int RootDistance, bond **BondsSet, int SetDimension, int SubOrder);
 | 
|---|
 | 278 |   int LookForRemovalCandidate(ofstream *&out, KeySet *&Leaf, int *&ShortestPathList);
 | 
|---|
 | 279 |   int GuesstimateFragmentCount(ofstream *out, int order);
 | 
|---|
 | 280 |           
 | 
|---|
 | 281 |   // Recognize doubly appearing molecules in a list of them   
 | 
|---|
 | 282 |   int * IsEqualToWithinThreshold(ofstream *out, molecule *OtherMolecule, double threshold);
 | 
|---|
 | 283 |   int * GetFatherSonAtomicMap(ofstream *out, molecule *OtherMolecule);
 | 
|---|
 | 284 |         
 | 
|---|
 | 285 |   // Output routines.
 | 
|---|
 | 286 |   bool Output(ofstream *out);
 | 
|---|
| [5e0d1f] | 287 |   bool OutputTrajectories(ofstream *out);
 | 
|---|
| [da5355] | 288 |   void OutputListOfBonds(ofstream *out) const;
 | 
|---|
| [14de469] | 289 |   bool OutputXYZ(ofstream *out) const;
 | 
|---|
| [362b0e] | 290 |   bool OutputTrajectoriesXYZ(ofstream *out);
 | 
|---|
| [14de469] | 291 |   bool Checkout(ofstream *out) const;
 | 
|---|
 | 292 | 
 | 
|---|
 | 293 |   private:
 | 
|---|
 | 294 |   int last_atom;      //!< number given to last atom
 | 
|---|
 | 295 | };
 | 
|---|
 | 296 | 
 | 
|---|
 | 297 | /** A list of \a molecule classes.
 | 
|---|
 | 298 |  */
 | 
|---|
 | 299 | class MoleculeListClass {
 | 
|---|
 | 300 |   public:
 | 
|---|
 | 301 |     molecule **ListOfMolecules;   //!< pointer list of fragment molecules to check for equality
 | 
|---|
 | 302 |     int NumberOfMolecules;        //!< Number of entries in \a **FragmentList and of to be returned one.
 | 
|---|
 | 303 |     int NumberOfTopAtoms;         //!< Number of atoms in the molecule from which all fragments originate
 | 
|---|
 | 304 |     
 | 
|---|
 | 305 |   MoleculeListClass();
 | 
|---|
 | 306 |   MoleculeListClass(int Num, int NumAtoms);
 | 
|---|
 | 307 |   ~MoleculeListClass();
 | 
|---|
 | 308 | 
 | 
|---|
 | 309 |   /// Output configs.
 | 
|---|
| [390248] | 310 |   bool AddHydrogenCorrection(ofstream *out, char *path);
 | 
|---|
| [2459b1] | 311 |   bool StoreForcesFile(ofstream *out, char *path, int *SortIndex);
 | 
|---|
| [db942e] | 312 |   bool OutputConfigForListOfFragments(ofstream *out, config *configuration, int *SortIndex);
 | 
|---|
| [14de469] | 313 |   void Output(ofstream *out);
 | 
|---|
 | 314 |   
 | 
|---|
 | 315 |   private:
 | 
|---|
 | 316 | };
 | 
|---|
 | 317 | 
 | 
|---|
 | 318 | 
 | 
|---|
 | 319 | /** A leaf for a tree of \a molecule class
 | 
|---|
 | 320 |  * Wraps molecules in a tree structure
 | 
|---|
 | 321 |  */
 | 
|---|
 | 322 | class MoleculeLeafClass {
 | 
|---|
 | 323 |   public:
 | 
|---|
 | 324 |     molecule *Leaf;                   //!< molecule of this leaf 
 | 
|---|
 | 325 |     //MoleculeLeafClass *UpLeaf;        //!< Leaf one level up
 | 
|---|
 | 326 |     //MoleculeLeafClass *DownLeaf;      //!< First leaf one level down
 | 
|---|
 | 327 |     MoleculeLeafClass *previous;  //!< Previous leaf on this level
 | 
|---|
 | 328 |     MoleculeLeafClass *next;      //!< Next leaf on this level
 | 
|---|
 | 329 | 
 | 
|---|
 | 330 |   //MoleculeLeafClass(MoleculeLeafClass *Up, MoleculeLeafClass *Previous);
 | 
|---|
 | 331 |   MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf);
 | 
|---|
 | 332 |   ~MoleculeLeafClass();
 | 
|---|
 | 333 | 
 | 
|---|
 | 334 |   bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous);
 | 
|---|
| [9fcf47] | 335 |   bool FillBondStructureFromReference(ofstream *out, molecule *reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList = false);
 | 
|---|
| [fc850d] | 336 |   bool FillRootStackForSubgraphs(ofstream *out, KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter);
 | 
|---|
| [da5355] | 337 |   bool AssignKeySetsToFragment(ofstream *out, molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);
 | 
|---|
 | 338 |   bool FillListOfLocalAtoms(ofstream *out, atom ***&ListOfLocalAtoms, int &FragmentCounter, int GlobalAtomCount, bool &FreeList);
 | 
|---|
| [87f6c9] | 339 |   void TranslateIndicesToGlobalIDs(ofstream *out, Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph);
 | 
|---|
| [da5355] | 340 |   int Count() const;
 | 
|---|
| [14de469] | 341 | };
 | 
|---|
 | 342 | 
 | 
|---|
 | 343 | /** The config file.
 | 
|---|
 | 344 |  * The class contains all parameters that control a dft run also functions to load and save.
 | 
|---|
 | 345 |  */
 | 
|---|
 | 346 | class config {
 | 
|---|
 | 347 |   public:
 | 
|---|
 | 348 |     int PsiType;
 | 
|---|
 | 349 |     int MaxPsiDouble;
 | 
|---|
 | 350 |     int PsiMaxNoUp;
 | 
|---|
 | 351 |     int PsiMaxNoDown;
 | 
|---|
 | 352 |     int MaxMinStopStep;
 | 
|---|
 | 353 |     int InitMaxMinStopStep;
 | 
|---|
 | 354 |     int ProcPEGamma;
 | 
|---|
 | 355 |     int ProcPEPsi;
 | 
|---|
| [5b15ab] | 356 |     char *configpath;
 | 
|---|
| [b5ecd9] | 357 |     char *configname;
 | 
|---|
| [49de64] | 358 |     bool FastParsing;
 | 
|---|
| [362b0e] | 359 |     double Deltat;
 | 
|---|
| [14de469] | 360 |     
 | 
|---|
 | 361 |     private:
 | 
|---|
 | 362 |     char *mainname;
 | 
|---|
 | 363 |     char *defaultpath;
 | 
|---|
 | 364 |     char *pseudopotpath;
 | 
|---|
 | 365 |     
 | 
|---|
 | 366 |     int DoOutVis;
 | 
|---|
 | 367 |     int DoOutMes;
 | 
|---|
 | 368 |     int DoOutNICS;
 | 
|---|
 | 369 |     int DoOutOrbitals;
 | 
|---|
 | 370 |     int DoOutCurrent;
 | 
|---|
 | 371 |     int DoFullCurrent;
 | 
|---|
 | 372 |     int DoPerturbation;
 | 
|---|
 | 373 |     int CommonWannier;
 | 
|---|
 | 374 |     double SawtoothStart;
 | 
|---|
 | 375 |     int VectorPlane;
 | 
|---|
 | 376 |     double VectorCut;
 | 
|---|
 | 377 |     int UseAddGramSch;
 | 
|---|
 | 378 |     int Seed;
 | 
|---|
 | 379 |     
 | 
|---|
 | 380 |     int MaxOuterStep;
 | 
|---|
 | 381 |     int OutVisStep;
 | 
|---|
 | 382 |     int OutSrcStep;
 | 
|---|
 | 383 |     double TargetTemp;
 | 
|---|
 | 384 |     int ScaleTempStep;
 | 
|---|
 | 385 |     int MaxPsiStep;
 | 
|---|
 | 386 |     double EpsWannier;
 | 
|---|
 | 387 |     
 | 
|---|
 | 388 |     int MaxMinStep;
 | 
|---|
 | 389 |     double RelEpsTotalEnergy;
 | 
|---|
 | 390 |     double RelEpsKineticEnergy;
 | 
|---|
 | 391 |     int MaxMinGapStopStep;
 | 
|---|
 | 392 |     int MaxInitMinStep;
 | 
|---|
 | 393 |     double InitRelEpsTotalEnergy;
 | 
|---|
 | 394 |     double InitRelEpsKineticEnergy;
 | 
|---|
 | 395 |     int InitMaxMinGapStopStep;
 | 
|---|
 | 396 |     
 | 
|---|
 | 397 |     //double BoxLength[NDIM*NDIM];
 | 
|---|
 | 398 |     
 | 
|---|
 | 399 |     double ECut;
 | 
|---|
 | 400 |     int MaxLevel;
 | 
|---|
 | 401 |     int RiemannTensor;
 | 
|---|
 | 402 |     int LevRFactor;
 | 
|---|
 | 403 |     int RiemannLevel;
 | 
|---|
 | 404 |     int Lev0Factor;
 | 
|---|
 | 405 |     int RTActualUse;
 | 
|---|
 | 406 |     int AddPsis;
 | 
|---|
 | 407 |     
 | 
|---|
 | 408 |     double RCut;
 | 
|---|
 | 409 |     int StructOpt;
 | 
|---|
 | 410 |     int IsAngstroem;
 | 
|---|
 | 411 |     int RelativeCoord;
 | 
|---|
 | 412 |     int MaxTypes;
 | 
|---|
 | 413 | 
 | 
|---|
 | 414 |   
 | 
|---|
 | 415 |   int ParseForParameter(int verbose, ifstream *file, const char *name, int sequential, int const xth, int const yth, int type, void *value, int repetition, int critical);
 | 
|---|
 | 416 |   
 | 
|---|
 | 417 |   public:
 | 
|---|
 | 418 |   config();
 | 
|---|
 | 419 |   ~config();
 | 
|---|
 | 420 | 
 | 
|---|
| [5b15ab] | 421 |   int TestSyntax(char *filename, periodentafel *periode, molecule *mol);
 | 
|---|
 | 422 |   void Load(char *filename, periodentafel *periode, molecule *mol);
 | 
|---|
 | 423 |   void LoadOld(char *filename, periodentafel *periode, molecule *mol);
 | 
|---|
| [7f3b9d] | 424 |   void RetrieveConfigPathAndName(string filename);
 | 
|---|
| [14de469] | 425 |   bool Save(ofstream *file, periodentafel *periode, molecule *mol) const;
 | 
|---|
 | 426 |   void Edit(molecule *mol);
 | 
|---|
 | 427 |   bool GetIsAngstroem() const;
 | 
|---|
 | 428 |   char *GetDefaultPath() const;
 | 
|---|
| [342f33f] | 429 |   void SetDefaultPath(const char *path);
 | 
|---|
| [14de469] | 430 | };
 | 
|---|
 | 431 | 
 | 
|---|
 | 432 | #endif /*MOLECULES_HPP_*/
 | 
|---|
 | 433 | 
 | 
|---|