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