Changes in src/molecules.hpp [df793a:2746be]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecules.hpp
-
Property mode
changed from
100644
to100755
rdf793a r2746be 1 1 /** \file molecules.hpp 2 2 * 3 * Class definitions of atom and molecule, element and periodentafel 3 * Class definitions of atom and molecule, element and periodentafel 4 4 */ 5 5 … … 10 10 11 11 // GSL headers 12 #include <gsl/gsl_multimin.h> 13 #include <gsl/gsl_vector.h> 14 #include <gsl/gsl_matrix.h> 12 15 #include <gsl/gsl_eigen.h> 13 16 #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 17 20 18 // STL headers … … 56 54 #define BoundariesTestPair pair< Boundaries::iterator, bool> 57 55 58 #define PointMap map < int, class BoundaryPointSet * > 59 #define PointPair pair < int, class BoundaryPointSet * > 60 #define PointTestPair pair < PointMap::iterator, bool > 61 62 #define LineMap map < int, class BoundaryLineSet * > 63 #define LinePair pair < int, class BoundaryLineSet * > 64 #define LineTestPair pair < Line Pair::iterator, bool >65 66 #define TriangleMap map < int, class BoundaryTriangleSet * > 67 #define TrianglePair pair < int, class BoundaryTriangleSet * > 68 #define TriangleTestPair pair < TrianglePair::iterator, bool > 56 #define PointMap map < int, class BoundaryPointSet * > 57 #define PointPair pair < int, class BoundaryPointSet * > 58 #define PointTestPair pair < PointMap::iterator, bool > 59 60 #define LineMap map < int, class BoundaryLineSet * > 61 #define LinePair pair < int, class BoundaryLineSet * > 62 #define LineTestPair pair < LineMap::iterator, bool > 63 64 #define TriangleMap map < int, class BoundaryTriangleSet * > 65 #define TrianglePair pair < int, class BoundaryTriangleSet * > 66 #define TriangleTestPair pair < TrianglePair::iterator, bool > 69 67 70 68 #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> > … … 88 86 //bool operator < (KeySet SubgraphA, KeySet SubgraphB); //note: this declaration is important, otherwise normal < is used (producing wrong order) 89 87 inline void InsertFragmentIntoGraph(ofstream *out, struct UniqueFragments *Fragment); // Insert a KeySet into a Graph 90 inline void InsertGraphIntoGraph(ofstream *out, Graph &graph1, Graph &graph2, int *counter); // Insert all KeySet's in a Graph into another Graph 88 inline void InsertGraphIntoGraph(ofstream *out, Graph &graph1, Graph &graph2, int *counter); // Insert all KeySet's in a Graph into another Graph 91 89 int CompareDoubles (const void * a, const void * b); 92 90 … … 142 140 unsigned char AdaptiveOrder; //!< current present bond order at site (0 means "not set") 143 141 bool MaxOrder; //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not 144 142 145 143 atom(); 146 144 ~atom(); 147 145 148 146 bool Output(int ElementNo, int AtomNo, ofstream *out) const; 149 147 bool OutputXYZLine(ofstream *out) const; 150 148 atom *GetTrueFather(); 151 149 bool Compare(atom &ptr); 152 150 153 151 private: 154 152 }; 155 153 156 ostream & operator << (ostream &ost, constatom &a);154 ostream & operator << (ostream &ost, atom &a); 157 155 158 156 /** Bonds between atoms. … … 171 169 int nr; //!< unique number in a molecule, updated by molecule::CreateAdjacencyList() 172 170 bool Cyclic; //!< flag whether bond is part of a cycle or not, given in DepthFirstSearchAnalysis() 173 enum EdgeType Type;//!< whether this is a tree or back edge 174 171 enum EdgeType Type;//!< whether this is a tree or back edge 172 175 173 atom * GetOtherAtom(atom *Atom) const; 176 174 bond * GetFirstBond(); 177 175 bond * GetLastBond(); 178 176 179 177 bool MarkUsed(enum Shading color); 180 178 enum Shading IsUsed(); … … 182 180 bool Contains(const atom *ptr); 183 181 bool Contains(const int nr); 184 182 185 183 bond(); 186 184 bond(atom *left, atom *right); … … 188 186 bond(atom *left, atom *right, int degree, int number); 189 187 ~bond(); 190 191 private: 188 189 private: 192 190 enum Shading Used; //!< marker in depth-first search, DepthFirstSearchAnalysis() 193 191 }; 194 192 195 196 ostream & operator << (ostream &ost, const bond &b); 193 ostream & operator << (ostream &ost, bond &b); 197 194 198 195 class MoleculeLeafClass; 199 200 201 #define MaxThermostats 6 //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented202 enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover }; //!< Thermostat names for output203 204 196 205 197 /** The complete molecule. … … 226 218 int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis() 227 219 double BondDistance; //!< typical bond distance used in CreateAdjacencyList() and furtheron 228 220 229 221 molecule(periodentafel *teil); 230 222 ~molecule(); 231 223 232 224 /// remove atoms from molecule. 233 225 bool AddAtom(atom *pointer); … … 238 230 atom * AddCopyAtom(atom *pointer); 239 231 bool AddXYZFile(string filename); 240 bool AddHydrogenReplacementAtom(ofstream *out, bond *Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bond **BondList, int NumBond, bool IsAngstroem); 232 bool AddHydrogenReplacementAtom(ofstream *out, bond *Bond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bond **BondList, int NumBond, bool IsAngstroem); 241 233 bond * AddBond(atom *first, atom *second, int degree); 242 234 bool RemoveBond(bond *pointer); 243 235 bool RemoveBonds(atom *BondPartner); 244 236 245 237 /// Find atoms. 246 atom * FindAtom(int Nr) const; 238 atom * FindAtom(int Nr) const; 247 239 atom * AskAtom(string text); 248 240 … … 252 244 void CalculateOrbitals(class config &configuration); 253 245 bool CenterInBox(ofstream *out, Vector *BoxLengths); 254 void CenterEdge(ofstream *out, Vector *max); 255 void CenterOrigin(ofstream *out, Vector *max); 246 void CenterEdge(ofstream *out, Vector *max); 247 void CenterOrigin(ofstream *out, Vector *max); 256 248 void CenterGravity(ofstream *out, Vector *max); 257 249 void Translate(const Vector *x); … … 267 259 void PrincipalAxisSystem(ofstream *out, bool DoRotate); 268 260 double VolumeOfConvexEnvelope(ofstream *out, bool IsAngstroem); 269 270 bool VerletForceIntegration(ofstream *out, char *file, config &configuration); 271 void Thermostats(config &configuration, double ActualTemp, int Thermostat); 272 273 double ConstrainedPotential(ofstream *out, atom **permutation, int start, int end, double *constants, bool IsAngstroem); 274 double MinimiseConstrainedPotential(ofstream *out, atom **&permutation, int startstep, int endstep, bool IsAngstroem); 275 void EvaluateConstrainedForces(ofstream *out, int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force); 276 bool LinearInterpolationBetweenConfiguration(ofstream *out, int startstep, int endstep, const char *prefix, config &configuration); 277 261 bool VerletForceIntegration(char *file, double delta_t, bool IsAngstroem); 262 278 263 bool CheckBounds(const Vector *x) const; 279 264 void GetAlignvector(struct lsq_params * par) const; 280 265 281 /// Initialising routines in fragmentation 266 /// Initialising routines in fragmentation 267 void CreateAdjacencyList2(ofstream *out, ifstream *output); 282 268 void CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem); 283 269 void CreateListOfBondsPerAtom(ofstream *out); 284 270 285 271 // Graph analysis 286 272 MoleculeLeafClass * DepthFirstSearchAnalysis(ofstream *out, class StackClass<bond *> *&BackEdgeStack); … … 298 284 299 285 molecule *CopyMolecule(); 300 286 301 287 /// Fragment molecule by two different approaches: 302 288 int FragmentMolecule(ofstream *out, int Order, config *configuration); … … 320 306 int LookForRemovalCandidate(ofstream *&out, KeySet *&Leaf, int *&ShortestPathList); 321 307 int GuesstimateFragmentCount(ofstream *out, int order); 322 323 // Recognize doubly appearing molecules in a list of them 308 309 // Recognize doubly appearing molecules in a list of them 324 310 int * IsEqualToWithinThreshold(ofstream *out, molecule *OtherMolecule, double threshold); 325 311 int * GetFatherSonAtomicMap(ofstream *out, molecule *OtherMolecule); 326 312 327 313 // Output routines. 328 314 bool Output(ofstream *out); … … 345 331 int NumberOfMolecules; //!< Number of entries in \a **FragmentList and of to be returned one. 346 332 int NumberOfTopAtoms; //!< Number of atoms in the molecule from which all fragments originate 347 333 348 334 MoleculeListClass(); 349 335 MoleculeListClass(int Num, int NumAtoms); … … 353 339 bool AddHydrogenCorrection(ofstream *out, char *path); 354 340 bool StoreForcesFile(ofstream *out, char *path, int *SortIndex); 355 bool OutputConfigForListOfFragments(ofstream *out, con st char *fragmentprefix, config *configuration, int *SortIndex, bool DoPeriodic, bool DoCentering);341 bool OutputConfigForListOfFragments(ofstream *out, config *configuration, int *SortIndex); 356 342 void Output(ofstream *out); 357 343 358 344 private: 359 345 }; … … 365 351 class MoleculeLeafClass { 366 352 public: 367 molecule *Leaf; //!< molecule of this leaf 353 molecule *Leaf; //!< molecule of this leaf 368 354 //MoleculeLeafClass *UpLeaf; //!< Leaf one level up 369 355 //MoleculeLeafClass *DownLeaf; //!< First leaf one level down … … 401 387 bool FastParsing; 402 388 double Deltat; 403 int DoConstrainedMD; 404 int MaxOuterStep; 405 int Thermostat; 406 int *ThermostatImplemented; 407 char **ThermostatNames; 408 double TempFrequency; 409 double alpha; 410 double HooverMass; 411 double TargetTemp; 412 int ScaleTempStep; 413 389 string basis; 390 414 391 private: 415 392 char *mainname; 416 393 char *defaultpath; 417 394 char *pseudopotpath; 418 395 419 396 int DoOutVis; 420 397 int DoOutMes; … … 431 408 int UseAddGramSch; 432 409 int Seed; 433 410 411 int MaxOuterStep; 434 412 int OutVisStep; 435 413 int OutSrcStep; 414 double TargetTemp; 415 int ScaleTempStep; 436 416 int MaxPsiStep; 437 417 double EpsWannier; 438 418 439 419 int MaxMinStep; 440 420 double RelEpsTotalEnergy; … … 445 425 double InitRelEpsKineticEnergy; 446 426 int InitMaxMinGapStopStep; 447 427 448 428 //double BoxLength[NDIM*NDIM]; 449 429 450 430 double ECut; 451 431 int MaxLevel; … … 456 436 int RTActualUse; 457 437 int AddPsis; 458 438 459 439 double RCut; 460 440 int StructOpt; … … 463 443 int MaxTypes; 464 444 465 445 466 446 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); 467 447 468 448 public: 469 449 config(); … … 474 454 void LoadOld(char *filename, periodentafel *periode, molecule *mol); 475 455 void RetrieveConfigPathAndName(string filename); 476 bool Save( ofstream *file, periodentafel *periode, molecule *mol) const;477 bool SaveMPQC( ofstream *file, molecule *mol) const;456 bool Save(const char *filename, periodentafel *periode, molecule *mol) const; 457 bool SaveMPQC(const char *filename, molecule *mol) const; 478 458 void Edit(molecule *mol); 479 459 bool GetIsAngstroem() const; 480 460 char *GetDefaultPath() const; 481 461 void SetDefaultPath(const char *path); 482 void InitThermostats(ifstream *source);483 462 }; 484 463 -
Property mode
changed from
Note:
See TracChangeset
for help on using the changeset viewer.