source: src/Atom/atom_atominfo.hpp@ 70f2a1

Action_Thermostats Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChemicalSpaceEvaluator Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph Fix_Verbose_Codepatterns ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion Gui_displays_atomic_force_velocity JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters Recreated_GuiChecks StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps
Last change on this file since 70f2a1 was 843590, checked in by Frederik Heber <heber@…>, 9 years ago

Adding particlename member variable to Atom(Info).

  • Property mode set to 100644
File size: 10.2 KB
RevLine 
[6b919f8]1/*
2 * atom_atominfo.hpp
3 *
4 * Created on: Oct 19, 2009
5 * Author: heber
6 */
7
8#ifndef ATOM_ATOMINFO_HPP_
9#define ATOM_ATOMINFO_HPP_
10
11
12using namespace std;
13
14/*********************************************** includes ***********************************/
15
16// include config.h
17#ifdef HAVE_CONFIG_H
18#include <config.h>
19#endif
20
[08a0f52]21#include <boost/function.hpp>
[54b42e]22#include <vector>
23
[7188b1]24#include "atom_observable.hpp"
25
[35a25a]26#include "types.hpp"
27
[57f243]28#include "LinearAlgebra/Vector.hpp"
[8f4df1]29#include "LinearAlgebra/VectorInterface.hpp"
[6b919f8]30
31/****************************************** forward declarations *****************************/
32
[d74077]33class AtomInfo;
[6b919f8]34class element;
[6625c3]35class ForceMatrix;
[cca9ef]36class RealSpaceMatrix;
[6b919f8]37
[7e51e1]38namespace MoleCuilder {
39 void removeLastStep(const std::vector<atomId_t> &atoms);
40};
41
[6b919f8]42/********************************************** declarations *******************************/
43
[7188b1]44class AtomInfo : public VectorInterface, public virtual AtomObservable {
[d74077]45
[6b919f8]46public:
47 AtomInfo();
[d74077]48 AtomInfo(const AtomInfo &_atom);
49 AtomInfo(const VectorInterface &_v);
50 virtual ~AtomInfo();
[6b919f8]51
[e2373df]52 /** Pushes back another step in all trajectory vectors.
53 *
54 * This allows to extend all trajectories contained in different classes
55 * consistently. This is implemented by the topmost class which calls the
56 * real functions, \sa AppendTrajectoryStep(), by all necessary subclasses.
57 */
[8cc22f]58 virtual void UpdateStep(const unsigned int _step)=0;
[e2373df]59
[7e51e1]60 /** Pops the last step in all trajectory vectors.
61 *
62 * This allows to decrease all trajectories contained in different classes
63 * by one consistently. This is implemented by the topmost class which calls
64 * the real functions, \sa removeTrajectoryStep(), by all necessary subclasses.
65 */
[8cc22f]66 virtual void removeStep(const unsigned int _step)=0;
[7e51e1]67
[08a0f52]68 /** DEPRECATED: Getter for element indicated by AtomicElement.
69 *
70 * \deprecated This function is deprecated, use getElement() instead.
[bce72c]71 *
[08a0f52]72 * @return constant pointer to element for AtomicElement
[bce72c]73 */
[d74077]74 const element *getType() const;
[08a0f52]75
76 /** Getter for element indicated by AtomicElement.
77 *
78 * \note Looking up the element requires looking the World instance and is
79 * thus significantly slower than instead just returning the internally
80 * stored atomicNumber_t. So, if possible use getElementNo() instead and
81 * check soundly whether you truely need access to all of element's member
82 * variables.
83 *
84 * @return const reference to element indicated by AtomicElement
85 */
86 const element & getElement() const;
87
88 /** Getter for AtomicElement.
89 *
90 * @return AtomicElement
91 */
92 atomicNumber_t getElementNo() const;
93
[843590]94 /** Getter for the name of Particle this atom is associated with.
95 *
96 * \return name of Particle to use in lookup in ParticleRegistry
97 */
98 const std::string &getParticleName() const;
99
100 /** Setter for the Particle name this atom is associated with.
101 *
102 * \param _name new name of atom's Particle
103 */
104 void setParticleName(const std::string & _name);
105
[bce72c]106 /** Setter for AtomicElement.
107 *
108 * @param _type new element by pointer to set
109 */
110 void setType(const element *_type);
111 /** Setter for AtomicElement.
112 *
113 * @param _typenr new element by index to set
114 */
115 void setType(const int _typenr);
116
117 /** Getter for AtomicVelocity.
[6625c3]118 *
119 * Current time step is used.
[bce72c]120 *
121 * @return constant reference to AtomicVelocity
122 */
[056e70]123// Vector& getAtomicVelocity();
[bce72c]124 /** Getter for AtomicVelocity.
[6625c3]125 *
126 * @param _step time step to return
127 * @return constant reference to AtomicVelocity
128 */
[056e70]129// Vector& getAtomicVelocity(const int _step);
[6625c3]130 /** Getter for AtomicVelocity.
131 *
132 * Current time step is used.
[bce72c]133 *
134 * @return constant reference to AtomicVelocity
135 */
136 const Vector& getAtomicVelocity() const;
[6625c3]137 /** Getter for AtomicVelocity.
138 *
139 * @param _step time step to return
140 * @return constant reference to AtomicVelocity
141 */
[6b020f]142 const Vector& getAtomicVelocityAtStep(const unsigned int _step) const;
[bce72c]143 /** Setter for AtomicVelocity.
[6625c3]144 *
145 * Current time step is used.
[bce72c]146 *
147 * @param _newvelocity new velocity to set
148 */
149 void setAtomicVelocity(const Vector &_newvelocity);
[6625c3]150 /** Setter for AtomicVelocity.
151 *
152 * @param _step time step to set
153 * @param _newvelocity new velocity to set
154 */
[6b020f]155 void setAtomicVelocityAtStep(const unsigned int _step, const Vector &_newvelocity);
[bce72c]156
157 /** Getter for AtomicForce.
[6625c3]158 *
159 * Current time step is used.
[bce72c]160 *
161 * @return constant reference to AtomicForce
162 */
163 const Vector& getAtomicForce() const;
[6625c3]164 /** Getter for AtomicForce.
165 *
166 * @param _step time step to return
167 * @return constant reference to AtomicForce
168 */
[6b020f]169 const Vector& getAtomicForceAtStep(const unsigned int _step) const;
[bce72c]170 /** Setter for AtomicForce.
[6625c3]171 *
172 * Current time step is used.
[bce72c]173 *
174 * @param _newvelocity new force vector to set
175 */
176 void setAtomicForce(const Vector &_newforce);
[6625c3]177 /** Setter for AtomicForce.
178 *
179 * @param _step time step to set
180 * @param _newvelocity new force vector to set
181 */
[6b020f]182 void setAtomicForceAtStep(const unsigned int _step, const Vector &_newforce);
[6625c3]183
184 /** Getter for FixedIon.
185 *
186 * @return constant reference to FixedIon
187 */
188 bool getFixedIon() const;
189 /** Setter for FixedIon.
190 *
191 * @param _fixedion new state of FixedIon
192 */
193 void setFixedIon(const bool _fixedion);
[d74077]194
195 ///// manipulation of the atomic position
196
197 // Accessors ussually come in pairs... and sometimes even more than that
[6625c3]198 /** Getter for AtomicPosition.
199 *
200 * Current time step is used.
201 *
202 * @param i component of vector
203 * @return i-th component of atomic position
204 */
[d74077]205 const double& operator[](size_t i) const;
[6625c3]206 /** Getter for AtomicPosition.
207 *
208 * Current time step is used.
209 *
210 * \sa operator[], this is if instance is a reference.
211 *
212 * @param i component of vector
213 * @return i-th component of atomic position
214 */
[d74077]215 const double& at(size_t i) const;
[6625c3]216 /** Getter for AtomicPosition.
217 *
218 * \sa operator[], this is if instance is a reference.
219 *
220 * @param i index of component of AtomicPosition
221 * @param _step time step to return
222 * @return atomic position at time step _step
223 */
[6b020f]224 const double& atStep(size_t i, unsigned int _step) const;
[6625c3]225 /** Setter for AtomicPosition.
226 *
227 * Current time step is used.
228 *
229 * @param i component to set
230 * @param value value to set to
231 */
[d74077]232 void set(size_t i, const double value);
[6625c3]233 /** Setter for AtomicPosition.
234 *
235 * @param i component to set
236 * @param _step time step to set
237 * @param value value to set to
238 */
[6b020f]239 void setAtStep(size_t i, unsigned int _step, const double value);
[6625c3]240 /** Getter for AtomicPosition.
241 *
242 * Current time step is used.
243 *
244 * @return atomic position
245 */
[d74077]246 const Vector& getPosition() const;
[6625c3]247 /** Getter for AtomicPosition.
248 *
249 * @param _step time step to return
250 * @return atomic position at time step _step
251 */
[6b020f]252 const Vector& getPositionAtStep(unsigned int _step) const;
[d74077]253
254 // Assignment operator
[6625c3]255 /** Setter for AtomicPosition.
256 *
257 * Current time step is used.
258 *
259 * @param _vector new position to set
260 */
[d74077]261 void setPosition(const Vector& _vector);
[6625c3]262 /** Setter for AtomicPosition.
263 *
264 * @param _step time step to set
265 * @param _vector new position to set for time step _step
266 */
[6b020f]267 void setPositionAtStep(const unsigned int _step, const Vector& _vector);
[d74077]268 class VectorInterface &operator=(const Vector& _vector);
269
270 // operators for mathematical operations
271 const VectorInterface& operator+=(const Vector& b);
272 const VectorInterface& operator-=(const Vector& b);
273 Vector const operator+(const Vector& b) const;
274 Vector const operator-(const Vector& b) const;
275
276 void Zero();
277 void One(const double one);
278 void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors);
279
280 double distance(const Vector &point) const;
281 double DistanceSquared(const Vector &y) const;
282 double distance(const VectorInterface &_atom) const;
283 double DistanceSquared(const VectorInterface &_atom) const;
284
285 void ScaleAll(const double *factor);
286 void ScaleAll(const Vector &factor);
287 void Scale(const double factor);
288
[6625c3]289 // operations for trajectories
[8cc22f]290 bool isStepPresent(const unsigned int _step) const;
[6625c3]291 void ResizeTrajectory(size_t MaxSteps);
292 size_t getTrajectorySize() const;
[6b020f]293 void CopyStepOnStep(const unsigned int dest, const unsigned int src);
[bcb593]294 void VelocityVerletUpdateX(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem);
295 void VelocityVerletUpdateU(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem);
[6b020f]296 double getKineticEnergy(const unsigned int step) const;
297 Vector getMomentum(const unsigned int step) const;
[6625c3]298 double getMass() const;
[2034f3]299 double getCharge() const {
300 return charge;
301 }
302 void setCharge(const double _charge) {
303 charge = _charge;
304 }
[6625c3]305
[d74077]306 std::ostream & operator << (std::ostream &ost) const;
[f16a4b]307
[443547]308protected:
[e2373df]309 /** Function used by this and inheriting classes to extend the trajectory
310 * vectors.
311 */
[8cc22f]312 void AppendTrajectoryStep(const unsigned int _step);
[e2373df]313
[7e51e1]314 /** Function used by this and inheriting classes to decrease the trajectory
315 * vectors by one.
316 */
[8cc22f]317 void removeTrajectoryStep(const unsigned int _step);
[7e51e1]318
[443547]319 // make these protected only such that deriving atom class still has full
320 // access needed for clone and alike
[8cc22f]321
322 //!> typedef for a vector of Vectors with inverse sorting to make lower_bound return present or last past step
323 typedef std::map<unsigned int, Vector, std::greater<unsigned int> > VectorTrajectory_t;
324 VectorTrajectory_t AtomicPosition; //!< coordinate vector of atom, giving last position within cell
325 VectorTrajectory_t AtomicVelocity; //!< velocity vector of atom, giving last velocity within cell
326 VectorTrajectory_t AtomicForce; //!< Force vector of atom, giving last force within cell
[bce72c]327
[443547]328private:
[35a25a]329 atomicNumber_t AtomicElement; //!< contains atomic number (i.e. Z of element) or "-1" if unset
[2034f3]330 bool FixedIon; //!< whether this nuclei is influenced by force integration or not
331 double charge; //!< charge of this nuclei
[843590]332 std::string particlename; //!< name of associated Particle
[6b919f8]333};
334
[d74077]335std::ostream & operator << (std::ostream &ost, const AtomInfo &a);
336
[fb0b62]337//const AtomInfo& operator*=(AtomInfo& a, const double m);
338//AtomInfo const operator*(const AtomInfo& a, const double m);
339//AtomInfo const operator*(const double m, const AtomInfo& a);
[d74077]340
[6b919f8]341#endif /* ATOM_ATOMINFO_HPP_ */
Note: See TracBrowser for help on using the repository browser.