| 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 |
|
|---|
| 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 | };
|
|---|
| 48 |
|
|---|
| 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 |
|
|---|
| 54 |
|
|---|
| 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
|
|---|
| 96 | char header1[MAXSTRINGSIZE]; //!< store first header line
|
|---|
| 97 | char header2[MAXSTRINGSIZE]; //!< store second header line
|
|---|
| 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;
|
|---|
| 110 | bool LoadPeriodentafel(char *filename = NULL);
|
|---|
| 111 | bool StorePeriodentafel(char *filename = NULL) const;
|
|---|
| 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:
|
|---|
| 190 | vector x; //!< coordinate array of atom, giving position within cell
|
|---|
| 191 | vector v; //!< velocity array of atom
|
|---|
| 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
|
|---|
| 198 | int FixedIon; //!< config variable that states whether forces act on the ion or not
|
|---|
| 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()
|
|---|
| 205 | unsigned char AdaptiveOrder; //!< current present bond order at site (0 means "not set")
|
|---|
| 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);
|
|---|
| 328 | void CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> *BackEdgeStack, int &MinimumRingSize);
|
|---|
| 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:
|
|---|
| 341 | void FragmentMolecule(ofstream *out, int Order, config *configuration);
|
|---|
| 342 | void CheckOrderAtSite(ofstream *out, bool &FragmentationToDo, int Order);
|
|---|
| 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);
|
|---|
| 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);
|
|---|
| 350 | bool ScanBufferIntoKeySet(ofstream *out, char *buffer, KeySet &CurrentSet);
|
|---|
| 351 | void BreadthFirstSearchAdd(ofstream *out, molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
|
|---|
| 352 | /// -# BOSSANOVA
|
|---|
| 353 | void FragmentBOSSANOVA(ofstream *out, Graph *&FragmentList, KeyStack &RootStack);
|
|---|
| 354 | int PowerSetGenerator(ofstream *out, int Order, struct UniqueFragments &FragmentSearch, KeySet RestrictedKeySet);
|
|---|
| 355 | bool BuildInducedSubgraph(ofstream *out, const molecule *Father);
|
|---|
| 356 | molecule * StoreFragmentFromKeySet(ofstream *out, KeySet &Leaflet, bool IsAngstroem);
|
|---|
| 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.
|
|---|
| 387 | bool StoreForcesFile(ofstream *out, char *path, int *SortIndex);
|
|---|
| 388 | bool OutputConfigForListOfFragments(ofstream *out, config *configuration, int *SortIndex);
|
|---|
| 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);
|
|---|
| 411 | bool FillBondStructureFromReference(ofstream *out, molecule *reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList = false);
|
|---|
| 412 | };
|
|---|
| 413 |
|
|---|
| 414 | /** The config file.
|
|---|
| 415 | * The class contains all parameters that control a dft run also functions to load and save.
|
|---|
| 416 | */
|
|---|
| 417 | class config {
|
|---|
| 418 | public:
|
|---|
| 419 | int PsiType;
|
|---|
| 420 | int MaxPsiDouble;
|
|---|
| 421 | int PsiMaxNoUp;
|
|---|
| 422 | int PsiMaxNoDown;
|
|---|
| 423 | int MaxMinStopStep;
|
|---|
| 424 | int InitMaxMinStopStep;
|
|---|
| 425 | int ProcPEGamma;
|
|---|
| 426 | int ProcPEPsi;
|
|---|
| 427 | char *configpath;
|
|---|
| 428 | char *configname;
|
|---|
| 429 |
|
|---|
| 430 | private:
|
|---|
| 431 | char *mainname;
|
|---|
| 432 | char *defaultpath;
|
|---|
| 433 | char *pseudopotpath;
|
|---|
| 434 |
|
|---|
| 435 | int DoOutVis;
|
|---|
| 436 | int DoOutMes;
|
|---|
| 437 | int DoOutNICS;
|
|---|
| 438 | int DoOutOrbitals;
|
|---|
| 439 | int DoOutCurrent;
|
|---|
| 440 | int DoFullCurrent;
|
|---|
| 441 | int DoPerturbation;
|
|---|
| 442 | int CommonWannier;
|
|---|
| 443 | double SawtoothStart;
|
|---|
| 444 | int VectorPlane;
|
|---|
| 445 | double VectorCut;
|
|---|
| 446 | int UseAddGramSch;
|
|---|
| 447 | int Seed;
|
|---|
| 448 |
|
|---|
| 449 | int MaxOuterStep;
|
|---|
| 450 | double Deltat;
|
|---|
| 451 | int OutVisStep;
|
|---|
| 452 | int OutSrcStep;
|
|---|
| 453 | double TargetTemp;
|
|---|
| 454 | int ScaleTempStep;
|
|---|
| 455 | int MaxPsiStep;
|
|---|
| 456 | double EpsWannier;
|
|---|
| 457 |
|
|---|
| 458 | int MaxMinStep;
|
|---|
| 459 | double RelEpsTotalEnergy;
|
|---|
| 460 | double RelEpsKineticEnergy;
|
|---|
| 461 | int MaxMinGapStopStep;
|
|---|
| 462 | int MaxInitMinStep;
|
|---|
| 463 | double InitRelEpsTotalEnergy;
|
|---|
| 464 | double InitRelEpsKineticEnergy;
|
|---|
| 465 | int InitMaxMinGapStopStep;
|
|---|
| 466 |
|
|---|
| 467 | //double BoxLength[NDIM*NDIM];
|
|---|
| 468 |
|
|---|
| 469 | double ECut;
|
|---|
| 470 | int MaxLevel;
|
|---|
| 471 | int RiemannTensor;
|
|---|
| 472 | int LevRFactor;
|
|---|
| 473 | int RiemannLevel;
|
|---|
| 474 | int Lev0Factor;
|
|---|
| 475 | int RTActualUse;
|
|---|
| 476 | int AddPsis;
|
|---|
| 477 |
|
|---|
| 478 | double RCut;
|
|---|
| 479 | int StructOpt;
|
|---|
| 480 | int IsAngstroem;
|
|---|
| 481 | int RelativeCoord;
|
|---|
| 482 | int MaxTypes;
|
|---|
| 483 |
|
|---|
| 484 |
|
|---|
| 485 | 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);
|
|---|
| 486 |
|
|---|
| 487 | public:
|
|---|
| 488 | config();
|
|---|
| 489 | ~config();
|
|---|
| 490 |
|
|---|
| 491 | int TestSyntax(char *filename, periodentafel *periode, molecule *mol);
|
|---|
| 492 | void Load(char *filename, periodentafel *periode, molecule *mol);
|
|---|
| 493 | void LoadOld(char *filename, periodentafel *periode, molecule *mol);
|
|---|
| 494 | void RetrieveConfigPathAndName(char *filename);
|
|---|
| 495 | bool Save(ofstream *file, periodentafel *periode, molecule *mol) const;
|
|---|
| 496 | void Edit(molecule *mol);
|
|---|
| 497 | bool GetIsAngstroem() const;
|
|---|
| 498 | char *GetDefaultPath() const;
|
|---|
| 499 | void config::SetDefaultPath(const char *path);
|
|---|
| 500 | };
|
|---|
| 501 |
|
|---|
| 502 | #endif /*MOLECULES_HPP_*/
|
|---|
| 503 |
|
|---|