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