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