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