|
1 | | -#include <cassert> |
2 | | -#include <iostream> |
3 | | -#include "module_parameter/parameter.h" |
4 | | -#include <sstream> |
5 | | -#include <cmath> |
6 | 1 | #include "ORB_nonlocal_lm.h" |
7 | | -#include "module_base/math_integral.h" |
| 2 | + |
| 3 | +#include "module_base/constants.h" |
8 | 4 | #include "module_base/global_function.h" |
9 | | -#include "module_base/mathzone.h" /// use Polynomial_Interpolation_xy, Spherical_Bessel |
| 5 | +#include "module_base/math_integral.h" |
| 6 | +#include "module_base/math_polyint.h" |
| 7 | +#include "module_base/math_sphbes.h" |
| 8 | +#include "module_base/mathzone.h" /// use Polynomial_Interpolation_xy, Spherical_Bessel |
10 | 9 | #include "module_base/mathzone_add1.h" /// use SplineD2 |
11 | | -#include "module_base/math_sphbes.h" // mohan add 2021-05-06 |
12 | | -#include "module_base/math_polyint.h" // mohan add 2021-05-06 |
| 10 | +#include "module_parameter/parameter.h" |
| 11 | + |
| 12 | +#include <cassert> |
| 13 | +#include <cmath> |
| 14 | +#include <iostream> |
| 15 | +#include <sstream> |
13 | 16 |
|
14 | 17 | Numerical_Nonlocal_Lm::Numerical_Nonlocal_Lm() |
15 | 18 | { |
@@ -178,84 +181,13 @@ void Numerical_Nonlocal_Lm::set_NL_proj( |
178 | 181 | return; |
179 | 182 | } |
180 | 183 |
|
181 | | -/* |
182 | | -// extra_uniform currently does not work, because |
183 | | -// beta[ir] = this->beta_r[ir]/r_radial[ir]; |
184 | | -// does not work for ir==0, and this formula is not stable for small r. |
185 | | -// |
186 | | -// If one really needs beta (in what circumstance?), one should do |
187 | | -// extrapolation to reach r=0. |
188 | | -
|
189 | | -void Numerical_Nonlocal_Lm::extra_uniform(const double &dr_uniform_in) |
190 | | -{ |
191 | | - assert(dr_uniform_in>0.0); |
192 | | - this->dr_uniform = dr_uniform_in; |
193 | | - this->nr_uniform = static_cast<int>(rcut/dr_uniform) + 10; |
194 | | -
|
195 | | -// std::cout << " nr_uniform = " << nr_uniform << std::endl; |
196 | | - |
197 | | - delete[] this->beta_uniform; |
198 | | - this->beta_uniform = new double[nr_uniform]; |
199 | | - ModuleBase::GlobalFunc::ZEROS (this->beta_uniform, nr_uniform); |
200 | | -
|
201 | | - // mohan fix bug 2011-04-14 |
202 | | - // the beta_r is beta*r. |
203 | | - // and beta is beta!!! |
204 | | - double* beta = new double[nr]; |
205 | | - ModuleBase::GlobalFunc::ZEROS(beta,nr); |
206 | | - for(int ir=0; ir<nr; ir++) |
207 | | - { |
208 | | - assert(r_radial[ir]>0.0); |
209 | | - beta[ir] = this->beta_r[ir]/r_radial[ir]; |
210 | | - } |
211 | | -
|
212 | | - for (int ir = 0; ir < this->nr_uniform; ir++) |
213 | | - { |
214 | | - double rnew = ir * dr_uniform; |
215 | | - this->beta_uniform[ir] = ModuleBase::PolyInt::Polynomial_Interpolation_xy(this->r_radial, beta, this->nr, rnew); |
216 | | - } |
217 | | - delete[] beta; |
218 | | -
|
219 | | - delete[] this->dbeta_uniform; |
220 | | - this->dbeta_uniform = new double[nr_uniform]; |
221 | | - ModuleBase::GlobalFunc::ZEROS(this->dbeta_uniform, nr_uniform); |
222 | | - |
223 | | - double* y2 = new double[nr]; |
224 | | - ModuleBase::Mathzone_Add1::SplineD2 (r_radial, beta_r, nr, 0.0, 0.0, y2); |
225 | | -
|
226 | | - double* rad = new double[nr_uniform]; |
227 | | - for (int ir = 0; ir < nr_uniform; ir++) |
228 | | - { |
229 | | - rad[ir] = ir*dr_uniform; |
230 | | - } |
231 | | - |
232 | | - double* tmp = new double[nr_uniform]; |
233 | | - double* tmp1 = new double[nr_uniform]; |
234 | | - ModuleBase::Mathzone_Add1::Cubic_Spline_Interpolation(r_radial, beta_r, y2, |
235 | | - nr, rad, nr_uniform, tmp, dbeta_uniform); |
236 | | -
|
237 | | - for(int ir= 0 ; ir<nr_uniform; ir++) |
238 | | - { |
239 | | - //assert(dbeta_uniform[ir]==beta_uniform[ir]); |
240 | | - } |
241 | | -
|
242 | | - delete [] y2; |
243 | | - delete [] rad; |
244 | | - delete [] tmp; |
245 | | - delete [] tmp1; |
246 | | - return; |
247 | | -} |
248 | | -*/ |
249 | | - |
250 | 184 | void Numerical_Nonlocal_Lm::get_kradial() |
251 | 185 | { |
252 | 186 | //ModuleBase::TITLE("Numerical_Nonlocal_Lm","get_kradial"); |
253 | 187 | double *jl = new double[nr]; |
254 | 188 | double *integrated_func = new double[nr]; |
255 | 189 |
|
256 | | - // mohan add constant of pi, 2021-04-26 |
257 | | - const double pi = 3.14159265358979323846; |
258 | | - const double pref = sqrt( 2.0 / pi ); |
| 190 | + const double pref = sqrt(2.0 / ModuleBase::PI); |
259 | 191 |
|
260 | 192 | for (int ik = 0; ik < nk; ik++) |
261 | 193 | { |
|
0 commit comments