source: src/molecule.hpp@ 51be2a

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 51be2a was 4e10f5, checked in by Tillmann Crueger <crueger@…>, 14 years ago

Merge branch 'stable' into StructureRefactoring

Conflicts:

src/Actions/WorldAction/CenterOnEdgeAction.cpp
src/Actions/WorldAction/ChangeBoxAction.cpp
src/Actions/WorldAction/RepeatBoxAction.cpp
src/Actions/WorldAction/ScaleBoxAction.cpp
src/World.cpp
src/boundary.cpp

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