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