| [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 | 
 | 
|---|
| [f66195] | 9 | /*********************************************** includes ***********************************/
 | 
|---|
 | 10 | 
 | 
|---|
| [962d8d] | 11 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 12 | #include <config.h>
 | 
|---|
 | 13 | #endif
 | 
|---|
 | 14 | 
 | 
|---|
| [edb93c] | 15 | //// STL headers
 | 
|---|
| [14de469] | 16 | #include <map>
 | 
|---|
 | 17 | #include <set>
 | 
|---|
 | 18 | #include <deque>
 | 
|---|
| [d7e30c] | 19 | #include <list>
 | 
|---|
| [5e0d1f] | 20 | #include <vector>
 | 
|---|
| [14de469] | 21 | 
 | 
|---|
| [520c8b] | 22 | #include <string>
 | 
|---|
 | 23 | 
 | 
|---|
| [68d781] | 24 | #include "types.hpp"
 | 
|---|
| [f66195] | 25 | #include "graph.hpp"
 | 
|---|
| [357fba] | 26 | #include "tesselation.hpp"
 | 
|---|
| [d5f216] | 27 | #include "Patterns/Observer.hpp"
 | 
|---|
| [bd58fb] | 28 | #include "Patterns/ObservedIterator.hpp"
 | 
|---|
| [ac9b56] | 29 | #include "Patterns/Cacheable.hpp"
 | 
|---|
| [14de469] | 30 | 
 | 
|---|
| [97ebf8] | 31 | #include "Descriptors/MoleculeDescriptor_impl.hpp"
 | 
|---|
 | 32 | 
 | 
|---|
| [f66195] | 33 | /****************************************** forward declarations *****************************/
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | class atom;
 | 
|---|
 | 36 | class bond;
 | 
|---|
| [b70721] | 37 | class BondedParticle;
 | 
|---|
 | 38 | class BondGraph;
 | 
|---|
| [f66195] | 39 | class element;
 | 
|---|
 | 40 | class ForceMatrix;
 | 
|---|
 | 41 | class LinkedCell;
 | 
|---|
| [14de469] | 42 | class molecule;
 | 
|---|
| [2319ed] | 43 | class MoleculeLeafClass;
 | 
|---|
| [14de469] | 44 | class MoleculeListClass;
 | 
|---|
| [f66195] | 45 | class periodentafel;
 | 
|---|
 | 46 | class Vector;
 | 
|---|
| [c550dd] | 47 | class Shape;
 | 
|---|
| [36166d] | 48 | template <class> class StackClass;
 | 
|---|
| [14de469] | 49 | 
 | 
|---|
 | 50 | /******************************** Some definitions for easier reading **********************************/
 | 
|---|
 | 51 | 
 | 
|---|
| [edb93c] | 52 | #define MoleculeList list <molecule *>
 | 
|---|
 | 53 | #define MoleculeListTest pair <MoleculeList::iterator, bool>
 | 
|---|
 | 54 | 
 | 
|---|
| [ed060e] | 55 | #define DistancePair pair < double, atom* >
 | 
|---|
 | 56 | #define DistanceMap multimap < double, atom* >
 | 
|---|
 | 57 | #define DistanceTestPair pair < DistanceMap::iterator, bool>
 | 
|---|
 | 58 | 
 | 
|---|
| [1907a7] | 59 | 
 | 
|---|
| [14de469] | 60 | /************************************* Class definitions ****************************************/
 | 
|---|
 | 61 | 
 | 
|---|
| [ccd9f5] | 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 | };
 | 
|---|
| [14de469] | 76 | 
 | 
|---|
 | 77 | /** The complete molecule.
 | 
|---|
 | 78 |  * Class incorporates number of types
 | 
|---|
 | 79 |  */
 | 
