Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule.hpp

    r273382 r6cfa36  
    3434#include "tesselation.hpp"
    3535#include "Patterns/Observer.hpp"
     36#include "Patterns/ObservedIterator.hpp"
    3637#include "Patterns/Cacheable.hpp"
     38
     39#include "Descriptors/MoleculeDescriptor_impl.hpp"
    3740
    3841/****************************************** forward declarations *****************************/
     
    8891  friend molecule *NewMolecule();
    8992  friend void DeleteMolecule(molecule *);
     93
    9094  public:
    91     double cell_size[6];//!< cell size
     95    typedef std::set<atom*> atomSet;
     96    typedef ObservedIterator<atomSet> iterator;
     97    typedef atomSet::const_iterator const_iterator;
     98
    9299    const periodentafel * const elemente; //!< periodic table with each element
    93     atom *start;        //!< start of atom list
    94     atom *end;          //!< end of atom list
    95     bond *first;        //!< start of bond list
    96     bond *last;         //!< end of bond list
     100    // old deprecated atom handling
     101    //atom *start;        //!< start of atom list
     102    //atom *end;          //!< end of atom list
     103    //bond *first;        //!< start of bond list
     104    //bond *last;         //!< end of bond list
    97105    int MDSteps;        //!< The number of MD steps in Trajectories
    98     int AtomCount;          //!< number of atoms, brought up-to-date by CountAtoms()
     106    //int AtomCount;          //!< number of atoms, brought up-to-date by CountAtoms()
    99107    int BondCount;          //!< number of atoms, brought up-to-date by CountBonds()
    100108    int ElementCount;       //!< how many unique elements are therein
     
    111119  private:
    112120    Cacheable<string> formula;
     121    Cacheable<int>    AtomCount;
    113122    moleculeId_t id;
     123    atomSet atoms; //<!set of atoms
    114124  protected:
     125    //void CountAtoms();
     126    /**
     127     * this iterator type should be used for internal variables, \
     128     * since it will not lock
     129     */
     130    typedef atomSet::iterator internal_iterator;
     131
     132
    115133    molecule(const periodentafel * const teil);
    116134    virtual ~molecule();
     
    120138  //getter and setter
    121139  const std::string getName();
     140  int getAtomCount() const;
     141  int doCountAtoms();
    122142  moleculeId_t getId();
    123143  void setId(moleculeId_t);
     
    126146  std::string calcFormula();
    127147
     148  iterator begin();
     149  const_iterator begin() const;
     150  iterator end();
     151  const_iterator end() const;
     152  bool empty() const;
     153  size_t size() const;
     154  const_iterator erase( const_iterator loc );
     155  const_iterator erase( atom * key );
     156  const_iterator find (  atom * key ) const;
     157  pair<iterator,bool> insert ( atom * const key );
     158  bool containsAtom(atom* key);
     159
    128160
    129161  // re-definition of virtual functions from PointCloud
     
    131163  Vector *GetCenter() const ;
    132164  TesselPoint *GetPoint() const ;
    133   TesselPoint *GetTerminalPoint() const ;
    134165  int GetMaxId() const;
    135166  void GoToNext() const ;
    136   void GoToPrevious() const ;
    137167  void GoToFirst() const ;
    138   void GoToLast() const ;
    139168  bool IsEmpty() const ;
    140169  bool IsEnd() const ;
     
    225254  bool RemoveBond(bond *pointer);
    226255  bool RemoveBonds(atom *BondPartner);
     256  bool hasBondStructure();
     257  unsigned int CountBonds() const;
    227258
    228259  /// Find atoms.
     
    231262
    232263  /// Count and change present atoms' coordination.
    233   void CountAtoms();
    234264  void CountElements();
    235265  void CalculateOrbitals(class config &configuration);
     
    248278  Vector * DetermineCenterOfGravity();
    249279  Vector * DetermineCenterOfAll() const;
     280  Vector * DetermineCenterOfBox() const;
    250281  void SetNameFromFilename(const char *filename);
    251282  void SetBoxDimension(Vector *dim);
     
    293324  int FragmentMolecule(int Order, config *configuration);
    294325  bool CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
    295   bool StoreBondsToFile(char *path);
    296   bool StoreAdjacencyToFile(char *path);
     326  bool StoreBondsToFile(char *path, char *filename);
     327  bool StoreAdjacencyToFile(char *path, char *filename);
    297328  bool CheckAdjacencyFileAgainstMolecule(char *path, atom **ListOfAtoms);
    298329  bool ParseOrderAtSiteFromFile(char *path);
     
    300331  bool StoreForcesFile(MoleculeListClass *BondFragments, char *path, int *SortIndex);
    301332  bool CreateMappingLabelsToConfigSequence(int *&SortIndex);
     333  bool CreateFatherLookupTable(atom **&LookupTable, int count = 0);
    302334  void BreadthFirstSearchAdd(molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
    303335  /// -# BOSSANOVA
     
    328360  private:
    329361  int last_atom;      //!< number given to last atom
    330   mutable atom *InternalPointer;  //!< internal pointer for PointCloud
     362  mutable internal_iterator InternalPointer;  //!< internal pointer for PointCloud
    331363};
    332364
     
    349381  bool StoreForcesFile(char *path, int *SortIndex);
    350382  void insert(molecule *mol);
     383  void erase(molecule *mol);
    351384  molecule * ReturnIndex(int index);
    352385  bool OutputConfigForListOfFragments(config *configuration, int *SortIndex);
Note: See TracChangeset for help on using the changeset viewer.