Ignore:
Timestamp:
Jul 23, 2009, 2:21:57 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
c3a303
Parents:
c95b69
Message:

fixed indentation from tabs to two spaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecules.hpp

    rc95b69 ra048fa  
    7979struct KeyCompare
    8080{
    81         bool operator() (const KeySet SubgraphA, const KeySet SubgraphB) const;
     81  bool operator() (const KeySet SubgraphA, const KeySet SubgraphB) const;
    8282};
    8383
    8484struct Trajectory
    8585{
    86         vector<Vector> R;       //!< position vector
    87         vector<Vector> U;       //!< velocity vector
    88         vector<Vector> F;       //!< last force vector
    89         atom *ptr;                              //!< pointer to atom whose trajectory we contain
    90 };
    91 
    92 //bool operator < (KeySet SubgraphA, KeySet SubgraphB);  //note: this declaration is important, otherwise normal < is used (producing wrong order)
     86  vector<Vector> R;  //!< position vector
     87  vector<Vector> U;  //!< velocity vector
     88  vector<Vector> F;  //!< last force vector
     89  atom *ptr;        //!< pointer to atom whose trajectory we contain
     90};
     91
     92//bool operator < (KeySet SubgraphA, KeySet SubgraphB);  //note: this declaration is important, otherwise normal < is used (producing wrong order)
    9393inline void InsertFragmentIntoGraph(ofstream *out, struct UniqueFragments *Fragment); // Insert a KeySet into a Graph
    94 inline void InsertGraphIntoGraph(ofstream *out, Graph &graph1, Graph &graph2, int *counter);    // Insert all KeySet's in a Graph into another Graph
     94inline void InsertGraphIntoGraph(ofstream *out, Graph &graph1, Graph &graph2, int *counter);  // Insert all KeySet's in a Graph into another Graph
    9595int CompareDoubles (const void * a, const void * b);
    9696
     
    100100
    101101// some algebraic matrix stuff
    102 #define RDET3(a) ((a)[0]*(a)[4]*(a)[8] + (a)[3]*(a)[7]*(a)[2] + (a)[6]*(a)[1]*(a)[5] - (a)[2]*(a)[4]*(a)[6] - (a)[5]*(a)[7]*(a)[0] - (a)[8]*(a)[1]*(a)[3])      //!< hard-coded determinant of a 3x3 matrix
    103 #define RDET2(a0,a1,a2,a3) ((a0)*(a3)-(a1)*(a2))                                                                                        //!< hard-coded determinant of a 2x2 matrix
     102#define RDET3(a) ((a)[0]*(a)[4]*(a)[8] + (a)[3]*(a)[7]*(a)[2] + (a)[6]*(a)[1]*(a)[5] - (a)[2]*(a)[4]*(a)[6] - (a)[5]*(a)[7]*(a)[0] - (a)[8]*(a)[1]*(a)[3])  //!< hard-coded determinant of a 3x3 matrix
     103#define RDET2(a0,a1,a2,a3) ((a0)*(a3)-(a1)*(a2))                      //!< hard-coded determinant of a 2x2 matrix
    104104
    105105
     
    107107 */
    108108struct LSQ_params {
    109         Vector **vectors;
    110         int num;
     109  Vector **vectors;
     110  int num;
    111111};
    112112
     
    116116 */
    117117struct lsq_params {
    118         gsl_vector *x;
    119         const molecule *mol;
    120         element *type;
     118  gsl_vector *x;
     119  const molecule *mol;
     120  element *type;
    121121};
    122122
     
    125125 */
    126126class atom {
    127         public:
    128                 Vector x;                        //!< coordinate array of atom, giving position within cell
    129                 Vector v;                        //!< velocity array of atom
    130                 element *type;  //!< pointing to element
    131                 atom *previous; //!< previous atom in molecule list
    132                 atom *next;              //!< next atom in molecule list
    133                 atom *father;    //!< In many-body bond order fragmentations points to originating atom
    134                 atom *Ancestor; //!< "Father" in Depth-First-Search
    135                 char *Name;                     //!< unique name used during many-body bond-order fragmentation
    136                 int FixedIon;    //!< config variable that states whether forces act on the ion or not
    137                 int *sort;                      //!< sort criteria
    138                 int nr;                          //!< continuous, unique number
    139                 int GraphNr;                    //!< unique number, given in DepthFirstSearchAnalysis()
    140                 int *ComponentNr;//!< belongs to this nonseparable components, given in DepthFirstSearchAnalysis() (if more than one, then is SeparationVertex)
    141                 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.
    142                 bool SeparationVertex; //!< whether this atom separates off subsets of atoms or not, determined in DepthFirstSearchAnalysis()
    143                 bool IsCyclic;                          //!< whether atom belong to as cycle or not, determined in DepthFirstSearchAnalysis()
    144                 unsigned char AdaptiveOrder;    //!< current present bond order at site (0 means "not set")
    145                 bool MaxOrder;  //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not
    146 
    147         atom();
    148         ~atom();
    149 
    150         bool Output(int ElementNo, int AtomNo, ofstream *out, const char *comment = NULL) const;
    151         bool OutputXYZLine(ofstream *out) const;
    152         atom *GetTrueFather();
    153         bool Compare(atom &ptr);
    154 
    155         private:
     127  public:
     128    Vector x;      //!< coordinate array of atom, giving position within cell
     129    Vector v;      //!< velocity array of atom
     130    element *type;  //!< pointing to element
     131    atom *previous; //!< previous atom in molecule list
     132    atom *next;    //!< next atom in molecule list
     133    atom *father;  //!< In many-body bond order fragmentations points to originating atom
     134    atom *Ancestor; //!< "Father" in Depth-First-Search
     135    char *Name;      //!< unique name used during many-body bond-order fragmentation
     136    int FixedIon;  //!< config variable that states whether forces act on the ion or not
     137    int *sort;      //!< sort criteria
     138    int nr;        //!< continuous, unique number
     139    int GraphNr;      //!< unique number, given in DepthFirstSearchAnalysis()
     140    int *ComponentNr;//!< belongs to this nonseparable components, given in DepthFirstSearchAnalysis() (if more than one, then is SeparationVertex)
     141    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.
     142    bool SeparationVertex; //!< whether this atom separates off subsets of atoms or not, determined in DepthFirstSearchAnalysis()
     143    bool IsCyclic;        //!< whether atom belong to as cycle or not, determined in DepthFirstSearchAnalysis()
     144    unsigned char AdaptiveOrder;  //!< current present bond order at site (0 means "not set")
     145    bool MaxOrder;  //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not
     146
     147  atom();
     148  ~atom();
     149
     150  bool Output(int ElementNo, int AtomNo, ofstream *out, const char *comment = NULL) const;
     151  bool OutputXYZLine(ofstream *out) const;
     152  atom *GetTrueFather();
     153  bool Compare(atom &ptr);
     154
     155  private:
    156156};
    157157
     
    164164 */
    165165class bond {
    166         public:
    167                 atom *leftatom;         //!< first bond partner
    168                 atom *rightatom;        //!< second bond partner
    169                 bond *previous; //!< previous atom in molecule list
    170                 bond *next;              //!< next atom in molecule list
    171                 int HydrogenBond;       //!< Number of hydrogen atoms in the bond
    172                 int BondDegree;         //!< single, double, triple, ... bond
    173                 int nr;                                  //!< unique number in a molecule, updated by molecule::CreateAdjacencyList()
    174                 bool Cyclic;                    //!< flag whether bond is part of a cycle or not, given in DepthFirstSearchAnalysis()
    175                 enum EdgeType Type;//!< whether this is a tree or back edge
    176 
    177         atom * GetOtherAtom(atom *Atom) const;
    178         bond * GetFirstBond();
    179         bond * GetLastBond();
    180 
    181         bool MarkUsed(enum Shading color);
    182         enum Shading IsUsed();
    183         void ResetUsed();
    184         bool Contains(const atom *ptr);
    185         bool Contains(const int nr);
    186 
    187         bond();
    188         bond(atom *left, atom *right);
    189         bond(atom *left, atom *right, int degree);
    190         bond(atom *left, atom *right, int degree, int number);
    191         ~bond();
    192 
    193         private:
    194                 enum Shading Used;                              //!< marker in depth-first search, DepthFirstSearchAnalysis()
     166  public:
     167    atom *leftatom;    //!< first bond partner
     168    atom *rightatom;  //!< second bond partner
     169    bond *previous; //!< previous atom in molecule list
     170    bond *next;    //!< next atom in molecule list
     171    int HydrogenBond;  //!< Number of hydrogen atoms in the bond
     172    int BondDegree;    //!< single, double, triple, ... bond
     173    int nr;          //!< unique number in a molecule, updated by molecule::CreateAdjacencyList()
     174    bool Cyclic;      //!< flag whether bond is part of a cycle or not, given in DepthFirstSearchAnalysis()
     175    enum EdgeType Type;//!< whether this is a tree or back edge
     176
     177  atom * GetOtherAtom(atom *Atom) const;
     178  bond * GetFirstBond();
     179  bond * GetLastBond();
     180
     181  bool MarkUsed(enum Shading color);
     182  enum Shading IsUsed();
     183  void ResetUsed();
     184  bool Contains(const atom *ptr);
     185  bool Contains(const int nr);
     186
     187  bond();
     188  bond(atom *left, atom *right);
     189  bond(atom *left, atom *right, int degree);
     190  bond(atom *left, atom *right, int degree, int number);
     191  ~bond();
     192
     193  private:
     194    enum Shading Used;        //!< marker in depth-first search, DepthFirstSearchAnalysis()
    195195};
    196196
     
    203203 */
    204204class molecule {
    205         public:
    206                 double cell_size[6];//!< cell size
    207                 periodentafel *elemente; //!< periodic table with each element
    208                 atom *start;                            //!< start of atom list
    209                 atom *end;                                      //!< end of atom list
    210                 bond *first;                            //!< start of bond list
    211                 bond *last;                              //!< end of bond list
    212                 bond ***ListOfBondsPerAtom; //!< pointer list for each atom and each bond it has
    213                 map<atom *, struct Trajectory> Trajectories; //!< contains old trajectory points
    214                 int MDSteps;                            //!< The number of MD steps in Trajectories
    215                 int *NumberOfBondsPerAtom;      //!< Number of Bonds each atom has
    216                 int AtomCount;                                  //!< number of atoms, brought up-to-date by CountAtoms()
    217                 int BondCount;                                  //!< number of atoms, brought up-to-date by CountBonds()
    218                 int ElementCount;                        //!< how many unique elements are therein
    219                 int ElementsInMolecule[MAX_ELEMENTS]; //!< list whether element (sorted by atomic number) is alread present or not
    220                 int NoNonHydrogen;      //!< number of non-hydrogen atoms in molecule
    221                 int NoNonBonds;          //!< number of non-hydrogen bonds in molecule
    222                 int NoCyclicBonds;      //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
    223                 double BondDistance;    //!< typical bond distance used in CreateAdjacencyList() and furtheron
    224                 bool ActiveFlag;    //!< in a MoleculeListClass used to discern active from inactive molecules
    225                 Vector Center;      //!< Center of molecule in a global box
    226                 char name[MAXSTRINGSIZE];         //!< arbitrary name
    227                 int IndexNr;        //!< index of molecule in a MoleculeListClass
    228 
    229         molecule(periodentafel *teil);
    230         ~molecule();
    231 
    232         /// remove atoms from molecule.
    233         bool AddAtom(atom *pointer);
    234         bool RemoveAtom(atom *pointer);
    235         bool UnlinkAtom(atom *pointer);
    236         bool CleanupMolecule();
    237 
    238         /// Add/remove atoms to/from molecule.
    239         atom * AddCopyAtom(atom *pointer);
    240         bool AddXYZFile(string filename);
    241         bool AddHydrogenReplacementAtom(ofstream *out, bond *Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bond **BondList, int NumBond, bool IsAngstroem);
    242         bond * AddBond(atom *first, atom *second, int degree);
    243         bool RemoveBond(bond *pointer);
    244         bool RemoveBonds(atom *BondPartner);
    245 
    246         /// Find atoms.
    247         atom * FindAtom(int Nr) const;
    248         atom * AskAtom(string text);
    249 
    250         /// Count and change present atoms' coordination.
    251         void CountAtoms(ofstream *out);
    252         void CountElements();
    253         void CalculateOrbitals(class config &configuration);
    254         bool CenterInBox(ofstream *out);
    255         void CenterEdge(ofstream *out, Vector *max);
    256         void CenterOrigin(ofstream *out, Vector *max);
    257         void CenterGravity(ofstream *out, Vector *max);
    258         void Translate(const Vector *x);
    259         void TranslatePeriodically(const Vector *trans);
    260         void Mirror(const Vector *x);
    261         void Align(Vector *n);
    262         void Scale(double **factor);
    263         void DetermineCenter(Vector &center);
    264         Vector * DetermineCenterOfGravity(ofstream *out);
    265         Vector * DetermineCenterOfAll(ofstream *out);
    266         void SetNameFromFilename(char *filename);
    267         void SetBoxDimension(Vector *dim);
    268         double * ReturnFullMatrixforSymmetric(double *cell_size);
    269         void ScanForPeriodicCorrection(ofstream *out);
    270         void PrincipalAxisSystem(ofstream *out, bool DoRotate);
    271         double VolumeOfConvexEnvelope(ofstream *out, bool IsAngstroem);
    272         Vector* FindEmbeddingHole(ofstream *out, molecule *srcmol);
    273 
    274         bool VerletForceIntegration(char *file, double delta_t, bool IsAngstroem);
    275 
    276         bool CheckBounds(const Vector *x) const;
    277         void GetAlignvector(struct lsq_params * par) const;
    278 
    279         /// Initialising routines in fragmentation
    280         void CreateAdjacencyList2(ofstream *out, ifstream *output);
    281         void CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem);
    282         void CreateListOfBondsPerAtom(ofstream *out);
    283 
    284         // Graph analysis
    285         MoleculeLeafClass * DepthFirstSearchAnalysis(ofstream *out, class StackClass<bond *> *&BackEdgeStack);
    286         void CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> *BackEdgeStack, int *&MinimumRingSize);
    287         bool PickLocalBackEdges(ofstream *out, atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack);
    288         bond * FindNextUnused(atom *vertex);
    289         void SetNextComponentNumber(atom *vertex, int nr);
    290         void InitComponentNumbers();
    291         void OutputComponentNumber(ofstream *out, atom *vertex);
    292         void ResetAllBondsToUnused();
    293         void ResetAllAtomNumbers();
    294         int CountCyclicBonds(ofstream *out);
    295         bool CheckForConnectedSubgraph(ofstream *out, KeySet *Fragment);
    296         string GetColor(enum Shading color);
    297 
    298         molecule *CopyMolecule();
    299 
    300         /// Fragment molecule by two different approaches:
    301         int FragmentMolecule(ofstream *out, int Order, config *configuration);
    302         bool CheckOrderAtSite(ofstream *out, bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
    303         bool StoreAdjacencyToFile(ofstream *out, char *path);
    304         bool CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms);
    305         bool ParseOrderAtSiteFromFile(ofstream *out, char *path);
    306         bool StoreOrderAtSiteFile(ofstream *out, char *path);
    307         bool ParseKeySetFile(ofstream *out, char *filename, Graph *&FragmentList);
    308         bool StoreKeySetFile(ofstream *out, Graph &KeySetList, char *path);
    309         bool StoreForcesFile(ofstream *out, MoleculeListClass *BondFragments, char *path, int *SortIndex);
    310         bool CreateMappingLabelsToConfigSequence(ofstream *out, int *&SortIndex);
    311         bool ScanBufferIntoKeySet(ofstream *out, char *buffer, KeySet &CurrentSet);
    312         void BreadthFirstSearchAdd(ofstream *out, molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
    313         /// -# BOSSANOVA
    314         void FragmentBOSSANOVA(ofstream *out, Graph *&FragmentList, KeyStack &RootStack, int *MinimumRingSize);
    315         int PowerSetGenerator(ofstream *out, int Order, struct UniqueFragments &FragmentSearch, KeySet RestrictedKeySet);
    316         bool BuildInducedSubgraph(ofstream *out, const molecule *Father);
    317         molecule * StoreFragmentFromKeySet(ofstream *out, KeySet &Leaflet, bool IsAngstroem);
    318         void SPFragmentGenerator(ofstream *out, struct UniqueFragments *FragmentSearch, int RootDistance, bond **BondsSet, int SetDimension, int SubOrder);
    319         int LookForRemovalCandidate(ofstream *&out, KeySet *&Leaf, int *&ShortestPathList);
    320         int GuesstimateFragmentCount(ofstream *out, int order);
    321 
    322         // Recognize doubly appearing molecules in a list of them
    323         int * IsEqualToWithinThreshold(ofstream *out, molecule *OtherMolecule, double threshold);
    324         int * GetFatherSonAtomicMap(ofstream *out, molecule *OtherMolecule);
    325 
    326         // Output routines.
    327         bool Output(ofstream *out);
    328         bool OutputTrajectories(ofstream *out);
    329         void OutputListOfBonds(ofstream *out) const;
    330         bool OutputXYZ(ofstream *out) const;
    331         bool OutputTrajectoriesXYZ(ofstream *out);
    332         bool Checkout(ofstream *out) const;
    333         bool OutputTemperatureFromTrajectories(ofstream *out, int startstep, int endstep, ofstream *output);
    334 
    335         private:
    336         int last_atom;                  //!< number given to last atom
     205  public:
     206    double cell_size[6];//!< cell size
     207    periodentafel *elemente; //!< periodic table with each element
     208    atom *start;        //!< start of atom list
     209    atom *end;          //!< end of atom list
     210    bond *first;        //!< start of bond list
     211    bond *last;        //!< end of bond list
     212    bond ***ListOfBondsPerAtom; //!< pointer list for each atom and each bond it has
     213    map<atom *, struct Trajectory> Trajectories; //!< contains old trajectory points
     214    int MDSteps;        //!< The number of MD steps in Trajectories
     215    int *NumberOfBondsPerAtom;  //!< Number of Bonds each atom has
     216    int AtomCount;          //!< number of atoms, brought up-to-date by CountAtoms()
     217    int BondCount;          //!< number of atoms, brought up-to-date by CountBonds()
     218    int ElementCount;      //!< how many unique elements are therein
     219    int ElementsInMolecule[MAX_ELEMENTS]; //!< list whether element (sorted by atomic number) is alread present or not
     220    int NoNonHydrogen;  //!< number of non-hydrogen atoms in molecule
     221    int NoNonBonds;    //!< number of non-hydrogen bonds in molecule
     222    int NoCyclicBonds;  //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
     223    double BondDistance;  //!< typical bond distance used in CreateAdjacencyList() and furtheron
     224    bool ActiveFlag;    //!< in a MoleculeListClass used to discern active from inactive molecules
     225    Vector Center;      //!< Center of molecule in a global box
     226    char name[MAXSTRINGSIZE];         //!< arbitrary name
     227    int IndexNr;        //!< index of molecule in a MoleculeListClass
     228
     229  molecule(periodentafel *teil);
     230  ~molecule();
     231
     232  /// remove atoms from molecule.
     233  bool AddAtom(atom *pointer);
     234  bool RemoveAtom(atom *pointer);
     235  bool UnlinkAtom(atom *pointer);
     236  bool CleanupMolecule();
     237
     238  /// Add/remove atoms to/from molecule.
     239  atom * AddCopyAtom(atom *pointer);
     240  bool AddXYZFile(string filename);
     241  bool AddHydrogenReplacementAtom(ofstream *out, bond *Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bond **BondList, int NumBond, bool IsAngstroem);
     242  bond * AddBond(atom *first, atom *second, int degree);
     243  bool RemoveBond(bond *pointer);
     244  bool RemoveBonds(atom *BondPartner);
     245
     246  /// Find atoms.
     247  atom * FindAtom(int Nr) const;
     248  atom * AskAtom(string text);
     249
     250  /// Count and change present atoms' coordination.
     251  void CountAtoms(ofstream *out);
     252  void CountElements();
     253  void CalculateOrbitals(class config &configuration);
     254  bool CenterInBox(ofstream *out);
     255  void CenterEdge(ofstream *out, Vector *max);
     256  void CenterOrigin(ofstream *out, Vector *max);
     257  void CenterGravity(ofstream *out, Vector *max);
     258  void Translate(const Vector *x);
     259  void TranslatePeriodically(const Vector *trans);
     260  void Mirror(const Vector *x);
     261  void Align(Vector *n);
     262  void Scale(double **factor);
     263  void DetermineCenter(Vector &center);
     264  Vector * DetermineCenterOfGravity(ofstream *out);
     265  Vector * DetermineCenterOfAll(ofstream *out);
     266  void SetNameFromFilename(char *filename);
     267  void SetBoxDimension(Vector *dim);
     268  double * ReturnFullMatrixforSymmetric(double *cell_size);
     269  void ScanForPeriodicCorrection(ofstream *out);
     270  void PrincipalAxisSystem(ofstream *out, bool DoRotate);
     271  double VolumeOfConvexEnvelope(ofstream *out, bool IsAngstroem);
     272  Vector* FindEmbeddingHole(ofstream *out, molecule *srcmol);
     273
     274  bool VerletForceIntegration(char *file, double delta_t, bool IsAngstroem);
     275
     276  bool CheckBounds(const Vector *x) const;
     277  void GetAlignvector(struct lsq_params * par) const;
     278
     279  /// Initialising routines in fragmentation
     280  void CreateAdjacencyList2(ofstream *out, ifstream *output);
     281  void CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem);
     282  void CreateListOfBondsPerAtom(ofstream *out);
     283
     284  // Graph analysis
     285  MoleculeLeafClass * DepthFirstSearchAnalysis(ofstream *out, class StackClass<bond *> *&BackEdgeStack);
     286  void CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> *BackEdgeStack, int *&MinimumRingSize);
     287  bool PickLocalBackEdges(ofstream *out, atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack);
     288  bond * FindNextUnused(atom *vertex);
     289  void SetNextComponentNumber(atom *vertex, int nr);
     290  void InitComponentNumbers();
     291  void OutputComponentNumber(ofstream *out, atom *vertex);
     292  void ResetAllBondsToUnused();
     293  void ResetAllAtomNumbers();
     294  int CountCyclicBonds(ofstream *out);
     295  bool CheckForConnectedSubgraph(ofstream *out, KeySet *Fragment);
     296  string GetColor(enum Shading color);
     297
     298  molecule *CopyMolecule();
     299
     300  /// Fragment molecule by two different approaches:
     301  int FragmentMolecule(ofstream *out, int Order, config *configuration);
     302  bool CheckOrderAtSite(ofstream *out, bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
     303  bool StoreAdjacencyToFile(ofstream *out, char *path);
     304  bool CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms);
     305  bool ParseOrderAtSiteFromFile(ofstream *out, char *path);
     306  bool StoreOrderAtSiteFile(ofstream *out, char *path);
     307  bool ParseKeySetFile(ofstream *out, char *filename, Graph *&FragmentList);
     308  bool StoreKeySetFile(ofstream *out, Graph &KeySetList, char *path);
     309  bool StoreForcesFile(ofstream *out, MoleculeListClass *BondFragments, char *path, int *SortIndex);
     310  bool CreateMappingLabelsToConfigSequence(ofstream *out, int *&SortIndex);
     311  bool ScanBufferIntoKeySet(ofstream *out, char *buffer, KeySet &CurrentSet);
     312  void BreadthFirstSearchAdd(ofstream *out, molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
     313  /// -# BOSSANOVA
     314  void FragmentBOSSANOVA(ofstream *out, Graph *&FragmentList, KeyStack &RootStack, int *MinimumRingSize);
     315  int PowerSetGenerator(ofstream *out, int Order, struct UniqueFragments &FragmentSearch, KeySet RestrictedKeySet);
     316  bool BuildInducedSubgraph(ofstream *out, const molecule *Father);
     317  molecule * StoreFragmentFromKeySet(ofstream *out, KeySet &Leaflet, bool IsAngstroem);
     318  void SPFragmentGenerator(ofstream *out, struct UniqueFragments *FragmentSearch, int RootDistance, bond **BondsSet, int SetDimension, int SubOrder);
     319  int LookForRemovalCandidate(ofstream *&out, KeySet *&Leaf, int *&ShortestPathList);
     320  int GuesstimateFragmentCount(ofstream *out, int order);
     321
     322  // Recognize doubly appearing molecules in a list of them
     323  int * IsEqualToWithinThreshold(ofstream *out, molecule *OtherMolecule, double threshold);
     324  int * GetFatherSonAtomicMap(ofstream *out, molecule *OtherMolecule);
     325
     326  // Output routines.
     327  bool Output(ofstream *out);
     328  bool OutputTrajectories(ofstream *out);
     329  void OutputListOfBonds(ofstream *out) const;
     330  bool OutputXYZ(ofstream *out) const;
     331  bool OutputTrajectoriesXYZ(ofstream *out);
     332  bool Checkout(ofstream *out) const;
     333  bool OutputTemperatureFromTrajectories(ofstream *out, int startstep, int endstep, ofstream *output);
     334
     335  private:
     336  int last_atom;      //!< number given to last atom
    337337};
    338338
     
    340340 */
    341341class MoleculeListClass {
    342         public:
    343           MoleculeList ListOfMolecules; //!< List of the contained molecules
    344           int MaxIndex;
    345 
    346         MoleculeListClass();
    347         ~MoleculeListClass();
    348 
    349         bool AddHydrogenCorrection(ofstream *out, char *path);
    350         bool StoreForcesFile(ofstream *out, char *path, int *SortIndex);
    351         bool insert(molecule *mol);
    352         molecule * ReturnIndex(int index);
    353         bool OutputConfigForListOfFragments(ofstream *out, config *configuration, int *SortIndex);
    354         int NumberOfActiveMolecules();
    355         void Enumerate(ofstream *out);
    356         void Output(ofstream *out);
    357 
    358         // merging of molecules
     342  public:
     343    MoleculeList ListOfMolecules; //!< List of the contained molecules
     344    int MaxIndex;
     345
     346  MoleculeListClass();
     347  ~MoleculeListClass();
     348
     349  bool AddHydrogenCorrection(ofstream *out, char *path);
     350  bool StoreForcesFile(ofstream *out, char *path, int *SortIndex);
     351  bool insert(molecule *mol);
     352  molecule * ReturnIndex(int index);
     353  bool OutputConfigForListOfFragments(ofstream *out, config *configuration, int *SortIndex);
     354  int NumberOfActiveMolecules();
     355  void Enumerate(ofstream *out);
     356  void Output(ofstream *out);
     357
     358  // merging of molecules
    359359  bool SimpleMerge(molecule *mol, molecule *srcmol);
    360360  bool SimpleAdd(molecule *mol, molecule *srcmol);
     
    364364  bool EmbedMerge(molecule *mol, molecule *srcmol);
    365365
    366         private:
     366  private:
    367367};
    368368
     
    372372 */
    373373class MoleculeLeafClass {
    374         public:
    375                 molecule *Leaf;                                                                  //!< molecule of this leaf
    376                 //MoleculeLeafClass *UpLeaf;                            //!< Leaf one level up
    377                 //MoleculeLeafClass *DownLeaf;                  //!< First leaf one level down
    378                 MoleculeLeafClass *previous;    //!< Previous leaf on this level
    379                 MoleculeLeafClass *next;                        //!< Next leaf on this level
    380 
    381         //MoleculeLeafClass(MoleculeLeafClass *Up, MoleculeLeafClass *Previous);
    382         MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf);
    383         ~MoleculeLeafClass();
    384 
    385         bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous);
    386         bool FillBondStructureFromReference(ofstream *out, molecule *reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList = false);
    387         bool FillRootStackForSubgraphs(ofstream *out, KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter);
    388         bool AssignKeySetsToFragment(ofstream *out, molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);
    389         bool FillListOfLocalAtoms(ofstream *out, atom ***&ListOfLocalAtoms, const int FragmentCounter, const int GlobalAtomCount, bool &FreeList);
    390         void TranslateIndicesToGlobalIDs(ofstream *out, Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph);
    391         int Count() const;
     374  public:
     375    molecule *Leaf;                  //!< molecule of this leaf
     376    //MoleculeLeafClass *UpLeaf;        //!< Leaf one level up
     377    //MoleculeLeafClass *DownLeaf;      //!< First leaf one level down
     378    MoleculeLeafClass *previous;  //!< Previous leaf on this level
     379    MoleculeLeafClass *next;      //!< Next leaf on this level
     380
     381  //MoleculeLeafClass(MoleculeLeafClass *Up, MoleculeLeafClass *Previous);
     382  MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf);
     383  ~MoleculeLeafClass();
     384
     385  bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous);
     386  bool FillBondStructureFromReference(ofstream *out, molecule *reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList = false);
     387  bool FillRootStackForSubgraphs(ofstream *out, KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter);
     388  bool AssignKeySetsToFragment(ofstream *out, molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);
     389  bool FillListOfLocalAtoms(ofstream *out, atom ***&ListOfLocalAtoms, const int FragmentCounter, const int GlobalAtomCount, bool &FreeList);
     390  void TranslateIndicesToGlobalIDs(ofstream *out, Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph);
     391  int Count() const;
    392392};
    393393
     
    412412 */
    413413class config {
    414         public:
    415                 int PsiType;
    416                 int MaxPsiDouble;
    417                 int PsiMaxNoUp;
    418                 int PsiMaxNoDown;
    419                 int MaxMinStopStep;
    420                 int InitMaxMinStopStep;
    421                 int ProcPEGamma;
    422                 int ProcPEPsi;
    423                 char *configpath;
    424                 char *configname;
    425                 bool FastParsing;
    426                 double Deltat;
    427                 string basis;
     414  public:
     415    int PsiType;
     416    int MaxPsiDouble;
     417    int PsiMaxNoUp;
     418    int PsiMaxNoDown;
     419    int MaxMinStopStep;
     420    int InitMaxMinStopStep;
     421    int ProcPEGamma;
     422    int ProcPEPsi;
     423    char *configpath;
     424    char *configname;
     425    bool FastParsing;
     426    double Deltat;
     427    string basis;
    428428
    429429    char *databasepath;
    430430
    431         private:
    432                 char *mainname;
    433                 char *defaultpath;
    434                 char *pseudopotpath;
    435 
    436                 int DoOutVis;
    437                 int DoOutMes;
    438                 int DoOutNICS;
    439                 int DoOutOrbitals;
    440                 int DoOutCurrent;
    441                 int DoFullCurrent;
    442                 int DoPerturbation;
    443                 int DoWannier;
    444                 int CommonWannier;
    445                 double SawtoothStart;
    446                 int VectorPlane;
    447                 double VectorCut;
    448                 int UseAddGramSch;
    449                 int Seed;
    450 
    451                 int MaxOuterStep;
    452                 int OutVisStep;
    453                 int OutSrcStep;
    454                 double TargetTemp;
    455                 int ScaleTempStep;
    456                 int MaxPsiStep;
    457                 double EpsWannier;
    458 
    459                 int MaxMinStep;
    460                 double RelEpsTotalEnergy;
    461                 double RelEpsKineticEnergy;
    462                 int MaxMinGapStopStep;
    463                 int MaxInitMinStep;
    464                 double InitRelEpsTotalEnergy;
    465                 double InitRelEpsKineticEnergy;
    466                 int InitMaxMinGapStopStep;
    467 
    468                 //double BoxLength[NDIM*NDIM];
    469 
    470                 double ECut;
    471                 int MaxLevel;
    472                 int RiemannTensor;
    473                 int LevRFactor;
    474                 int RiemannLevel;
    475                 int Lev0Factor;
    476                 int RTActualUse;
    477                 int AddPsis;
    478 
    479                 double RCut;
    480                 int StructOpt;
    481                 int IsAngstroem;
    482                 int RelativeCoord;
    483                 int MaxTypes;
    484 
    485 
    486         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);
    487         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);
    488 
    489         public:
    490         config();
    491         ~config();
    492 
    493         int TestSyntax(char *filename, periodentafel *periode, molecule *mol);
    494         void Load(char *filename, periodentafel *periode, molecule *mol);
    495         void LoadOld(char *filename, periodentafel *periode, molecule *mol);
    496         void RetrieveConfigPathAndName(string filename);
    497         bool Save(const char *filename, periodentafel *periode, molecule *mol) const;
    498         bool SaveMPQC(const char *filename, molecule *mol) const;
    499         void Edit();
    500         bool GetIsAngstroem() const;
    501         char *GetDefaultPath() const;
    502         void SetDefaultPath(const char *path);
     431  private:
     432    char *mainname;
     433    char *defaultpath;
     434    char *pseudopotpath;
     435
     436    int DoOutVis;
     437    int DoOutMes;
     438    int DoOutNICS;
     439    int DoOutOrbitals;
     440    int DoOutCurrent;
     441    int DoFullCurrent;
     442    int DoPerturbation;
     443    int DoWannier;
     444    int CommonWannier;
     445    double SawtoothStart;
     446    int VectorPlane;
     447    double VectorCut;
     448    int UseAddGramSch;
     449    int Seed;
     450
     451    int MaxOuterStep;
     452    int OutVisStep;
     453    int OutSrcStep;
     454    double TargetTemp;
     455    int ScaleTempStep;
     456    int MaxPsiStep;
     457    double EpsWannier;
     458
     459    int MaxMinStep;
     460    double RelEpsTotalEnergy;
     461    double RelEpsKineticEnergy;
     462    int MaxMinGapStopStep;
     463    int MaxInitMinStep;
     464    double InitRelEpsTotalEnergy;
     465    double InitRelEpsKineticEnergy;
     466    int InitMaxMinGapStopStep;
     467
     468    //double BoxLength[NDIM*NDIM];
     469
     470    double ECut;
     471    int MaxLevel;
     472    int RiemannTensor;
     473    int LevRFactor;
     474    int RiemannLevel;
     475    int Lev0Factor;
     476    int RTActualUse;
     477    int AddPsis;
     478
     479    double RCut;
     480    int StructOpt;
     481    int IsAngstroem;
     482    int RelativeCoord;
     483    int MaxTypes;
     484
     485
     486  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);
     487  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);
     488
     489  public:
     490  config();
     491  ~config();
     492
     493  int TestSyntax(char *filename, periodentafel *periode, molecule *mol);
     494  void Load(char *filename, periodentafel *periode, molecule *mol);
     495  void LoadOld(char *filename, periodentafel *periode, molecule *mol);
     496  void RetrieveConfigPathAndName(string filename);
     497  bool Save(const char *filename, periodentafel *periode, molecule *mol) const;
     498  bool SaveMPQC(const char *filename, molecule *mol) const;
     499  void Edit();
     500  bool GetIsAngstroem() const;
     501  char *GetDefaultPath() const;
     502  void SetDefaultPath(const char *path);
    503503};
    504504
Note: See TracChangeset for help on using the changeset viewer.