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