source: src/element.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 83f176, checked in by Frederik Heber <heber@…>, 14 years ago

Made all member variables of class element private, added accessor functions and periodentafel is friend.

  • Property mode set to 100755
File size: 3.9 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/** \file element.cpp
9 *
10 * Function implementations for the class element.
11 *
12 */
13
14// include config.h
15#ifdef HAVE_CONFIG_H
16#include <config.h>
17#endif
18
19#include "Helpers/MemDebug.hpp"
20
21#include <iomanip>
22#include <fstream>
23
24#include "Helpers/Assert.hpp"
25#include "element.hpp"
26
27using namespace std;
28
29/************************************* Functions for class element **********************************/
30
31/** Constructor of class element.
32 */
33element::element() :
34 mass(0),
35 CovalentRadius(0),
36 VanDerWaalsRadius(0),
37 Z(-1),
38 Valence(0),
39 NoValenceOrbitals(0)
40{
41};
42
43element::element(const element &src) :
44 mass(src.mass),
45 CovalentRadius(src.CovalentRadius),
46 VanDerWaalsRadius(src.VanDerWaalsRadius),
47 Z(src.Z),
48 Valence(src.Valence),
49 NoValenceOrbitals(src.NoValenceOrbitals),
50 name(src.name),
51 symbol(src.symbol)
52{
53 period = src.period;
54 group = src.group;
55 block = src.block;
56}
57
58/** Destructor of class element.
59 */
60element::~element() {};
61
62element &element::operator=(const element &src){
63 if(this!=&src){
64 mass=src.mass;
65 CovalentRadius=src.CovalentRadius;
66 VanDerWaalsRadius=src.VanDerWaalsRadius;
67 Z=src.Z;
68 Valence=src.Valence;
69 NoValenceOrbitals=src.NoValenceOrbitals;
70 name=src.name;
71 symbol=src.symbol;
72 period = src.period;
73 group = src.group;
74 block = src.block;
75 }
76 return *this;
77}
78
79/** Prints element data to \a *out.
80 * \param *out outstream
81 */
82bool element::Output(ostream * const out) const
83{
84 if (out != NULL) {
85 *out << name << "\t" << symbol << "\t" << period << "\t" << group << "\t" << block << "\t" << Z << "\t" << mass << "\t" << CovalentRadius << "\t" << VanDerWaalsRadius << endl;
86 //*out << Z << "\t" << fixed << setprecision(11) << showpoint << mass << "g/mol\t" << name << "\t" << symbol << "\t" << endl;
87 return true;
88 } else
89 return false;
90};
91
92/** Prints element data to \a *out.
93 * \param *out outstream
94 * \param No cardinal number of element
95 * \param NoOfAtoms total number of atom of this element type
96 */
97bool element::Checkout(ostream * const out, const int Number, const int NoOfAtoms) const
98{
99 if (out != NULL) {
100 *out << "Ion_Type" << Number << "\t" << NoOfAtoms << "\t" << Z << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << mass << "\t" << name << "\t" << symbol <<endl;
101 return true;
102 } else
103 return false;
104};
105
106atomicNumber_t element::getNumber() const{
107 return Z;
108}
109
110double element::getMass() const
111{
112 return mass;
113}
114
115double element::getCovalentRadius() const
116{
117 return CovalentRadius;
118}
119
120double element::getVanDerWaalsRadius() const
121{
122 return VanDerWaalsRadius;
123}
124
125int element::getAtomicNumber() const
126{
127 return Z;
128}
129
130double element::getValence() const
131{
132 return Valence;
133}
134
135int element::getNoValenceOrbitals() const
136{
137 return NoValenceOrbitals;
138}
139
140double element::getHBondDistance(const int i) const
141{
142 ASSERT((i>=0) && (i<3), "Access to element::HBondDistance out of bounds.");
143 return HBondDistance[i];
144}
145
146double element::getHBondAngle(const int i) const
147{
148 ASSERT((i>=0) && (i<3), "Access to element::HBondAngle out of bounds.");
149 return HBondAngle[i];
150}
151
152string &element::getSymbol(){
153 return symbol;
154}
155
156const string &element::getSymbol() const{
157 return symbol;
158}
159
160void element::setSymbol(const std::string &temp)
161{
162 symbol = temp;
163}
164
165std::string &element::getName(){
166 return name;
167}
168
169const std::string &element::getName() const{
170 return name;
171}
172
173void element::setName(const std::string &temp)
174{
175 name = temp;
176}
177
178std::ostream &operator<<(std::ostream &ost,const element &elem){
179 ost << elem.getName() << "(" << elem.getNumber() << ")";
180 return ost;
181}
Note: See TracBrowser for help on using the repository browser.