source: src/molecules.hpp@ 2319ed

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
Last change on this file since 2319ed was 2319ed, checked in by Frederik Heber <heber@…>, 16 years ago

We are one step further in fixing the convex hull: There are two functions of Saskia Metzler missing, but then we may proceed with testing whether the simple correction scheme of the convex envelope works, but one thing: Right now we cannot associate a Tesselation to its molecule as the snake bites it's one tail. Hence, the next commit will consist of fixing this bad-OOP issue.

  • Makefile.am: Just some alphabetical resorting.
  • atom::atom() new copy constructor
  • builder.cpp: some output for cluster volume, molecule::AddCopyAtom() uses new copy constructor
  • FillBoxWithMolecule() - new function to fill the remainder of the simulation box with some given filler molecules. Makes explicit use of the tesselated surfaces
  • find_convex_border() - InsertStraddlingPoints() and CorrectConcaveBaselines() is called to correct for atoms outside the envelope and caused-by concave points
  • Tesselation::InsertStraddlingPoints() enlarges the envelope for all atoms found outside, Tesselation::CorrectConcaveBaselines() corrects all found baselines if the adjacent triangles are concave by flipping.
  • boundary.cpp: Lots of helper routines for stuff further below:
  • The following routines are needed to check whether point is in- or outside:
  • FIX: Tesselation::AddPoint() - newly created BoundaryPoint is removed if already present.

Problem: We want to associate a Tesselation class with each molecule class. However, so far we have to know about atoms and bond and molecules inside the Tesselation. We have to remove this dependency and create some intermediate class which enables/encapsulates the access to Vectors, e.g. hidden inside the atom class. This is also good OOP! The Tesselation also only needs a set of Vectors, not more!

  • Property mode set to 100755
