source: src/atom_atominfo.hpp@ e4b2f6

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

Rewrote VerletForceIntegration into a functor in Dynamics/.

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