source: src/Atom/atom_atominfo.hpp@ 0cd8cf

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 0cd8cf was 4882d5, checked in by Frederik Heber <heber@…>, 12 years ago

Rewrote VerletIntegrationAction to diminish dependence on ForceMatrix.

  • atom::VelocityVerletUpdate() now works on the forces stored in AtomicForces.
  • ThermoStatContainer::getActive() getter for the currently active thermostat.
  • VerletForceIntegration::operator() split up into several smaller functions.
  • Property mode set to 100644
File size: 8.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
[08a0f52]21#include <boost/function.hpp>
[54b42e]22#include <vector>
23
[7188b1]24#include "atom_observable.hpp"
25
[35a25a]26#include "types.hpp"
27
[57f243]28#include "LinearAlgebra/Vector.hpp"
[8f4df1]29#include "LinearAlgebra/VectorInterface.hpp"
[6b919f8]30
31/****************************************** forward declarations *****************************/
32
[d74077]33class AtomInfo;
[6b919f8]34class element;
[6625c3]35class ForceMatrix;
[cca9ef]36class RealSpaceMatrix;
[6b919f8]37
38/********************************************** declarations *******************************/
39
[7188b1]40class AtomInfo : public VectorInterface, public virtual AtomObservable {
[d74077]41
[6b919f8]42public:
43 AtomInfo();
[d74077]44 AtomInfo(const AtomInfo &_atom);
45 AtomInfo(const VectorInterface &_v);
46 virtual ~AtomInfo();
[6b919f8]47
[e2373df]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
[08a0f52]56 /** DEPRECATED: Getter for element indicated by AtomicElement.
57 *
58 * \deprecated This function is deprecated, use getElement() instead.
[bce72c]59 *
[08a0f52]60 * @return constant pointer to element for AtomicElement
[bce72c]61 */
[d74077]62 const element *getType() const;
[08a0f52]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
[bce72c]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.
[6625c3]94 *
95 * Current time step is used.
[bce72c]96 *
97 * @return constant reference to AtomicVelocity
98 */
[056e70]99// Vector& getAtomicVelocity();
[bce72c]100 /** Getter for AtomicVelocity.
[6625c3]101 *
102 * @param _step time step to return
103 * @return constant reference to AtomicVelocity
104 */
[056e70]105// Vector& getAtomicVelocity(const int _step);
[6625c3]106 /** Getter for AtomicVelocity.
107 *
108 * Current time step is used.
[bce72c]109 *
110 * @return constant reference to AtomicVelocity
111 */
112 const Vector& getAtomicVelocity() const;
[6625c3]113 /** Getter for AtomicVelocity.
114 *
115 * @param _step time step to return
116 * @return constant reference to AtomicVelocity
117 */
[6b020f]118 const Vector& getAtomicVelocityAtStep(const unsigned int _step) const;
[bce72c]119 /** Setter for AtomicVelocity.
[6625c3]120 *
121 * Current time step is used.
[bce72c]122 *
123 * @param _newvelocity new velocity to set
124 */
125 void setAtomicVelocity(const Vector &_newvelocity);
[6625c3]126 /** Setter for AtomicVelocity.
127 *
128 * @param _step time step to set
129 * @param _newvelocity new velocity to set
130 */
[6b020f]131 void setAtomicVelocityAtStep(const unsigned int _step, const Vector &_newvelocity);
[bce72c]132
133 /** Getter for AtomicForce.
[6625c3]134 *
135 * Current time step is used.
[bce72c]136 *
137 * @return constant reference to AtomicForce
138 */
139 const Vector& getAtomicForce() const;
[6625c3]140 /** Getter for AtomicForce.
141 *
142 * @param _step time step to return
143 * @return constant reference to AtomicForce
144 */
[6b020f]145 const Vector& getAtomicForceAtStep(const unsigned int _step) const;
[bce72c]146 /** Setter for AtomicForce.
[6625c3]147 *
148 * Current time step is used.
[bce72c]149 *
150 * @param _newvelocity new force vector to set
151 */
152 void setAtomicForce(const Vector &_newforce);
[6625c3]153 /** Setter for AtomicForce.
154 *
155 * @param _step time step to set
156 * @param _newvelocity new force vector to set
157 */
[6b020f]158 void setAtomicForceAtStep(const unsigned int _step, const Vector &_newforce);
[6625c3]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);
[d74077]170
171 ///// manipulation of the atomic position
172
173 // Accessors ussually come in pairs... and sometimes even more than that
[6625c3]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 */
[d74077]181 const double& operator[](size_t i) const;
[6625c3]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 */
[d74077]191 const double& at(size_t i) const;
[6625c3]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 */
[6b020f]200 const double& atStep(size_t i, unsigned int _step) const;
[6625c3]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 */
[d74077]208 void set(size_t i, const double value);
[6625c3]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 */
[6b020f]215 void setAtStep(size_t i, unsigned int _step, const double value);
[6625c3]216 /** Getter for AtomicPosition.
217 *
218 * Current time step is used.
219 *
220 * @return atomic position
221 */
[d74077]222 const Vector& getPosition() const;
[6625c3]223 /** Getter for AtomicPosition.
224 *
225 * @param _step time step to return
226 * @return atomic position at time step _step
227 */
[6b020f]228 const Vector& getPositionAtStep(unsigned int _step) const;
[d74077]229
230 // Assignment operator
[6625c3]231 /** Setter for AtomicPosition.
232 *
233 * Current time step is used.
234 *
235 * @param _vector new position to set
236 */
[d74077]237 void setPosition(const Vector& _vector);
[6625c3]238 /** Setter for AtomicPosition.
239 *
240 * @param _step time step to set
241 * @param _vector new position to set for time step _step
242 */
[6b020f]243 void setPositionAtStep(const unsigned int _step, const Vector& _vector);
[d74077]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
[6625c3]265 // operations for trajectories
266 void ResizeTrajectory(size_t MaxSteps);
267 size_t getTrajectorySize() const;
[6b020f]268 void CopyStepOnStep(const unsigned int dest, const unsigned int src);
[4882d5]269 void VelocityVerletUpdate(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem);
[6b020f]270 double getKineticEnergy(const unsigned int step) const;
271 Vector getMomentum(const unsigned int step) const;
[6625c3]272 double getMass() const;
[2034f3]273 double getCharge() const {
274 return charge;
275 }
276 void setCharge(const double _charge) {
277 charge = _charge;
278 }
[6625c3]279
[d74077]280 std::ostream & operator << (std::ostream &ost) const;
[f16a4b]281
[443547]282protected:
[e2373df]283 /** Function used by this and inheriting classes to extend the trajectory
284 * vectors.
285 */
286 void AppendTrajectoryStep();
287
[443547]288 // make these protected only such that deriving atom class still has full
289 // access needed for clone and alike
[54b42e]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
[bce72c]293
[443547]294private:
[35a25a]295 atomicNumber_t AtomicElement; //!< contains atomic number (i.e. Z of element) or "-1" if unset
[2034f3]296 bool FixedIon; //!< whether this nuclei is influenced by force integration or not
297 double charge; //!< charge of this nuclei
[6b919f8]298};
299
[d74077]300std::ostream & operator << (std::ostream &ost, const AtomInfo &a);
301
[fb0b62]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);
[d74077]305
[6b919f8]306#endif /* ATOM_ATOMINFO_HPP_ */
Note: See TracBrowser for help on using the repository browser.