Loading [MathJax]/extensions/tex2jax.js
SIRIUS 7.5.0
Electronic structure library and applications
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
atom_type_base.hpp
Go to the documentation of this file.
1// Copyright (c) 2013-2017 Anton Kozhevnikov, Thomas Schulthess
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without modification, are permitted provided that
5// the following conditions are met:
6//
7// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
8// following disclaimer.
9// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
10// and the following disclaimer in the documentation and/or other materials provided with the distribution.
11//
12// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
13// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
15// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
17// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
18// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19
20/** \file atom_type_base.hpp
21 *
22 * \brief Contains declaration and implementation of sirius::Atom_type_base class.
23 */
24
25#ifndef __ATOM_TYPE_BASE_HPP__
26#define __ATOM_TYPE_BASE_HPP__
27
28#include "atomic_data.hpp"
30
31namespace sirius {
32
33/// Base class for sirius::Atom_type and sirius::Free_atom classes.
35{
36 protected:
37 /// Nucleus charge or pseudocharge, treated as positive(!) integer.
38 int zn_{0};
39
40 /// Chemical element symbol.
41 std::string symbol_;
42
43 /// Chemical element name.
44 std::string name_;
45
46 /// Atom mass.
47 double mass_{0};
48
49 /// List of atomic levels.
50 std::vector<atomic_level_descriptor> atomic_levels_;
51
52 ///// Number of core electrons.
53 //double num_core_electrons_{0};
54
55 ///// Number of valence electrons.
56 //double num_valence_electrons_{0};
57
58 /* forbid copy constructor */
59 Atom_type_base(Atom_type_base const& src) = delete;
60
61 /* forbid assignment operator */
62 Atom_type_base& operator=(Atom_type_base& src) = delete;
63
64 /// Density of a free atom.
66
67 /// Density of a free atom as read from the input file.
68 /** Does not contain 4 Pi and r^2 prefactors. */
69 std::vector<double> free_atom_density_;
70
71 /// Radial grid of a free atom.
73
74 private:
75 /// Initialize atomic levels of neutral atom and radial grid.
76 void init()
77 {
78 /* add valence levels to the list of atom's levels */
79 for (auto& e : atomic_conf[zn_ - 1]) {
80 /* check if this level is already in the list */
81 bool in_list{false};
82 for (auto& c : atomic_levels_) {
83 if (c.n == e.n && c.l == e.l && c.k == e.k) {
84 in_list = true;
85 break;
86 }
87 }
88 if (!in_list) {
89 auto level = e;
90 level.core = false;
91 atomic_levels_.push_back(level);
92 }
93 }
94 ///* get the number of core electrons */
95 //for (auto& e : atomic_levels_) {
96 // if (e.core) {
97 // num_core_electrons_ += e.occupancy;
98 // }
99 //}
100
101 ///* get number of valence electrons */
102 //num_valence_electrons_ = zn_ - num_core_electrons_;
103
104 free_atom_radial_grid_ = Radial_grid_exp<double>(2000 + 150 * zn(), 1e-7, 20.0 + 0.25 * zn(), 1.0);
105 }
106
107 public:
108 /// Constructor.
110 : zn_(zn__)
111 , symbol_(atomic_symb[zn_ - 1])
112 , name_(atomic_name[zn_ - 1])
113 {
114 init();
115 }
116
117 /// Constructor.
118 Atom_type_base(std::string symbol__)
119 : zn_(atomic_zn.at(symbol__))
120 , symbol_(symbol__)
121 , name_(atomic_name[zn_ - 1])
122 {
123 init();
124 }
125
126 /// Get atomic charge.
127 inline int zn() const
128 {
129 assert(zn_ > 0);
130 return zn_;
131 }
132
133 /// Set atomic charge.
134 inline int zn(int zn__)
135 {
136 zn_ = zn__;
137 return zn_;
138 }
139
140 /// Get atomic symbol.
141 inline std::string const& symbol() const
142 {
143 return symbol_;
144 }
145
146 /// Get name of the element.
147 inline std::string const& name() const
148 {
149 return name_;
150 }
151
152 /// Get atomic mass.
153 inline double mass() const
154 {
155 return mass_;
156 }
157
158 /// Get the whole radial grid.
160 {
162 }
163
164 /// Get the radial point at a given index.
165 inline double free_atom_radial_grid(int ir) const
166 {
167 return free_atom_radial_grid_[ir];
168 }
169
170 /// Return number of the atomic levels.
171 inline int num_atomic_levels() const
172 {
173 return static_cast<int>(atomic_levels_.size());
174 }
175
176 inline atomic_level_descriptor const& atomic_level(int idx) const
177 {
178 return atomic_levels_[idx];
179 }
180
181 //inline double num_core_electrons() const
182 //{
183 // return num_core_electrons_;
184 //}
185
186 //inline double num_valence_electrons() const
187 //{
188 // return num_valence_electrons_;
189 //}
190};
191
192} // namespace
193
194#endif // __ATOM_TYPE_BASE_HPP__
195
Basic atomic data information.
Base class for sirius::Atom_type and sirius::Free_atom classes.
std::string symbol_
Chemical element symbol.
double mass_
Atom mass.
int zn_
Nucleus charge or pseudocharge, treated as positive(!) integer.
double mass() const
Get atomic mass.
int zn(int zn__)
Set atomic charge.
std::string const & symbol() const
Get atomic symbol.
int num_atomic_levels() const
Return number of the atomic levels.
std::vector< double > free_atom_density_
Density of a free atom as read from the input file.
int zn() const
Get atomic charge.
Atom_type_base(int zn__)
Constructor.
std::string const & name() const
Get name of the element.
std::vector< atomic_level_descriptor > atomic_levels_
List of atomic levels.
double free_atom_radial_grid(int ir) const
Get the radial point at a given index.
std::string name_
Chemical element name.
Spline< double > free_atom_density_spline_
Density of a free atom.
Radial_grid< double > free_atom_radial_grid_
Radial grid of a free atom.
Atom_type_base(std::string symbol__)
Constructor.
Radial_grid< double > const & free_atom_radial_grid() const
Get the whole radial grid.
void init()
Initialize atomic levels of neutral atom and radial grid.
Namespace of the SIRIUS library.
Definition: sirius.f90:5
Contains declaraion and partial implementation of sirius::Radial_grid class.
Describes single atomic level.
Definition: atomic_data.hpp:15