source: src/Atom/atom_atominfo.hpp@ aec098

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 aec098 was 2034f3, checked in by Frederik Heber <heber@…>, 13 years ago

Added AtomInfo::charge along with getter and setter.

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