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