|---|
| [520c8b] | 80 | class molecule : public PointCloud , public Observable {
 | 
|---|
| [cbc5fb] | 81 |   friend molecule *NewMolecule();
 | 
|---|
 | 82 |   friend void DeleteMolecule(molecule *);
 | 
|---|
| [bd58fb] | 83 | 
 | 
|---|
| [042f82] | 84 |   public:
 | 
|---|
| [274d45] | 85 |     typedef std::list<atom*> atomSet;
 | 
|---|
 | 86 |     typedef std::set<atomId_t> atomIdSet;
 | 
|---|
| [bd58fb] | 87 |     typedef ObservedIterator<atomSet> iterator;
 | 
|---|
 | 88 |     typedef atomSet::const_iterator const_iterator;
 | 
|---|
| [d3347e] | 89 | 
 | 
|---|
| [fa649a] | 90 |     const periodentafel * const elemente; //!< periodic table with each element
 | 
|---|
| [bd58fb] | 91 |     // old deprecated atom handling
 | 
|---|
| [e87acf] | 92 |     //atom *start;        //!< start of atom list
 | 
|---|
 | 93 |     //atom *end;          //!< end of atom list
 | 
|---|
| [e08c46] | 94 |     //bond *first;        //!< start of bond list
 | 
|---|
 | 95 |     //bond *last;         //!< end of bond list
 | 
|---|
| [042f82] | 96 |     int MDSteps;        //!< The number of MD steps in Trajectories
 | 
|---|
| [ea7176] | 97 |     //int AtomCount;          //!< number of atoms, brought up-to-date by CountAtoms()
 | 
|---|
| [042f82] | 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
 | 
|---|
| [fa649a] | 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()
 | 
|---|
| [042f82] | 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
 | 
|---|
| [520c8b] | 108 |     char name[MAXSTRINGSIZE];         //!< arbitrary name
 | 
|---|
| [042f82] | 109 | 
 | 
|---|
| [ac9b56] | 110 |   private:
 | 
|---|
 | 111 |     Cacheable<string> formula;
 | 
|---|
| [ea7176] | 112 |     Cacheable<int>    AtomCount;
 | 
|---|
| [cbc5fb] | 113 |     moleculeId_t id;
 | 
|---|
| [274d45] | 114 |     atomSet atoms; //<!list of atoms
 | 
|---|
 | 115 |     atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms
 | 
|---|
| [cbc5fb] | 116 |   protected:
 | 
|---|
| [ea7176] | 117 |     //void CountAtoms();
 | 
|---|
| [d3347e] | 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 | 
 | 
|---|
| [cbc5fb] | 125 |     molecule(const periodentafel * const teil);
 | 
|---|
 | 126 |     virtual ~molecule();
 | 
|---|
| [ac9b56] | 127 | 
 | 
|---|
| [042f82] | 128 | 
 | 
|---|
| [cbc5fb] | 129 | public:
 | 
|---|
| [520c8b] | 130 |   //getter and setter
 | 
|---|
 | 131 |   const std::string getName();
 | 
|---|
| [ea7176] | 132 |   int getAtomCount() const;
 | 
|---|
 | 133 |   int doCountAtoms();
 | 
|---|
| [cbc5fb] | 134 |   moleculeId_t getId();
 | 
|---|
 | 135 |   void setId(moleculeId_t);
 | 
|---|
| [520c8b] | 136 |   void setName(const std::string);
 | 
|---|
| [ac9b56] | 137 |   const std::string getFormula();
 | 
|---|
 | 138 |   std::string calcFormula();
 | 
|---|
| [520c8b] | 139 | 
 | 
|---|
| [bd58fb] | 140 |   iterator begin();
 | 
|---|
 | 141 |   const_iterator begin() const;
 | 
|---|
| [e87acf] | 142 |   iterator end();
 | 
|---|
 | 143 |   const_iterator end() const;
 | 
|---|
| [9879f6] | 144 |   bool empty() const;
 | 
|---|
 | 145 |   size_t size() const;
 | 
|---|
 | 146 |   const_iterator erase( const_iterator loc );
 | 
|---|
| [6cfa36] | 147 |   const_iterator erase( atom * key );
 | 
|---|
 | 148 |   const_iterator find (  atom * key ) const;
 | 
|---|
| [9879f6] | 149 |   pair<iterator,bool> insert ( atom * const key );
 | 
|---|
| [6cfa36] | 150 |   bool containsAtom(atom* key);
 | 
|---|
| [bd58fb] | 151 | 
 | 
|---|
| [cbc5fb] | 152 | 
 | 
|---|
| [357fba] | 153 |   // re-definition of virtual functions from PointCloud
 | 
|---|
| [6a7f78c] | 154 |   const char * const GetName() const;
 | 
|---|
| [e138de] | 155 |   Vector *GetCenter() const ;
 | 
|---|
| [776b64] | 156 |   TesselPoint *GetPoint() const ;
 | 
|---|
| [71b20e] | 157 |   int GetMaxId() const;
 | 
|---|
| [776b64] | 158 |   void GoToNext() const ;
 | 
|---|
 | 159 |   void GoToFirst() const ;
 | 
|---|
 | 160 |   bool IsEmpty() const ;
 | 
|---|
 | 161 |   bool IsEnd() const ;
 | 
|---|
| [042f82] | 162 | 
 | 
|---|
| [33f9f7] | 163 |   // templates for allowing global manipulation of all vectors
 | 
|---|
| [e9f8f9] | 164 |   template <typename res> void ActOnAllVectors( res (Vector::*f)() ) const;
 | 
|---|
| [49f802c] | 165 |   template <typename res> void ActOnAllVectors( res (Vector::*f)() const) const;
 | 
|---|
| [e9f8f9] | 166 |   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T), T t ) const;
 | 
