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