25#ifndef __ATOM_TYPE_HPP__
26#define __ATOM_TYPE_HPP__
82 if (wfd.
am.
s() == 0) {
83 out <<
"{n: " << wfd.
n <<
", l: " << wfd.
am.
l() <<
"}";
85 out <<
"{n: " << wfd.
n <<
", l: " << wfd.
am.
l() <<
", j: " << wfd.
am.
j() <<
"}";
262 std::unique_ptr<Gaunt_coefficients<std::complex<double>>>
gaunt_coefs_{
nullptr};
277 inline void read_input_core(nlohmann::json
const& parser);
279 inline void read_input_aw(nlohmann::json
const& parser);
281 inline void read_input_lo(nlohmann::json
const& parser);
283 inline void read_pseudo_uspp(nlohmann::json
const& parser);
285 inline void read_pseudo_paw(nlohmann::json
const& parser);
288 inline void read_input(std::string
const& str__);
293 RTE_ASSERT(this->lmax_apw() >= -1);
296 RTE_THROW(
"default AW descriptor is empty");
300 for (
int l = 0; l <= this->lmax_apw(); l++) {
310 if (l < this->lmax_apw()) {
340 double mass__, std::vector<atomic_level_descriptor>
const& levels__)
376 void add_hubbard_orbital(
int n__,
int l__,
double occ__,
double U,
double J,
const double* hub_coef__,
377 double alpha__,
double beta__,
double J0__, std::vector<double> initial_occupancy__,
378 const bool use_for_calculations__);
386 radial_grid_ = Radial_grid_factory<double>(grid_type__, num_points__, rmin__, rmax__, p__);
387 if (
parameters_.processing_unit() == sddk::device_t::GPU) {
396 if (
parameters_.processing_unit() == sddk::device_t::GPU) {
405 if (num_points__ <= 0) {
406 RTE_THROW(
"wrong number of radial points");
429 for (
int ist = 0; ist < num_atomic_levels(); ist++) {
431 if (atomic_level(ist).
core && atomic_level(ist).
l == l) {
432 rsd.
n = atomic_level(ist).
n + 1;
453 s <<
"wrong angular quantum number" << std::endl
454 <<
"atom type id: " <<
id() <<
" (" <<
symbol_ <<
")" << std::endl
455 <<
"idxlo: " << ilo << std::endl
456 <<
"n: " << l << std::endl
457 <<
"l: " << n << std::endl
469 for (
int ist = 0; ist < num_atomic_levels(); ist++) {
470 if (atomic_level(ist).
core && atomic_level(ist).
l == l) {
472 rsd.
n = atomic_level(ist).
n + 1;
497 s <<
"small norm (" << d <<
") of radial atomic pseudo wave-function for n=" << n__
498 <<
" and j=" << am__.
j();
516 RTE_THROW(
"can't add more beta projectors");
542 s <<
"wrong l for Q radial functions of atom type " <<
label_ << std::endl
543 <<
"current l: " << l__ << std::endl
544 <<
"lmax_beta: " <<
lmax_beta() << std::endl
545 <<
"maximum allowed l: " << 2 *
lmax_beta();
557 for (
int l = 0; l <= 2 *
lmax_beta(); l++) {
558 for (
int idx = 0; idx < nbrf * (nbrf + 1) / 2; idx++) {
587 inline std::vector<double>& ps_core_charge_density(std::vector<double> ps_core__)
593 inline std::vector<double>
const& ps_core_charge_density()
const
598 inline std::vector<double>& ps_total_charge_density(std::vector<double> ps_dens__)
604 inline std::vector<double>
const& ps_total_charge_density()
const
616 inline std::vector<double>
const&
ae_paw_wf(
int i__)
const
627 inline void add_ps_paw_wf(std::vector<double> f__)
632 inline std::vector<double>
const& ps_paw_wf(
int i__)
const
637 inline int num_ps_paw_wf()
const
642 inline auto const& ae_paw_wfs_array()
const
647 inline auto const& ps_paw_wfs_array()
const
652 inline auto const& paw_ae_core_charge_density()
const
657 inline auto& paw_ae_core_charge_density(std::vector<double> inp__)
663 inline auto const& paw_wf_occ()
const
668 inline auto& paw_wf_occ(std::vector<double> inp__)
675 inline int id()
const
681 inline int zn()
const
688 inline int zn(
int zn__)
694 inline std::string
const& symbol()
const
699 inline std::string
const& name()
const
730 inline Radial_grid<double>
const& free_atom_radial_grid()
const
735 inline double radial_grid(
int ir)
const
740 inline double free_atom_radial_grid(
int ir)
const
745 inline int num_atomic_levels()
const
755 inline double num_core_electrons()
const
760 inline double num_valence_electrons()
const
783 inline int num_aw_descriptors()
const
788 inline auto const& aw_descriptor(
int l)
const
794 inline int num_lo_descriptors()
const
799 inline auto const& lo_descriptor(
int idx)
const
804 inline int max_aw_order()
const
812 return static_cast<int>(aw_descriptor(l__).size());
822 inline auto const& indexr_wfs()
const
827 inline auto const& indexr_hub()
const
832 inline auto const&
indexr(
int i)
const
838 inline int indexr_by_l_order(
int l,
int order)
const
843 inline int indexr_by_idxlo(
int idxlo)
const
848 inline auto const& indexb()
const
853 inline auto const& indexb(
int i)
const
859 inline int indexb_by_l_m_order(
int l,
int m,
int order)
const
861 return indexb_.index_by_l_m_order(l, m, order);
864 inline int indexb_by_lm_order(
int lm,
int order)
const
866 return indexb_.index_by_lm_order(
lm, order);
869 inline int mt_aw_basis_size()
const
874 inline int mt_lo_basis_size()
const
891 inline auto const& indexb_wfs()
const
902 inline auto const& hubbard_radial_function(
int i)
const
907 inline void set_symbol(
const std::string symbol__)
912 inline void set_zn(
int zn__)
917 inline void set_mass(
double mass__)
922 inline void set_configuration(
int n,
int l,
int k,
double occupancy,
bool core)
936 return static_cast<int>(
atom_id_.size());
951 inline bool initialized()
const
956 inline std::string
const& label()
const
961 inline std::string
const& file_name()
const
966 inline void d_mtrx_ion(sddk::matrix<double>
const& d_mtrx_ion__)
969 sddk::memory_t::host,
"Atom_type::d_mtrx_ion_");
973 inline auto const& d_mtrx_ion()
const
978 inline bool is_paw()
const
983 inline bool is_paw(
bool is_paw__)
989 double paw_core_energy()
const
994 double paw_core_energy(
double paw_core_energy__)
1000 inline auto const& idx_radial_integrals()
const
1002 return idx_radial_integrals_;
1005 inline auto& rf_coef()
const
1010 inline auto& vrf_coef()
const
1015 inline auto const& parameters()
const
1020 inline auto f_coefficients(
int xi1,
int xi2,
int s1,
int s2)
const
1025 inline auto const& q_radial_function(
int idxrf1__,
int idxrf2__,
int l__)
const
1027 if (idxrf1__ > idxrf2__) {
1028 std::swap(idxrf1__, idxrf2__);
1031 int ijv = idxrf2__ * (idxrf2__ + 1) / 2 + idxrf1__;
1036 inline bool spin_orbit_coupling()
const
1041 inline bool spin_orbit_coupling(
bool so__)
1065 return ((indexb(xi).am == indexb(xj).am) && (indexb(xi).idxrf == indexb(xj).idxrf));
1080 inline int lmax_apw()
const
1083 return parameters_.cfg().parameters().lmax_apw();
1089 inline int lmmax_apw()
const
1094 inline int lmax_lo()
const
1120 lmax = std::max(
lmax, e.first.l());
1125 auto const& gaunt_coefs()
const
Basic atomic data information.
Contains definitiona and implementation of sirius::basis_functions_index class.
Defines the properties of atom type.
void add_q_radial_function(int idxrf1__, int idxrf2__, int l__, std::vector< double > qrf__)
Add radial function of the augmentation charge.
Radial_grid< double > radial_grid_
Radial grid of the muffin-tin sphere.
int mt_basis_size() const
Total number of muffin-tin basis functions (APW + LO).
std::vector< atomic_level_descriptor > atomic_levels_
List of atomic levels.
std::vector< double > & local_potential(std::vector< double > vloc__)
Set the radial function of the local potential.
std::vector< double > local_potential_
Local part of pseudopotential.
int num_beta_radial_functions() const
Number of beta-radial functions.
void add_lo_descriptor(int ilo, int n, int l, double enu, int dme, int auto_enu)
Add local orbital descriptor.
int lmax_ps_atomic_wf() const
Return maximum orbital quantum number for the atomic wave-functions.
radial_functions_index indexr_wfs_
Index for the radial atomic functions.
void add_atom_id(int atom_id__)
Add global index of atom to this atom type.
int id_
Unique id of atom type in the range [0, ).
std::unique_ptr< Gaunt_coefficients< std::complex< double > > > gaunt_coefs_
Non-zero Gaunt coefficients.
std::vector< double > free_atom_density_
Density of a free atom as read from the input file.
void add_lo_descriptor(local_orbital_descriptor const &lod__)
Add the entire local orbital descriptor.
std::vector< local_orbital_descriptor > lo_descriptors_
List of radial descriptor sets used to construct local orbitals.
bool hubbard_correction() const
Get the Hubbard correction switch.
Simulation_parameters const & parameters_
Basic parameters.
int lmax_beta() const
Maximum orbital quantum number between all beta-projector radial functions.
Radial_grid< double > free_atom_radial_grid_
Radial grid of a free atom.
auto const & beta_radial_function(rf_index idxrf__) const
Return a radial beta function.
int atom_id(int idx) const
Return atom ID (global index) by the index of atom within a given type.
int num_mt_points() const
Return number of muffin-tin radial grid points.
bool augment_
True if the pseudopotential is soft and charge augmentation is required.
void free_atom_density(std::vector< double > rho__)
Set the free atom all-electron density.
std::vector< ps_atomic_wf_descriptor > ps_atomic_wfs_
Atomic wave-functions used to setup the initial subspace and to apply U-correction.
void set_free_atom_radial_grid(int num_points__, double const *points__)
Set radial grid of the free atom.
void read_hubbard_input()
Pass information from the hubbard input section (parsed in input.hpp) to the atom type.
auto const & indexr() const
Return const reference to the index of radial functions.
double free_atom_density(double x) const
Get free atom density at point x.
int zn() const
Return ionic charge (as positive integer).
basis_functions_index indexb_hub_
Index of basis functions for hubbard orbitals.
std::vector< double > const & local_potential() const
Get the radial function of the local potential.
Atom_type(Atom_type &&src)=default
Move constructor.
sddk::mdarray< Spline< double >, 2 > q_radial_functions_l_
Radial functions of the Q-operator.
double mt_radius() const
Return muffin-tin radius.
Atom_type(Simulation_parameters const ¶meters__, std::string symbol__, std::string name__, int zn__, double mass__, std::vector< atomic_level_descriptor > const &levels__)
Constructor.
auto const & ps_atomic_wf(int idx__) const
Return a tuple describing a given atomic radial function.
int zn(int zn__)
Set ionic charge.
void print_info(std::ostream &out__) const
Print basic info to standard output.
void init_free_atom_density(bool smooth)
Initialize the free atom density (smooth or true).
bool spin_orbit_coupling_
True if the pseudo potential includes spin orbit coupling.
Spline< double > free_atom_density_spline_
Density of a free atom.
double free_atom_density(const int idx) const
Get free atom density at i-th point of radial grid.
Atom_type(Simulation_parameters const ¶meters__, int id__, std::string label__, std::string file_name__)
Constructor.
int lmax_apw_
Maximul orbital quantum number of LAPW basis functions.
const auto & lo_descriptor_hub() const
void init()
Initialize the atom type.
bool compare_index_beta_functions(const int xi, const int xj) const
Compare indices of beta projectors.
std::vector< double > const & ae_paw_wf(int i__) const
Get all-electron PAW wave-function.
std::vector< std::vector< double > > ae_paw_wfs_
List of all-electron wave functions of the PAW method.
void set_radial_grid(int num_points__, double const *points__)
Set external radial grid.
int mt_radial_basis_size() const
Total number of radial basis functions.
double num_core_electrons_
Number of core electrons.
bool hubbard_correction_
Hubbard correction.
std::vector< double > ps_core_charge_density_
Pseudo-core charge density (used by PP-PW method in non-linear core correction).
std::vector< radial_solution_descriptor_set > aw_descriptors_
List of radial descriptor sets used to construct augmented waves.
basis_functions_index indexb_wfs_
Index of atomic wavefunctions (radial function * spherical harmonic).
int zn_
Nucleus charge or pseudocharge, treated as positive(!) integer.
basis_functions_index indexb_
Index of atomic basis functions (radial function * spherical harmonic).
radial_functions_index indexr_hub_
Index of radial functions for hubbard orbitals.
sddk::mdarray< double, 2 > ps_paw_wfs_array_
Pseudo wave functions of the PAW method packed in a single array.
std::string symbol_
Chemical element symbol.
void generate_f_coefficients()
Generate coefficients used in spin-orbit case.
std::vector< int > atom_id_
List of atom indices (global) for a given type.
bool hubbard_correction(bool ldapu__)
Set the Hubbard correction switch.
std::string name_
Chemical element name.
bool initialized_
True if the atom type was initialized.
void add_aw_descriptor(int n, int l, double enu, int dme, int auto_enu)
Add augmented-wave descriptor.
std::vector< std::pair< angular_momentum, Spline< double > > > beta_radial_functions_
Radial functions of beta-projectors.
std::vector< radial_solution_descriptor_set > aw_specific_l_
Augmented wave configuration for specific l.
int num_atoms() const
Return number of atoms of a given type.
std::vector< double > ps_total_charge_density_
Total pseudo-charge density (used by PP-PW method to setup initial density).
std::vector< hubbard_orbital_descriptor > lo_descriptors_hub_
List of Hubbard orbital descriptors.
std::string file_name_
Name of the input file for this atom type.
int id() const
Return atom type id.
std::vector< double > paw_ae_core_charge_density_
Core electron contribution to all electron charge density in PAW method.
void add_hubbard_orbital(int n__, int l__, double occ__, double U, double J, const double *hub_coef__, double alpha__, double beta__, double J0__, std::vector< double > initial_occupancy__, const bool use_for_calculations__)
Add a hubbard orbital to a list.
bool paw_core_energy_
Core energy of PAW.
radial_functions_index indexr_
Index of radial basis functions.
radial_solution_descriptor_set aw_default_l_
Default augmented wave configuration.
int num_ae_paw_wf() const
Get the number of all-electron PAW wave-functions.
void init_aw_descriptors()
Initialize descriptors of the augmented-wave radial functions.
std::string label_
Unique string label for the atom type.
void set_radial_grid(radial_grid_t grid_type__, int num_points__, double rmin__, double rmax__, double p__)
Set the radial grid of the given type.
int max_aw_order_
Maximum number of AW radial functions across angular momentums.
bool augment() const
Return true if this atom type has an augementation charge.
std::vector< std::vector< double > > ps_paw_wfs_
List of pseudo wave functions of the PAW method.
sddk::mdarray< std::complex< double >, 4 > f_coefficients_
void add_ps_atomic_wf(int n__, angular_momentum am__, std::vector< double > f__, double occ__=0.0)
Add atomic radial function to the list.
void read_input(std::string const &str__)
Read atomic parameters from json file or string.
double mass() const
Return atomic mass.
sddk::matrix< std::complex< double > > p_mtrx_
Inverse of (Q_{\xi \xi'j}^{-1} + beta_pw^{H}_{\xi} * beta_pw_{xi'})
sddk::mdarray< double, 2 > ae_paw_wfs_array_
All-electron wave functions of the PAW method packed in a single array.
std::vector< double > paw_wf_occ_
Occupations of PAW wave-functions.
int aw_order(int l__) const
Order of augmented wave radial functions for a given l.
void add_ae_paw_wf(std::vector< double > f__)
Add all-electron PAW wave-function.
sddk::mdarray< double, 2 > d_mtrx_ion_
Ionic part of D-operator matrix.
bool is_paw_
True if the pseudopotential is used for PAW.
auto const & indexb_hub() const
Return whole index of hubbard basis functions.
double num_valence_electrons_
Number of valence electrons.
void add_beta_radial_function(angular_momentum am__, std::vector< double > beta__)
Add a radial function of beta-projector to a list of functions.
External radial grid provided as a list of points.
T last() const
Last point of the grid.
int num_points() const
Number of grid points.
Set of basic parameters of a simulation.
T at_point(U x) const
Compute value at any point.
Angular momentum quantum number.
auto l() const
Get orbital quantum number l.
auto s() const
Get spin quantum number s.
auto j() const
Get total angular momentum j = l +/- 1/2.
A helper class to establish various index mappings for the atomic basis functions.
int size() const
Return total number of MT basis functions.
auto size_aw() const
Return size of AW part of basis functions in case of LAPW.
auto size_lo() const
Return size of local-orbital part of basis functions in case of LAPW.
Radial basis function index.
auto index_of(angular_momentum am__, int order__) const
Return index of radial function.
int size() const
Return total number of radial functions.
Multidimensional array with the column-major (Fortran) order.
Contains definition and implementation of sirius::Gaunt class.
Contains a descriptor class for Hubbard orbitals.
void copy(T *target__, T const *source__, size_t n__)
Copy memory inside a device.
int lmax(int lmmax__)
Get maximum orbital quantum number by the maximum lm index.
int lmmax(int lmax)
Maximum number of combinations for a given .
int lm(int l, int m)
Get composite lm index by angular index l and azimuthal index m.
std::enable_if_t< std::is_same< T, real_type< F > >::value, void > inner(::spla::Context &spla_ctx__, sddk::memory_t mem__, spin_range spins__, W const &wf_i__, band_range br_i__, Wave_functions< T > const &wf_j__, band_range br_j__, la::dmatrix< F > &result__, int irow0__, int jcol0__)
Compute inner product between the two sets of wave-functions.
Namespace of the SIRIUS library.
std::ostream & operator<<(std::ostream &out, hbar &&b)
Inject horisontal bar to ostream.
radial_grid_t
Types of radial grid.
strong_type< int, struct __rf_lo_index_tag > rf_lo_index
Local orbital radial function index.
std::vector< radial_solution_descriptor > radial_solution_descriptor_set
Set of radial solution descriptors, used to construct augmented waves or local orbitals.
strong_type< int, struct __rf_index_tag > rf_index
Radial function index.
int packed_index(int i__, int j__)
Pack two indices into one for symmetric matrices.
Packed index for symmetric matrices.
Simple classes and functions to work with vectors and matrices of the R^3 space.
Contains definition and implementation of sirius::radial_functions_index class.
Contains declaration and partial implementation of sirius::Radial_solver class.
Contains declaration and particular implementation of sirius::SHT class.
Contains definition and implementation of sirius::Simulation_parameters class.
Describes single atomic level.
bool core
True if this is a core level.
int n
Principal quantum number.
double occupancy
Level occupancy.
int l
Angular momentum quantum number.
Descriptor of a local orbital radial function.
radial_solution_descriptor_set rsd_set
Set of radial solution descriptors.
angular_momentum am
Orbital quantum number .
Store basic information about radial pseudo wave-functions.
double occ
Shell occupancy.
Spline< double > f
Radial wave-function.
ps_atomic_wf_descriptor(int n__, angular_momentum am__, double occ__, Spline< double > f__)
Constructor.
angular_momentum am
Angular momentum quantum number.
int n
Principal quantum number.
Describes radial solution.
double enu
Energy of the solution.
int auto_enu
Automatically determine energy.
int n
Principal quantum number.
int l
Angular momentum quantum number.
int dme
Order of energy derivative.