source: src/molecule.hpp@ 97ebf8

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 97ebf8 was 97ebf8, checked in by Frederik Heber <heber@…>, 15 years ago

Added all commands defined in ParseCommandLineOptions() as Actions.

  • Actions are not yet used, except verbose, version and help.
  • Files are present and included in Makefile.am
  • not unit tests written so far
  • no action has been tested so far (except for MapOfActions)
  • structure introduced to to transition from ParseCommandLineOptions to actions.
  • program name and config file are fixed arguments.

Signed-off-by: Frederik Heber <heber@…>

  • Property mode set to 100755
File size: 21.4 KB
Line 
1/** \file molecule.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/*********************************************** includes ***********************************/
12
13// GSL headers
14#include <gsl/gsl_eigen.h>
15#include <gsl/gsl_heapsort.h>
16#include <gsl/gsl_linalg.h>
17#include <gsl/gsl_matrix.h>
18#include <gsl/gsl_multimin.h>
19#include <gsl/gsl_vector.h>
20#include <gsl/gsl_randist.h>
21
22//// STL headers
23#include <map>
24#include <set>
25#include <deque>
26#include <list>
27#include <vector>
28
29#include <string>
30
31#include "defs.hpp"
32#include "graph.hpp"
33#include "stackclass.hpp"
34#include "tesselation.hpp"
35#include "Patterns/Observer.hpp"
36#include "Patterns/Cacheable.hpp"
37
38#include "Descriptors/MoleculeDescriptor_impl.hpp"
39
40/****************************************** forward declarations *****************************/
41
42class atom;
43class bond;
44class BondedParticle;
45class BondGraph;
46class element;
47class ForceMatrix;
48class LinkedCell;
49class molecule;
50class MoleculeLeafClass;
51class MoleculeListClass;
52class periodentafel;
53class Vector;
54
55/******************************** Some definitions for easier reading **********************************/
56
57#define MoleculeList list <molecule *>
58#define MoleculeListTest pair <MoleculeList::iterator, bool>
59
60#define DistancePair pair < double, atom* >
61#define DistanceMap multimap < double, atom* >
62#define DistanceTestPair pair < DistanceMap::iterator, bool>
63
64
65/************************************* Class definitions ****************************************/
66
67/** Structure to contain parameters needed for evaluation of constraint potential.
68 */
69struct EvaluatePotential
70{
71 int startstep; //!< start configuration (MDStep in atom::trajectory)
72 int endstep; //!< end configuration (MDStep in atom::trajectory)
73 atom **PermutationMap; //!< gives target ptr for each atom, array of size molecule::AtomCount (this is "x" in \f$ V^{con}(x) \f$ )
74 DistanceMap **DistanceList; //!< distance list of each atom to each atom
75 DistanceMap::iterator *StepList; //!< iterator to ascend through NearestNeighbours \a **DistanceList
76 int *DoubleList; //!< count of which sources want to move to this target, basically the injective measure (>1 -> not injective)
77 DistanceMap::iterator *DistanceIterators; //!< marks which was the last picked target as injective candidate with smallest distance
78 bool IsAngstroem; //!< whether coordinates are in angstroem (true) or bohrradius (false)
79 double *PenaltyConstants; //!< penalty constant in front of each term
80};
81
82#define MaxThermostats 6 //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
83enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover }; //!< Thermostat names for output
84
85
86/** The complete molecule.
87 * Class incorporates number of types
88 */
89class molecule : public PointCloud , public Observable {
90 friend molecule *NewMolecule();
91 friend void DeleteMolecule(molecule *);
92 public:
93 const periodentafel * const elemente; //!< periodic table with each element
94 atom *start; //!< start of atom list
95 atom *end; //!< end of atom list
96 bond *first; //!< start of bond list
97 bond *last; //!< end of bond list
98 int MDSteps; //!< The number of MD steps in Trajectories
99 int AtomCount; //!< number of atoms, brought up-to-date by CountAtoms()
100 int BondCount; //!< number of atoms, brought up-to-date by CountBonds()
101 int ElementCount; //!< how many unique elements are therein
102 int ElementsInMolecule[MAX_ELEMENTS]; //!< list whether element (sorted by atomic number) is alread present or not
103 mutable int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule
104 mutable int NoNonBonds; //!< number of non-hydrogen bonds in molecule
105 mutable int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
106 double BondDistance; //!< typical bond distance used in CreateAdjacencyList() and furtheron
107 bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules
108 Vector Center; //!< Center of molecule in a global box
109 int IndexNr; //!< index of molecule in a MoleculeListClass
110 char name[MAXSTRINGSIZE]; //!< arbitrary name
111
112 private:
113 Cacheable<string> formula;
114 moleculeId_t id;
115 protected:
116 molecule(const periodentafel * const teil);
117 virtual ~molecule();
118
119
120public:
121 //getter and setter
122 const std::string getName();
123 moleculeId_t getId();
124 void setId(moleculeId_t);
125 void setName(const std::string);
126 const std::string getFormula();
127 std::string calcFormula();
128
129
130 // re-definition of virtual functions from PointCloud
131 const char * const GetName() const;
132 Vector *GetCenter() const ;
133 TesselPoint *GetPoint() const ;
134 TesselPoint *GetTerminalPoint() const ;
135 int GetMaxId() const;
136 void GoToNext() const ;
137 void GoToPrevious() const ;
138 void GoToFirst() const ;
139 void GoToLast() const ;
140 bool IsEmpty() const ;
141 bool IsEnd() const ;
142
143 // templates for allowing global manipulation of all vectors
144 template <typename res> void ActOnAllVectors( res (Vector::*f)() ) const;
145 template <typename res> void ActOnAllVectors( res (Vector::*f)() const) const;
146 template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T), T t ) const;
147 template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T) const, T t ) const;
148 template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T&), T &t ) const;
149 template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T&) const, T &t ) const;
150 template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const;
151 template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const;
152 template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const;
153 template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const;
154
155 // templates for allowing global manipulation of molecule with each atom as single argument
156 template <typename res> void ActWithEachAtom( res (molecule::*f)(atom *) ) const;
157 template <typename res> void ActWithEachAtom( res (molecule::*f)(atom *) const) const;
158
159 // templates for allowing global copying of molecule with each atom as single argument
160 template <typename res> void ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const;
161 template <typename res> void ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const;
162
163 // templates for allowing global manipulation of all atoms
164 template <typename res, typename typ> void ActOnAllAtoms( res (typ::*f)() ) const;
165 template <typename res, typename typ> void ActOnAllAtoms( res (typ::*f)() const) const;
166 template <typename res, typename typ, typename T> void ActOnAllAtoms( res (typ::*f)(T), T t ) const;
167 template <typename res, typename typ, typename T> void ActOnAllAtoms( res (typ::*f)(T) const, T t ) const;
168 template <typename res, typename typ, typename T, typename U> void ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const;
169 template <typename res, typename typ, typename T, typename U> void ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const;
170 template <typename res, typename typ, typename T, typename U, typename V> void ActOnAllAtoms( res (typ::*f)(T, U, V), T t, U u, V v) const;
171 template <typename res, typename typ, typename T, typename U, typename V> void ActOnAllAtoms( res (typ::*f)(T, U, V) const, T t, U u, V v) const;
172 template <typename res, typename typ, typename T, typename U, typename V, typename W> void ActOnAllAtoms( res (typ::*f)(T, U, V, W), T t, U u, V v, W w) const;
173 template <typename res, typename typ, typename T, typename U, typename V, typename W> void ActOnAllAtoms( res (typ::*f)(T, U, V, W) const, T t, U u, V v, W w) const;
174
175 // templates for allowing conditional global copying of molecule with each atom as single argument
176 template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const;
177 template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () const ) const;
178 template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () ) const;
179 template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () const ) const;
180 template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const;
181 template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T) const, T t ) const;
182 template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T), T t ) const;
183 template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T) const, T t ) const;
184 template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const;
185 template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const;
186 template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const;
187 template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const;
188 template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const;
189 template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const;
190 template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const;
191 template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const;
192
193 // templates for allowing global manipulation of an array with one entry per atom
194 void SetIndexedArrayForEachAtomTo ( atom **array, int ParticleInfo::* index) const;
195 template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::* index, void (*Setor)(T *, T *)) const;
196 template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::* index, void (*Setor)(T *, T *), T t) const;
197 template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::* index, void (*Setor)(T *, T *), T *t) const;
198 template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int element::* index, void (*Setor)(T *, T *)) const;
199 template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int element::* index, void (*Setor)(T *, T *), T t) const;
200 template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int element::* index, void (*Setor)(T *, T *), T *t) const;
201 template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value) const;
202 template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ atom::*value) const;
203 template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const;
204 template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ &vect ) const;
205
206 // templates for allowing global manipulation of each atom by entries in an array
207 template <typename T, typename typ, typename typ2> void SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*value ) const;
208 template <typename T, typename typ> void SetAtomValueToValue ( T value, T typ::*ptr ) const;
209
210 template <typename res, typename typ> res SumPerAtom(res (typ::*f)() ) const;
211 template <typename res, typename typ> res SumPerAtom(res (typ::*f)() const ) const;
212 template <typename res, typename typ, typename T> res SumPerAtom(res (typ::*f)(T) , T t ) const;
213 template <typename res, typename typ, typename T> res SumPerAtom(res (typ::*f)(T) const, T t ) const;
214
215 /// remove atoms from molecule.
216 bool AddAtom(atom *pointer);
217 bool RemoveAtom(atom *pointer);
218 bool UnlinkAtom(atom *pointer);
219 bool CleanupMolecule();
220
221 /// Add/remove atoms to/from molecule.
222 atom * AddCopyAtom(atom *pointer);
223 bool AddXYZFile(string filename);
224 bool AddHydrogenReplacementAtom(bond *Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bool IsAngstroem);
225 bond * AddBond(atom *first, atom *second, int degree = 1);
226 bool RemoveBond(bond *pointer);
227 bool RemoveBonds(atom *BondPartner);
228
229 /// Find atoms.
230 atom * FindAtom(int Nr) const;
231 atom * AskAtom(string text);
232
233 /// Count and change present atoms' coordination.
234 void CountAtoms();
235 void CountElements();
236 void CalculateOrbitals(class config &configuration);
237 bool CenterInBox();
238 bool BoundInBox();
239 void CenterEdge(Vector *max);
240 void CenterOrigin();
241 void CenterPeriodic();
242 void CenterAtVector(Vector *newcenter);
243 void Translate(const Vector *x);
244 void TranslatePeriodically(const Vector *trans);
245 void Mirror(const Vector *x);
246 void Align(Vector *n);
247 void Scale(const double ** const factor);
248 void DeterminePeriodicCenter(Vector &center);
249 Vector * DetermineCenterOfGravity();
250 Vector * DetermineCenterOfAll() const;
251 void SetNameFromFilename(const char *filename);
252 void SetBoxDimension(Vector *dim);
253 void ScanForPeriodicCorrection();
254 bool VerletForceIntegration(char *file, config &configuration);
255 void Thermostats(config &configuration, double ActualTemp, int Thermostat);
256 void PrincipalAxisSystem(bool DoRotate);
257 double VolumeOfConvexEnvelope(bool IsAngstroem);
258
259 double ConstrainedPotential(struct EvaluatePotential &Params);
260 double MinimiseConstrainedPotential(atom **&permutation, int startstep, int endstep, bool IsAngstroem);
261 void EvaluateConstrainedForces(int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force);
262 bool LinearInterpolationBetweenConfiguration(int startstep, int endstep, const char *prefix, config &configuration, bool MapByIdentity);
263
264 bool CheckBounds(const Vector *x) const;
265 void GetAlignvector(struct lsq_params * par) const;
266
267 /// Initialising routines in fragmentation
268 void CreateAdjacencyListFromDbondFile(ifstream *output);
269 void CreateAdjacencyList(double bonddistance, bool IsAngstroem, void (BondGraph::*f)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG = NULL);
270 int CorrectBondDegree() const;
271 void OutputBondsList() const;
272 void CyclicBondAnalysis() const;
273 void OutputGraphInfoPerAtom() const;
274 void OutputGraphInfoPerBond() const;
275
276
277 // Graph analysis
278 MoleculeLeafClass * DepthFirstSearchAnalysis(class StackClass<bond *> *&BackEdgeStack) const;
279 void CyclicStructureAnalysis(class StackClass<bond *> *BackEdgeStack, int *&MinimumRingSize) const;
280 bool PickLocalBackEdges(atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack) const;
281 bond * FindNextUnused(atom *vertex) const;
282 void SetNextComponentNumber(atom *vertex, int nr) const;
283 void ResetAllBondsToUnused() const;
284 int CountCyclicBonds();
285 bool CheckForConnectedSubgraph(KeySet *Fragment);
286 string GetColor(enum Shading color) const;
287 bond * CopyBond(atom *left, atom *right, bond *CopyBond);
288
289
290 molecule *CopyMolecule();
291 molecule* CopyMoleculeFromSubRegion(const Vector offset, const double *parallelepiped) const;
292
293 /// Fragment molecule by two different approaches:
294 int FragmentMolecule(int Order, config *configuration);
295 bool CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
296 bool StoreBondsToFile(char *path, char *filename);
297 bool StoreAdjacencyToFile(char *path, char *filename);
298 bool CheckAdjacencyFileAgainstMolecule(char *path, atom **ListOfAtoms);
299 bool ParseOrderAtSiteFromFile(char *path);
300 bool StoreOrderAtSiteFile(char *path);
301 bool StoreForcesFile(MoleculeListClass *BondFragments, char *path, int *SortIndex);
302 bool CreateMappingLabelsToConfigSequence(int *&SortIndex);
303 void BreadthFirstSearchAdd(molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
304 /// -# BOSSANOVA
305 void FragmentBOSSANOVA(Graph *&FragmentList, KeyStack &RootStack, int *MinimumRingSize);
306 int PowerSetGenerator(int Order, struct UniqueFragments &FragmentSearch, KeySet RestrictedKeySet);
307 bool BuildInducedSubgraph(const molecule *Father);
308 molecule * StoreFragmentFromKeySet(KeySet &Leaflet, bool IsAngstroem);
309 void SPFragmentGenerator(struct UniqueFragments *FragmentSearch, int RootDistance, bond **BondsSet, int SetDimension, int SubOrder);
310 int LookForRemovalCandidate(KeySet *&Leaf, int *&ShortestPathList);
311 int GuesstimateFragmentCount(int order);
312
313 // Recognize doubly appearing molecules in a list of them
314 int * IsEqualToWithinThreshold(molecule *OtherMolecule, double threshold);
315 int * GetFatherSonAtomicMap(molecule *OtherMolecule);
316
317 // Output routines.
318 bool Output(ofstream * const output);
319 bool OutputTrajectories(ofstream * const output);
320 void OutputListOfBonds() const;
321 bool OutputXYZ(ofstream * const output) const;
322 bool OutputTrajectoriesXYZ(ofstream * const output);
323 bool Checkout(ofstream * const output) const;
324 bool OutputTemperatureFromTrajectories(ofstream * const output, int startstep, int endstep);
325
326 // Manipulation routines
327 void flipActiveFlag();
328
329 private:
330 int last_atom; //!< number given to last atom
331 mutable atom *InternalPointer; //!< internal pointer for PointCloud
332};
333
334molecule *NewMolecule();
335void DeleteMolecule(molecule* mol);
336
337#include "molecule_template.hpp"
338
339/** A list of \a molecule classes.
340 */
341class MoleculeListClass : public Observable {
342 public:
343 MoleculeList ListOfMolecules; //!< List of the contained molecules
344 int MaxIndex;
345
346 MoleculeListClass(World *world);
347 ~MoleculeListClass();
348
349 bool AddHydrogenCorrection(char *path);
350 bool StoreForcesFile(char *path, int *SortIndex);
351 void insert(molecule *mol);
352 molecule * ReturnIndex(int index);
353 bool OutputConfigForListOfFragments(config *configuration, int *SortIndex);
354 int NumberOfActiveMolecules();
355 void Enumerate(ostream *out);
356 void Output(ofstream *out);
357 void DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration);
358 int CountAllAtoms() const;
359
360 // Methods moved here from the menus
361 // TODO: more refactoring needed on these methods
362 void flipChosen();
363 void createNewMolecule(periodentafel *periode);
364 void loadFromXYZ(periodentafel *periode);
365 void setMoleculeFilename();
366 void parseXYZIntoMolecule();
367 void eraseMolecule();
368
369
370 // merging of molecules
371 bool SimpleMerge(molecule *mol, molecule *srcmol);
372 bool SimpleAdd(molecule *mol, molecule *srcmol);
373 bool SimpleMultiMerge(molecule *mol, int *src, int N);
374 bool SimpleMultiAdd(molecule *mol, int *src, int N);
375 bool ScatterMerge(molecule *mol, int *src, int N);
376 bool EmbedMerge(molecule *mol, molecule *srcmol);
377
378 private:
379 World *world; //!< The world this List belongs to. Needed to avoid deadlocks in the destructor
380};
381
382
383/** A leaf for a tree of \a molecule class
384 * Wraps molecules in a tree structure
385 */
386class MoleculeLeafClass {
387 public:
388 molecule *Leaf; //!< molecule of this leaf
389 //MoleculeLeafClass *UpLeaf; //!< Leaf one level up
390 //MoleculeLeafClass *DownLeaf; //!< First leaf one level down
391 MoleculeLeafClass *previous; //!< Previous leaf on this level
392 MoleculeLeafClass *next; //!< Next leaf on this level
393
394 //MoleculeLeafClass(MoleculeLeafClass *Up, MoleculeLeafClass *Previous);
395 MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf);
396 ~MoleculeLeafClass();
397
398 bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous);
399 bool FillBondStructureFromReference(const molecule * const reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList = false);
400 bool FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter);
401 bool AssignKeySetsToFragment(molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);
402 bool FillListOfLocalAtoms(atom ***&ListOfLocalAtoms, const int FragmentCounter, const int GlobalAtomCount, bool &FreeList);
403 void TranslateIndicesToGlobalIDs(Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph);
404 int Count() const;
405};
406
407
408#endif /*MOLECULES_HPP_*/
409
Note: See TracBrowser for help on using the repository browser.