[f92d00] | 1 | /** \file molecule.hpp
|
---|
[a0bcf1] | 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 |
|
---|
[17b3a5c] | 11 | /*********************************************** includes ***********************************/
|
---|
| 12 |
|
---|
[a0bcf1] | 13 | // GSL headers
|
---|
[32b6dc] | 14 | #include <gsl/gsl_eigen.h>
|
---|
[a0bcf1] | 15 | #include <gsl/gsl_heapsort.h>
|
---|
[c99adf] | 16 | #include <gsl/gsl_linalg.h>
|
---|
| 17 | #include <gsl/gsl_matrix.h>
|
---|
| 18 | #include <gsl/gsl_multimin.h>
|
---|
| 19 | #include <gsl/gsl_vector.h>
|
---|
[556157] | 20 | #include <gsl/gsl_randist.h>
|
---|
[a0bcf1] | 21 |
|
---|
[eb167d] | 22 | //// STL headers
|
---|
[a0bcf1] | 23 | #include <map>
|
---|
| 24 | #include <set>
|
---|
| 25 | #include <deque>
|
---|
[0a08df] | 26 | #include <list>
|
---|
[67f102] | 27 | #include <vector>
|
---|
[a0bcf1] | 28 |
|
---|
[17b3a5c] | 29 | #include "graph.hpp"
|
---|
[d50d2a] | 30 | #include "stackclass.hpp"
|
---|
[834ff3] | 31 | #include "tesselation.hpp"
|
---|
[6997fa] | 32 | #include "Patterns/Observer.hpp"
|
---|
[a0bcf1] | 33 |
|
---|
[17b3a5c] | 34 | /****************************************** forward declarations *****************************/
|
---|
| 35 |
|
---|
| 36 | class atom;
|
---|
| 37 | class bond;
|
---|
[5f697c] | 38 | class BondedParticle;
|
---|
| 39 | class BondGraph;
|
---|
[17b3a5c] | 40 | class element;
|
---|
| 41 | class ForceMatrix;
|
---|
| 42 | class LinkedCell;
|
---|
[a0bcf1] | 43 | class molecule;
|
---|
[4e4940] | 44 | class MoleculeLeafClass;
|
---|
[a0bcf1] | 45 | class MoleculeListClass;
|
---|
[17b3a5c] | 46 | class periodentafel;
|
---|
| 47 | class Vector;
|
---|
[a0bcf1] | 48 |
|
---|
| 49 | /******************************** Some definitions for easier reading **********************************/
|
---|
| 50 |
|
---|
[eb167d] | 51 | #define MoleculeList list <molecule *>
|
---|
| 52 | #define MoleculeListTest pair <MoleculeList::iterator, bool>
|
---|
| 53 |
|
---|
[dfc1c7] | 54 | #define DistancePair pair < double, atom* >
|
---|
| 55 | #define DistanceMap multimap < double, atom* >
|
---|
| 56 | #define DistanceTestPair pair < DistanceMap::iterator, bool>
|
---|
| 57 |
|
---|
[c830e8e] | 58 |
|
---|
[a0bcf1] | 59 | /************************************* Class definitions ****************************************/
|
---|
| 60 |
|
---|
[104cf4] | 61 | /** Structure to contain parameters needed for evaluation of constraint potential.
|
---|
| 62 | */
|
---|
| 63 | struct EvaluatePotential
|
---|
| 64 | {
|
---|
| 65 | int startstep; //!< start configuration (MDStep in atom::trajectory)
|
---|
| 66 | int endstep; //!< end configuration (MDStep in atom::trajectory)
|
---|
| 67 | atom **PermutationMap; //!< gives target ptr for each atom, array of size molecule::AtomCount (this is "x" in \f$ V^{con}(x) \f$ )
|
---|
| 68 | DistanceMap **DistanceList; //!< distance list of each atom to each atom
|
---|
| 69 | DistanceMap::iterator *StepList; //!< iterator to ascend through NearestNeighbours \a **DistanceList
|
---|
| 70 | int *DoubleList; //!< count of which sources want to move to this target, basically the injective measure (>1 -> not injective)
|
---|
| 71 | DistanceMap::iterator *DistanceIterators; //!< marks which was the last picked target as injective candidate with smallest distance
|
---|
| 72 | bool IsAngstroem; //!< whether coordinates are in angstroem (true) or bohrradius (false)
|
---|
| 73 | double *PenaltyConstants; //!< penalty constant in front of each term
|
---|
| 74 | };
|
---|
[a0bcf1] | 75 |
|
---|
[556157] | 76 | #define MaxThermostats 6 //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
|
---|
| 77 | enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover }; //!< Thermostat names for output
|
---|
| 78 |
|
---|
| 79 |
|
---|
[a0bcf1] | 80 | /** The complete molecule.
|
---|
| 81 | * Class incorporates number of types
|
---|
| 82 | */
|
---|
[834ff3] | 83 | class molecule : public PointCloud {
|
---|
[a048fa] | 84 | public:
|
---|
| 85 | double cell_size[6];//!< cell size
|
---|
[df0520] | 86 | const periodentafel * const elemente; //!< periodic table with each element
|
---|
[a048fa] | 87 | atom *start; //!< start of atom list
|
---|
| 88 | atom *end; //!< end of atom list
|
---|
| 89 | bond *first; //!< start of bond list
|
---|
| 90 | bond *last; //!< end of bond list
|
---|
| 91 | int MDSteps; //!< The number of MD steps in Trajectories
|
---|
| 92 | int AtomCount; //!< number of atoms, brought up-to-date by CountAtoms()
|
---|
| 93 | int BondCount; //!< number of atoms, brought up-to-date by CountBonds()
|
---|
| 94 | int ElementCount; //!< how many unique elements are therein
|
---|
| 95 | int ElementsInMolecule[MAX_ELEMENTS]; //!< list whether element (sorted by atomic number) is alread present or not
|
---|
[df0520] | 96 | mutable int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule
|
---|
| 97 | mutable int NoNonBonds; //!< number of non-hydrogen bonds in molecule
|
---|
| 98 | mutable int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
|
---|
[a048fa] | 99 | double BondDistance; //!< typical bond distance used in CreateAdjacencyList() and furtheron
|
---|
| 100 | bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules
|
---|
| 101 | Vector Center; //!< Center of molecule in a global box
|
---|
| 102 | char name[MAXSTRINGSIZE]; //!< arbitrary name
|
---|
| 103 | int IndexNr; //!< index of molecule in a MoleculeListClass
|
---|
| 104 |
|
---|
[df0520] | 105 | molecule(const periodentafel * const teil);
|
---|
[f4a346] | 106 | virtual ~molecule();
|
---|
[a048fa] | 107 |
|
---|
[834ff3] | 108 | // re-definition of virtual functions from PointCloud
|
---|
[cc9225] | 109 | const char * const GetName() const;
|
---|
[543ce4] | 110 | Vector *GetCenter() const ;
|
---|
[a9b2a0a] | 111 | TesselPoint *GetPoint() const ;
|
---|
| 112 | TesselPoint *GetTerminalPoint() const ;
|
---|
[ff4611] | 113 | int GetMaxId() const;
|
---|
[a9b2a0a] | 114 | void GoToNext() const ;
|
---|
| 115 | void GoToPrevious() const ;
|
---|
| 116 | void GoToFirst() const ;
|
---|
| 117 | void GoToLast() const ;
|
---|
| 118 | bool IsEmpty() const ;
|
---|
| 119 | bool IsEnd() const ;
|
---|
[a048fa] | 120 |
|
---|
[4bc937] | 121 | // templates for allowing global manipulation of all vectors
|
---|
[8ffe32] | 122 | template <typename res> void ActOnAllVectors( res (Vector::*f)() ) const;
|
---|
[3efb4a] | 123 | template <typename res> void ActOnAllVectors( res (Vector::*f)() const) const;
|
---|
[8ffe32] | 124 | template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T), T t ) const;
|
---|
[3efb4a] | 125 | template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T) const, T t ) const;
|
---|
[8ffe32] | 126 | template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const;
|
---|
[3efb4a] | 127 | template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const;
|
---|
[8ffe32] | 128 | template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const;
|
---|
[3efb4a] | 129 | template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const;
|
---|
[8ffe32] | 130 |
|
---|
| 131 | // templates for allowing global manipulation of molecule with each atom as single argument
|
---|
| 132 | template <typename res> void ActWithEachAtom( res (molecule::*f)(atom *) ) const;
|
---|
[3efb4a] | 133 | template <typename res> void ActWithEachAtom( res (molecule::*f)(atom *) const) const;
|
---|
[8ffe32] | 134 |
|
---|
| 135 | // templates for allowing global copying of molecule with each atom as single argument
|
---|
| 136 | template <typename res> void ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const;
|
---|
[3efb4a] | 137 | template <typename res> void ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const;
|
---|
[4bc937] | 138 |
|
---|
[f92d00] | 139 | // templates for allowing global manipulation of all atoms
|
---|
[6b937bd] | 140 | template <typename res, typename typ> void ActOnAllAtoms( res (typ::*f)() ) const;
|
---|
| 141 | template <typename res, typename typ> void ActOnAllAtoms( res (typ::*f)() const) const;
|
---|
| 142 | template <typename res, typename typ, typename T> void ActOnAllAtoms( res (typ::*f)(T), T t ) const;
|
---|
| 143 | template <typename res, typename typ, typename T> void ActOnAllAtoms( res (typ::*f)(T) const, T t ) const;
|
---|
| 144 | template <typename res, typename typ, typename T, typename U> void ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const;
|
---|
| 145 | template <typename res, typename typ, typename T, typename U> void ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const;
|
---|
| 146 | template <typename res, typename typ, typename T, typename U, typename V> void ActOnAllAtoms( res (typ::*f)(T, U, V), T t, U u, V v) const;
|
---|
| 147 | template <typename res, typename typ, typename T, typename U, typename V> void ActOnAllAtoms( res (typ::*f)(T, U, V) const, T t, U u, V v) const;
|
---|
| 148 | template <typename res, typename typ, typename T, typename U, typename V, typename W> void ActOnAllAtoms( res (typ::*f)(T, U, V, W), T t, U u, V v, W w) const;
|
---|
| 149 | template <typename res, typename typ, typename T, typename U, typename V, typename W> void ActOnAllAtoms( res (typ::*f)(T, U, V, W) const, T t, U u, V v, W w) const;
|
---|
[8ffe32] | 150 |
|
---|
| 151 | // templates for allowing conditional global copying of molecule with each atom as single argument
|
---|
[94d0ad] | 152 | template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const;
|
---|
| 153 | template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () const ) const;
|
---|
| 154 | template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () ) const;
|
---|
| 155 | template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () const ) const;
|
---|
| 156 | template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const;
|
---|
| 157 | template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T) const, T t ) const;
|
---|
| 158 | template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T), T t ) const;
|
---|
| 159 | template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T) const, T t ) const;
|
---|
| 160 | template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const;
|
---|
| 161 | template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const;
|
---|
| 162 | template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const;
|
---|
| 163 | template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const;
|
---|
| 164 | template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const;
|
---|
| 165 | template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const;
|
---|
| 166 | template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const;
|
---|
| 167 | template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const;
|
---|
[8ffe32] | 168 |
|
---|
| 169 | // templates for allowing global manipulation of an array with one entry per atom
|
---|
[94d0ad] | 170 | void SetIndexedArrayForEachAtomTo ( atom **array, int ParticleInfo::* index) const;
|
---|
| 171 | template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::* index, void (*Setor)(T *, T *)) const;
|
---|
| 172 | template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::* index, void (*Setor)(T *, T *), T t) const;
|
---|
| 173 | template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::* index, void (*Setor)(T *, T *), T *t) const;
|
---|
| 174 | template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int element::* index, void (*Setor)(T *, T *)) const;
|
---|
| 175 | template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int element::* index, void (*Setor)(T *, T *), T t) const;
|
---|
| 176 | template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int element::* index, void (*Setor)(T *, T *), T *t) const;
|
---|
| 177 | template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value) const;
|
---|
| 178 | template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ atom::*value) const;
|
---|
| 179 | template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const;
|
---|
| 180 | template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ &vect ) const;
|
---|
[f92d00] | 181 |
|
---|
[ff9879] | 182 | // templates for allowing global manipulation of each atom by entries in an array
|
---|
[94d0ad] | 183 | template <typename T, typename typ, typename typ2> void SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*value ) const;
|
---|
| 184 | template <typename T, typename typ> void SetAtomValueToValue ( T value, T typ::*ptr ) const;
|
---|
[6b937bd] | 185 |
|
---|
| 186 | template <typename res, typename typ> res SumPerAtom(res (typ::*f)() ) const;
|
---|
| 187 | template <typename res, typename typ> res SumPerAtom(res (typ::*f)() const ) const;
|
---|
| 188 | template <typename res, typename typ, typename T> res SumPerAtom(res (typ::*f)(T) , T t ) const;
|
---|
| 189 | template <typename res, typename typ, typename T> res SumPerAtom(res (typ::*f)(T) const, T t ) const;
|
---|
[872b51] | 190 |
|
---|
[a048fa] | 191 | /// remove atoms from molecule.
|
---|
| 192 | bool AddAtom(atom *pointer);
|
---|
| 193 | bool RemoveAtom(atom *pointer);
|
---|
| 194 | bool UnlinkAtom(atom *pointer);
|
---|
| 195 | bool CleanupMolecule();
|
---|
| 196 |
|
---|
| 197 | /// Add/remove atoms to/from molecule.
|
---|
| 198 | atom * AddCopyAtom(atom *pointer);
|
---|
| 199 | bool AddXYZFile(string filename);
|
---|
[543ce4] | 200 | bool AddHydrogenReplacementAtom(bond *Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bool IsAngstroem);
|
---|
[f92d00] | 201 | bond * AddBond(atom *first, atom *second, int degree = 1);
|
---|
[a048fa] | 202 | bool RemoveBond(bond *pointer);
|
---|
| 203 | bool RemoveBonds(atom *BondPartner);
|
---|
| 204 |
|
---|
| 205 | /// Find atoms.
|
---|
| 206 | atom * FindAtom(int Nr) const;
|
---|
| 207 | atom * AskAtom(string text);
|
---|
| 208 |
|
---|
| 209 | /// Count and change present atoms' coordination.
|
---|
[543ce4] | 210 | void CountAtoms();
|
---|
[a048fa] | 211 | void CountElements();
|
---|
| 212 | void CalculateOrbitals(class config &configuration);
|
---|
[543ce4] | 213 | bool CenterInBox();
|
---|
| 214 | bool BoundInBox();
|
---|
| 215 | void CenterEdge(Vector *max);
|
---|
| 216 | void CenterOrigin();
|
---|
| 217 | void CenterPeriodic();
|
---|
| 218 | void CenterAtVector(Vector *newcenter);
|
---|
[a048fa] | 219 | void Translate(const Vector *x);
|
---|
| 220 | void TranslatePeriodically(const Vector *trans);
|
---|
| 221 | void Mirror(const Vector *x);
|
---|
| 222 | void Align(Vector *n);
|
---|
[a9b2a0a] | 223 | void Scale(const double ** const factor);
|
---|
[1b2aa1] | 224 | void DeterminePeriodicCenter(Vector ¢er);
|
---|
[543ce4] | 225 | Vector * DetermineCenterOfGravity();
|
---|
| 226 | Vector * DetermineCenterOfAll() const;
|
---|
[1b2aa1] | 227 | void SetNameFromFilename(const char *filename);
|
---|
[a048fa] | 228 | void SetBoxDimension(Vector *dim);
|
---|
[543ce4] | 229 | void ScanForPeriodicCorrection();
|
---|
| 230 | bool VerletForceIntegration(char *file, config &configuration);
|
---|
[556157] | 231 | void Thermostats(config &configuration, double ActualTemp, int Thermostat);
|
---|
[543ce4] | 232 | void PrincipalAxisSystem(bool DoRotate);
|
---|
| 233 | double VolumeOfConvexEnvelope(bool IsAngstroem);
|
---|
[a048fa] | 234 |
|
---|
[543ce4] | 235 | double ConstrainedPotential(struct EvaluatePotential &Params);
|
---|
| 236 | double MinimiseConstrainedPotential(atom **&permutation, int startstep, int endstep, bool IsAngstroem);
|
---|
| 237 | void EvaluateConstrainedForces(int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force);
|
---|
| 238 | bool LinearInterpolationBetweenConfiguration(int startstep, int endstep, const char *prefix, config &configuration, bool MapByIdentity);
|
---|
[32b6dc] | 239 |
|
---|
[a048fa] | 240 | bool CheckBounds(const Vector *x) const;
|
---|
| 241 | void GetAlignvector(struct lsq_params * par) const;
|
---|
| 242 |
|
---|
| 243 | /// Initialising routines in fragmentation
|
---|
[543ce4] | 244 | void CreateAdjacencyListFromDbondFile(ifstream *output);
|
---|
| 245 | void CreateAdjacencyList(double bonddistance, bool IsAngstroem, void (BondGraph::*f)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG = NULL);
|
---|
| 246 | int CorrectBondDegree() const;
|
---|
| 247 | void OutputBondsList() const;
|
---|
[df0520] | 248 | void CyclicBondAnalysis() const;
|
---|
[543ce4] | 249 | void OutputGraphInfoPerAtom() const;
|
---|
| 250 | void OutputGraphInfoPerBond() const;
|
---|
[b0ee98] | 251 |
|
---|
[a048fa] | 252 |
|
---|
| 253 | // Graph analysis
|
---|
[543ce4] | 254 | MoleculeLeafClass * DepthFirstSearchAnalysis(class StackClass<bond *> *&BackEdgeStack) const;
|
---|
| 255 | void CyclicStructureAnalysis(class StackClass<bond *> *BackEdgeStack, int *&MinimumRingSize) const;
|
---|
| 256 | bool PickLocalBackEdges(atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack) const;
|
---|
[df0520] | 257 | bond * FindNextUnused(atom *vertex) const;
|
---|
| 258 | void SetNextComponentNumber(atom *vertex, int nr) const;
|
---|
| 259 | void ResetAllBondsToUnused() const;
|
---|
[543ce4] | 260 | int CountCyclicBonds();
|
---|
| 261 | bool CheckForConnectedSubgraph(KeySet *Fragment);
|
---|
[df0520] | 262 | string GetColor(enum Shading color) const;
|
---|
[872b51] | 263 | bond * CopyBond(atom *left, atom *right, bond *CopyBond);
|
---|
| 264 |
|
---|
[a048fa] | 265 |
|
---|
| 266 | molecule *CopyMolecule();
|
---|
[94d0ad] | 267 | molecule* CopyMoleculeFromSubRegion(const Vector offset, const double *parallelepiped) const;
|
---|
[a048fa] | 268 |
|
---|
| 269 | /// Fragment molecule by two different approaches:
|
---|
[543ce4] | 270 | int FragmentMolecule(int Order, config *configuration);
|
---|
| 271 | bool CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
|
---|
| 272 | bool StoreAdjacencyToFile(char *path);
|
---|
| 273 | bool CheckAdjacencyFileAgainstMolecule(char *path, atom **ListOfAtoms);
|
---|
| 274 | bool ParseOrderAtSiteFromFile(char *path);
|
---|
| 275 | bool StoreOrderAtSiteFile(char *path);
|
---|
| 276 | bool StoreForcesFile(MoleculeListClass *BondFragments, char *path, int *SortIndex);
|
---|
| 277 | bool CreateMappingLabelsToConfigSequence(int *&SortIndex);
|
---|
| 278 | void BreadthFirstSearchAdd(molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
|
---|
[a048fa] | 279 | /// -# BOSSANOVA
|
---|
[543ce4] | 280 | void FragmentBOSSANOVA(Graph *&FragmentList, KeyStack &RootStack, int *MinimumRingSize);
|
---|
| 281 | int PowerSetGenerator(int Order, struct UniqueFragments &FragmentSearch, KeySet RestrictedKeySet);
|
---|
| 282 | bool BuildInducedSubgraph(const molecule *Father);
|
---|
| 283 | molecule * StoreFragmentFromKeySet(KeySet &Leaflet, bool IsAngstroem);
|
---|
| 284 | void SPFragmentGenerator(struct UniqueFragments *FragmentSearch, int RootDistance, bond **BondsSet, int SetDimension, int SubOrder);
|
---|
| 285 | int LookForRemovalCandidate(KeySet *&Leaf, int *&ShortestPathList);
|
---|
| 286 | int GuesstimateFragmentCount(int order);
|
---|
[a048fa] | 287 |
|
---|
| 288 | // Recognize doubly appearing molecules in a list of them
|
---|
[543ce4] | 289 | int * IsEqualToWithinThreshold(molecule *OtherMolecule, double threshold);
|
---|
| 290 | int * GetFatherSonAtomicMap(molecule *OtherMolecule);
|
---|
[a048fa] | 291 |
|
---|
| 292 | // Output routines.
|
---|
[543ce4] | 293 | bool Output(ofstream * const output);
|
---|
| 294 | bool OutputTrajectories(ofstream * const output);
|
---|
| 295 | void OutputListOfBonds() const;
|
---|
| 296 | bool OutputXYZ(ofstream * const output) const;
|
---|
| 297 | bool OutputTrajectoriesXYZ(ofstream * const output);
|
---|
| 298 | bool Checkout(ofstream * const output) const;
|
---|
| 299 | bool OutputTemperatureFromTrajectories(ofstream * const output, int startstep, int endstep);
|
---|
[a048fa] | 300 |
|
---|
[f00f02] | 301 | // Manipulation routines
|
---|
| 302 | void flipActiveFlag();
|
---|
| 303 |
|
---|
[a048fa] | 304 | private:
|
---|
| 305 | int last_atom; //!< number given to last atom
|
---|
[a9b2a0a] | 306 | mutable atom *InternalPointer; //!< internal pointer for PointCloud
|
---|
[a0bcf1] | 307 | };
|
---|
| 308 |
|
---|
[8ffe32] | 309 | #include "molecule_template.hpp"
|
---|
[4bc937] | 310 |
|
---|
[a0bcf1] | 311 | /** A list of \a molecule classes.
|
---|
| 312 | */
|
---|
[6997fa] | 313 | class MoleculeListClass : public Observable {
|
---|
[a048fa] | 314 | public:
|
---|
| 315 | MoleculeList ListOfMolecules; //!< List of the contained molecules
|
---|
| 316 | int MaxIndex;
|
---|
| 317 |
|
---|
| 318 | MoleculeListClass();
|
---|
| 319 | ~MoleculeListClass();
|
---|
| 320 |
|
---|
[543ce4] | 321 | bool AddHydrogenCorrection(char *path);
|
---|
| 322 | bool StoreForcesFile(char *path, int *SortIndex);
|
---|
[1b2aa1] | 323 | void insert(molecule *mol);
|
---|
[a048fa] | 324 | molecule * ReturnIndex(int index);
|
---|
[543ce4] | 325 | bool OutputConfigForListOfFragments(config *configuration, int *SortIndex);
|
---|
[a048fa] | 326 | int NumberOfActiveMolecules();
|
---|
| 327 | void Enumerate(ofstream *out);
|
---|
| 328 | void Output(ofstream *out);
|
---|
[478683] | 329 | void DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration);
|
---|
[486aa5] | 330 | int CountAllAtoms() const;
|
---|
[a048fa] | 331 |
|
---|
[f48622] | 332 | // Methods moved here from the menus
|
---|
| 333 | // TODO: more refactoring needed on these methods
|
---|
[fab853] | 334 | void flipChosen();
|
---|
[f48622] | 335 | void createNewMolecule(periodentafel *periode);
|
---|
| 336 | void loadFromXYZ(periodentafel *periode);
|
---|
| 337 | void changeName();
|
---|
| 338 | void setMoleculeFilename();
|
---|
| 339 | void parseXYZIntoMolecule();
|
---|
| 340 | void eraseMolecule();
|
---|
| 341 |
|
---|
[fab853] | 342 |
|
---|
[a048fa] | 343 | // merging of molecules
|
---|
[c830e8e] | 344 | bool SimpleMerge(molecule *mol, molecule *srcmol);
|
---|
| 345 | bool SimpleAdd(molecule *mol, molecule *srcmol);
|
---|
| 346 | bool SimpleMultiMerge(molecule *mol, int *src, int N);
|
---|
| 347 | bool SimpleMultiAdd(molecule *mol, int *src, int N);
|
---|
| 348 | bool ScatterMerge(molecule *mol, int *src, int N);
|
---|
| 349 | bool EmbedMerge(molecule *mol, molecule *srcmol);
|
---|
| 350 |
|
---|
[a048fa] | 351 | private:
|
---|
[a0bcf1] | 352 | };
|
---|
| 353 |
|
---|
| 354 |
|
---|
| 355 | /** A leaf for a tree of \a molecule class
|
---|
| 356 | * Wraps molecules in a tree structure
|
---|
| 357 | */
|
---|
| 358 | class MoleculeLeafClass {
|
---|
[a048fa] | 359 | public:
|
---|
| 360 | molecule *Leaf; //!< molecule of this leaf
|
---|
| 361 | //MoleculeLeafClass *UpLeaf; //!< Leaf one level up
|
---|
| 362 | //MoleculeLeafClass *DownLeaf; //!< First leaf one level down
|
---|
| 363 | MoleculeLeafClass *previous; //!< Previous leaf on this level
|
---|
| 364 | MoleculeLeafClass *next; //!< Next leaf on this level
|
---|
| 365 |
|
---|
| 366 | //MoleculeLeafClass(MoleculeLeafClass *Up, MoleculeLeafClass *Previous);
|
---|
| 367 | MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf);
|
---|
| 368 | ~MoleculeLeafClass();
|
---|
| 369 |
|
---|
| 370 | bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous);
|
---|
[543ce4] | 371 | bool FillBondStructureFromReference(const molecule * const reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList = false);
|
---|
| 372 | bool FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter);
|
---|
| 373 | bool AssignKeySetsToFragment(molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);
|
---|
| 374 | bool FillListOfLocalAtoms(atom ***&ListOfLocalAtoms, const int FragmentCounter, const int GlobalAtomCount, bool &FreeList);
|
---|
| 375 | void TranslateIndicesToGlobalIDs(Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph);
|
---|
[a048fa] | 376 | int Count() const;
|
---|
[a0bcf1] | 377 | };
|
---|
| 378 |
|
---|
[88b936] | 379 |
|
---|
[a0bcf1] | 380 | #endif /*MOLECULES_HPP_*/
|
---|
| 381 |
|
---|