25#ifndef __SMEARING_HPP__
26#define __SMEARING_HPP__
49get_smearing_t(std::string name__)
51 std::transform(name__.begin(), name__.end(), name__.begin(), ::tolower);
52 std::map<std::string, smearing_t>
const m = {
53 {
"gaussian", smearing_t::gaussian},
54 {
"fermi_dirac", smearing_t::fermi_dirac},
55 {
"cold", smearing_t::cold},
56 {
"methfessel_paxton", smearing_t::methfessel_paxton},
59 if (m.count(name__) == 0) {
61 s <<
"get_smearing_t(): wrong label of the smearing_t enumerator: " << name__;
62 throw std::runtime_error(s.str());
69 static double delta(
double x__,
double width__);
70 static double occupancy(
double x__,
double width__);
71 static double entropy(
double x__,
double width__);
76 static double dxdelta(
double x__,
double width__);
77 static double delta(
double x__,
double width__);
78 static double occupancy(
double x__,
double width__);
79 static double entropy(
double x__,
double width__);
84 static double delta(
double x__,
double width__);
85 static double occupancy(
double x__,
double width__);
86 static double entropy(
double x__,
double width__);
93 static double dxdelta(
double x__,
double width__);
104 static double dxdelta(
double x__,
double width__,
int n__);
105 static double delta(
double x__,
double width__,
int n__);
106 static double occupancy(
double x__,
double width__,
int n__);
107 static double entropy(
double x__,
double width__,
int n__);
110inline std::function<double(
double)>
111occupancy(smearing_t type__,
double width__)
114 case smearing_t::gaussian: {
115 return [width__](
double x__) {
return gaussian::occupancy(x__, width__); };
117 case smearing_t::fermi_dirac: {
118 return [width__](
double x__) {
return fermi_dirac::occupancy(x__, width__); };
120 case smearing_t::cold: {
121 return [width__](
double x__) {
return cold::occupancy(x__, width__); };
123 case smearing_t::methfessel_paxton: {
124 return [width__](
double x__) {
return methfessel_paxton::occupancy(x__, width__, 1); };
127 throw std::runtime_error(
"wrong type of smearing");
132inline std::function<double(
double)>
133entropy(smearing_t type__,
double width__)
136 case smearing_t::gaussian: {
137 return [width__](
double x__) {
return gaussian::entropy(x__, width__); };
139 case smearing_t::fermi_dirac: {
140 return [width__](
double x__) {
return fermi_dirac::entropy(x__, width__); };
142 case smearing_t::cold: {
143 return [width__](
double x__) {
return cold::entropy(x__, width__); };
145 case smearing_t::methfessel_paxton: {
146 return [width__](
double x__) {
return methfessel_paxton::entropy(x__, width__, 1); };
149 throw std::runtime_error(
"wrong type of smearing");
154inline std::function<double(
double)>
155delta(smearing_t type__,
double width__)
158 case smearing_t::gaussian: {
159 throw std::runtime_error(
"not available");
161 case smearing_t::fermi_dirac: {
162 return [width__](
double x__) {
return fermi_dirac::delta(x__, width__); };
164 case smearing_t::cold: {
165 return [width__](
double x__) {
return cold::delta(x__, width__); };
167 case smearing_t::methfessel_paxton: {
168 return [width__](
double x__) {
return methfessel_paxton::delta(x__, width__, 1); };
171 throw std::runtime_error(
"wrong type of smearing");
176inline std::function<double(
double)>
177dxdelta(smearing_t type__,
double width__)
180 case smearing_t::gaussian: {
181 throw std::runtime_error(
"not available");
183 case smearing_t::fermi_dirac: {
186 case smearing_t::cold: {
187 return [width__](
double x__) {
return cold::dxdelta(x__, width__); };
189 case smearing_t::methfessel_paxton: {
190 return [width__](
double x__) {
return methfessel_paxton::dxdelta(x__, width__, 1); };
193 throw std::runtime_error(
"wrong type of smearing");
std::enable_if_t< std::is_same< T, real_type< F > >::value, void > transform(::spla::Context &spla_ctx__, sddk::memory_t mem__, la::dmatrix< F > const &M__, int irow0__, int jcol0__, real_type< F > alpha__, Wave_functions< T > const &wf_in__, spin_index s_in__, band_range br_in__, real_type< F > beta__, Wave_functions< T > &wf_out__, spin_index s_out__, band_range br_out__)
Apply linear transformation to the wave-functions.
Namespace of the SIRIUS library.
static double dxdelta(double x__, double width__)
static double dxdelta(double x__, double width__)