Changeset 437922 for src/molecules.hpp


Ignore:
Timestamp:
Jul 23, 2009, 12:14:13 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
d067d45
Parents:
178f92
Message:

Fix indentation from tab to two spaces.

The trouble was caused at the merge e08f45e4539ffcc30e039dec5606cf06b45ab6be. Seemingly, I thought eclipse had pulled some shit which i didn't

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecules.hpp

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