source: src/atom_atominfo.hpp@ 30c753

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 30c753 was 35a25a, checked in by Frederik Heber <heber@…>, 13 years ago

AtomInfo does not store ref to element anymore but only atomic number.

  • if we want to allow for elements to be changed, no refs may be stored at other places. Now we just store the atomic number and look up the element in the periodentafel on request.
  • Property mode set to 100644
File size: 7.9 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 <vector>
22
23#include "atom_observable.hpp"
24
25#include "types.hpp"
26
27#include "LinearAlgebra/Vector.hpp"
28#include "LinearAlgebra/VectorInterface.hpp"
29
30/****************************************** forward declarations *****************************/
31
32class AtomInfo;
33class element;
34class ForceMatrix;
35class RealSpaceMatrix;
36
37/********************************************** declarations *******************************/
38
39class AtomInfo : public VectorInterface, public virtual AtomObservable {
40
41public:
42 AtomInfo();
43 AtomInfo(const AtomInfo &_atom);
44 AtomInfo(const VectorInterface &_v);
45 virtual ~AtomInfo();
46
47 /** Pushes back another step in all trajectory vectors.
48 *
49 * This allows to extend all trajectories contained in different classes
50 * consistently. This is implemented by the topmost class which calls the
51 * real functions, \sa AppendTrajectoryStep(), by all necessary subclasses.
52 */
53 virtual void UpdateSteps()=0;
54
55 /** Getter for AtomicElement.
56 *
57 * @return constant reference to AtomicElement
58 */
59 const element *getType() const;
60 /** Setter for AtomicElement.
61 *
62 * @param _type new element by pointer to set
63 */
64 void setType(const element *_type);
65 /** Setter for AtomicElement.
66 *
67 * @param _typenr new element by index to set
68 */
69 void setType(const int _typenr);
70
71 /** Getter for AtomicVelocity.
72 *
73 * Current time step is used.
74 *
75 * @return constant reference to AtomicVelocity
76 */
77// Vector& getAtomicVelocity();
78 /** Getter for AtomicVelocity.
79 *
80 * @param _step time step to return
81 * @return constant reference to AtomicVelocity
82 */
83// Vector& getAtomicVelocity(const int _step);
84 /** Getter for AtomicVelocity.
85 *
86 * Current time step is used.
87 *
88 * @return constant reference to AtomicVelocity
89 */
90 const Vector& getAtomicVelocity() const;
91 /** Getter for AtomicVelocity.
92 *
93 * @param _step time step to return
94 * @return constant reference to AtomicVelocity
95 */
96 const Vector& getAtomicVelocityAtStep(const unsigned int _step) const;
97 /** Setter for AtomicVelocity.
98 *
99 * Current time step is used.
100 *
101 * @param _newvelocity new velocity to set
102 */
103 void setAtomicVelocity(const Vector &_newvelocity);
104 /** Setter for AtomicVelocity.
105 *
106 * @param _step time step to set
107 * @param _newvelocity new velocity to set
108 */
109 void setAtomicVelocityAtStep(const unsigned int _step, const Vector &_newvelocity);
110
111 /** Getter for AtomicForce.
112 *
113 * Current time step is used.
114 *
115 * @return constant reference to AtomicForce
116 */
117 const Vector& getAtomicForce() const;
118 /** Getter for AtomicForce.
119 *
120 * @param _step time step to return
121 * @return constant reference to AtomicForce
122 */
123 const Vector& getAtomicForceAtStep(const unsigned int _step) const;
124 /** Setter for AtomicForce.
125 *
126 * Current time step is used.
127 *
128 * @param _newvelocity new force vector to set
129 */
130 void setAtomicForce(const Vector &_newforce);
131 /** Setter for AtomicForce.
132 *
133 * @param _step time step to set
134 * @param _newvelocity new force vector to set
135 */
136 void setAtomicForceAtStep(const unsigned int _step, const Vector &_newforce);
137
138 /** Getter for FixedIon.
139 *
140 * @return constant reference to FixedIon
141 */
142 bool getFixedIon() const;
143 /** Setter for FixedIon.
144 *
145 * @param _fixedion new state of FixedIon
146 */
147 void setFixedIon(const bool _fixedion);
148
149 ///// manipulation of the atomic position
150
151 // Accessors ussually come in pairs... and sometimes even more than that
152 /** Getter for AtomicPosition.
153 *
154 * Current time step is used.
155 *
156 * @param i component of vector
157 * @return i-th component of atomic position
158 */
159 const double& operator[](size_t i) const;
160 /** Getter for AtomicPosition.
161 *
162 * Current time step is used.
163 *
164 * \sa operator[], this is if instance is a reference.
165 *
166 * @param i component of vector
167 * @return i-th component of atomic position
168 */
169 const double& at(size_t i) const;
170 /** Getter for AtomicPosition.
171 *
172 * \sa operator[], this is if instance is a reference.
173 *
174 * @param i index of component of AtomicPosition
175 * @param _step time step to return
176 * @return atomic position at time step _step
177 */
178 const double& atStep(size_t i, unsigned int _step) const;
179 /** Setter for AtomicPosition.
180 *
181 * Current time step is used.
182 *
183 * @param i component to set
184 * @param value value to set to
185 */
186 void set(size_t i, const double value);
187 /** Setter for AtomicPosition.
188 *
189 * @param i component to set
190 * @param _step time step to set
191 * @param value value to set to
192 */
193 void setAtStep(size_t i, unsigned int _step, const double value);
194 /** Getter for AtomicPosition.
195 *
196 * Current time step is used.
197 *
198 * @return atomic position
199 */
200 const Vector& getPosition() const;
201 /** Getter for AtomicPosition.
202 *
203 * @param _step time step to return
204 * @return atomic position at time step _step
205 */
206 const Vector& getPositionAtStep(unsigned int _step) const;
207
208 // Assignment operator
209 /** Setter for AtomicPosition.
210 *
211 * Current time step is used.
212 *
213 * @param _vector new position to set
214 */
215 void setPosition(const Vector& _vector);
216 /** Setter for AtomicPosition.
217 *
218 * @param _step time step to set
219 * @param _vector new position to set for time step _step
220 */
221 void setPositionAtStep(const unsigned int _step, const Vector& _vector);
222 class VectorInterface &operator=(const Vector& _vector);
223
224 // operators for mathematical operations
225 const VectorInterface& operator+=(const Vector& b);
226 const VectorInterface& operator-=(const Vector& b);
227 Vector const operator+(const Vector& b) const;
228 Vector const operator-(const Vector& b) const;
229
230 void Zero();
231 void One(const double one);
232 void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors);
233
234 double distance(const Vector &point) const;
235 double DistanceSquared(const Vector &y) const;
236 double distance(const VectorInterface &_atom) const;
237 double DistanceSquared(const VectorInterface &_atom) const;
238
239 void ScaleAll(const double *factor);
240 void ScaleAll(const Vector &factor);
241 void Scale(const double factor);
242
243 // operations for trajectories
244 void ResizeTrajectory(size_t MaxSteps);
245 size_t getTrajectorySize() const;
246 void CopyStepOnStep(const unsigned int dest, const unsigned int src);
247 void VelocityVerletUpdate(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem, ForceMatrix *Force, const size_t offset);
248 double getKineticEnergy(const unsigned int step) const;
249 Vector getMomentum(const unsigned int step) const;
250 double getMass() const;
251
252 std::ostream & operator << (std::ostream &ost) const;
253
254protected:
255 /** Function used by this and inheriting classes to extend the trajectory
256 * vectors.
257 */
258 void AppendTrajectoryStep();
259
260 // make these protected only such that deriving atom class still has full
261 // access needed for clone and alike
262 std::vector<Vector> AtomicPosition; //!< coordinate vector of atom, giving last position within cell
263 std::vector<Vector> AtomicVelocity; //!< velocity vector of atom, giving last velocity within cell
264 std::vector<Vector> AtomicForce; //!< Force vector of atom, giving last force within cell
265
266private:
267 atomicNumber_t AtomicElement; //!< contains atomic number (i.e. Z of element) or "-1" if unset
268 bool FixedIon;
269};
270
271std::ostream & operator << (std::ostream &ost, const AtomInfo &a);
272
273//const AtomInfo& operator*=(AtomInfo& a, const double m);
274//AtomInfo const operator*(const AtomInfo& a, const double m);
275//AtomInfo const operator*(const double m, const AtomInfo& a);
276
277#endif /* ATOM_ATOMINFO_HPP_ */
Note: See TracBrowser for help on using the repository browser.