source: src/atom_atominfo.cpp@ c38826

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 c38826 was 1f8337, checked in by Tillmann Crueger <crueger@…>, 14 years ago

Moved AtomInfo::getMass() method to class atom to avoid problems with virtual inheritance

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