source: src/atom_atominfo.hpp@ 0180d6

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 0180d6 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
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
[54b42e]21#include <vector>
22
[57f243]23#include "LinearAlgebra/Vector.hpp"
[8f4df1]24#include "LinearAlgebra/VectorInterface.hpp"
[6b919f8]25
26/****************************************** forward declarations *****************************/
27
[d74077]28class AtomInfo;
[6625c3]29class config;
[6b919f8]30class element;
[6625c3]31class ForceMatrix;
[cca9ef]32class RealSpaceMatrix;
[6b919f8]33
34/********************************************** declarations *******************************/
35
[d74077]36class AtomInfo : public VectorInterface {
37
[6b919f8]38public:
39 AtomInfo();
[d74077]40 AtomInfo(const AtomInfo &_atom);
41 AtomInfo(const VectorInterface &_v);
42 virtual ~AtomInfo();
[6b919f8]43
[e2373df]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
[bce72c]52 /** Getter for AtomicElement.
53 *
54 * @return constant reference to AtomicElement
55 */
[d74077]56 const element *getType() const;
[bce72c]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.
[6625c3]69 *
70 * Current time step is used.
[bce72c]71 *
72 * @return constant reference to AtomicVelocity
73 */
[056e70]74// Vector& getAtomicVelocity();
[bce72c]75 /** Getter for AtomicVelocity.
[6625c3]76 *
77 * @param _step time step to return
78 * @return constant reference to AtomicVelocity
79 */
[056e70]80// Vector& getAtomicVelocity(const int _step);
[6625c3]81 /** Getter for AtomicVelocity.
82 *
83 * Current time step is used.
[bce72c]84 *
85 * @return constant reference to AtomicVelocity
86 */
87 const Vector& getAtomicVelocity() const;
[6625c3]88 /** Getter for AtomicVelocity.
89 *
90 * @param _step time step to return
91 * @return constant reference to AtomicVelocity
92 */
[6b020f]93 const Vector& getAtomicVelocityAtStep(const unsigned int _step) const;
[bce72c]94 /** Setter for AtomicVelocity.
[6625c3]95 *
96 * Current time step is used.
[bce72c]97 *
98 * @param _newvelocity new velocity to set
99 */
100 void setAtomicVelocity(const Vector &_newvelocity);
[6625c3]101 /** Setter for AtomicVelocity.
102 *
103 * @param _step time step to set
104 * @param _newvelocity new velocity to set
105 */
[6b020f]106 void setAtomicVelocityAtStep(const unsigned int _step, const Vector &_newvelocity);
[bce72c]107
108 /** Getter for AtomicForce.
[6625c3]109 *
110 * Current time step is used.
[bce72c]111 *
112 * @return constant reference to AtomicForce
113 */
114 const Vector& getAtomicForce() const;
[6625c3]115 /** Getter for AtomicForce.
116 *
117 * @param _step time step to return
118 * @return constant reference to AtomicForce
119 */
[6b020f]120 const Vector& getAtomicForceAtStep(const unsigned int _step) const;
[bce72c]121 /** Setter for AtomicForce.
[6625c3]122 *
123 * Current time step is used.
[bce72c]124 *
125 * @param _newvelocity new force vector to set
126 */
127 void setAtomicForce(const Vector &_newforce);
[6625c3]128 /** Setter for AtomicForce.
129 *
130 * @param _step time step to set
131 * @param _newvelocity new force vector to set
132 */
[6b020f]133 void setAtomicForceAtStep(const unsigned int _step, const Vector &_newforce);
[6625c3]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);
[d74077]145
146 ///// manipulation of the atomic position
147
148 // Accessors ussually come in pairs... and sometimes even more than that
[6625c3]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 */
[d74077]156 const double& operator[](size_t i) const;
[6625c3]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 */
[d74077]166 const double& at(size_t i) const;
[6625c3]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 */
[6b020f]175 const double& atStep(size_t i, unsigned int _step) const;
[6625c3]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 */
[d74077]183 void set(size_t i, const double value);
[6625c3]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 */
[6b020f]190 void setAtStep(size_t i, unsigned int _step, const double value);
[6625c3]191 /** Getter for AtomicPosition.
192 *
193 * Current time step is used.
194 *
195 * @return atomic position
196 */
[d74077]197 const Vector& getPosition() const;
[6625c3]198 /** Getter for AtomicPosition.
199 *
200 * @param _step time step to return
201 * @return atomic position at time step _step
202 */
[6b020f]203 const Vector& getPositionAtStep(unsigned int _step) const;
[d74077]204
205 // Assignment operator
[6625c3]206 /** Setter for AtomicPosition.
207 *
208 * Current time step is used.
209 *
210 * @param _vector new position to set
211 */
[d74077]212 void setPosition(const Vector& _vector);
[6625c3]213 /** Setter for AtomicPosition.
214 *
215 * @param _step time step to set
216 * @param _vector new position to set for time step _step
217 */
[6b020f]218 void setPositionAtStep(const unsigned int _step, const Vector& _vector);
[d74077]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
[6625c3]240 // operations for trajectories
241 void ResizeTrajectory(size_t MaxSteps);
242 size_t getTrajectorySize() const;
[6b020f]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;
[6625c3]247 double getMass() const;
248
[d74077]249 std::ostream & operator << (std::ostream &ost) const;
[f16a4b]250
[443547]251protected:
[e2373df]252 /** Function used by this and inheriting classes to extend the trajectory
253 * vectors.
254 */
255 void AppendTrajectoryStep();
256
[443547]257 // make these protected only such that deriving atom class still has full
258 // access needed for clone and alike
[54b42e]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
[bce72c]262
[443547]263private:
[d74077]264 const element *AtomicElement; //!< pointing to element
[6625c3]265 bool FixedIon;
[6b919f8]266};
267
[d74077]268std::ostream & operator << (std::ostream &ost, const AtomInfo &a);
269
[fb0b62]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);
[d74077]273
[6b919f8]274#endif /* ATOM_ATOMINFO_HPP_ */
Note: See TracBrowser for help on using the repository browser.