25#ifndef __CALL_NLCG_HPP__
26#define __CALL_NLCG_HPP__
32#include "nlcglib/overlap.hpp"
33#include "nlcglib/nlcglib.hpp"
39call_nlcg(Simulation_context& ctx, config_t::nlcg_t
const& nlcg_params, Energy& energy, K_point_set& kset,
42 using numeric_t = std::complex<double>;
44 double temp = nlcg_params.T();
45 double tol = nlcg_params.tol();
46 double kappa = nlcg_params.kappa();
47 double tau = nlcg_params.tau();
48 int maxiter = nlcg_params.maxiter();
49 int restart = nlcg_params.restart();
50 auto nlcg_pu = ctx.processing_unit();
51 if(nlcg_params.processing_unit() !=
"") {
52 nlcg_pu = sddk::get_device_t(nlcg_params.processing_unit());
55 std::string smear = ctx.cfg().parameters().smearing();
57 nlcglib::smearing_type smearing;
58 if (smear.compare(
"fermi_dirac") == 0) {
59 smearing = nlcglib::smearing_type::FERMI_DIRAC;
60 }
else if (smear.compare(
"gaussian_spline") == 0) {
61 smearing = nlcglib::smearing_type::GAUSSIAN_SPLINE;
62 }
else if (smear.compare(
"gaussian") == 0) {
63 smearing = nlcglib::smearing_type::GAUSS;
64 }
else if (smear.compare(
"methfessel_paxton") == 0) {
65 smearing = nlcglib::smearing_type::METHFESSEL_PAXTON;
66 }
else if (smear.compare(
"cold") == 0) {
67 smearing = nlcglib::smearing_type::COLD;
69 RTE_THROW(
"invalid smearing type given");
72 Hamiltonian0<double> H0(potential,
false );
74 sirius::UltrasoftPrecond us_precond(kset, ctx, H0.Q());
75 sirius::Overlap_operators<sirius::S_k<numeric_t>> S(kset, ctx, H0.Q());
79 case sddk::device_t::CPU: {
80 nlcglib::nlcg_us_cpu(energy, us_precond, S, smearing, temp, tol, kappa, tau, maxiter, restart);
83 case sddk::device_t::GPU: {
84 nlcglib::nlcg_us_device(energy, us_precond, S, smearing, temp, tol, kappa, tau, maxiter, restart);
Contains defintion of nlcglib interface.
Contains declaration and definition of sirius::Hamiltonian class.
Namespace of the SIRIUS library.
Contains definition and implementation of Simulation_context class.
Provides preconditioner for ultrasoft case.