|---|
| [49f802c] | 167 |   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T) const, T t ) const;
 | 
|---|
| [273382] | 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;
 | 
|---|
| [e9f8f9] | 170 |   template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const;
 | 
|---|
| [49f802c] | 171 |   template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const;
 | 
|---|
| [e9f8f9] | 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;
 | 
|---|
| [49f802c] | 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;
 | 
|---|
| [e9f8f9] | 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;
 | 
|---|
| [49f802c] | 177 |   template <typename res> void ActWithEachAtom( res (molecule::*f)(atom *) const) const;
 | 
|---|
| [e9f8f9] | 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;
 | 
|---|
| [49f802c] | 181 |   template <typename res> void ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const;
 | 
|---|
| [33f9f7] | 182 | 
 | 
|---|
| [cee0b57] | 183 |   // templates for allowing global manipulation of all atoms
 | 
|---|
| [4455f4] | 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;
 | 
|---|
| [e9f8f9] | 194 | 
 | 
|---|
 | 195 |   // templates for allowing conditional global copying of molecule with each atom as single argument
 | 
|---|
| [b453f9] | 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;
 | 
|---|
| [e9f8f9] | 212 | 
 | 
|---|
 | 213 |   // templates for allowing global manipulation of an array with one entry per atom
 | 
|---|
| [b453f9] | 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;
 | 
|---|
| [cee0b57] | 225 | 
 | 
|---|
| [5034e1] | 226 |   // templates for allowing global manipulation of each atom by entries in an array
 | 
|---|
| [b453f9] | 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;
 | 
|---|
| [4455f4] | 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;
 | 
|---|
| [266237] | 234 | 
 | 
|---|
| [042f82] | 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);
 | 
|---|
| [e138de] | 244 |   bool AddHydrogenReplacementAtom(bond *Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bool IsAngstroem);
 | 
|---|
| [cee0b57] | 245 |   bond * AddBond(atom *first, atom *second, int degree = 1);
 | 
|---|
| [042f82] | 246 |   bool RemoveBond(bond *pointer);
 | 
|---|
 | 247 |   bool RemoveBonds(atom *BondPartner);
 | 
|---|
| [e08c46] | 248 |   bool hasBondStructure();
 | 
|---|
 | 249 |   unsigned int CountBonds() const;
 | 
|---|
| [042f82] | 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();
 | 
|---|
| [e138de] | 257 |   bool CenterInBox();
 | 
|---|
 | 258 |   bool BoundInBox();
 | 
|---|
 | 259 |   void CenterEdge(Vector *max);
 | 
|---|
 | 260 |   void CenterOrigin();
 | 
|---|
 | 261 |   void CenterPeriodic();
 | 
|---|
 | 262 |   void CenterAtVector(Vector *newcenter);
 | 
|---|
| [042f82] | 263 |   void Translate(const Vector *x);
 | 
|---|
 | 264 |   void TranslatePeriodically(const Vector *trans);
 | 
|---|
 | 265 |   void Mirror(const Vector *x);
 | 
|---|
 | 266 |   void Align(Vector *n);
 | 
|---|
| [776b64] | 267 |   void Scale(const double ** const factor);
 | 
|---|
| [437922] | 268 |   void DeterminePeriodicCenter(Vector ¢er);
 | 
|---|
| [e138de] | 269 |   Vector * DetermineCenterOfGravity();
 | 
|---|
 | 270 |   Vector * DetermineCenterOfAll() const;
 | 
|---|
| [eddea2] | 271 |   Vector * DetermineCenterOfBox() const;
 | 
|---|
| [437922] | 272 |   void SetNameFromFilename(const char *filename);
 | 
|---|
| [042f82] | 273 |   void SetBoxDimension(Vector *dim);
 | 
|---|
| [e138de] | 274 |   void ScanForPeriodicCorrection();
 | 
