SIRIUS 7.5.0
Electronic structure library and applications
atom_symmetry_class.hpp
Go to the documentation of this file.
1// Copyright (c) 2013-2016 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_symmetry_class.hpp
21 *
22 * \brief Contains declaration and partial implementation of sirius::Atom_symmetry_class class.
23 */
24
25#ifndef __ATOM_SYMMETRY_CLASS_HPP__
26#define __ATOM_SYMMETRY_CLASS_HPP__
27
28#include "atom_type.hpp"
30#include "core/mpi/pstdout.hpp"
31
32namespace sirius {
33
34/// Data and methods specific to the symmetry class of the atom.
35/** Atoms transforming into each other under symmetry opeartions belong to the same symmetry class. They have the
36 * same spherical part of the on-site potential and, as a consequence, the same radial functions.
37 */
39{
40 private:
41 /// Symmetry class id in the range [0, N_class).
42 int id_;
43
44 /// List of atoms of this class.
45 std::vector<int> atom_id_;
46
47 /// Pointer to atom type.
49
50 /// Spherical part of the effective potential.
51 /** Used by the LAPW radial solver. */
52 std::vector<double> spherical_potential_;
53
54 /// List of radial functions for the LAPW basis.
55 /** This array stores all the radial functions (AW and LO) and their derivatives. Radial derivatives of functions
56 * are multiplied by \f$ x \f$.\n
57 * 1-st dimension: index of radial point \n
58 * 2-nd dimension: index of radial function \n
59 * 3-nd dimension: 0 - function itself, 1 - radial derivative r*(du/dr) */
61
62 /// Surface derivatives of AW radial functions.
64
65 /// Spherical part of radial integral.
67
68 /// Overlap integrals.
70
71 /// Overlap integrals for IORA relativistic treatment.
73
74 /// Spin-orbit interaction integrals.
76
77 /// Core charge density.
78 /** All-electron core charge density of the LAPW method. It is recomputed on every SCF iteration due to
79 the change of effective potential. */
80 std::vector<double> ae_core_charge_density_;
81
82 /// Core eigen-value sum.
83 double core_eval_sum_{0};
84
85 /// Core leakage.
86 double core_leakage_{0};
87
88 /// list of radial descriptor sets used to construct augmented waves
89 mutable std::vector<radial_solution_descriptor_set> aw_descriptors_;
90
91 /// list of radial descriptor sets used to construct local orbitals
92 mutable std::vector<local_orbital_descriptor> lo_descriptors_;
93
94 /// Generate radial functions for augmented waves
96
97 /// Generate local orbital raidal functions
99
100 /// Orthogonalize the radial functions.
102
103 public:
104 /// Constructor
106
107 /// Set the spherical component of the potential
108 /** Atoms belonging to the same symmetry class have the same spherical potential. */
109 void set_spherical_potential(std::vector<double> const& vs__);
110
111 /// Generate APW and LO radial functions.
113
114 void sync_radial_functions(mpi::Communicator const& comm__, int const rank__);
115
116 void sync_radial_integrals(mpi::Communicator const& comm__, int const rank__);
117
118 void sync_core_charge_density(mpi::Communicator const& comm__, int const rank__);
119
120 /// Check if local orbitals are linearly independent
121 std::vector<int> check_lo_linear_independence(double etol__);
122
123 /// Dump local orbitals to the file for debug purposes
124 void dump_lo();
125
126 /// Find core states and generate core density.
128
129 /// Find linearization energy.
130 void find_enu(relativity_t rel__);
131
132 void write_enu(mpi::pstdout& pout) const;
133
134 /// Generate radial overlap and SO integrals
135 /** In the case of spin-orbit interaction the following integrals are computed:
136 * \f[
137 * \int f_{p}(r) \Big( \frac{1}{(2 M c)^2} \frac{1}{r} \frac{d V}{d r} \Big) f_{p'}(r) r^2 dr
138 * \f]
139 *
140 * Relativistic mass M is defined as
141 * \f[
142 * M = 1 - \frac{1}{2 c^2} V
143 * \f]
144 */
146
147 /// Get m-th order radial derivative of AW functions at the MT surface.
148 inline double aw_surface_deriv(int l__, int order__, int dm__) const
149 {
150 RTE_ASSERT(dm__ <= 2);
151 auto idxrf = atom_type_.indexr().index_of(angular_momentum(l__), order__);
152 return surface_derivatives_(dm__, idxrf);
153 }
154
155 /// Set surface derivative of AW radial functions.
156 inline void aw_surface_deriv(int l__, int order__, int dm__, double deriv__)
157 {
158 RTE_ASSERT(dm__ <= 2);
159 auto idxrf = atom_type_.indexr().index_of(angular_momentum(l__), order__);
160 surface_derivatives_(dm__, idxrf) = deriv__;
161 }
162
163 /// Return symmetry class id.
164 inline int id() const
165 {
166 return id_;
167 }
168
169 /// Add atom id to the current class.
170 inline void add_atom_id(int atom_id__)
171 {
172 atom_id_.push_back(atom_id__);
173 }
174
175 /// Return number of atoms belonging to the current symmetry class.
176 inline int num_atoms() const
177 {
178 return static_cast<int>(atom_id_.size());
179 }
180
181 inline int atom_id(int idx) const
182 {
183 return atom_id_[idx];
184 }
185
186 /// Get a value of the radial functions.
187 inline double radial_function(int ir, int idx) const
188 {
189 return radial_functions_(ir, idx, 0);
190 }
191
192 /// Set radial function.
193 inline void radial_function(int idx__, std::vector<double> f__)
194 {
195 for (int ir = 0; ir < this->atom_type().num_mt_points(); ir++) {
196 radial_functions_(ir, idx__, 0) = f__[ir];
197 }
198 }
199
200 /// Set radial function derivative r*(du/dr).
201 inline void radial_function_derivative(int idx__, std::vector<double> f__)
202 {
203 for (int ir = 0; ir < this->atom_type().num_mt_points(); ir++) {
204 radial_functions_(ir, idx__, 1) = f__[ir];
205 }
206 }
207
208 inline double h_spherical_integral(int i1, int i2) const
209 {
210 return h_spherical_integrals_(i1, i2);
211 }
212
213 inline double const& o_radial_integral(int l, int order1, int order2) const
214 {
215 return o_radial_integrals_(l, order1, order2);
216 }
217
218 inline void set_o_radial_integral(int l, int order1, int order2, double oint__)
219 {
220 o_radial_integrals_(l, order1, order2) = oint__;
221 }
222
223 inline double const& o1_radial_integral(int xi1__, int xi2__) const
224 {
225 return o1_radial_integrals_(xi1__, xi2__);
226 }
227
228 inline void set_o1_radial_integral(int idxrf1__, int idxrf2__, double val__)
229 {
230 o1_radial_integrals_(idxrf1__, idxrf2__) = val__;
231 }
232
233 inline double so_radial_integral(int l, int order1, int order2) const
234 {
235 return so_radial_integrals_(l, order1, order2);
236 }
237
238 inline double ae_core_charge_density(int ir) const
239 {
240 RTE_ASSERT(ir >= 0 && ir < (int)ae_core_charge_density_.size());
241
242 return ae_core_charge_density_[ir];
243 }
244
245 inline Atom_type const& atom_type() const
246 {
247 return atom_type_;
248 }
249
250 inline double core_eval_sum() const
251 {
252 return core_eval_sum_;
253 }
254
255 inline double core_leakage() const
256 {
257 return core_leakage_;
258 }
259
260 inline int num_aw_descriptors() const
261 {
262 return static_cast<int>(aw_descriptors_.size());
263 }
264
265 inline radial_solution_descriptor_set& aw_descriptor(int idx__) const
266 {
267 return aw_descriptors_[idx__];
268 }
269
270 inline int num_lo_descriptors() const
271 {
272 return static_cast<int>(lo_descriptors_.size());
273 }
274
275 inline local_orbital_descriptor& lo_descriptor(int idx__) const
276 {
277 return lo_descriptors_[idx__];
278 }
279
280 inline void set_aw_enu(int l, int order, double enu)
281 {
282 aw_descriptors_[l][order].enu = enu;
283 }
284
285 inline double get_aw_enu(int l, int order) const
286 {
287 return aw_descriptors_[l][order].enu;
288 }
289
290 inline void set_lo_enu(int idxlo, int order, double enu)
291 {
292 lo_descriptors_[idxlo].rsd_set[order].enu = enu;
293 }
294
295 inline double get_lo_enu(int idxlo, int order) const
296 {
297 return lo_descriptors_[idxlo].rsd_set[order].enu;
298 }
299};
300
301} // namespace sirius
302
303#endif // __ATOM_SYMMETRY_CLASS_H__
Contains declaration and implementation of sirius::Atom_type class.
Data and methods specific to the symmetry class of the atom.
void generate_aw_radial_functions(relativity_t rel__)
Generate radial functions for augmented waves.
void generate_radial_functions(relativity_t rel__)
Generate APW and LO radial functions.
Atom_symmetry_class(int id_, Atom_type const &atom_type_)
Constructor.
void set_spherical_potential(std::vector< double > const &vs__)
Set the spherical component of the potential.
void aw_surface_deriv(int l__, int order__, int dm__, double deriv__)
Set surface derivative of AW radial functions.
std::vector< int > atom_id_
List of atoms of this class.
double core_eval_sum_
Core eigen-value sum.
void generate_lo_radial_functions(relativity_t rel__)
Generate local orbital raidal functions.
void dump_lo()
Dump local orbitals to the file for debug purposes.
Atom_type const & atom_type_
Pointer to atom type.
std::vector< double > ae_core_charge_density_
Core charge density.
std::vector< local_orbital_descriptor > lo_descriptors_
list of radial descriptor sets used to construct local orbitals
void generate_core_charge_density(relativity_t core_rel__)
Find core states and generate core density.
sddk::mdarray< double, 2 > o1_radial_integrals_
Overlap integrals for IORA relativistic treatment.
int id() const
Return symmetry class id.
std::vector< double > spherical_potential_
Spherical part of the effective potential.
void add_atom_id(int atom_id__)
Add atom id to the current class.
void radial_function(int idx__, std::vector< double > f__)
Set radial function.
sddk::mdarray< double, 3 > so_radial_integrals_
Spin-orbit interaction integrals.
void find_enu(relativity_t rel__)
Find linearization energy.
sddk::mdarray< double, 2 > h_spherical_integrals_
Spherical part of radial integral.
sddk::mdarray< double, 3 > o_radial_integrals_
Overlap integrals.
void radial_function_derivative(int idx__, std::vector< double > f__)
Set radial function derivative r*(du/dr).
int id_
Symmetry class id in the range [0, N_class).
sddk::mdarray< double, 3 > radial_functions_
List of radial functions for the LAPW basis.
std::vector< radial_solution_descriptor_set > aw_descriptors_
list of radial descriptor sets used to construct augmented waves
int num_atoms() const
Return number of atoms belonging to the current symmetry class.
sddk::mdarray< double, 2 > surface_derivatives_
Surface derivatives of AW radial functions.
void generate_radial_integrals(relativity_t rel__)
Generate radial overlap and SO integrals.
void orthogonalize_radial_functions()
Orthogonalize the radial functions.
double radial_function(int ir, int idx) const
Get a value of the radial functions.
double aw_surface_deriv(int l__, int order__, int dm__) const
Get m-th order radial derivative of AW functions at the MT surface.
std::vector< int > check_lo_linear_independence(double etol__)
Check if local orbitals are linearly independent.
Defines the properties of atom type.
Definition: atom_type.hpp:93
int num_mt_points() const
Return number of muffin-tin radial grid points.
Definition: atom_type.hpp:718
auto const & indexr() const
Return const reference to the index of radial functions.
Definition: atom_type.hpp:817
Angular momentum quantum number.
MPI communicator wrapper.
Parallel standard output.
Definition: pstdout.hpp:42
Contains definition of eigensolver factory.
Namespace of the SIRIUS library.
Definition: sirius.f90:5
relativity_t
Type of relativity treatment in the case of LAPW.
Definition: typedefs.hpp:95
std::vector< radial_solution_descriptor > radial_solution_descriptor_set
Set of radial solution descriptors, used to construct augmented waves or local orbitals.
Definition: typedefs.hpp:155
Contains implementation of the parallel standard output.