[357fba] | 1 | /*
|
---|
| 2 | * atom.hpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Aug 3, 2009
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #ifndef ATOM_HPP_
|
---|
| 9 | #define ATOM_HPP_
|
---|
| 10 |
|
---|
| 11 | using namespace std;
|
---|
| 12 |
|
---|
[f66195] | 13 | /*********************************************** includes ***********************************/
|
---|
| 14 |
|
---|
[cd4ccc] | 15 | // include config.h
|
---|
| 16 | #ifdef HAVE_CONFIG_H
|
---|
| 17 | #include <config.h>
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
| 20 | #include <iostream>
|
---|
[266237] | 21 | #include <list>
|
---|
[fcd7b6] | 22 | #include <vector>
|
---|
[cd4ccc] | 23 |
|
---|
[4a7776a] | 24 | #include <gsl/gsl_randist.h>
|
---|
| 25 |
|
---|
[357fba] | 26 | #include "tesselation.hpp"
|
---|
[f66195] | 27 |
|
---|
| 28 | /****************************************** forward declarations *****************************/
|
---|
[357fba] | 29 |
|
---|
[e41951] | 30 | class bond;
|
---|
[4a7776a] | 31 | class config;
|
---|
[f66195] | 32 | class element;
|
---|
[ccd9f5] | 33 | class ForceMatrix;
|
---|
[f66195] | 34 | class Vector;
|
---|
| 35 |
|
---|
[266237] | 36 | #define BondList list<bond *>
|
---|
| 37 |
|
---|
[f66195] | 38 | /********************************************** declarations *******************************/
|
---|
[e41951] | 39 |
|
---|
[357fba] | 40 | /** Single atom.
|
---|
| 41 | * Class incorporates position, type
|
---|
| 42 | */
|
---|
| 43 | class atom : public TesselPoint {
|
---|
| 44 | public:
|
---|
[fcd7b6] | 45 | struct
|
---|
| 46 | {
|
---|
| 47 | vector<Vector> R; //!< position vector
|
---|
| 48 | vector<Vector> U; //!< velocity vector
|
---|
| 49 | vector<Vector> F; //!< last force vector
|
---|
| 50 | } Trajectory;
|
---|
| 51 |
|
---|
| 52 | Vector x; //!< coordinate vector of atom, giving last position within cell
|
---|
| 53 | Vector v; //!< velocity vector of atom, giving last velocity within cell
|
---|
| 54 | Vector F; //!< Force vector of atom, giving last force within cell
|
---|
[266237] | 55 | BondList ListOfBonds; //!< list of all bonds
|
---|
[357fba] | 56 | element *type; //!< pointing to element
|
---|
| 57 | atom *previous; //!< previous atom in molecule list
|
---|
| 58 | atom *next; //!< next atom in molecule list
|
---|
| 59 | atom *father; //!< In many-body bond order fragmentations points to originating atom
|
---|
| 60 | atom *Ancestor; //!< "Father" in Depth-First-Search
|
---|
| 61 | //char *Name; //!< unique name used during many-body bond-order fragmentation, comes from TesselPoint
|
---|
| 62 | int FixedIon; //!< config variable that states whether forces act on the ion or not
|
---|
| 63 | int *sort; //!< sort criteria
|
---|
| 64 | //int nr; //!< continuous, unique number, comes from TesselPoint
|
---|
| 65 | int GraphNr; //!< unique number, given in DepthFirstSearchAnalysis()
|
---|
| 66 | int *ComponentNr;//!< belongs to this nonseparable components, given in DepthFirstSearchAnalysis() (if more than one, then is SeparationVertex)
|
---|
| 67 | 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.
|
---|
| 68 | bool SeparationVertex; //!< whether this atom separates off subsets of atoms or not, determined in DepthFirstSearchAnalysis()
|
---|
| 69 | bool IsCyclic; //!< whether atom belong to as cycle or not, determined in DepthFirstSearchAnalysis()
|
---|
| 70 | unsigned char AdaptiveOrder; //!< current present bond order at site (0 means "not set")
|
---|
| 71 | bool MaxOrder; //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not
|
---|
| 72 |
|
---|
| 73 | atom();
|
---|
| 74 | atom(class atom *pointer);
|
---|
[055861] | 75 | virtual ~atom();
|
---|
[357fba] | 76 |
|
---|
[fcd7b6] | 77 | bool Output(ofstream *out, int ElementNo, int AtomNo, const char *comment = NULL) const;
|
---|
| 78 | bool Output(ofstream *out, int *ElementNo, int *AtomNo, const char *comment = NULL);
|
---|
[357fba] | 79 | bool OutputXYZLine(ofstream *out) const;
|
---|
[fcd7b6] | 80 | bool OutputTrajectory(ofstream *out, int *ElementNo, int *AtomNo, int step) const;
|
---|
[681a8a] | 81 | bool OutputTrajectoryXYZ(ofstream *out, int step) const;
|
---|
[266237] | 82 | bool OutputBondOfAtom(ofstream *out) const;
|
---|
| 83 | void OutputAdjacency(ofstream *AdjacencyFile) const;
|
---|
| 84 |
|
---|
[681a8a] | 85 |
|
---|
[e65246] | 86 | void EqualsFather ( atom *ptr, atom **res );
|
---|
| 87 | void CorrectFather();
|
---|
[357fba] | 88 | atom *GetTrueFather();
|
---|
[ab1932] | 89 | bool Compare(const atom &ptr);
|
---|
[357fba] | 90 |
|
---|
[4a7776a] | 91 | // trajectory stuff
|
---|
| 92 | void ResizeTrajectory(int MaxSteps);
|
---|
| 93 | void CopyStepOnStep(int dest, int src);
|
---|
| 94 | void VelocityVerletUpdate(int MDSteps, config *configuration, ForceMatrix *Force);
|
---|
| 95 | void SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity );
|
---|
| 96 |
|
---|
[49f802c] | 97 | double DistanceToVector(Vector &origin);
|
---|
| 98 | double DistanceSquaredToVector(Vector &origin);
|
---|
| 99 |
|
---|
[4a7776a] | 100 | bool IsInParallelepiped(Vector offset, double *parallelepiped);
|
---|
| 101 |
|
---|
[5034e1] | 102 | // bond order stuff
|
---|
| 103 | void OutputOrder(ofstream *file);
|
---|
[266237] | 104 | void OutputGraphInfo(ofstream *out) const;
|
---|
| 105 | void OutputComponentNumber(ofstream *out) const;
|
---|
| 106 | int CountBonds() const;
|
---|
| 107 | int CorrectBondDegree(ofstream *out);
|
---|
| 108 |
|
---|
| 109 | bool RegisterBond(bond *Binder);
|
---|
| 110 | bool UnregisterBond(bond *Binder);
|
---|
| 111 | void UnregisterAllBond();
|
---|
[5034e1] | 112 |
|
---|
[4a7776a] | 113 | // constraint potential and dynamics stuff
|
---|
[49f802c] | 114 | void AddKineticToTemperature(double *temperature, int step) const;
|
---|
[ccd9f5] | 115 | void EvaluateConstrainedForce(int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force);
|
---|
[4a7776a] | 116 | void CorrectVelocity(double *ActualTemp, int Step, Vector *CoGVelocity);
|
---|
| 117 |
|
---|
| 118 | // thermostats
|
---|
| 119 | void Thermostat_Woodcock(double ScaleTempFactor, int Step, double *ekin);
|
---|
| 120 | void Thermostat_Gaussian_init(int Step, double *G, double *E);
|
---|
| 121 | void Thermostat_Gaussian_least_constraint(int Step, double G_over_E, double *ekin, config *configuration);
|
---|
| 122 | void Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration);
|
---|
| 123 | void Thermostat_Berendsen(int Step, double ScaleTempFactor, double *ekin, config *configuration);
|
---|
| 124 | void Thermostat_NoseHoover_init(int Step, double *delta_alpha);
|
---|
| 125 | void Thermostat_NoseHoover_scale(int Step, double *ekin, config *configuration);
|
---|
[49f802c] | 126 |
|
---|
[e9f8f9] | 127 |
|
---|
[055861] | 128 | ostream & operator << (ostream &ost);
|
---|
| 129 |
|
---|
[357fba] | 130 | private:
|
---|
| 131 | };
|
---|
| 132 |
|
---|
| 133 | ostream & operator << (ostream &ost, const atom &a);
|
---|
| 134 |
|
---|
| 135 | #endif /* ATOM_HPP_ */
|
---|