Ignore:
Timestamp:
Aug 3, 2009, 8:21:05 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
04dcc0
Parents:
0e2190 (diff), eb167d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'TesselationRefactoring' into ConcaveHull

Conflicts:

molecuilder/src/boundary.cpp
molecuilder/src/boundary.hpp
molecuilder/src/linkedcell.cpp
molecuilder/src/linkedcell.hpp
molecuilder/src/molecules.hpp

All of Saskia Metzler's new function were transfered from boundary.cpp to tesselation.cpp and the changes due to TesselPoint, LinkedCell and so on incorporated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecules.hpp

    r0e2190 rf4a346  
    1818#include <gsl/gsl_randist.h>
    1919
    20 // STL headers
     20//// STL headers
    2121#include <map>
    2222#include <set>
     
    2525#include <vector>
    2626
    27 #include "helpers.hpp"
     27#include "atom.hpp"
     28#include "bond.hpp"
     29#include "element.hpp"
     30#include "linkedcell.hpp"
    2831#include "parser.hpp"
    2932#include "periodentafel.hpp"
    3033#include "stackclass.hpp"
     34#include "tesselation.hpp"
    3135#include "vector.hpp"
    3236
    33 class atom;
    34 class bond;
    35 class config;
    3637class molecule;
    3738class MoleculeLeafClass;
    3839class MoleculeListClass;
    39 class Verbose;
    40 class Tesselation;
    4140
    4241/******************************** Some definitions for easier reading **********************************/
     
    5049#define GraphTestPair pair<Graph::iterator, bool>
    5150
     51#define MoleculeList list <molecule *>
     52#define MoleculeListTest pair <MoleculeList::iterator, bool>
     53
    5254#define DistancePair pair < double, atom* >
    5355#define DistanceMap multimap < double, atom* >
    5456#define DistanceTestPair pair < DistanceMap::iterator, bool>
    5557
    56 #define Boundaries map <double, DistancePair >
    57 #define BoundariesPair pair<double, DistancePair >
    58 #define BoundariesTestPair pair< Boundaries::iterator, bool>
    59 
    60 #define PointMap map < int, class BoundaryPointSet * >
    61 #define PointPair pair < int, class BoundaryPointSet * >
    62 #define PointTestPair pair < PointMap::iterator, bool >
    63 #define CandidateList list <class CandidateForTesselation *>
    64 
    65 #define LineMap multimap < int, class BoundaryLineSet * >
    66 #define LinePair pair < int, class BoundaryLineSet * >
    67 #define LineTestPair pair < LineMap::iterator, bool >
    68 
    69 #define TriangleMap map < int, class BoundaryTriangleSet * >
    70 #define TrianglePair pair < int, class BoundaryTriangleSet * >
    71 #define TriangleTestPair pair < TrianglePair::iterator, bool >
    72 
    73 #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
    74 #define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
    75 
    76 #define MoleculeList list <molecule *>
    77 #define MoleculeListTest pair <MoleculeList::iterator, bool>
    78 
    79 #define LinkedAtoms list <atom *>
     58
     59//#define LinkedAtoms list <atom *>
    8060
    8161/******************************** Some small functions and/or structures **********************************/
     
    125105};
    126106
    127 /** Single atom.
    128  * Class incoporates position, type
    129  */
    130 class atom {
    131   public:
    132     Vector x;       //!< coordinate array of atom, giving position within cell
    133     Vector v;       //!< velocity array of atom
    134     element *type;  //!< pointing to element
    135     atom *previous; //!< previous atom in molecule list
    136     atom *next;     //!< next atom in molecule list
    137     atom *father;   //!< In many-body bond order fragmentations points to originating atom
    138     atom *Ancestor; //!< "Father" in Depth-First-Search
    139     char *Name;      //!< unique name used during many-body bond-order fragmentation
    140     int FixedIon;   //!< config variable that states whether forces act on the ion or not
    141     int *sort;      //!< sort criteria
    142     int nr;         //!< continuous, unique number
    143     int GraphNr;      //!< unique number, given in DepthFirstSearchAnalysis()
    144     int *ComponentNr;//!< belongs to this nonseparable components, given in DepthFirstSearchAnalysis() (if more than one, then is SeparationVertex)
    145     int LowpointNr; //!< needed in DepthFirstSearchAnalysis() to detect nonseparable components, is the lowest possible number of an atom to reach via tree edges only followed by at most one back edge.
    146     bool SeparationVertex; //!< whether this atom separates off subsets of atoms or not, determined in DepthFirstSearchAnalysis()
    147     bool IsCyclic;        //!< whether atom belong to as cycle or not, determined in DepthFirstSearchAnalysis()
    148     unsigned char AdaptiveOrder;  //!< current present bond order at site (0 means "not set")
    149     bool MaxOrder;  //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not
    150 
    151   atom();
    152   atom(class atom *pointer);
    153   ~atom();
    154 
    155   bool Output(int ElementNo, int AtomNo, ofstream *out, const char *comment = NULL) const;
    156   bool OutputXYZLine(ofstream *out) const;
    157   atom *GetTrueFather();
    158   bool Compare(const atom &ptr);
    159 
    160   private:
    161 };
    162 
    163 ostream & operator << (ostream &ost, const atom &a);
    164 
    165 /** Bonds between atoms.
    166  * Class incorporates bonds between atoms in a molecule,
    167  * used to derive tge fragments in many-body bond order
    168  * calculations.
    169  */
    170 class bond {
    171   public:
    172     atom *leftatom;    //!< first bond partner
    173     atom *rightatom;  //!< second bond partner
    174     bond *previous; //!< previous atom in molecule list
    175     bond *next;     //!< next atom in molecule list
    176     int HydrogenBond;  //!< Number of hydrogen atoms in the bond
    177     int BondDegree;    //!< single, double, triple, ... bond
    178     int nr;           //!< unique number in a molecule, updated by molecule::CreateAdjacencyList()
    179     bool Cyclic;      //!< flag whether bond is part of a cycle or not, given in DepthFirstSearchAnalysis()
    180     enum EdgeType Type;//!< whether this is a tree or back edge
    181 
    182   atom * GetOtherAtom(atom *Atom) const;
    183   bond * GetFirstBond();
    184   bond * GetLastBond();
    185 
    186   bool MarkUsed(enum Shading color);
    187   enum Shading IsUsed();
    188   void ResetUsed();
    189   bool Contains(const atom *ptr);
    190   bool Contains(const int nr);
    191 
    192   bond();
    193   bond(atom *left, atom *right);
    194   bond(atom *left, atom *right, int degree);
    195   bond(atom *left, atom *right, int degree, int number);
    196   ~bond();
    197 
    198   private:
    199     enum Shading Used;        //!< marker in depth-first search, DepthFirstSearchAnalysis()
    200 };
    201 
    202 
    203 ostream & operator << (ostream &ost, const bond &b);
    204 
    205107#define MaxThermostats 6      //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
    206108enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover };   //!< Thermostat names for output
     
    210112 * Class incorporates number of types
    211113 */
    212 class molecule {
     114class molecule : public PointCloud {
    213115  public:
    214116    double cell_size[6];//!< cell size
     
    234136    char name[MAXSTRINGSIZE];         //!< arbitrary name
    235137    int IndexNr;        //!< index of molecule in a MoleculeListClass
     138    class Tesselation *TesselStruct;
    236139
    237140  molecule(periodentafel *teil);
    238   ~molecule();
     141  virtual ~molecule();
     142
     143  // re-definition of virtual functions from PointCloud
     144  Vector *GetCenter(ofstream *out);
     145  TesselPoint *GetPoint();
     146  TesselPoint *GetTerminalPoint();
     147  void GoToNext();
     148  void GoToPrevious();
     149  void GoToFirst();
     150  void GoToLast();
     151  bool IsEmpty();
     152  bool IsLast();
    239153
    240154  /// remove atoms from molecule.
     
    350264  private:
    351265  int last_atom;      //!< number given to last atom
     266  atom *InternalPointer;  //!< internal pointer for PointCloud
    352267};
    353268
     
    423338
    424339
    425 /** The config file.
    426  * The class contains all parameters that control a dft run also functions to load and save.
    427  */
    428 class config {
    429   public:
    430     int PsiType;
    431     int MaxPsiDouble;
    432     int PsiMaxNoUp;
    433     int PsiMaxNoDown;
    434     int MaxMinStopStep;
    435     int InitMaxMinStopStep;
    436     int ProcPEGamma;
    437     int ProcPEPsi;
    438     char *configpath;
    439     char *configname;
    440     bool FastParsing;
    441     double Deltat;
    442     string basis;
    443 
    444     char *databasepath;
    445 
    446     int DoConstrainedMD;
    447     int MaxOuterStep;
    448     int Thermostat;
    449     int *ThermostatImplemented;
    450     char **ThermostatNames;
    451     double TempFrequency;
    452     double alpha;
    453     double HooverMass;
    454     double TargetTemp;
    455     int ScaleTempStep;
    456    
    457   private:
    458     char *mainname;
    459     char *defaultpath;
    460     char *pseudopotpath;
    461 
    462     int DoOutVis;
    463     int DoOutMes;
    464     int DoOutNICS;
    465     int DoOutOrbitals;
    466     int DoOutCurrent;
    467     int DoFullCurrent;
    468     int DoPerturbation;
    469     int DoWannier;
    470     int CommonWannier;
    471     double SawtoothStart;
    472     int VectorPlane;
    473     double VectorCut;
    474     int UseAddGramSch;
    475     int Seed;
    476 
    477     int OutVisStep;
    478     int OutSrcStep;
    479     int MaxPsiStep;
    480     double EpsWannier;
    481 
    482     int MaxMinStep;
    483     double RelEpsTotalEnergy;
    484     double RelEpsKineticEnergy;
    485     int MaxMinGapStopStep;
    486     int MaxInitMinStep;
    487     double InitRelEpsTotalEnergy;
    488     double InitRelEpsKineticEnergy;
    489     int InitMaxMinGapStopStep;
    490 
    491     //double BoxLength[NDIM*NDIM];
    492 
    493     double ECut;
    494     int MaxLevel;
    495     int RiemannTensor;
    496     int LevRFactor;
    497     int RiemannLevel;
    498     int Lev0Factor;
    499     int RTActualUse;
    500     int AddPsis;
    501 
    502     double RCut;
    503     int StructOpt;
    504     int IsAngstroem;
    505     int RelativeCoord;
    506     int MaxTypes;
    507 
    508 
    509   int ParseForParameter(int verbose, ifstream *file, const char *name, int sequential, int const xth, int const yth, int type, void *value, int repetition, int critical);
    510   int ParseForParameter(int verbose, struct ConfigFileBuffer *FileBuffer, const char *name, int sequential, int const xth, int const yth, int type, void *value, int repetition, int critical);
    511 
    512   public:
    513   config();
    514   ~config();
    515 
    516   int TestSyntax(char *filename, periodentafel *periode, molecule *mol);
    517   void Load(char *filename, periodentafel *periode, molecule *mol);
    518   void LoadOld(char *filename, periodentafel *periode, molecule *mol);
    519   void RetrieveConfigPathAndName(string filename);
    520   bool Save(const char *filename, periodentafel *periode, molecule *mol) const;
    521   bool SaveMPQC(const char *filename, molecule *mol) const;
    522   void Edit();
    523   bool GetIsAngstroem() const;
    524   char *GetDefaultPath() const;
    525   void SetDefaultPath(const char *path);
    526   void InitThermostats(ifstream *source);
    527 };
    528 
    529340#endif /*MOLECULES_HPP_*/
    530341
Note: See TracChangeset for help on using the changeset viewer.