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

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

Added Particle and ParticleRegistry class.

  • Paricle class contains among other partial nuclei charge information.
  • 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 /** Print parameters to given stream \a ost.
60 *
61 * These are virtual functions to allow for overriding and hence
62 * changing the default behavior.
63 *
64 * @param ost stream to print to
65 */
66 void stream_to(std::ostream &ost) const;
67
68 /** Parse parameters from given stream \a ist.
69 *
70 * These are virtual functions to allow for overriding and hence
71 * changing the default behavior.
72 *
73 * @param ist stream to parse from
74 */
75 void stream_from(std::istream &ist);
76
77private:
78 /** Default constructor for class Particle.
79 *
80 * \warning default constructor is private to prevent Particle without a
81 * unique name.
82 *
83 */
84 Particle();
85
86 /** Helper function to find index to a parameter name.
87 *
88 * \param name name of parameter to look up index for
89 * \return index in ParameterNames or -1 if not found
90 */
91 size_t lookupParameterName(const std::string &name) const;
92
93 /** Returns the name of the element.
94 *
95 * \return name of the particle's element
96 */
97 std::string getElement() 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
105 /** Finds the next free token in the registry for the given element.
106 *
107 * \param _periode reference to periodentafel for looking up element nr
108 * \param _number atomic number of particle's element
109 * \return unique token for this element
110 */
111 std::string findFreeName(
112 const periodentafel &_periode,
113 const atomicNumber_t &_number) const;
114
115private:
116 //!> token/name of this particle
117 const std::string name;
118
119 //!> reference to periodentafel to look up elements
120 const periodentafel &periode;
121
122 //!> partial charge of this particle
123 double charge;
124 //!> (effective) mass of this particle
125 double mass;
126 //!> (effective) degrees of freedom
127 unsigned int dof;
128 //!> atomic number of the particle's element
129 atomicNumber_t atomic_number;
130
131 // the following variables are due to convention in .potentials file
132 double sigma;
133 double epsilon;
134 double sigma_14;
135 double epsilon_14;
136
137 enum parameters_t {
138 e_particle_type,
139 e_element_name,
140 e_sigma,
141 e_epsilon,
142 e_sigma_14,
143 e_epsilon_14,
144 e_mass,
145 e_free,
146 e_charge,
147 MAXPARAMETERS
148 };
149
150 static const std::vector<std::string> ParameterNames;
151};
152
153/** Output stream operator for class Particle.
154 *
155 * \param ost output stream
156 * \param p Particle instance
157 */
158std::ostream& operator<<(std::ostream &ost, const Particle &p);
159
160#endif /* PARTICLE_HPP_ */
Note: See TracBrowser for help on using the repository browser.