| [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>
|
|---|
| [a564be] | 18 | #include <stack>
|
|---|
| [14de469] | 19 | #include <deque>
|
|---|
| [d7e30c] | 20 | #include <list>
|
|---|
| [5e0d1f] | 21 | #include <vector>
|
|---|
| [14de469] | 22 |
|
|---|
| [520c8b] | 23 | #include <string>
|
|---|
| 24 |
|
|---|
| [e39e7a] | 25 | #include <boost/bimap/bimap.hpp>
|
|---|
| 26 | #include <boost/bimap/unordered_set_of.hpp>
|
|---|
| 27 | #include <boost/bimap/multiset_of.hpp>
|
|---|
| 28 | #include <boost/optional.hpp>
|
|---|
| 29 | #include <boost/shared_ptr.hpp>
|
|---|
| 30 |
|
|---|
| [8e1f901] | 31 | #include "AtomIdSet.hpp"
|
|---|
| [6f0841] | 32 | #include "Atom/AtomSet.hpp"
|
|---|
| [ad011c] | 33 | #include "CodePatterns/Cacheable.hpp"
|
|---|
| [02ce36] | 34 | #include "CodePatterns/Observer/Observable.hpp"
|
|---|
| [30c753] | 35 | #include "Descriptors/AtomIdDescriptor.hpp"
|
|---|
| [07a47e] | 36 | #include "Fragmentation/HydrogenSaturation_enum.hpp"
|
|---|
| [389cc8] | 37 | #include "Formula.hpp"
|
|---|
| [30c753] | 38 | #include "Helpers/defs.hpp"
|
|---|
| [560bbe] | 39 | #include "IdPool_policy.hpp"
|
|---|
| 40 | #include "IdPool.hpp"
|
|---|
| [c67ff9] | 41 | #include "Shapes/Shape.hpp"
|
|---|
| [30c753] | 42 | #include "types.hpp"
|
|---|
| [14de469] | 43 |
|
|---|
| [f66195] | 44 | /****************************************** forward declarations *****************************/
|
|---|
| 45 |
|
|---|
| 46 | class atom;
|
|---|
| 47 | class bond;
|
|---|
| [b70721] | 48 | class BondedParticle;
|
|---|
| 49 | class BondGraph;
|
|---|
| [49c059] | 50 | class DepthFirstSearchAnalysis;
|
|---|
| [f66195] | 51 | class element;
|
|---|
| 52 | class ForceMatrix;
|
|---|
| [dadc74] | 53 | class Graph;
|
|---|
| [6bd7e0] | 54 | class LinkedCell_deprecated;
|
|---|
| [6d551c] | 55 | class ListOfLocalAtoms_t;
|
|---|
| [14de469] | 56 | class molecule;
|
|---|
| [2319ed] | 57 | class MoleculeLeafClass;
|
|---|
| [14de469] | 58 | class MoleculeListClass;
|
|---|
| [c67ff9] | 59 | class MoleculeUnittest;
|
|---|
| [1f91f4] | 60 | class RealSpaceMatrix;
|
|---|
| [f66195] | 61 | class Vector;
|
|---|
| [14de469] | 62 |
|
|---|
| 63 | /************************************* Class definitions ****************************************/
|
|---|
| 64 |
|
|---|
| [a7aebd] | 65 | /** External function to remove all atoms since this will also delete the molecule
|
|---|
| 66 | *
|
|---|
| 67 | * \param _mol ref pointer to molecule to destroy
|
|---|
| 68 | */
|
|---|
| 69 | void removeAtomsinMolecule(molecule *&_mol);
|
|---|
| 70 |
|
|---|
| [14de469] | 71 | /** The complete molecule.
|
|---|
| 72 | * Class incorporates number of types
|
|---|
| 73 | */
|
|---|
| [34c43a] | 74 | class molecule : public Observable
|
|---|
| [e4afb4] | 75 | {
|
|---|
| [c67ff9] | 76 | //!> grant unit test access
|
|---|
| 77 | friend class MoleculeUnittest;
|
|---|
| 78 | //!> function may access cstor
|
|---|
| [cbc5fb] | 79 | friend molecule *NewMolecule();
|
|---|
| [c67ff9] | 80 | //!> function may access dstor
|
|---|
| [cbc5fb] | 81 | friend void DeleteMolecule(molecule *);
|
|---|
| [bd58fb] | 82 |
|
|---|
| [e4afb4] | 83 | public:
|
|---|
| [8e1f901] | 84 | typedef AtomIdSet::atomIdSet atomIdSet;
|
|---|
| 85 | typedef AtomIdSet::iterator iterator;
|
|---|
| 86 | typedef AtomIdSet::const_iterator const_iterator;
|
|---|
| [e4afb4] | 87 |
|
|---|
| 88 | int MDSteps; //!< The number of MD steps in Trajectories
|
|---|
| 89 | mutable int NoNonBonds; //!< number of non-hydrogen bonds in molecule
|
|---|
| 90 | mutable int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
|
|---|
| 91 | bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules
|
|---|
| 92 | int IndexNr; //!< index of molecule in a MoleculeListClass
|
|---|
| 93 | char name[MAXSTRINGSIZE]; //!< arbitrary name
|
|---|
| 94 |
|
|---|
| 95 | private:
|
|---|
| 96 | Formula formula;
|
|---|
| [e791dc] | 97 | Cacheable<size_t> NoNonHydrogen; //!< number of non-hydrogen atoms in molecule
|
|---|
| [458c31] | 98 | Cacheable<int> BondCount; //!< number of atoms, brought up-to-date by doCountBonds()
|
|---|
| [e4afb4] | 99 | moleculeId_t id;
|
|---|
| [8e1f901] | 100 | AtomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms
|
|---|
| [560bbe] | 101 | IdPool<atomId_t, uniqueId> atomIdPool; //!< pool of internal ids such that way may guarantee uniqueness
|
|---|
| [c6ab91] | 102 | typedef std::map<atomId_t,atom *> LocalToGlobalId_t;
|
|---|
| 103 | LocalToGlobalId_t LocalToGlobalId; //!< internal map to ease FindAtom
|
|---|
| [560bbe] | 104 |
|
|---|
| [e4afb4] | 105 | protected:
|
|---|
| [ac9b56] | 106 |
|
|---|
| [4d2b33] | 107 | molecule();
|
|---|
| [e4afb4] | 108 | virtual ~molecule();
|
|---|
| [042f82] | 109 |
|
|---|
| [6a3c83] | 110 | public:
|
|---|
| 111 |
|
|---|
| 112 | /******* Notifications *******/
|
|---|
| 113 |
|
|---|
| 114 | //!> enumeration of present notification types: only insertion/removal of atoms or molecules
|
|---|
| 115 | enum NotificationType {
|
|---|
| 116 | AtomInserted,
|
|---|
| 117 | AtomRemoved,
|
|---|
| 118 | AtomNrChanged,
|
|---|
| [c32d21] | 119 | AtomMoved,
|
|---|
| [6b6959] | 120 | FormulaChanged,
|
|---|
| [cbd409] | 121 | MoleculeCenterChanged,
|
|---|
| [6a3c83] | 122 | MoleculeNameChanged,
|
|---|
| [f54524] | 123 | IndexChanged,
|
|---|
| [e39e7a] | 124 | BoundingBoxChanged,
|
|---|
| [24edfe] | 125 | AboutToBeRemoved,
|
|---|
| [b71881] | 126 | SelectionChanged,
|
|---|
| [6a3c83] | 127 | NotificationType_MAX
|
|---|
| 128 | };
|
|---|
| 129 |
|
|---|
| [8c001a] | 130 | //>! access to last changed element (atom)
|
|---|
| [fb95a5] | 131 | const atomId_t lastChangedAtomId() const
|
|---|
| 132 | { return _lastchangedatomid; }
|
|---|
| [8c001a] | 133 |
|
|---|
| [cbc5fb] | 134 | public:
|
|---|
| [520c8b] | 135 | //getter and setter
|
|---|
| [73a857] | 136 | const std::string getName() const;
|
|---|
| [ea7176] | 137 | int getAtomCount() const;
|
|---|
| [e791dc] | 138 | size_t doCountNoNonHydrogen() const;
|
|---|
| 139 | size_t getNoNonHydrogen() const;
|
|---|
| [458c31] | 140 | int getBondCount() const;
|
|---|
| 141 | int doCountBonds() const;
|
|---|
| [73a857] | 142 | moleculeId_t getId() const;
|
|---|
| [cbc5fb] | 143 | void setId(moleculeId_t);
|
|---|
| [520c8b] | 144 | void setName(const std::string);
|
|---|
| [73a857] | 145 | const Formula &getFormula() const;
|
|---|
| 146 | unsigned int getElementCount() const;
|
|---|
| [389cc8] | 147 | bool hasElement(const element*) const;
|
|---|
| 148 | bool hasElement(atomicNumber_t) const;
|
|---|
| 149 | bool hasElement(const std::string&) const;
|
|---|
| 150 |
|
|---|
| [a7a087] | 151 | virtual bool changeId(atomId_t newId);
|
|---|
| [520c8b] | 152 |
|
|---|
| [f01769] | 153 | World::AtomComposite getAtomSet();
|
|---|
| 154 | World::ConstAtomComposite getAtomSet() const;
|
|---|
| [3738f0] | 155 |
|
|---|
| [8e1f901] | 156 | // simply pass on all functions to AtomIdSet
|
|---|
| 157 | iterator begin() {
|
|---|
| 158 | return atomIds.begin();
|
|---|
| 159 | }
|
|---|
| 160 | const_iterator begin() const
|
|---|
| 161 | {
|
|---|
| 162 | return atomIds.begin();
|
|---|
| 163 | }
|
|---|
| 164 | iterator end()
|
|---|
| 165 | {
|
|---|
| 166 | return atomIds.end();
|
|---|
| 167 | }
|
|---|
| 168 | const_iterator end() const
|
|---|
| 169 | {
|
|---|
| 170 | return atomIds.end();
|
|---|
| 171 | }
|
|---|
| 172 | bool empty() const
|
|---|
| 173 | {
|
|---|
| 174 | return atomIds.empty();
|
|---|
| 175 | }
|
|---|
| 176 | size_t size() const
|
|---|
| 177 | {
|
|---|
| 178 | return atomIds.size();
|
|---|
| 179 | }
|
|---|
| 180 | const_iterator find(atom * key) const
|
|---|
| 181 | {
|
|---|
| 182 | return atomIds.find(key);
|
|---|
| 183 | }
|
|---|
| [c67ff9] | 184 |
|
|---|
| 185 | /** Returns the set of atomic ids contained in this molecule.
|
|---|
| 186 | *
|
|---|
| 187 | * @return set of atomic ids
|
|---|
| 188 | */
|
|---|
| [8e1f901] | 189 | const atomIdSet & getAtomIds() const {
|
|---|
| 190 | return atomIds.getAtomIds();
|
|---|
| 191 | }
|
|---|
| 192 |
|
|---|
| 193 | std::pair<iterator, bool> insert(atom * const key);
|
|---|
| 194 |
|
|---|
| [6aad6f] | 195 | /** Predicate whether given \a key is contained in this molecule.
|
|---|
| 196 | *
|
|---|
| 197 | * @param key atom to check
|
|---|
| 198 | * @return true - is contained, false - else
|
|---|
| 199 | */
|
|---|
| 200 | bool containsAtom(const atom* key) const
|
|---|
| 201 | {
|
|---|
| 202 | return atomIds.contains(key);
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | /** Predicate whether given \a id is contained in this molecule.
|
|---|
| 206 | *
|
|---|
| 207 | * @param id atomic id to check
|
|---|
| 208 | * @return true - is contained, false - else
|
|---|
| 209 | */
|
|---|
| 210 | bool containsAtom(const atomId_t id) const
|
|---|
| 211 | {
|
|---|
| 212 | return atomIds.contains(id);
|
|---|
| 213 | }
|
|---|
| [bd58fb] | 214 |
|
|---|
| [2e4105] | 215 | private:
|
|---|
| 216 | friend void atom::removeFromMolecule();
|
|---|
| 217 | /** Erase an atom from the list.
|
|---|
| 218 | * \note This should only be called by atom::removeFromMolecule(),
|
|---|
| 219 | * otherwise it is not assured that the atom knows about it.
|
|---|
| 220 | *
|
|---|
| 221 | * @param loc locator to atom in list
|
|---|
| 222 | * @return iterator to just after removed item (compliant with standard)
|
|---|
| 223 | */
|
|---|
| 224 | const_iterator erase(const_iterator loc);
|
|---|
| [8e1f901] | 225 |
|
|---|
| [2e4105] | 226 | /** Erase an atom from the list.
|
|---|
| 227 | * \note This should only be called by atom::removeFromMolecule(),
|
|---|
| 228 | * otherwise it is not assured that the atom knows about it.
|
|---|
| 229 | *
|
|---|
| 230 | * @param *key key to atom in list
|
|---|
| 231 | * @return iterator to just after removed item (compliant with standard)
|
|---|
| 232 | */
|
|---|
| 233 | const_iterator erase(atom * key);
|
|---|
| 234 |
|
|---|
| [560bbe] | 235 | private:
|
|---|
| 236 | friend bool atom::changeNr(int newId);
|
|---|
| 237 | /**
|
|---|
| 238 | * used when changing an ParticleInfo::Nr.
|
|---|
| 239 | * Note that this number is local with this molecule.
|
|---|
| 240 | * Unless you are calling this method from inside an atom don't fiddle with the third parameter.
|
|---|
| 241 | *
|
|---|
| 242 | * @param oldNr old Nr
|
|---|
| 243 | * @param newNr new Nr to set
|
|---|
| 244 | * @param *target ref to atom
|
|---|
| 245 | * @return indicates wether the change could be done or not.
|
|---|
| 246 | */
|
|---|
| 247 | bool changeAtomNr(int oldNr, int newNr, atom* target=0);
|
|---|
| 248 |
|
|---|
| [ceaab1] | 249 | friend bool atom::changeId(atomId_t newId);
|
|---|
| 250 | /**
|
|---|
| 251 | * used when changing an ParticleInfo::Id.
|
|---|
| 252 | * Note that this number is global (and the molecule uses it to know which atoms belong to it)
|
|---|
| 253 | *
|
|---|
| 254 | * @param oldId old Id
|
|---|
| 255 | * @param newId new Id to set
|
|---|
| 256 | * @return indicates wether the change could be done or not.
|
|---|
| 257 | */
|
|---|
| 258 | bool changeAtomId(int oldId, int newId);
|
|---|
| 259 |
|
|---|
| [c6ab91] | 260 | /** Updates the internal lookup fro local to global indices.
|
|---|
| 261 | *
|
|---|
| 262 | * \param pointer pointer to atom
|
|---|
| 263 | */
|
|---|
| 264 | void InsertLocalToGlobalId(atom * const pointer);
|
|---|
| 265 |
|
|---|
| [560bbe] | 266 | /** Sets the name of the atom.
|
|---|
| 267 | *
|
|---|
| 268 | * The name is set via its element symbol and its internal ParticleInfo::Nr.
|
|---|
| 269 | *
|
|---|
| 270 | * @param _atom atom whose name to set
|
|---|
| 271 | */
|
|---|
| 272 | void setAtomName(atom *_atom) const;
|
|---|
| 273 |
|
|---|
| [9b3262b] | 274 | /** Resets the formula for this molecule.
|
|---|
| 275 | *
|
|---|
| 276 | * This is required in case an atom changes its element as we then don't
|
|---|
| 277 | * have any knowledge about its previous element anymore.
|
|---|
| 278 | */
|
|---|
| 279 | void resetFormula();
|
|---|
| 280 |
|
|---|
| [b71881] | 281 | //!> grant World (only) access to selection state changers
|
|---|
| 282 | friend class World;
|
|---|
| 283 |
|
|---|
| 284 | /** Sets the internal selection state to true.
|
|---|
| 285 | *
|
|---|
| 286 | */
|
|---|
| 287 | void select();
|
|---|
| 288 |
|
|---|
| 289 | /** Unsets the internal selection state to true.
|
|---|
| 290 | *
|
|---|
| 291 | */
|
|---|
| 292 | void unselect();
|
|---|
| 293 |
|
|---|
| [2e4105] | 294 | public:
|
|---|
| 295 |
|
|---|
| [b71881] | 296 | /** Getter to internal selection status.
|
|---|
| 297 | *
|
|---|
| 298 | * \return true - molecule is selected, false - else
|
|---|
| 299 | */
|
|---|
| 300 | bool getSelected() const { return selected; }
|
|---|
| 301 |
|
|---|
| [e39e7a] | 302 | /** Structure for the required information on the bounding box.
|
|---|
| 303 | *
|
|---|
| 304 | */
|
|---|
| 305 | struct BoundingBoxInfo {
|
|---|
| 306 | //!> position of center
|
|---|
| 307 | Vector position;
|
|---|
| 308 | //!> radius of sphere
|
|---|
| 309 | double radius;
|
|---|
| 310 |
|
|---|
| 311 | /** Equivalence operator for bounding box.
|
|---|
| 312 | *
|
|---|
| 313 | * \return true - both bounding boxes have same position and radius
|
|---|
| 314 | */
|
|---|
| 315 | bool operator==(const BoundingBoxInfo &_other) const
|
|---|
| 316 | { return (radius == _other.radius) && (position == _other.position); }
|
|---|
| 317 |
|
|---|
| 318 | /** Inequivalence operator for bounding box.
|
|---|
| 319 | *
|
|---|
| 320 | * \return true - bounding boxes have either different positions or different radii or both
|
|---|
| 321 | */
|
|---|
| 322 | bool operator!=(const BoundingBoxInfo &_other) const
|
|---|
| 323 | { return !(*this == _other); }
|
|---|
| 324 | };
|
|---|
| 325 |
|
|---|
| 326 | private:
|
|---|
| 327 |
|
|---|
| 328 | /** Returns the current bounding box.
|
|---|
| 329 | *
|
|---|
| 330 | * \return Shape with center and extension of box
|
|---|
| 331 | */
|
|---|
| 332 | BoundingBoxInfo updateBoundingBox() const;
|
|---|
| 333 |
|
|---|
| [cbd409] | 334 | /** Returns the current center of the molecule.
|
|---|
| 335 | *
|
|---|
| 336 | * \return center
|
|---|
| 337 | */
|
|---|
| 338 | Vector updateMoleculeCenter() const;
|
|---|
| 339 |
|
|---|
| [e39e7a] | 340 | // stuff for keeping bounding box up-to-date efficiently
|
|---|
| 341 |
|
|---|
| 342 | //!> Cacheable for the bounding box, ptr such that
|
|---|
| 343 | boost::shared_ptr< Cacheable<BoundingBoxInfo> > BoundingBox;
|
|---|
| [cbd409] | 344 |
|
|---|
| 345 | //!> Cacheable for the bounding box, ptr such that
|
|---|
| 346 | boost::shared_ptr< Cacheable<Vector> > MoleculeCenter;
|
|---|
| 347 |
|
|---|
| [e39e7a] | 348 | /** Bimap storing atomic ids and the component per axis.
|
|---|
| 349 | *
|
|---|
| 350 | * We need a bimap in order to have the components sorted and be able to
|
|---|
| 351 | * access max and min values in linear time and also access the ids in
|
|---|
| 352 | * constant time in order to update the map, when atoms move, are inserted,
|
|---|
| 353 | * or removed.
|
|---|
| 354 | */
|
|---|
| 355 | typedef boost::bimaps::bimap<
|
|---|
| 356 | boost::bimaps::unordered_set_of< atomId_t >,
|
|---|
| 357 | boost::bimaps::multiset_of< double, std::greater<double> >
|
|---|
| 358 | > AtomDistanceMap_t;
|
|---|
| 359 | std::vector<AtomDistanceMap_t> BoundingBoxSweepingAxis;
|
|---|
| 360 |
|
|---|
| 361 | public:
|
|---|
| 362 |
|
|---|
| 363 | /** Returns the current bounding box of this molecule.
|
|---|
| 364 | *
|
|---|
| 365 | * \return bounding box info with center and radius
|
|---|
| 366 | */
|
|---|
| 367 | BoundingBoxInfo getBoundingBox() const;
|
|---|
| 368 |
|
|---|
| [c67ff9] | 369 | /** Function to create a bounding spherical shape for the currently associated atoms.
|
|---|
| 370 | *
|
|---|
| [55feea1] | 371 | * \param boundary extra boundary of shape around (i.e. distance between outermost atom
|
|---|
| 372 | * and the shape's surface)
|
|---|
| [c67ff9] | 373 | */
|
|---|
| [aeb694] | 374 | Shape getBoundingSphere(const double boundary = 0.) const;
|
|---|
| 375 |
|
|---|
| 376 | /** Creates the bounding box by adding van der Waals-Spheres around every atom.
|
|---|
| 377 | *
|
|---|
| 378 | * \param scale extra scale parameter to enlarge the spheres artifically
|
|---|
| 379 | */
|
|---|
| 380 | Shape getBoundingShape(const double scale = 1.) const;
|
|---|
| [c67ff9] | 381 |
|
|---|
| [cbd409] | 382 | /** Returns the current center of this molecule.
|
|---|
| 383 | *
|
|---|
| 384 | * \return center of the molecule
|
|---|
| 385 | */
|
|---|
| 386 | Vector getMoleculeCenter() const;
|
|---|
| 387 |
|
|---|
| [042f82] | 388 | /// remove atoms from molecule.
|
|---|
| 389 | bool AddAtom(atom *pointer);
|
|---|
| 390 | bool RemoveAtom(atom *pointer);
|
|---|
| 391 | bool UnlinkAtom(atom *pointer);
|
|---|
| 392 | bool CleanupMolecule();
|
|---|
| 393 |
|
|---|
| 394 | /// Add/remove atoms to/from molecule.
|
|---|
| 395 | atom * AddCopyAtom(atom *pointer);
|
|---|
| [06804b] | 396 | // bool AddHydrogenReplacementAtom(bond::ptr Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bool IsAngstroem);
|
|---|
| [88c8ec] | 397 | bond::ptr AddBond(atom *first, atom *second, int degree = 1);
|
|---|
| [e4afb4] | 398 | bool hasBondStructure() const;
|
|---|
| [042f82] | 399 |
|
|---|
| 400 | /// Find atoms.
|
|---|
| 401 | atom * FindAtom(int Nr) const;
|
|---|
| [955b91] | 402 | atom * AskAtom(std::string text);
|
|---|
| [f01769] | 403 | bool isInMolecule(const atom * const _atom) const;
|
|---|
| [042f82] | 404 |
|
|---|
| 405 | /// Count and change present atoms' coordination.
|
|---|
| [e138de] | 406 | bool CenterInBox();
|
|---|
| 407 | bool BoundInBox();
|
|---|
| [833b15] | 408 | void CenterEdge();
|
|---|
| [e138de] | 409 | void CenterOrigin();
|
|---|
| 410 | void CenterPeriodic();
|
|---|
| [833b15] | 411 | void CenterAtVector(const Vector &newcenter);
|
|---|
| 412 | void Translate(const Vector &x);
|
|---|
| 413 | void TranslatePeriodically(const Vector &trans);
|
|---|
| 414 | void Mirror(const Vector &x);
|
|---|
| 415 | void Align(const Vector &n);
|
|---|
| 416 | void Scale(const double *factor);
|
|---|
| [9291d04] | 417 | void DeterminePeriodicCenter(Vector ¢er, const enum HydrogenTreatment _treatment = ExcludeHydrogen);
|
|---|
| [833b15] | 418 | const Vector DetermineCenterOfGravity() const;
|
|---|
| 419 | const Vector DetermineCenterOfAll() const;
|
|---|
| [437922] | 420 | void SetNameFromFilename(const char *filename);
|
|---|
| [3c58f8] | 421 | bool ScanForPeriodicCorrection();
|
|---|
| [e138de] | 422 | double VolumeOfConvexEnvelope(bool IsAngstroem);
|
|---|
| [1f91f4] | 423 | RealSpaceMatrix getInertiaTensor() const;
|
|---|
| [5b6a4b7] | 424 | void RotateToPrincipalAxisSystem(const Vector &Axis);
|
|---|
| [042f82] | 425 |
|
|---|
| 426 | bool CheckBounds(const Vector *x) const;
|
|---|
| 427 | void GetAlignvector(struct lsq_params * par) const;
|
|---|
| 428 |
|
|---|
| 429 | /// Initialising routines in fragmentation
|
|---|
| [e138de] | 430 | void OutputBondsList() const;
|
|---|
| [49c059] | 431 |
|
|---|
| [88c8ec] | 432 | bond::ptr CopyBond(atom *left, atom *right, bond::ptr CopyBond);
|
|---|
| [266237] | 433 |
|
|---|
| [f01769] | 434 | molecule *CopyMolecule(const Vector &offset = zeroVec);
|
|---|
| 435 | molecule* CopyMoleculeFromSubRegion(const Shape&);
|
|---|
| [042f82] | 436 |
|
|---|
| 437 | /// Fragment molecule by two different approaches:
|
|---|
| [e4afb4] | 438 | bool StoreBondsToFile(std::string filename, std::string path = "");
|
|---|
| [6d551c] | 439 | bool CreateFatherLookupTable(ListOfLocalAtoms_t &LookupTable, int count = 0);
|
|---|
| [b9772a] | 440 |
|
|---|
| [042f82] | 441 | // Recognize doubly appearing molecules in a list of them
|
|---|
| [f01769] | 442 | int * GetFatherSonAtomicMap(const molecule * const OtherMolecule);
|
|---|
| [6d551c] | 443 | bool FillBondStructureFromReference(const molecule * const reference, ListOfLocalAtoms_t &ListOfLocalAtoms, bool FreeList = false);
|
|---|
| 444 | bool FillListOfLocalAtoms(ListOfLocalAtoms_t &ListOfLocalAtoms, const int GlobalAtomCount);
|
|---|
| [042f82] | 445 |
|
|---|
| 446 | // Output routines.
|
|---|
| [e4afb4] | 447 | bool Output(std::ostream * const output) const;
|
|---|
| [e138de] | 448 | void OutputListOfBonds() const;
|
|---|
| [042f82] | 449 |
|
|---|
| [c68025] | 450 | // Manipulation routines
|
|---|
| 451 | void flipActiveFlag();
|
|---|
| 452 |
|
|---|
| [c32d21] | 453 | virtual void update(Observable *publisher);
|
|---|
| 454 | virtual void recieveNotification(Observable *publisher, Notification_ptr notification);
|
|---|
| 455 | virtual void subjectKilled(Observable *publisher);
|
|---|
| 456 |
|
|---|
| [e4afb4] | 457 | private:
|
|---|
| [b71881] | 458 | //!> id of last atom that signalled changed associated with this molecule
|
|---|
| [fb95a5] | 459 | atomId_t _lastchangedatomid;
|
|---|
| [8c001a] | 460 |
|
|---|
| [e4afb4] | 461 | int last_atom; //!< number given to last atom
|
|---|
| [cbd409] | 462 |
|
|---|
| [b71881] | 463 | //!> center of the molecule
|
|---|
| [cbd409] | 464 | Vector molcenter;
|
|---|
| [b71881] | 465 |
|
|---|
| 466 | //!> internal state whether atom is selected or not
|
|---|
| 467 | bool selected;
|
|---|
| [14de469] | 468 | };
|
|---|
| 469 |
|
|---|
| [cbc5fb] | 470 | molecule *NewMolecule();
|
|---|
| 471 | void DeleteMolecule(molecule* mol);
|
|---|
| 472 |
|
|---|
| [14de469] | 473 |
|
|---|
| 474 |
|
|---|
| 475 | #endif /*MOLECULES_HPP_*/
|
|---|
| 476 |
|
|---|