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