|---|
| [ef7d30] | 275 |   bool VerletForceIntegration(char *file, config &configuration, const size_t offset);
 | 
|---|
| [62f793] | 276 |   void Thermostats(config &configuration, double ActualTemp, int Thermostat);
 | 
|---|
| [e138de] | 277 |   void PrincipalAxisSystem(bool DoRotate);
 | 
|---|
 | 278 |   double VolumeOfConvexEnvelope(bool IsAngstroem);
 | 
|---|
| [042f82] | 279 | 
 | 
|---|
| [e138de] | 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);
 | 
|---|
| [35b698] | 283 |   bool LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string &prefix, config &configuration, bool MapByIdentity);
 | 
|---|
| [d52ea1b] | 284 |         
 | 
|---|
| [042f82] | 285 |   bool CheckBounds(const Vector *x) const;
 | 
|---|
 | 286 |   void GetAlignvector(struct lsq_params * par) const;
 | 
|---|
 | 287 | 
 | 
|---|
 | 288 |   /// Initialising routines in fragmentation
 | 
|---|
| [e138de] | 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;
 | 
|---|
| [fa649a] | 293 |   void CyclicBondAnalysis() const;
 | 
|---|
| [e138de] | 294 |   void OutputGraphInfoPerAtom() const;
 | 
|---|
 | 295 |   void OutputGraphInfoPerBond() const;
 | 
|---|
| [b8b75d] | 296 | 
 | 
|---|
| [042f82] | 297 | 
 | 
|---|
 | 298 |   // Graph analysis
 | 
|---|
| [e138de] | 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;
 | 
|---|
| [fa649a] | 302 |   bond * FindNextUnused(atom *vertex) const;
 | 
|---|
 | 303 |   void SetNextComponentNumber(atom *vertex, int nr) const;
 | 
|---|
 | 304 |   void ResetAllBondsToUnused() const;
 | 
|---|
| [e138de] | 305 |   int CountCyclicBonds();
 | 
|---|
 | 306 |   bool CheckForConnectedSubgraph(KeySet *Fragment);
 | 
|---|
| [fa649a] | 307 |   string GetColor(enum Shading color) const;
 | 
|---|
| [266237] | 308 |   bond * CopyBond(atom *left, atom *right, bond *CopyBond);
 | 
|---|
 | 309 | 
 | 
|---|
| [042f82] | 310 | 
 | 
|---|
 | 311 |   molecule *CopyMolecule();
 | 
|---|
| [c550dd] | 312 |   molecule* CopyMoleculeFromSubRegion(const Shape&) const;
 | 
|---|
| [042f82] | 313 | 
 | 
|---|
 | 314 |   /// Fragment molecule by two different approaches:
 | 
|---|
| [35b698] | 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);
 | 
|---|
| [e138de] | 323 |   bool CreateMappingLabelsToConfigSequence(int *&SortIndex);
 | 
|---|
| [9879f6] | 324 |   bool CreateFatherLookupTable(atom **&LookupTable, int count = 0);
 | 
|---|
| [e138de] | 325 |   void BreadthFirstSearchAdd(molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
 | 
|---|
| [042f82] | 326 |   /// -# BOSSANOVA
 | 
|---|
| [e138de] | 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);
 | 
|---|
| [042f82] | 334 | 
 | 
|---|
 | 335 |   // Recognize doubly appearing molecules in a list of them
 | 
|---|
| [e138de] | 336 |   int * IsEqualToWithinThreshold(molecule *OtherMolecule, double threshold);
 | 
|---|
 | 337 |   int * GetFatherSonAtomicMap(molecule *OtherMolecule);
 | 
|---|
| [042f82] | 338 | 
 | 
|---|
 | 339 |   // Output routines.
 | 
|---|
| [e138de] | 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);
 | 
|---|
| [042f82] | 347 | 
 | 
|---|
| [c68025] | 348 |   // Manipulation routines
 | 
|---|
 | 349 |   void flipActiveFlag();
 | 
|---|
 | 350 | 
 | 
|---|
| [042f82] | 351 |   private:
 | 
|---|
 | 352 |   int last_atom;      //!< number given to last atom
 | 
|---|
| [d3347e] | 353 |   mutable internal_iterator InternalPointer;  //!< internal pointer for PointCloud
 | 
|---|
| [14de469] | 354 | };
 | 
|---|
 | 355 | 
 | 
