source: src/atom_atominfo.cpp@ 2d292d

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

Member variable Vector and element of class atom are now private.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 * atom_atominfo.cpp
3 *
4 * Created on: Oct 19, 2009
5 * Author: heber
6 */
7
8#include "Helpers/MemDebug.hpp"
9
10#include "periodentafel.hpp"
11#include "World.hpp"
12#include "element.hpp"
13#include "atom_atominfo.hpp"
14
15/** Constructor of class AtomInfo.
16 */
17AtomInfo::AtomInfo() : AtomicElement(NULL) {};
18
19/** Copy constructor of class AtomInfo.
20 */
21AtomInfo::AtomInfo(const AtomInfo &_atom) : AtomicPosition(_atom.AtomicPosition), AtomicElement(_atom.AtomicElement) {};
22
23AtomInfo::AtomInfo(const VectorInterface &_v) : AtomicPosition(_v.getPosition()), AtomicElement(NULL)
24{};
25
26/** Destructor of class AtomInfo.
27 */
28AtomInfo::~AtomInfo()
29{
30};
31
32const element *AtomInfo::getType() const
33{
34 return AtomicElement;
35}
36
37const double& AtomInfo::operator[](size_t i) const
38{
39 return AtomicPosition[i];
40}
41
42const double& AtomInfo::at(size_t i) const
43{
44 return AtomicPosition.at(i);
45}
46
47void AtomInfo::set(size_t i, const double value)
48{
49 AtomicPosition.at(i) = value;
50}
51
52const Vector& AtomInfo::getPosition() const
53{
54 return AtomicPosition;
55}
56
57void AtomInfo::setType(const element* _type) {
58 AtomicElement = _type;
59}
60
61void AtomInfo::setType(const int Z) {
62 const element *elem = World::getInstance().getPeriode()->FindElement(Z);
63 setType(elem);
64}
65
66void AtomInfo::setPosition(const Vector& _vector)
67{
68 AtomicPosition = _vector;
69 //cout << "AtomInfo::setPosition: " << getType()->symbol << " at " << getPosition() << endl;
70}
71
72const VectorInterface& AtomInfo::operator+=(const Vector& b)
73{
74 AtomicPosition += b;
75 return *this;
76}
77
78const VectorInterface& AtomInfo::operator-=(const Vector& b)
79{
80 AtomicPosition -= b;
81 return *this;
82}
83
84Vector const AtomInfo::operator+(const Vector& b) const
85{
86 Vector a(AtomicPosition);
87 a += b;
88 return a;
89}
90
91Vector const AtomInfo::operator-(const Vector& b) const
92{
93 Vector a(AtomicPosition);
94 a -= b;
95 return a;
96}
97
98double AtomInfo::distance(const Vector &point) const
99{
100 return AtomicPosition.distance(point);
101}
102
103double AtomInfo::DistanceSquared(const Vector &y) const
104{
105 return AtomicPosition.DistanceSquared(y);
106}
107
108double AtomInfo::distance(const VectorInterface &_atom) const
109{
110 return _atom.distance(AtomicPosition);
111}
112
113double AtomInfo::DistanceSquared(const VectorInterface &_atom) const
114{
115 return _atom.DistanceSquared(AtomicPosition);
116}
117
118VectorInterface &AtomInfo::operator=(const Vector& _vector)
119{
120 AtomicPosition = _vector;
121 return *this;
122}
123
124void AtomInfo::ScaleAll(const double *factor)
125{
126 AtomicPosition.ScaleAll(factor);
127}
128
129void AtomInfo::ScaleAll(const Vector &factor)
130{
131 AtomicPosition.ScaleAll(factor);
132}
133
134void AtomInfo::Scale(const double factor)
135{
136 AtomicPosition.Scale(factor);
137}
138
139void AtomInfo::Zero()
140{
141 AtomicPosition.Zero();
142}
143
144void AtomInfo::One(const double one)
145{
146 AtomicPosition.One(one);
147}
148
149void AtomInfo::LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors)
150{
151 AtomicPosition.LinearCombinationOfVectors(x1,x2,x3,factors);
152}
153
154const AtomInfo& operator*=(AtomInfo& a, const double m)
155{
156 a.Scale(m);
157 return a;
158}
159
160AtomInfo const operator*(const AtomInfo& a, const double m)
161{
162 AtomInfo copy(a);
163 copy *= m;
164 return copy;
165}
166
167AtomInfo const operator*(const double m, const AtomInfo& a)
168{
169 AtomInfo copy(a);
170 copy *= m;
171 return copy;
172}
173
174std::ostream & AtomInfo::operator << (std::ostream &ost) const
175{
176 return (ost << getPosition());
177}
178
179std::ostream & operator << (std::ostream &ost, const AtomInfo &a)
180{
181 ost << a;
182 return ost;
183}
184
Note: See TracBrowser for help on using the repository browser.