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