source: src/Atom/atom_atominfo.hpp@ 440ac3

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 440ac3 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
Line 
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
21#include <boost/function.hpp>
22#include <vector>
23
24#include "atom_observable.hpp"
25
26#include "types.hpp"
27
28#include "LinearAlgebra/Vector.hpp"
29#include "LinearAlgebra/VectorInterface.hpp"
30
31/****************************************** forward declarations *****************************/
32
33class AtomInfo;
34class element;
35class ForceMatrix;
36class RealSpaceMatrix;
37
38namespace MoleCuilder {
39 void removeLastStep(const std::vector<atomId_t> &atoms);
40};
41
42/********************************************** declarations *******************************/
43
44class AtomInfo : public VectorInterface, public virtual AtomObservable {
45
46public:
47 AtomInfo();
48 AtomInfo(const AtomInfo &_atom);
49 AtomInfo(const VectorInterface &_v);
50 virtual ~AtomInfo();
51
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 */
58 virtual void UpdateStep(const unsigned int _step)=0;
59
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 */
66 virtual void removeStep(const unsigned int _step)=0;
67
68 /** DEPRECATED: Getter for element indicated by AtomicElement.
69 *
70 * \deprecated This function is deprecated, use getElement() instead.
71 *
72 * @return constant pointer to element for AtomicElement
73 */
74 const element *getType() const;
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
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
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.
118 *
119 * Current time step is used.
120 *
121 * @return constant reference to AtomicVelocity
122 */
123// Vector& getAtomicVelocity();
124 /** Getter for AtomicVelocity.
125 *
126 * @param _step time step to return
127 * @return constant reference to AtomicVelocity
128 */
129// Vector& getAtomicVelocity(const int _step);
130 /** Getter for AtomicVelocity.
131 *
132 * Current time step is used.
133 *
134 * @return constant reference to AtomicVelocity
135 */
136 const Vector& getAtomicVelocity() const;
137 /** Getter for AtomicVelocity.
138 *
139 * @param _step time step to return
140 * @return constant reference to AtomicVelocity
141 */
142 const Vector& getAtomicVelocityAtStep(const unsigned int _step) const;
143 /** Setter for AtomicVelocity.
144 *
145 * Current time step is used.
146 *
147 * @param _newvelocity new velocity to set
148 */
149 void setAtomicVelocity(const Vector &_newvelocity);
150 /** Setter for AtomicVelocity.
151 *
152 * @param _step time step to set
153 * @param _newvelocity new velocity to set
154 */
155 void setAtomicVelocityAtStep(const unsigned int _step, const Vector &_newvelocity);
156
157 /** Getter for AtomicForce.
158 *
159 * Current time step is used.
160 *
161 * @return constant reference to AtomicForce
162 */
163 const Vector& getAtomicForce() const;
164 /** Getter for AtomicForce.
165 *
166 * @param _step time step to return
167 * @return constant reference to AtomicForce
168 */
169 const Vector& getAtomicForceAtStep(const unsigned int _step) const;
170 /** Setter for AtomicForce.
171 *
172 * Current time step is used.
173 *
174 * @param _newvelocity new force vector to set
175 */
176 void setAtomicForce(const Vector &_newforce);
177 /** Setter for AtomicForce.
178 *
179 * @param _step time step to set
180 * @param _newvelocity new force vector to set
181 */
182 void setAtomicForceAtStep(const unsigned int _step, const Vector &_newforce);
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);
194
195 ///// manipulation of the atomic position
196
197 // Accessors ussually come in pairs... and sometimes even more than that
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 */
205 const double& operator[](size_t i) const;
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 */
215 const double& at(size_t i) const;
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 */
224 const double& atStep(size_t i, unsigned int _step) const;
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 */
232 void set(size_t i, const double value);
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 */
239 void setAtStep(size_t i, unsigned int _step, const double value);
240 /** Getter for AtomicPosition.
241 *
242 * Current time step is used.
243 *
244 * @return atomic position
245 */
246 const Vector& getPosition() const;
247 /** Getter for AtomicPosition.
248 *
249 * @param _step time step to return
250 * @return atomic position at time step _step
251 */
252 const Vector& getPositionAtStep(unsigned int _step) const;
253
254 // Assignment operator
255 /** Setter for AtomicPosition.
256 *
257 * Current time step is used.
258 *
259 * @param _vector new position to set
260 */
261 void setPosition(const Vector& _vector);
262 /** Setter for AtomicPosition.
263 *
264 * @param _step time step to set
265 * @param _vector new position to set for time step _step
266 */
267 void setPositionAtStep(const unsigned int _step, const Vector& _vector);
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
289 // operations for trajectories
290 bool isStepPresent(const unsigned int _step) const;
291 void ResizeTrajectory(size_t MaxSteps);
292 size_t getTrajectorySize() const;
293 void CopyStepOnStep(const unsigned int dest, const unsigned int src);
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);
296 double getKineticEnergy(const unsigned int step) const;
297 Vector getMomentum(const unsigned int step) const;
298 double getMass() const;
299 double getCharge() const {
300 return charge;
301 }
302 void setCharge(const double _charge) {
303 charge = _charge;
304 }
305
306 std::ostream & operator << (std::ostream &ost) const;
307
308protected:
309 /** Function used by this and inheriting classes to extend the trajectory
310 * vectors.
311 */
312 void AppendTrajectoryStep(const unsigned int _step);
313
314 /** Function used by this and inheriting classes to decrease the trajectory
315 * vectors by one.
316 */
317 void removeTrajectoryStep(const unsigned int _step);
318
319 // make these protected only such that deriving atom class still has full
320 // access needed for clone and alike
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
327
328private:
329 atomicNumber_t AtomicElement; //!< contains atomic number (i.e. Z of element) or "-1" if unset
330 bool FixedIon; //!< whether this nuclei is influenced by force integration or not
331 double charge; //!< charge of this nuclei
332 std::string particlename; //!< name of associated Particle
333};
334
335std::ostream & operator << (std::ostream &ost, const AtomInfo &a);
336
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);
340
341#endif /* ATOM_ATOMINFO_HPP_ */
Note: See TracBrowser for help on using the repository browser.