|---|
| [cbc5fb] | 356 | molecule *NewMolecule();
 | 
|---|
 | 357 | void DeleteMolecule(molecule* mol);
 | 
|---|
 | 358 | 
 | 
|---|
| [e9f8f9] | 359 | #include "molecule_template.hpp"
 | 
|---|
| [33f9f7] | 360 | 
 | 
|---|
| [14de469] | 361 | /** A list of \a molecule classes.
 | 
|---|
 | 362 |  */
 | 
|---|
| [d5f216] | 363 | class MoleculeListClass : public Observable {
 | 
|---|
| [042f82] | 364 |   public:
 | 
|---|
 | 365 |     MoleculeList ListOfMolecules; //!< List of the contained molecules
 | 
|---|
 | 366 |     int MaxIndex;
 | 
|---|
 | 367 | 
 | 
|---|
| [cbc5fb] | 368 |   MoleculeListClass(World *world);
 | 
|---|
| [042f82] | 369 |   ~MoleculeListClass();
 | 
|---|
 | 370 | 
 | 
|---|
| [35b698] | 371 |   bool AddHydrogenCorrection(std::string &path);
 | 
|---|
 | 372 |   bool StoreForcesFile(std::string &path, int *SortIndex);
 | 
|---|
| [437922] | 373 |   void insert(molecule *mol);
 | 
|---|
| [bd6bfa] | 374 |   void erase(molecule *mol);
 | 
|---|
| [042f82] | 375 |   molecule * ReturnIndex(int index);
 | 
|---|
| [35b698] | 376 |   bool OutputConfigForListOfFragments(std::string &prefix, int *SortIndex);
 | 
|---|
| [042f82] | 377 |   int NumberOfActiveMolecules();
 | 
|---|
| [24a5e0] | 378 |   void Enumerate(ostream *out);
 | 
|---|
| [042f82] | 379 |   void Output(ofstream *out);
 | 
|---|
| [244a84] | 380 |   void DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration);
 | 
|---|
| [568be7] | 381 |   int CountAllAtoms() const;
 | 
|---|
| [042f82] | 382 | 
 | 
|---|
| [477bb2] | 383 |   // Methods moved here from the menus
 | 
|---|
 | 384 |   // TODO: more refactoring needed on these methods
 | 
|---|
| [77675f] | 385 |   void flipChosen();
 | 
|---|
| [477bb2] | 386 |   void createNewMolecule(periodentafel *periode);
 | 
|---|
 | 387 |   void loadFromXYZ(periodentafel *periode);
 | 
|---|
 | 388 |   void setMoleculeFilename();
 | 
|---|
 | 389 |   void parseXYZIntoMolecule();
 | 
|---|
 | 390 |   void eraseMolecule();
 | 
|---|
 | 391 | 
 | 
|---|
| [77675f] | 392 | 
 | 
|---|
| [042f82] | 393 |   // merging of molecules
 | 
|---|
| [1907a7] | 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 | 
 | 
|---|
| [042f82] | 401 |   private:
 | 
|---|
| [cbc5fb] | 402 |   World *world; //!< The world this List belongs to. Needed to avoid deadlocks in the destructor
 | 
|---|
| [14de469] | 403 | };
 | 
|---|
 | 404 | 
 | 
|---|
 | 405 | 
 | 
|---|
 | 406 | /** A leaf for a tree of \a molecule class
 | 
|---|
 | 407 |  * Wraps molecules in a tree structure
 | 
|---|
 | 408 |  */
 | 
|---|
 | 409 | class MoleculeLeafClass {
 | 
|---|
| [042f82] | 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);
 | 
|---|
| [c27778] | 422 |   bool FillBondStructureFromReference(const molecule * const reference, atom **&ListOfLocalAtoms, bool FreeList = false);
 | 
|---|
| [e138de] | 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);
 | 
|---|
| [c27778] | 425 |   bool FillListOfLocalAtoms(atom **&ListOfLocalAtoms, const int GlobalAtomCount, bool &FreeList);
 | 
|---|
| [e138de] | 426 |   void TranslateIndicesToGlobalIDs(Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph);
 | 
|---|
| [042f82] | 427 |   int Count() const;
 | 
|---|
| [14de469] | 428 | };
 | 
|---|
 | 429 | 
 | 
|---|
| [d1df9b] | 430 | 
 | 
|---|
| [14de469] | 431 | #endif /*MOLECULES_HPP_*/
 | 
|---|
 | 432 | 
 | 
|---|