source: src/Potentials/Particles/Particle.hpp@ fd5440

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_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 fd5440 was fd5440, checked in by Frederik Heber <heber@…>, 9 years ago

FIX: Particle's member variables are now public and fixes to stream functions.

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*
2 * Particle.hpp
3 *
4 * Created on: May 13, 2013
5 * Author: heber
6 */
7
8#ifndef PARTICLE_HPP_
9#define PARTICLE_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <iosfwd>
17#include <string>
18#include <vector>
19
20#include "types.hpp"
21
22class periodentafel;
23
24class Particle
25{
26public:
27 /** Constructor for class Particle.
28 *
29 * Chooses token as combination of element's symbol and a number such that name is
30 * unique with registry.
31 *
32 * \param _periode reference to periodentafel for looking up element nr
33 * \param _number atomic number of particle's element
34 */
35 Particle(const periodentafel &_periode, const atomicNumber_t &_number);
36
37 /** Constructor for class Particle.
38 *
39 * \param _periode reference to periodentafel for looking up element nr
40 * \param _token unique token/name of this particle
41 * \param _number atomic number of particle's element
42 */
43 Particle(const periodentafel &_periode, const std::string &_token, const atomicNumber_t &_number);
44
45 /** Destructor for class Particle.
46 *
47 */
48 ~Particle() {}
49
50 /** Getter for the name of this Particle.
51 *
52 * This function is required such that Particle's can be stored in a registry.
53 *
54 * \return name of particle
55 */
56 const std::string& getName() const
57 { return name; }
58
59 /** Returns the name of the element.
60 *
61 * \return name of the particle's element
62 */
63 std::string getElement() const;
64
65 /** Print parameters to given stream \a ost.
66 *
67 * These are virtual functions to allow for overriding and hence
68 * changing the default behavior.
69 *
70 * @param ost stream to print to
71 */
72 void stream_to(std::ostream &ost) const;
73
74 /** Parse parameters from given stream \a ist.
75 *
76 * These are virtual functions to allow for overriding and hence
77 * changing the default behavior.
78 *
79 * @param ist stream to parse from
80 */
81 void stream_from(std::istream &ist);
82
83private:
84 /** Default constructor for class Particle.
85 *
86 * \warning default constructor is private to prevent Particle without a
87 * unique name.
88 *
89 */
90 Particle();
91
92 /** Helper function to find index to a parameter name.
93 *
94 * \param name name of parameter to look up index for
95 * \return index in ParameterNames or -1 if not found
96 */
97 size_t lookupParameterName(const std::string &name) const;
98
99 /** Setter for the particle's element.
100 *
101 * \param element_name name of particle's element, must be known to periodentafel.
102 */
103 void setElement(const std::string &element_name);
104
105public:
106
107 /** Finds the next free token in the registry for the given element.
108 *
109 * \param _periode reference to periodentafel for looking up element nr
110 * \param _number atomic number of particle's element
111 * \return unique token for this element
112 */
113 static std::string findFreeName(
114 const periodentafel &_periode,
115 const atomicNumber_t &_number);
116
117 //!> token/name of this particle
118 const std::string name;
119
120 //!> reference to periodentafel to look up elements
121 const periodentafel &periode;
122
123 //!> partial charge of this particle
124 double charge;
125 //!> (effective) mass of this particle
126 double mass;
127 //!> (effective) degrees of freedom
128 unsigned int dof;
129 //!> atomic number of the particle's element
130 atomicNumber_t atomic_number;
131
132 // the following variables are due to convention in .potentials file
133 double sigma;
134 double epsilon;
135 double sigma_14;
136 double epsilon_14;
137
138 enum parameters_t {
139 e_particle_type,
140 e_element_name,
141 e_sigma,
142 e_epsilon,
143 e_sigma_14,
144 e_epsilon_14,
145 e_mass,
146 e_free,
147 e_charge,
148 MAXPARAMETERS
149 };
150
151 static const std::vector<std::string> ParameterNames;
152};
153
154/** Output stream operator for class Particle.
155 *
156 * \param ost output stream
157 * \param p Particle instance
158 */
159std::ostream& operator<<(std::ostream &ost, const Particle &p);
160
161#endif /* PARTICLE_HPP_ */
Note: See TracBrowser for help on using the repository browser.