File size: 20.1 KB
Line 
1/** \file molecules.hpp
2 *
3 * Class definitions of atom and molecule, element and periodentafel
4 */
5
6#ifndef MOLECULES_HPP_
7#define MOLECULES_HPP_
8
9using namespace std;
10
11// GSL headers
12#include <gsl/gsl_eigen.h>
13#include <gsl/gsl_heapsort.h>
14#include <gsl/gsl_linalg.h>
15#include <gsl/gsl_matrix.h>
16#include <gsl/gsl_multimin.h>
17#include <gsl/gsl_vector.h>
18#include <gsl/gsl_randist.h>
19
20// STL headers
21#include <map>
22#include <set>
23#include <deque>
24#include <list>
25#include <vector>
26
27#include "helpers.hpp"
28#include "parser.hpp"
29#include "periodentafel.hpp"
30#include "stackclass.hpp"
31#include "vector.hpp"
32
33class atom;
34class bond;
35class config;
36class molecule;
37class MoleculeLeafClass;
38class MoleculeListClass;
39class Verbose;
40class Tesselation;
41
42/******************************** Some definitions for easier reading **********************************/
43
44#define KeyStack deque<int>
45#define KeySet set<int>
46#define NumberValuePair pair<int, double>
47#define Graph map <KeySet, NumberValuePair, KeyCompare >
48#define GraphPair pair <KeySet, NumberValuePair >
49#define KeySetTestPair pair<KeySet::iterator, bool>
50#define GraphTestPair pair<Graph::iterator, bool>
51
52#define DistancePair pair < double, atom* >
53#define DistanceMap multimap < double, atom* >
54#define DistanceTestPair pair < DistanceMap::iterator, bool>
55
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 *>
80
81/******************************** Some small functions and/or structures **********************************/
82
83struct KeyCompare
84{
85 bool operator() (const KeySet SubgraphA, const KeySet SubgraphB) const;
86};
87
88struct Trajectory
89{
90 vector<Vector> R; //!< position vector
91 vector<Vector> U; //!< velocity vector
92 vector<Vector> F; //!< last force vector
93 atom *ptr; //!< pointer to atom whose trajectory we contain
94};
95
96//bool operator < (KeySet SubgraphA, KeySet SubgraphB); //note: this declaration is important, otherwise normal < is used (producing wrong order)
97inline void InsertFragmentIntoGraph(ofstream *out, struct UniqueFragments *Fragment); // Insert a KeySet into a Graph
98inline void InsertGraphIntoGraph(ofstream *out, Graph &graph1, Graph &graph2, int *counter); // Insert all KeySet's in a Graph into another Graph
99int CompareDoubles (const void * a, const void * b);
100
101
102/************************************* Class definitions ****************************************/
103
104
105// some algebraic matrix stuff
106#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
107#define RDET2(a0,a1,a2,a3) ((a0)*(a3)-(a1)*(a2)) //!< hard-coded determinant of a 2x2 matrix
108
109
110/** Parameter structure for least square minimsation.
111 */
112struct LSQ_params {
113 Vector **vectors;
114 int num;
115};
116
117double LSQ(const gsl_vector * x, void * params);
118
119/** Parameter structure for least square minimsation.
120 */
121struct lsq_params {
122 gsl_vector *x;
123 const molecule *mol;
124 element *type;
125};
126
127/** Single atom.
128 * Class incoporates position, type
129 */
130class 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(atom &ptr);
159
160 private:
161};
162
163ostream & 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 */
170class 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
203ostream & operator << (ostream &ost, const bond &b);
204
205#define MaxThermostats 6 //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
206enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover }; //!< Thermostat names for output
207
208
209/** The complete molecule.
210 * Class incorporates number of types
211 */
212class molecule {
213 public:
214 double cell_size[6];//!< cell size
215 periodentafel *elemente; //!< periodic table with each element
216 atom *start; //!< start of atom list
217 atom *end; //!< end of atom list
218 bond *first; //!< start of bond list
219 bond *last; //!< end of bond list
220 bond ***ListOfBondsPerAtom; //!< pointer list for each atom and each bond it has
221 map<atom *, struct Trajectory> Trajectories; //!< contains old trajectory points
222 int MDSteps; //!< The number of MD steps in Trajectories
223 int *NumberOfBondsPerAtom; //!< Number of Bonds each atom has
224 int AtomCount; //!< number of atoms, brought up-to-date by CountAtoms()
225 int BondCount; //!< number of atoms, brought up-to-date by CountBonds()
226 int ElementCount; //!< how many unique elements are therein
227 int ElementsInMolecule[MAX_ELEMENTS]; //!< list whether element (sorted by atomic number) is alread present or not
228 int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule
229 int NoNonBonds; //!< number of non-hydrogen bonds in molecule
230 int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
231 double BondDistance; //!< typical bond distance used in CreateAdjacencyList() and furtheron
232 bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules
233 Vector Center; //!< Center of molecule in a global box
234 char name[MAXSTRINGSIZE]; //!< arbitrary name
235 int IndexNr; //!< index of molecule in a MoleculeListClass
236
237 molecule(periodentafel *teil);
238 ~molecule();
239
240 /// remove atoms from molecule.
241 bool AddAtom(atom *pointer);
242 bool RemoveAtom(atom *pointer);
243 bool UnlinkAtom(atom *pointer);
244 bool CleanupMolecule();
245
246 /// Add/remove atoms to/from molecule.
247 atom * AddCopyAtom(atom *pointer);
248 bool AddXYZFile(string filename);
249 bool AddHydrogenReplacementAtom(ofstream *out, bond *Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bond **BondList, int NumBond, bool IsAngstroem);
250 bond * AddBond(atom *first, atom *second, int degree);
251 bool RemoveBond(bond *pointer);
252 bool RemoveBonds(atom *BondPartner);
253
254 /// Find atoms.
255 atom * FindAtom(int Nr) const;
256 atom * AskAtom(string text);
257
258 /// Count and change present atoms' coordination.
259 void CountAtoms(ofstream *out);
260 void CountElements();
261 void CalculateOrbitals(class config &configuration);
262 bool CenterInBox(ofstream *out);
263 void CenterEdge(ofstream *out, Vector *max);
264 void CenterOrigin(ofstream *out);
265 void CenterPeriodic(ofstream *out);
266 void CenterAtVector(ofstream *out, Vector *newcenter);
267 void Translate(const Vector *x);
268 void TranslatePeriodically(const Vector *trans);
269 void Mirror(const Vector *x);
270 void Align(Vector *n);
271 void Scale(double **factor);
272 void DeterminePeriodicCenter(Vector &center);
273 Vector * DetermineCenterOfGravity(ofstream *out);
274 Vector * DetermineCenterOfAll(ofstream *out);
275 void SetNameFromFilename(const char *filename);
276 void SetBoxDimension(Vector *dim);
277 double * ReturnFullMatrixforSymmetric(double *cell_size);
278 void ScanForPeriodicCorrection(ofstream *out);
279 bool VerletForceIntegration(ofstream *out, char *file, config &configuration);
280 void Thermostats(config &configuration, double ActualTemp, int Thermostat);
281 void PrincipalAxisSystem(ofstream *out, bool DoRotate);
282 double VolumeOfConvexEnvelope(ofstream *out, bool IsAngstroem);
283 Vector* FindEmbeddingHole(ofstream *out, molecule *srcmol);
284
285
286 double ConstrainedPotential(ofstream *out, atom **permutation, int start, int end, double *constants, bool IsAngstroem);
287 double MinimiseConstrainedPotential(ofstream *out, atom **&permutation, int startstep, int endstep, bool IsAngstroem);
288 void EvaluateConstrainedForces(ofstream *out, int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force);
289 bool LinearInterpolationBetweenConfiguration(ofstream *out, int startstep, int endstep, const char *prefix, config &configuration);
290
291 bool CheckBounds(const Vector *x) const;
292 void GetAlignvector(struct lsq_params * par) const;
293
294 /// Initialising routines in fragmentation
295 void CreateAdjacencyList2(ofstream *out, ifstream *output);
296 void CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem);
297 void CreateListOfBondsPerAtom(ofstream *out);
298
299 // Graph analysis
300 MoleculeLeafClass * DepthFirstSearchAnalysis(ofstream *out, class StackClass<bond *> *&BackEdgeStack);
301 void CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> *BackEdgeStack, int *&MinimumRingSize);
302 bool PickLocalBackEdges(ofstream *out, atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack);
303 bond * FindNextUnused(atom *vertex);
304 void SetNextComponentNumber(atom *vertex, int nr);
305 void InitComponentNumbers();
306 void OutputComponentNumber(ofstream *out, atom *vertex);
307 void ResetAllBondsToUnused();
308 void ResetAllAtomNumbers();
309 int CountCyclicBonds(ofstream *out);
310 bool CheckForConnectedSubgraph(ofstream *out, KeySet *Fragment);
311 string GetColor(enum Shading color);
312
313 molecule *CopyMolecule();
314
315 /// Fragment molecule by two different approaches:
316 int FragmentMolecule(ofstream *out, int Order, config *configuration);
317 bool CheckOrderAtSite(ofstream *out, bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
318 bool StoreAdjacencyToFile(ofstream *out, char *path);
319 bool CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms);
320 bool ParseOrderAtSiteFromFile(ofstream *out, char *path);
321 bool StoreOrderAtSiteFile(ofstream *out, char *path);
322 bool ParseKeySetFile(ofstream *out, char *filename, Graph *&FragmentList);
323 bool StoreKeySetFile(ofstream *out, Graph &KeySetList, char *path);
324 bool StoreForcesFile(ofstream *out, MoleculeListClass *BondFragments, char *path, int *SortIndex);
325 bool CreateMappingLabelsToConfigSequence(ofstream *out, int *&SortIndex);
326 bool ScanBufferIntoKeySet(ofstream *out, char *buffer, KeySet &CurrentSet);
327 void BreadthFirstSearchAdd(ofstream *out, molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
328 /// -# BOSSANOVA
329 void FragmentBOSSANOVA(ofstream *out, Graph *&FragmentList, KeyStack &RootStack, int *MinimumRingSize);
330 int PowerSetGenerator(ofstream *out, int Order, struct UniqueFragments &FragmentSearch, KeySet RestrictedKeySet);
331 bool BuildInducedSubgraph(ofstream *out, const molecule *Father);
332 molecule * StoreFragmentFromKeySet(ofstream *out, KeySet &Leaflet, bool IsAngstroem);
333 void SPFragmentGenerator(ofstream *out, struct UniqueFragments *FragmentSearch, int RootDistance, bond **BondsSet, int SetDimension, int SubOrder);
334 int LookForRemovalCandidate(ofstream *&out, KeySet *&Leaf, int *&ShortestPathList);
335 int GuesstimateFragmentCount(ofstream *out, int order);
336
337 // Recognize doubly appearing molecules in a list of them
338 int * IsEqualToWithinThreshold(ofstream *out, molecule *OtherMolecule, double threshold);
339 int * GetFatherSonAtomicMap(ofstream *out, molecule *OtherMolecule);
340
341 // Output routines.
342 bool Output(ofstream *out);
343 bool OutputTrajectories(ofstream *out);
344 void OutputListOfBonds(ofstream *out) const;
345 bool OutputXYZ(ofstream *out) const;
346 bool OutputTrajectoriesXYZ(ofstream *out);
347 bool Checkout(ofstream *out) const;
348 bool OutputTemperatureFromTrajectories(ofstream *out, int startstep, int endstep, ofstream *output);
349
350 private:
351 int last_atom; //!< number given to last atom
352};
353
354/** A list of \a molecule classes.
355 */
356class MoleculeListClass {
357 public:
358 MoleculeList ListOfMolecules; //!< List of the contained molecules
359 int MaxIndex;
360
361 MoleculeListClass();
362 ~MoleculeListClass();
363
364 bool AddHydrogenCorrection(ofstream *out, char *path);
365 bool StoreForcesFile(ofstream *out, char *path, int *SortIndex);
366 void insert(molecule *mol);
367 molecule * ReturnIndex(int index);
368 bool OutputConfigForListOfFragments(ofstream *out, config *configuration, int *SortIndex);
369 int NumberOfActiveMolecules();
370 void Enumerate(ofstream *out);
371 void Output(ofstream *out);
372
373 // merging of molecules
374 bool SimpleMerge(molecule *mol, molecule *srcmol);
375 bool SimpleAdd(molecule *mol, molecule *srcmol);
376 bool SimpleMultiMerge(molecule *mol, int *src, int N);
377 bool SimpleMultiAdd(molecule *mol, int *src, int N);
378 bool ScatterMerge(molecule *mol, int *src, int N);
379 bool EmbedMerge(molecule *mol, molecule *srcmol);
380
381 private:
382};
383
384
385/** A leaf for a tree of \a molecule class
386 * Wraps molecules in a tree structure
387 */
388class MoleculeLeafClass {
389 public:
390 molecule *Leaf; //!< molecule of this leaf
391 //MoleculeLeafClass *UpLeaf; //!< Leaf one level up
392 //MoleculeLeafClass *DownLeaf; //!< First leaf one level down
393 MoleculeLeafClass *previous; //!< Previous leaf on this level
394 MoleculeLeafClass *next; //!< Next leaf on this level
395
396 //MoleculeLeafClass(MoleculeLeafClass *Up, MoleculeLeafClass *Previous);
397 MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf);
398 ~MoleculeLeafClass();
399
400 bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous);
401 bool FillBondStructureFromReference(ofstream *out, molecule *reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList = false);
402 bool FillRootStackForSubgraphs(ofstream *out, KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter);
403 bool AssignKeySetsToFragment(ofstream *out, molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);
404 bool FillListOfLocalAtoms(ofstream *out, atom ***&ListOfLocalAtoms, const int FragmentCounter, const int GlobalAtomCount, bool &FreeList);
405 void TranslateIndicesToGlobalIDs(ofstream *out, Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph);
406 int Count() const;
407};
408
409class ConfigFileBuffer {
410 public:
411 char **buffer;
412 int *LineMapping;
413 int CurrentLine;
414 int NoLines;
415
416 ConfigFileBuffer();
417 ConfigFileBuffer(char *filename);
418 ~ConfigFileBuffer();
419
420 void InitMapping();
421 void MapIonTypesInBuffer(int NoAtoms);
422};
423
424
425/** The config file.
426 * The class contains all parameters that control a dft run also functions to load and save.
427 */
428class 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
529#endif /*MOLECULES_HPP_*/
530
Note: See TracBrowser for help on using the repository browser.