source: src/Potentials/Particles/Particle.hpp@ 64cafb2

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator 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_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 64cafb2 was 086e30, checked in by Frederik Heber <heber@…>, 9 years ago

Added ParticleFactory and general StreamFactory.

  • Property mode set to 100644
File size: 4.0 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 //!> grant factory access to default cstor.
85 friend class ParticleFactory;
86
87 /** Default constructor for class Particle.
88 *
89 * \warning default constructor is private to prevent Particle without a
90 * unique name.
91 *
92 * \param _periode reference to periodentafel for looking up element nr
93 */
94 Particle(const periodentafel &_periode);
95
96 /** Helper function to find index to a parameter name.
97 *
98 * \param name name of parameter to look up index for
99 * \return index in ParameterNames or -1 if not found
100 */
101 size_t lookupParameterName(const std::string &name) const;
102
103 /** Setter for the particle's element.
104 *
105 * \param element_name name of particle's element, must be known to periodentafel.
106 */
107 void setElement(const std::string &element_name);
108
109public:
110
111 /** Finds the next free token in the registry for the given element.
112 *
113 * \param _periode reference to periodentafel for looking up element nr
114 * \param _number atomic number of particle's element
115 * \return unique token for this element
116 */
117 static std::string findFreeName(
118 const periodentafel &_periode,
119 const atomicNumber_t &_number);
120
121 //!> token/name of this particle
122 const std::string name;
123
124 //!> reference to periodentafel to look up elements
125 const periodentafel &periode;
126
127 //!> partial charge of this particle
128 double charge;
129 //!> (effective) mass of this particle
130 double mass;
131 //!> (effective) degrees of freedom
132 unsigned int dof;
133 //!> atomic number of the particle's element
134 atomicNumber_t atomic_number;
135
136 // the following variables are due to convention in .potentials file
137 double sigma;
138 double epsilon;
139 double sigma_14;
140 double epsilon_14;
141
142 enum parameters_t {
143 e_particle_type,
144 e_element_name,
145 e_sigma,
146 e_epsilon,
147 e_sigma_14,
148 e_epsilon_14,
149 e_mass,
150 e_free,
151 e_charge,
152 MAXPARAMETERS
153 };
154
155 static const std::vector<std::string> ParameterNames;
156};
157
158/** Output stream operator for class Particle.
159 *
160 * \param ost output stream
161 * \param p Particle instance
162 */
163std::ostream& operator<<(std::ostream &ost, const Particle &p);
164
165#endif /* PARTICLE_HPP_ */
Note: See TracBrowser for help on using the repository browser.