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