25#ifndef __BETA_PROJECTORS_STRAIN_DERIV_HPP__
26#define __BETA_PROJECTORS_STRAIN_DERIV_HPP__
37 void generate_pw_coefs_t()
39 PROFILE(
"sirius::Beta_projectors_strain_deriv::generate_pw_coefs_t");
41 if (!this->num_beta_t()) {
45 auto& uc = this->ctx_.unit_cell();
47 std::vector<int> offset_t(uc.num_atom_types());
48 std::generate(offset_t.begin(), offset_t.end(),
49 [n = 0, iat = 0, &uc] ()
mutable
52 n += uc.atom_type(iat++).mt_basis_size();
56 auto& beta_ri0 = *this->ctx_.ri().beta_;
57 auto& beta_ri1 = *this->ctx_.ri().beta_djl_;
66 #pragma omp parallel for schedule(static)
67 for (
int igkloc = 0; igkloc < this->num_gkvec_loc(); igkloc++) {
68 auto gvc = this->
gkvec_.template gkvec_cart<index_domain_t::local>(igkloc);
71 double theta = rtp[1];
82 #pragma omp parallel for schedule(static)
83 for (
int igkloc = 0; igkloc < this->num_gkvec_loc(); igkloc++) {
84 auto gvc = this->
gkvec_.template gkvec_cart<index_domain_t::local>(igkloc);
88 auto inv_len = (gvs[0] < 1e-10) ? 0 : 1.0 / gvs[0];
90 for (
int iat = 0; iat < uc.num_atom_types(); iat++) {
91 auto& atom_type = uc.atom_type(iat);
93 auto ri0 = beta_ri0.values(iat, gvs[0]);
94 auto ri1 = beta_ri1.values(iat, gvs[0]);
96 for (
int nu = 0; nu < 3; nu++) {
97 for (
int mu = 0; mu < 3; mu++) {
98 double p = (mu == nu) ? 0.5 : 0;
100 for (
int xi = 0; xi < atom_type.mt_basis_size(); xi++) {
101 int l = atom_type.indexb(xi).am.l();
102 int lm = atom_type.indexb(xi).lm;
103 int idxrf = atom_type.indexb(xi).idxrf;
105 auto z = std::pow(std::complex<double>(0, -1), l) *
fourpi /
106 std::sqrt(uc.omega());
108 auto d1 = ri0(idxrf) * (-gvc[mu] * rlm_dg(
lm, nu, igkloc) - p * rlm_g(
lm, igkloc));
110 auto d2 = ri1(idxrf) * rlm_g(
lm, igkloc) * (-gvc[mu] * gvc[nu] * inv_len);
112 this->
pw_coeffs_t_(igkloc, offset_t[atom_type.id()] + xi, mu + nu * 3) =
113 static_cast<std::complex<T>
>(z * (d1 + d2));
125 generate_pw_coefs_t();
Contains declaration and implementation of sirius::Beta_projectors_base class.
Base class for beta-projectors, gradient of beta-projectors and strain derivatives of beta-projectors...
fft::Gvec const & gkvec_
List of G+k vectors.
sddk::mdarray< std::complex< T >, 3 > pw_coeffs_t_
Phase-factor independent coefficients of |beta> functions for atom types.
Simulation context is a set of parameters and objects describing a single simulation.
A set of G-vectors for FFTs and G+k basis functions.
void zero(memory_t mem__, size_t idx0__, size_t n__)
Zero n elements starting from idx0.
auto spherical_coordinates(vector< double > vc)
Transform Cartesian coordinates [x,y,z] to spherical coordinates [r,theta,phi].
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.
void dRlm_dr(int lmax__, r3::vector< double > &r__, sddk::mdarray< double, 2 > &data__, bool divide_by_r__=true)
Compute the derivatives of real spherical harmonics over the components of cartesian vector.
void spherical_harmonics(int lmax, double theta, double phi, std::complex< double > *ylm)
Optimized implementation of complex spherical harmonics.
Namespace of the SIRIUS library.