source: src/atom_atominfo.hpp@ 0cbad2

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 0cbad2 was e2373df, checked in by Frederik Heber <heber@…>, 14 years ago

TesselPoint, Atom and AtomInfo have virtual UpdateSteps() to allow consistent extending of trajectories.

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