원시데이터 수집 시스템
선정목록으로

SIMPLE code: optical properties with optimal basis functions

관련 필름·전자재료 · (13) 프리즘 필름

기본 정보

저자
  1. Prandini, Gianluca
  2. Galante, Mario
  3. Marzari, Nicola
  4. Umari Paolo
DOI
10.48550/arxiv.1901.03175
저널
arXiv (Cornell University)
발행년도
2022
발행기관
Cornell University
피인용수
0
라이선스
0
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.48550/arxiv.1901.03175
토픽
Electron and X-Ray Spectroscopy Techniques
OpenAlex ID
W6929190625

평가 내용

관련도
관련
사업분야
필름·전자재료 · (13) 프리즘 필름
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '필름·전자재료 > 프리즘 필름' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

We present SIMPLE, a code developed to calculate optical properties of metallic and insulating extended systems using the optimal basis method originally proposed by E. L. Shirley in 1996. Two different approaches for the evaluation of the complex dielectric function are implemented: (i) the independent-particle approximation considering both interband and intraband contributions for metals and (ii) the Bethe-Salpeter equation for insulators. Since, notably, the optimal basis set is systematically improvable, accurate results can be obtained at a strongly reduced computational cost. Moreover, the simplicity of the method allows for a straightforward use of the code; improvement of the optimal basis and thus the overall precision of the simulations is simply controlled by one (for metals) or two (for insulators) input thresholds. The code is extensively tested, in terms of verification and performance, on bulk silver for metals and on bulk silicon for insulators.

본문 110,946자

본문 펼치기
## SIMPLE code: optical properties with optimal basis functions Gianluca Prandini <sup>a,</sup> <sup>_∗_</sup>, Mario Galante <sup>b,c</sup>, Nicola Marzari <sup>a</sup>, Paolo Umari <sup>b</sup> _aTheory_ _and_ _Simulation_ _of_ _Materials_ _(THEOS)_ _and_ _National_ _Centre_ _for_ _Computational_ _Design_ _and_ _Discovery_ _of_ _Novel_ _Materials_ _(MARVEL),_ _Ecole_ <sup>_´_</sup> _Polytechnique_ _F´ed´erale_ _de_ _Lausanne,_ _1015_ _Lausanne,_ _Switzerland_ _bDipartimento_ _di_ _Fisica_ _e_ _Astronomia,_ _Universit`a_ _di_ _Padova,_ _via_ _Marzolo_ _8,_ _I-35131_ _Padova,_ _Italy_ _cSchool_ _of_ _Physics_ _and_ _CRANN_ _Institute,_ _Trinity_ _College_ _Dublin,_ _College_ _Green,_ _Dublin_ _2,_ _Ireland_ Abstract We present `SIMPLE`, a code developed to calculate optical properties of metallic and insulating extended systems using the optimal basis method originally proposed by E. L. Shirley in 1996. Two different approaches for the evaluation of the complex dielectric function are implemented: (i) the independentparticle approximation considering both interband and intraband contributions for metals and (ii) the Bethe-Salpeter equation for insulators. Since, notably, the optimal basis set is systematically improvable, accurate results can be obtained at a strongly reduced computational cost. Moreover, the simplicity of the method allows for a straightforward use of the code; improvement of the optimal basis and thus the overall precision of the simulations is simply controlled by one (for metals) or two (for insulators) input thresholds. The code is extensively tested, in terms of verification and performance, on bulk silver for metals and on bulk silicon for insulators. _Keywords:_ Bethe-Salpeter equation, Excitons, Optimal basis, Band interpolations, Optical properties, Dielectric function, Drude plasma frequency Program summary _∗_ Corresponding author. _E-mail_ _address:_ gianluca.prandini@epfl.ch _Preprint_ _submitted_ _to_ _Computer_ _Physics_ _Communications_ _June_ _18,_ _2019_ _Program_ _Title:_ `SIMPLE` _Licensing_ _provisions:_ GNU General Public License V 2.0 _Programming_ _language:_ Fortran 95 _Distribution_ _format:_ tar.gz _Computer:_ Any computer architecture _External_ _routines:_ Quantum ESPRESSO distribution, BLAS, LAPACK, FFTW, MPI. _Nature_ _of_ _problem:_ First-principles calculations of the optical properties of metals and insulators. _Solution_ _method:_ Shirley’s optimal basis for the complex dielectric function, at the independent-particle level for metals and by solving the Bethe-Salpeter equation for insulators. _Restrictions:_ Norm-conserving pseudopotentials. 1. Introduction Density-functional theory (DFT) has largely proven itself to be a powerful and reliable tool to predict structural and vibrational properties (and, in general, any ground-state property) of complex materials. This is to be contrasted with well-known intrinsic limitations in the description of electronic excitations [1]. However, complementary first-principles methods for calculating optical properties have been developed and applied to the study of materials, giving thus birth in recent years to the field of theoretical spectroscopies. In particular, the Bethe-Salpeter equation (BSE), based on manybody perturbation theory [2, 3, 4], has become the state-of-the-art approach for the simulation of optical spectroscopies, such as absorption or reflectivity, of extended systems. Although usually at least one order of magnitude more demanding in terms of computational cost with respect to typical DFT simulations, the BSE approach and the _GW_ method [5] have proven to be the most accurate and predictive methodologies for the study of neutral and charged excitations in extended systems, respectively (we mention in passing the development of Koopmans’ compliant spectral functionals as an alternative to _GW_ [6, 7, 8, 9]). Leveraged by the computational power available nowadays and due to the large range of technologically relevant applications, such as photovoltaics, plasmonics and optoelectronics, first-principles methods for the calculation of optical properties are starting to be routinely used not just to help analyzing and interpreting experimental data but also to 2 guide the discovery of novel materials by computational design [10]. This trend is evident from the fact that methods for theoretical spectroscopies are now being implemented and becoming available to researchers in different specialized codes, such as Yambo [11] or BerkeleyGW [12] (see Ref. [13] for a more comprehensive list), and interfaced with broadly available DFT engines (e.g. Quantum ESPRESSO [14], Abinit [15] and Siesta [16] or directly incorporated in these [17, 18, 19, 20]). We present here the `SIMPLE` code, which has been implemented as a component of the Quantum ESPRESSO (QE) distribution. The main purpose of the code is to provide accurate and, at the same time, efficient first-principles simulations of the optical properties of both insulating and metallic materials. For metals, where the electron-hole interaction is screened by conduction electrons, the independent-particle (IP) approximation including both interband and intraband contributions has been implemented. For insulators instead, where the inclusion of the electron-hole interaction is often compulsory to correctly simulate optical spectra, the BSE approach has been implemented. In order to increase the efficiency of the calculation of the IP and BSE optical properties we exploit the method originally developed by E. L. Shirley in 1996 [21]. It is based on the use of an optimal basis (OB) set to represent the periodic part of the Bloch wavefunctions, and in this work we introduce a generalization of the method to represent also products of periodic functions. The most attractive feature of this approach resides in the fact that it allows a significant reduction of the computational cost of the simulations by introducing a well-controlled numerical error. The paper is organized as follows: in Section 2 we introduce the most important theoretical concepts deployed in the code. In Section 3 we describe the main algorithms implemented, in particular the OB method and its application and extension to calculate optical properties of metals at the IP level and of insulators by solving the BSE. Then in Section 4 the structure of the `SIMPLE` code is presented and the main input parameters are described in detail. Finally in Section 5 and Section 6 the verification and the performance of the `SIMPLE` code are discussed. 2. Theoretical background A natural physical quantity to study in first-principles simulations of optical properties is the full dielectric function, a complex (as opposite to real) dy 3 namical (i.e. frequency-dependent) quantity. In the following we will show the basic equations that relate this macroscopic property of a material to its underling microscopic electronic structure, both within the framework of the IP approximation and of the BSE approach. Throughout the paper we use Hartree atomic units (ℏ = _m_ = _e_ <sup>2</sup> = 1) and Gaussian units (4 _πε_ 0 = 1) for electromagnetism. The general expression of the IP dielectric function <sup>1</sup> (valid both for metals and insulators) at a generic transferred momentum q and frequency _ω_ is [24] _ε_ IP( q _, ω_ ) = 1 _−_ <sup><u>4</u></sup> <sup>_<u>π</u>_</sup> _|_ q _|_ <sup>2</sup> <u>1</u> _V_ k _n,n_ <sup>_′_</sup> _<u>| ⟨ψn′</u>_ <u>k</u> <u>+</u> <u>q</u> _<u>| e</u>_ <sup>_i_</sup> <sup>q</sup> <sup>_·_</sup> <sup>r</sup> _<u>|ψn</u>_ <u>k</u> _<u>⟩|</u>_ <sup>2</sup> ( _fn_ k _−_ _fn′_ k + q ) (1) _ω −_ ( _En′_ k + q _−_ _En_ k ) + _iη_ which is written in terms of the solutions of the one-particle Schr¨odinger equation, _H_ <sup>KS</sup> _|ψn_ k _⟩_ = _En_ k _|ψn_ k _⟩_, where _H_ <sup>KS</sup> is the Kohn-Sham (KS) Hamiltonian. _fn_ k gives the occupation according to the Fermi-Dirac distribution of the KS Bloch state _|ψn_ k _⟩_ with band index _n_ and wavevector k while _V_ is the volume of the crystal. Instead, _η_ is an infinitesimal broadening introduced to perform the adiabatic switching-on of the perturbation and which, in practice, is used as an empirical broadening with the purpose to account for scattering processes, always present in real materials, and/or for finite experimental resolution. We recall here that the Bloch wavefunctions have the form _ψn_ k ( x ) = _e_ <sup>_i_</sup> <sup>k</sup> <sup>_·_</sup> <sup>r</sup> _un_ k ( x ) _,_ (2) where x is a combined position and spin coordinate, x = ( r _, σ_ ), and the function _un_ k ( x ) is periodic with the periodicity of the crystal. In the noncollinear case, where spin-orbit interaction is explicitly included in the DFT calculation, _n_ has to be understood as a spinorial band index and _|ψn_ k _⟩_ as a two-component spinor. On the other hand the dielectric function obtained from the solution of the BSE within the Tamm-Dancoff approximation is given by an expression [25] 1 Here we neglect the fact that the dielectric function is actually a 3 _×_ 3 complex tensor whose additional off-diagonal terms describe subtle magnetic phenomena beyond the scope of this work, such as the Kerr effect or the anomalous Hall effect [22, 23]. In the following we will deal exclusively with the diagonal terms which are specified by the direction of the transferred momentum q . 4 (valid for finite-gap systems) very similar to the IP case of Eq. 1 _,_ (3) ���2 _ε_ BSE( q _, ω_ ) = 1 _−_ <sup><u>4</u></sup> <sup>_<u>π</u>_</sup> _|_ q _|_ <sup>2</sup> <u>1</u> _V_ _λ_ _ω −_ _E_ <sup>˜</sup> _λ_ ( q ) + _iη_ ���� _v,c,_ k <sup>_⟨ψv_</sup> <sup>k</sup> <sup>+</sup> <sup>q</sup> <sup>_| ei_</sup> <sup>q</sup> <sup>_·_</sup> <sup>r</sup> <sup>_|ψc_</sup> <sup>k</sup> <sup>_⟩_</sup> <sup>_A_</sup> _λ,_ <sup>(</sup> <sup>_vc_</sup> q <sup>k</sup> <sup>)</sup> _λ,_ q where the broadening _η_ has to be interpreted as in Eq. 1. The main difference with respect to the IP expression is that Eq. 3 is written in terms of the solutions of an effective two-particle Schr¨odinger-like equation _vc_ <sup>exc</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>(</sup> <sup>q</sup> <sup>)</sup> <sup>_A_</sup> _λ,_ <sup>(</sup> <sup>_v_</sup> q <sup>_′c′_</sup> <sup>k</sup> <sup>_′_</sup> <sup>)</sup> <sup>(</sup> _λ,_ <sup>_vc_</sup> q <sup>k</sup> <sup>)</sup> <sup>_,_</sup> (4) _Hvc_ <sup>exc</sup> k _λ,_ <sup>(</sup> <sup>_v_</sup> q <sup>_′c′_</sup> <sup>k</sup> <sup>_′_</sup> <sup>)</sup> = _E_ <sup>˜</sup> _λ_ ( q ) _A_ <sup>(</sup> _λ,_ <sup>_vc_</sup> q <sup>k</sup> <sup>)</sup> where _Hvc_ <sup>exc</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>(</sup> <sup>q</sup> <sup>)</sup> <sup>is</sup> <sup>the</sup> <sup>excitonic</sup> <sup>Hamiltonian</sup> <sup>matrix2</sup> <sup>in</sup> <sup>the</sup> <sup>basis</sup> <sup>of</sup> <sup>the</sup> single-particle Bloch wavefunctions of electron and hole states. In this basis, _Aλ,_ <sup>(</sup> <sup>_vc_</sup> q <sup>k</sup> <sup>)</sup> = _⟨ψv_ k + q _ψc_ k _|Aλ,_ q _⟩_ are the excitonic amplitudes labelled by the quan where _Hvc_ <sup>exc</sup> k _Aλ,_ <sup>(</sup> <sup>_vc_</sup> q <sup>k</sup> <sup>)</sup> = _⟨ψv_ k + q _ψc_ k _|Aλ,_ q _⟩_ are the excitonic amplitudes labelled by the quan tum numbers ( _λ,_ q ) and having energy _E_ <sup>˜</sup> _λ_ ( q ) <sup>3</sup> . We note in passing that both for Eq. 1 and Eq. 3 _GW_ energies (at the _G_ 0 _W_ 0 level) or even eigenvectors (e.g. at the self-consistent _GW_ level) could be substituted for the KS ones; this is often the practice, especially for Eq. 3, albeit at a largely increased computational cost. We are interested in studying the optical limit, q _→_ 0, for which the transferred momentum of the photons is negligible with respect to the size of the Brillouin zone (BZ). In general the dielectric function depends on the direction q ˆ = q _/|_ q _|_ of the perturbing electric field and only for crystals with cubic symmetry the dielectric tensor is equivalent to a scalar. In the following we will study the optical limit of Eq. 1 and Eq. 3 and we will keep explicit the dependence on the direction q ˆ for the general case of anisotropic systems. _2.1._ _IP_ In metals, the IP dielectric function of Eq. 1 in the optical limit can be divided into two separate contributions, an intraband Drude-like term due 2In Eq. 3 it is understood that the long-range component of the bare Coulomb interaction in the excitonic Hamiltonian is not included. 3 We have introduced the notation used throughout the paper _⟨_ x _|ψv_ k + q _ψc_ k _⟩_ = _ψv_ k + q ( x ) _ψc_ k ( x ) , where the indeces _v_ and _c_ stand for valence band and conduction band, respectively. 5 to the conduction electrons at the Fermi surface and an interband term due to vertical transitions between occupied and unoccupied bands [26, 27, 28] _ε_ IP(ˆ q _, ω_ ) = _ε_ <sup>inter</sup> IP <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>) +</sup> <sup>_ε_</sup> <sup>intra</sup> IP <sup>intra</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> <sup>_,_</sup> (5) where _<u>fn</u>_ <u>k</u> _<u>−</u>_ _<u>fn′</u>_ <u>k</u> _ω −_ ( _En′_ k _−_ _En_ k ) + _iη_ <sup>_,_</sup> (6) <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>) = 1</sup> <sup>_−_</sup> <sup><u>4</u></sup> <sup>_<u>π</u>_</sup> k _n_ = _̸_ _n_ <sup>_′_</sup> _<u>| ⟨ψn′</u>_ <u>k</u> _<u>|</u>_ <u>ˆ</u> <u>q</u> _<u>·</u>_ <u>v</u> _<u>|ψn</u>_ <u>k</u> _<u>⟩|</u>_ <sup>2</sup> ( _En′_ k _−_ _En_ k ) <sup>2</sup> _ε_ <sup>inter</sup> IP _V_ _<u>ω</u>_ <u>D</u> <sup>2</sup> <sup>intra</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>) =</sup> <sup>_−_</sup> _ω_ ( _ω_ _ε_ <sup>intra</sup> IP _<u>ω</u>_ <u>D</u> <sup>2</sup> <sup><u>(ˆ</u></sup> <sup><u>q</u></sup> <sup><u>)</u></sup> _ω_ ( _ω_ + _iγ_ ) <sup>_._</sup> (7) We have defined the Drude plasma frequency as _,_ (8) D <sup>2</sup> <sup>(ˆ</sup> <sup>q</sup> <sup>) =</sup> <sup><u>4</u></sup> <sup>_<u>π</u>_</sup> k _n_ _ω_ <sup>2</sup> _V_ - _−_ <sup>_<u>∂f</u>_</sup> _∂E_ _| ⟨ψn_ k _|_ ˆ q _·_ v _|ψn_ k _⟩|_ <sup>2</sup> where v = _−i_ [ r _, H_ <sup>KS</sup> ] is the velocity operator and _γ_ is an empirical broadening representing dissipation effects of the conduction electrons, whose value can be taken from experimental data or estimated from additional firstprinciples calculations [29]. In the limit of zero temperature, the derivative of the Fermi-Dirac distribution in Eq. 8 is a Dirac-delta function centred at the chemical potential and the Drude plasma frequency _ω_ D(ˆ q ) is always zero in finite-gap systems. _2.2._ _BSE_ The expression in Eq. 3 of the BSE dielectric function, in the optical limit q _→_ 0, is given by [30] _v,c,_ k 2 _,_ (9) ����� _ε_ BSE(ˆ q _, ω_ ) = 1 _−_ <sup><u>4</u></sup> <sup>_<u>π</u>_</sup> _V_ _λ_ <u>1</u> _ω −_ _E_ <sup>˜</sup> _λ_ + _iη_ _<u>⟨ψv</u>_ <u>k</u> _<u>|</u>_ <u>ˆ</u> <u>q</u> _<u>·</u>_ <u>v</u> _<u>|ψc</u>_ <u>k</u> _<u>⟩</u>_ _Ec_ k _−_ _Ev_ k _Aλ_ <sup>(</sup> <sup>_vc_</sup> <sup>k</sup> <sup>)</sup> ����� where we construct the excitonic Hamiltonian considering only vertical electronhole transitions ( q = 0 ). This means that _E_ <sup>˜</sup> _λ_ and _A_ <sup>(</sup> _λ_ <sup>_vc_</sup> <sup>k</sup> <sup>)</sup> in Eq. 9 are the eigen hole transitions ( q = 0 ). This means that _E_ <sup>˜</sup> _λ_ and _A_ <sup>(</sup> _λ_ <sup>_vc_</sup> <sup>k</sup> <sup>)</sup> in Eq. 9 are the eigen values and eigenfunctions of the Hamiltonian _Hvc_ <sup>exc</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>=</sup> <sup>_H_</sup> _vc_ <sup>exc</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>(</sup> <sup>q</sup> <sup>=</sup> <sup>0</sup> <sup>).</sup> _vc_ <sup>exc</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>=</sup> <sup>_H_</sup> _vc_ <sup>exc</sup> k values and eigenfunctions of the Hamiltonian _Hvc_ <sup>exc</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>=</sup> <sup>_H_</sup> _vc_ <sup>exc</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>(</sup> <sup>q</sup> <sup>=</sup> <sup>0</sup> <sup>).</sup> The excitonic Hamiltonian at q = 0 can be divided into three different contributions [31]: _Hvc_ <sup>exc</sup> k _vc_ <sup>exc</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>= (</sup> <sup>_Ec_</sup> <sup>k</sup> <sup>_−_</sup> <sup>_Ev_</sup> <sup>k</sup> <sup>_′_</sup> <sup>)</sup> <sup>_δ_</sup> <sup>k</sup> <sup>_,_</sup> <sup>k</sup> <sup>_′δc,c′δv,v′_</sup> <sup>+</sup> <sup>_K_</sup> _vc_ <sup>_x_</sup> _vc_ <sup>_x_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>+</sup> <sup>_K_</sup> _vc_ <sup>_d_</sup> _vc_ <sup>_d_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′._</sup> (10) 6 The first term on the right-hand side of Eq. 10 is called the _diagonal_ term and corresponds to the IP approximation <sup>4</sup> . Indeed it is worth noting that Eq. 9 reduces to Eq. 6 (in case of insulators) if the other remaining two terms in Eq. 10, that give rise to the electron-hole interactions, are neglected. _K_ <sup>_d_</sup>, called _direct_ term, describes the attraction between the electron and hole involving the screened Coulomb interaction _W_ while _K_ <sup>_x_</sup>, called _exchange_ term, describes the repulsion between the electron and hole involving the bare Coulomb interaction _v_ . Their explicit expressions are _v_ <sup>_∗′_</sup> k <sup>_′_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> <sup>_,_</sup> (11) _Kvc_ <sup>_x_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>=</sup> �� _d_ x _d_ x <sup>_′_</sup> _ψc_ <sup>_∗_</sup> _c_ <sup>_∗_</sup> k <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_ψv_</sup> <sup>k</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_v_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_ψc′_</sup> <sup>k</sup> <sup>_′_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> <sup>_ψ_</sup> _v_ <sup>_∗_</sup> _v_ <sup>_∗′_</sup> k <sup>_′_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> <sup>_._</sup> (12) _Kvc_ <sup>_d_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>=</sup> <sup>_−_</sup> �� _d_ x _d_ x <sup>_′_</sup> _ψc_ <sup>_∗_</sup> _c_ <sup>_∗_</sup> k <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_ψc′_</sup> <sup>k</sup> <sup>_′_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_W_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_ψv_</sup> <sup>k</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> <sup>_ψ_</sup> _v_ <sup>_∗_</sup> In the non-collinear case the notation - _d_ x implies that we perform both an integration over the space variable r and a summation over the spin variable _σ_ �� _d_ x _≡_ <sup>�</sup> _σ_ - _d_ r �. In the non-collinear case the notation �� _d_ x _≡_ <sup>�</sup> _σ_ - _d_ r �. 3. Implementation _3.1._ _Optimal_ _basis_ _(OB)_ The basic idea of the optimal basis (OB) method [21] is to obtain a reduced set of basis functions, indicated with the notation _{bi}_, to represent the periodic part of the Bloch wavefunctions at any k-point inside the BZ. The OB _{bi}_ are constructed starting from the periodic KS states _{un_ k _}_ calculated on an initial grid of _Nk_ k-points. The band index _n_, which ranges from 1 to _N_, runs over the selected _Nv_ top valence and _Nc_ lowest conduction bands ( _N_ = _Nv_ + _Nc_ ). We use a Gram-Schimdt orthonormalization algorithm with a threshold _sb_ which proceeds k-point by k-point, as illustrated in Algorithm 1. With this approach we disregard basis vectors which would contribute marginally (i.e. below the threshold) to the periodic KS states; the dimension _Nb_ of the OB is directly dictated by the threshold _sb_ . It is worth noting that the algorithm proceeds on blocks of _N_ states at each 4In the _diagonal_ term we will consider here differences of KS energies and not of quasiparticle energies (obtained, for example, within the _GW_ approximation or from Koopmans’ compliant spectral functionals [8]). In our implementation the KS energies can be corrected by means of an user-defined scissor operator that performs a rigid shift of the bands. 7 time. This permits, on one hand, the use of efficient BLAS matrix-matrix multiplication routines for the orthonormalization and, on the other hand, to avoid dealing with too large matrices, as it would be the case when working with all the periodic KS states at once. <u>Algorithm</u> <u>1</u> <u>Calculate</u> <u>optimal</u> <u>basis</u> <u>vectors</u> _<u>|bi⟩</u>_ <u>.</u> _sb_ _←_ user-defined parameter _Nb_ _←_ _N_ for _i ←_ 1 _, N_ do _|bi⟩←|ui_ k 1 _⟩_ end for for _l ←_ 2 _, Nk_ do for _i ←_ 1 _, N_ do _|u_ ˜ _i_ k _l⟩←|ui_ k _l⟩−_ <sup>�</sup> _|u_ ˜ _i_ k _l⟩←|ui_ k _l⟩−_ <sup>�</sup> _j_ =1 _,Nb_ <sup>_|bj⟩⟨bj|ui_</sup> <sup>k</sup> _l_ <sup>_⟩_</sup> end for _Nb_ <sup>_′_</sup> <sup>_←_</sup> <sup>_Nb_</sup> _Nb_ <sup>_′_</sup> <sup>_←_</sup> <sup>_Nb_</sup> for _i ←_ 1 _, N_ do _|u_ ˜ <sup>_′_</sup> _i_ _j_ = _N_ <sup>_′_</sup> <sup>_′_</sup> _i_ k _l_ <sup>_⟩←|u_</sup> <sup>˜</sup> <sup>_i_</sup> <sup>k</sup> _l_ <sup>_⟩−_</sup> <sup>�</sup> _|u_ ˜ <sup>_′_</sup> _i_ k _l_ <sup>_⟩←|u_</sup> <sup>˜</sup> <sup>_i_</sup> <sup>k</sup> _l_ <sup>_⟩−_</sup> <sup>�</sup> _j_ = _Nb_ <sup>_′_</sup> <sup>+1</sup> <sup>_,Nb |bj⟩⟨bj|u_</sup> <sup>˜</sup> <sup>_i_</sup> <sup>k</sup> <sup>_l⟩_</sup> if _⟨u_ ˜ <sup>_′_</sup> _i_ k _l_ <sup>_|u_</sup> <sup>˜</sup> _i_ <sup>_′_</sup> k _l_ <sup>_⟩≥_</sup> <sup>_sb_</sup> <sup>then</sup> <sup>_′_</sup> _i_ k _l_ <sup>_|u_</sup> <sup>˜</sup> _i_ <sup>_′_</sup> <sup>_′_</sup> _i_ k _l_ <sup>_|u_</sup> <sup>˜</sup> <sup>_′_</sup> _i_ _u_ ˜ <sup>_′_</sup> _i_ k _l_ <sup>_|u_</sup> <sup>˜</sup> _i_ <sup>_′_</sup> k _l_ <sup>_⟩≥_</sup> <sup>_sb_</sup> <sup>then</sup> _α ←⟨u_ ˜ <sup>_′_</sup> _i_ k _l_ <sup>_|u_</sup> <sup>˜</sup> <sup>_′_</sup> _i_ k _l_ <sup>_⟩_</sup> _α ←⟨u_ ˜ <sup>_′_</sup> _i_ k _l_ <sup>_|u_</sup> <sup>˜</sup> <sup>_′_</sup> _i_ k _l_ <sup>_⟩_</sup> _Nb_ _←_ _Nb_ + 1 _|bNb⟩←_ _~~√~~_ <u>1</u> _<u>α</u>_ _|u_ ˜ _i_ <sup>_′_</sup> k _l_ _|bNb⟩←_ _~~√~~_ <u>1</u> _<u>α</u>_ _|u_ ˜ _i_ <sup>_′_</sup> k _l_ <sup>_⟩_</sup> end if end for <u>end</u> <u>for</u> Using this basis we can approximate a generic, periodic KS state with wavevector k and band index _n_ as _un_ k ( x ) _≃_ _Nb_ _i_ =1 ˜ _b_ <sup>_n_</sup> _i_ <sup>k</sup> _bi_ ( x ) _._ (13) _3.2._ _IP_ Once the OB is constructed it is possible to obtain the periodic part of the Bloch wavefunctions at a generic k-point following the interpolation procedure described in Ref. [32]. This allows to perform the fine samplings of the BZ required in Eq. 6 and in Eq. 7 for metals. For this purpose, we 8 need to construct the matrix elements of the k-dependent KS Hamiltonian _H_ <sup>KS</sup> ( k ) _≡_ _e_ <sup>_−i_</sup> <sup>k</sup> <sup>_·_</sup> <sup>r</sup> _H_ <sup>KS</sup> _e_ <sup>_i_</sup> <sup>k</sup> <sup>_·_</sup> <sup>r</sup> in terms of the OB. By diagonalizing this matrix we can then obtain the coefficients <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> and the band energies _En_ k for each point k in the dense interpolation k-grid. _Band_ _interpolation_ The operator _H_ <sup>KS</sup> ( k ) is divided into three separate contributions (kinetic energy, local potential and non-local potential): _H_ <sup>KS</sup> ( k ) = <sup><u>(</u></sup> <sup>_<u>−i∇</u>_</sup> <sup><u>+</u></sup> <sup><u>k</u></sup> <sup><u>)2</u></sup> + _V_ <sup>_loc_</sup> + _V_ <sup>_nl_</sup> ( k ) _._ (14) 2 In our implementation the OB functions are expanded in a plane-wave basis as _e_ <sup>_i_</sup> <sup>G</sup> <sup>_·_</sup> <sup>r</sup> _bi_ ( G ) _,_ (15) _bi_ ( x ) = G where the sum is over the reciprocal lattice vectors G and _{bi_ ( G ) _}_ is the set of Fourier coefficients of _bi_ ( x ). By using the expression above we obtain the matrix elements of the KS Hamiltonian _ij_ <sup>KS(</sup> <sup>k</sup> <sup>) =</sup> <sup>_⟨bi| H_</sup> <sup>KS(</sup> <sup>k</sup> <sup>)</sup> <sup>_|bj⟩_</sup> <sup>=</sup> <sup><u>1</u></sup> <sup>(1)</sup> _ij_ <sup>+</sup> <sup>_K_</sup> _ij_ <sup>(0)</sup> _ij_ <sup>_nl_</sup> <sup>(</sup> <sup>k</sup> <sup>)</sup> <sup>_._</sup> <sup>(16)</sup> _Hij_ <sup>KS</sup> <sup><u>1</u></sup> - _k_ <sup>2</sup> _δij_ + k _·_ K <sup>(1)</sup> _ij_ 2 _ij_ - + _Vij_ <sup>_loc_</sup> _ij_ <sup>_loc_</sup> <sup>+</sup> <sup>_V_</sup> _ij_ <sup>_nl_</sup> The terms inside the square brackets in Eq. 16 refer to the matrix elements of the k-dependent kinetic energy, which have a simple quadratic polynomial dependence on k . For convenience we define two additional quantities, K <sup>(1)</sup> _ij_ _ij_ and _K_ <sup>(0)</sup> _ij_ <sup>,</sup> <sup>in</sup> <sup>terms</sup> <sup>of</sup> <sup>the</sup> <sup>Fourier</sup> <sup>coefficients</sup> <sup>_bi_</sup> <sup>(</sup> <sup>G</sup> <sup>):</sup> <sup>(0)</sup> _ij_ <sup>,</sup> <sup>in</sup> <sup>terms</sup> <sup>of</sup> <sup>the</sup> <sup>Fourier</sup> <sup>coefficients</sup> <sup>_bi_</sup> <sup>(</sup> <sup>G</sup> <sup>):</sup> K <sup>(1)</sup> _ij_ <sup>= 2</sup> G _b_ <sup>_∗_</sup> _i_ <sup>(</sup> <sup>G</sup> <sup>)</sup> <sup>G</sup> <sup>_bj_</sup> <sup>(</sup> <sup>G</sup> <sup>)</sup> <sup>_,_</sup> (17) _b_ <sup>_∗_</sup> _i_ <sup>_∗_</sup> _i_ <sup>(</sup> <sup>G</sup> <sup>)</sup> <sup>G</sup> <sup>2</sup> <sup>_bj_</sup> <sup>(</sup> <sup>G</sup> <sup>)</sup> <sup>_._</sup> (18) _K_ <sup>(0)</sup> _ij_ <sup>=</sup> G _b_ <sup>_∗_</sup> _i_ <sup>(</sup> <sup>G</sup> <sup>)</sup> <sup>G</sup> <sup>2</sup> <sup>_bj_</sup> <sup>(</sup> <sup>G</sup> <sup>)</sup> <sup>_._</sup> (18) The matrix elements of the local potential do not depend on k and are easily obtained in real space using fast-Fourier transforms _Vij_ <sup>_loc_</sup> = _d_ r _b_ <sup>_∗_</sup> _i_ <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_V_</sup> <sup>_loc_</sup> <sup>(</sup> <sup>r</sup> <sup>)</sup> <sup>_bj_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_._</sup> (19) 9 For the non-local potential, in this work we only consider norm-conserving pseudopotentials so that the non-local part of the pseudopotential can be written as _Vij_ <sup>_nl_</sup> <sup>(</sup> <sup>k</sup> <sup>) =</sup> _λ_ _βλi_ <sup>_∗_</sup> <sup>(</sup> <sup>k</sup> <sup>)</sup> <sup>_Dλ_</sup> <sup>_βλj_</sup> <sup>(</sup> <sup>k</sup> <sup>)</sup> <sup>_,_</sup> (20) where the index _λ_ = ( _I, n, m, l_ ) refers to the sites _I_ of the ions in the cell together with the associated atomic quantum numbers ( _n, m, l_ ) and _Dλ_ are the coefficients of the pseudopotential. In the expression above _βλi_ ( k ) = _⟨βλ| e_ <sup>_i_</sup> <sup>k</sup> <sup>_·_</sup> <sup>r</sup> _|bi⟩_, where _|βλ⟩_ are the pseudopotential projector functions centered on each ionic site _I_ . Since K <sup>(1)</sup> _ij_ <sup>,</sup> <sup>_K_</sup> _ij_ <sup>(0)</sup> and _Vij_ <sup>_loc_</sup> do not depend on k, they need to be calculated <sup>(1)</sup> _ij_ <sup>,</sup> <sup>_K_</sup> _ij_ <sup>(0)</sup> _ij_ <sup>(0)</sup> and _Vij_ <sup>_loc_</sup> Since K <sup>(1)</sup> _ij_ <sup>,</sup> <sup>_K_</sup> _ij_ <sup>(0)</sup> and _Vij_ <sup>_loc_</sup> do not depend on k, they need to be calculated only once after the OB is built. The matrix elements _Vij_ <sup>_nl_</sup> <sup>(</sup> <sup>k</sup> <sup>) of the non-local</sup> only once after the OB is built. The matrix elements _Vij_ <sup>_nl_</sup> <sup>(</sup> <sup>k</sup> <sup>) of the non-local</sup> part of the pseudopotential instead have a non-analytic dependence over k and thus they should be calculated for every k . The calculation of the matrix elements _Hij_ <sup>KS(</sup> <sup>k</sup> <sup>)</sup> <sup>and</sup> <sup>the</sup> <sup>subsequent</sup> <sup>diagonalization</sup> <sup>of</sup> <sup>the</sup> <sup>matrix</sup> <sup>for</sup> <sup>each</sup> elements _Hij_ <sup>KS(</sup> <sup>k</sup> <sup>)</sup> <sup>and</sup> <sup>the</sup> <sup>subsequent</sup> <sup>diagonalization</sup> <sup>of</sup> <sup>the</sup> <sup>matrix</sup> <sup>for</sup> <sup>each</sup> point k give the coefficients <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> and the band energies _En_ k for all the bands point k give the coefficients <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> and the band energies _En_ k for all the bands _n ≤_ _Nb_ . _Dielectric_ _function_ Once the coefficients and the band energies at all the needed k-points are known, we have almost all the elements necessary to calculate the IP dielectric function through Eq. 6 and Eq. 7. For this purpose we also need the matrix elements of the k-dependent velocity operator v ( k ) = _−i_ [ r _, H_ <sup>KS</sup> ( k )] = _−i∇_ + k _−_ _i_ [ r _, V_ <sup>_nl_</sup> ( k )] _._ (21) In terms of the OB these are given by _⟨un_ k _|_ v ( k ) _|un′_ k _⟩_ = <sup><u>1</u></sup> 2 _Nb_ _i,j_ =1 <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> <sup>)</sup> <sup>_∗_</sup> <sup>˜</sup> <sup>_b_</sup> _j_ <sup>_n′_</sup> <sup>k</sup> <sup>(1)</sup> _ij_ <sup>+</sup> <sup>k</sup> <sup>_⟨un_</sup> <sup>k</sup> <sup>_|un′_</sup> <sup>k</sup> <sup>_⟩_</sup> <sup>+</sup> ( <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> _j_ <sup>_n′_</sup> <sup>k</sup> K <sup>(1)</sup> _ij_ (22) _j_ <sup>_n′_</sup> <sup>k</sup> _⟨bi|_ [ r _, V_ <sup>_nl_</sup> ( k )] _|bj⟩_ _._ + ( _−i_ ) _Nb_ _i,j_ =1 ( <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> <sup>_n_</sup> _i_ <sup>k</sup> <sup>)</sup> <sup>_∗_</sup> <sup>˜</sup> <sup>_b_</sup> _j_ <sup>_n′_</sup> <sup>k</sup> The local contribution to the velocity matrix elements (first two terms in the right-hand side of Eq. 22) are easily obtained once the KS Hamiltonian matrix in Eq. 16 is diagonalized. On the other hand, the matrix elements _⟨bi|_ [ r _, V_ <sup>_nl_</sup> ( k )] _|bj⟩_ of the commutator of the non-local part of the pseudopotential need to be computed and, having a non-analytic dependence over k, they should be calculated for each k . 10 _3.3._ _BSE_ For BSE calculations in finite-gap systems we do not interpolate over the kpoints, as in the IP calculation, but we work with the initial k-grid as there is no need to perform an interpolation since significantly coarser k-grids with respect to metals are usually sufficient to obtain converged results. In this case the band energies are known from the initial DFT calculation, while the coefficients <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> are simply calculated through the scalar products ˜ _b_ <sup>_n_</sup> _i_ <sup>k</sup> = _⟨bi|un_ k _⟩_ _._ (23) _Optimal_ _product_ _basis_ _(OPB)_ We then build a basis, that we call optimal product basis (OPB), for representing in real space products of the periodic parts of the Bloch wavefunctions at the same k-point: _u_ <sup>_∗_</sup> _n_ k <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_un′_</sup> <sup>k</sup> <sup>(</sup> <sup>x</sup> <sup>).</sup> <sup>We construct this optimally small basis</sup> at the same k-point: _u_ <sup>_∗_</sup> _n_ k <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_un′_</sup> <sup>k</sup> <sup>(</sup> <sup>x</sup> <sup>).</sup> <sup>We construct this optimally small basis</sup> _{Bα}_ using a Gram-Schmidt orthonormalisation algorithm with a threshold starting from the products _b_ <sup>_∗_</sup> _i_ <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_bj_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>of</sup> <sup>OB</sup> <sup>functions</sup> <sup>obtained</sup> <sup>in</sup> <sup>the</sup> <sup>first</sup> starting from the products _b_ <sup>_∗_</sup> _i_ <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_bj_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>of</sup> <sup>OB</sup> <sup>functions</sup> <sup>obtained</sup> <sup>in</sup> <sup>the</sup> <sup>first</sup> step. The threshold _sp_ controls the precision of the OPB and hence its dimension, that we indicate with _Np_ . We outline this strategy in Algorithm 2. Also in this case we can take advantage of the BLAS library for matrix-matrix multiplications, avoiding at the same time to deal with large matrices. Using this new basis, we approximate the product of two OB functions as _b_ <sup>_∗_</sup> _i_ <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_bj_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_≃_</sup> _Np_ _α_ =1 _Fij_ <sup>_α_</sup> <sup>_Bα_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_,_</sup> (24) with _ij_ <sup>_α_</sup> <sup>=</sup> <sup>_⟨Bα|b∗_</sup> _i_ _Fij_ <sup>_α_</sup> <sup>_∗_</sup> _i_ <sup>_bj⟩_</sup> <sup>_._</sup> (25) We can now express products of periodic KS states as _Nb_ _i,j_ =1 <sup>_∗_</sup> _i_ <sup>_bj⟩≃_</sup> _ij_ <sup>_α_</sup> <sup>_|Bα⟩_</sup> <sup>_._</sup> (26) _j_ <sup>_n′_</sup> <sup>k</sup> _|b_ <sup>_∗_</sup> _i_ _j_ <sup>_n′_</sup> <sup>k</sup> _Fij_ <sup>_α_</sup> _|u_ <sup>_∗_</sup> _n_ k <sup>_un′_</sup> <sup>k</sup> <sup>_⟩≃_</sup> _Nb_ _i,j_ =1 ( <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> <sup>_n_</sup> _i_ <sup>k</sup> <sup>)</sup> <sup>_∗_</sup> <sup>˜</sup> <sup>_b_</sup> _j_ <sup>_n′_</sup> <sup>k</sup> _Np_ _α_ =1 ( <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> <sup>_n_</sup> _i_ <sup>k</sup> <sup>)</sup> <sup>_∗_</sup> <sup>˜</sup> <sup>_b_</sup> _j_ <sup>_n′_</sup> <sup>k</sup> We then define _j_ <sup>_n′_</sup> <sup>k</sup> _Fij_ <sup>_α_</sup> _ij_ <sup>_α,_</sup> (27) _Jα,nn_ <sup>k</sup> <sup>_′_</sup> <sup>=</sup> _Nb_ _i,j_ =1 ( <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> <sup>_n_</sup> _i_ <sup>k</sup> <sup>)</sup> <sup>_∗_</sup> <sup>˜</sup> <sup>_b_</sup> _j_ <sup>_n′_</sup> <sup>k</sup> so that, similarly to Eq. 13, _u_ <sup>_∗_</sup> _n_ k <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_un′_</sup> <sup>k</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>is</sup> <sup>approximated</sup> <sup>as</sup> _|u_ <sup>_∗_</sup> _n_ k <sup>_un′_</sup> <sup>k</sup> <sup>_⟩≃_</sup> _Np_ _α_ =1 11 _Jα,nn_ <sup>k</sup> <sup>_′ |Bα⟩_</sup> <sup>_._</sup> (28) <u>Algorithm</u> <u>2</u> <u>Calculate</u> <u>optimal</u> <u>product</u> <u>basis</u> <u>vectors</u> _<u>|Bα⟩</u>_ <u>.</u> _sp_ _←_ user-defined parameter _Np_ _←_ 0 for _i ←_ 1 _, Nb_ do for _j_ _←_ 1 _, Nb_ do _B_ ˜ _j_ ( x ) _←_ _b_ <sup>_∗_</sup> _i_ _B_ ˜ _j_ ( x ) _←_ _b_ <sup>_∗_</sup> _i_ <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_bj_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> end for for _j_ _←_ 1 _, Nb_ do _|B_ <sup>˜</sup> _j_ <sup>_′_</sup> <sup>_⟩←|B_</sup> <sup>˜</sup> <sup>_j⟩−_</sup> <sup>�</sup> _α_ =1 _,Np_ <sup>_|Bα⟩⟨Bα|B_</sup> <sup>˜</sup> <sup>_j⟩_</sup> end for _Np_ <sup>_′_</sup> <sup>_←_</sup> <sup>0</sup> _|B_ <sup>˜</sup> _j_ <sup>_′_</sup> _j_ <sup>_′_</sup> <sup>_⟩←|B_</sup> <sup>˜</sup> <sup>_j⟩−_</sup> <sup>�</sup> _Np_ <sup>_′_</sup> <sup>_←_</sup> <sup>0</sup> for _j_ _←_ 1 _, Nb_ do _α_ = _Np_ +1 _,Np_ + _Np_ <sup>_′_</sup> <sup>_|Bα⟩⟨Bα|B_</sup> <sup>˜</sup> _j_ <sup>_′_</sup> _|B_ <sup>˜</sup> _j_ <sup>_′′_</sup> _j_ <sup>_′′⟩←|B_</sup> <sup>˜</sup> _j_ <sup>_′_</sup> _j_ <sup>_′_</sup> <sup>_⟩−_</sup> <sup>�</sup> _j_ <sup>_′_</sup> <sup>_⟩_</sup> if _⟨B_ <sup>˜</sup> _j_ <sup>_′′_</sup> _j_ <sup>_′′|B_</sup> <sup>˜</sup> _j_ <sup>_′′_</sup> _B_ <sup>˜</sup> _j_ <sup>_′′|B_</sup> <sup>˜</sup> _j_ <sup>_′′⟩≥_</sup> <sup>_sp_</sup> <sup>then</sup> _Np_ <sup>_′_</sup> <sup>_←_</sup> <sup>_N ′_</sup> _p_ <sup>+ 1</sup> _p_ <sup>_′_</sup> <sup>_←_</sup> <sup>_N ′_</sup> _p_ _Np_ <sup>_′_</sup> <sup>_←_</sup> <sup>_N ′_</sup> _p_ <sup>+ 1</sup> <u>1</u> _|BNp′_ _⟩←_ ~~<u>�</u>~~ _⟨B_ <sup>˜</sup> _j_ <sup>_′′|_</sup> _j_ _j_ <sup>_′′⟩_</sup> <sup>_|B_</sup> <sup>˜</sup> <sup>_′′_</sup> _j_ <sup>_′′|_</sup> <sup>˜</sup> <sup>_B_</sup> _j_ <sup>_′′_</sup> _j_ <sup>_′′⟩_</sup> end if end for _Np_ _←_ _Np_ + _Np_ <sup>_′_</sup> <u>end</u> <u>for</u> 12 _Exchange_ _and_ _direct_ _term_ The reduction of the cost of the BSE calculation is achieved by evaluating only on the product basis _{Bα}_ the matrix elements of the bare ( _v_ ) and of the screened ( _W_ ) Coulomb interactions required for the exchange and the direct terms of the excitonic Hamiltonian. The number of such elements is much smaller then all the elements defining the _Kvc_ <sup>_x_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>and</sup> <sup>_K_</sup> _vc_ <sup>_d_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>matrices.</sup> _vc_ <sup>_x_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>and</sup> <sup>_K_</sup> _vc_ <sup>_d_</sup> smaller then all the elements defining the _Kvc_ <sup>_x_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>and</sup> <sup>_K_</sup> _vc_ <sup>_d_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> <sup>matrices.</sup> These are then obtained through: k <sup>_∗_</sup> <sup>_′_</sup> _v_ <sup>_′_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> _Kvc_ <sup>_x_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> = _≃_ = _d_ x _d_ x <sup>_′_</sup> _u_ <sup>_∗_</sup> k _Np_ _α,β_ =1 _Np_ _α,β_ =1 - _Jα,vc_ <sup>k</sup> <sup>_∗_</sup> k _c_ <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_u_</sup> <sup>k</sup> <sup>_v_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_v_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_u_</sup> <sup>k</sup> <sup>_′c′_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> <sup>_u_</sup> k <sup>_∗_</sup> _d_ x _d_ x <sup>_′_</sup> _Bα_ <sup>_∗_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_v_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_Bβ_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> - _Jα,vc_ <sup>k</sup> - _∗_ _Jβ,v_ k _′_ <sup>_′_</sup> _c_ <sup>_′_</sup> - _∗_ _Jβ,v_ k _′_ <sup>_′_</sup> _c_ <sup>_′V_</sup> _αβ_ <sup>0</sup> <sup>_,_</sup> where we have defined _Vαβ_ <sup>k</sup> <sup>_′′_</sup> <sup>=</sup> _d_ x _d_ x <sup>_′_</sup> _Bα_ <sup>_∗_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_ei_</sup> <sup>k</sup> <sup>_′′·_</sup> <sup>r</sup> <sup>_v_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_e−i_</sup> <sup>k</sup> <sup>_′′·_</sup> <sup>r</sup> <sup>_′Bβ_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> <sup>_._</sup> (29) We divide the screened Coulomb interaction in a bare and a correlation part: _W_ = _v_ + _Wc_ . The bare part of the direct operator reads _v_ <sup>_∗′_</sup> k <sup>_′_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> _Kvc_ <sup>_d,bare_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> = _−_ _≃_ _−_ = _−_ _d_ x _d_ x <sup>_′_</sup> _u_ <sup>_∗_</sup> _c_ _Np_ _α,β_ =1 _Np_ _α,β_ =1 - _G_ <sup>k</sup> _α,c_ <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> _c_ - _G_ <sup>k</sup> _α,c_ <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> <sup>_∗_</sup> _c_ k <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_uc′_</sup> <sup>k</sup> <sup>_′_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_ei_</sup> <sup>(</sup> <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> <sup>)</sup> <sup>_·_</sup> <sup>r</sup> <sup>_v_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_e−i_</sup> <sup>(</sup> <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> <sup>)</sup> <sup>_·_</sup> <sup>r</sup> <sup>_uv_</sup> <sup>k</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> <sup>_u_</sup> _v_ <sup>_∗_</sup> _d_ x _d_ x <sup>_′_</sup> _Bα_ <sup>_∗_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_ei_</sup> <sup>(</sup> <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> <sup>)</sup> <sup>_·_</sup> <sup>r</sup> <sup>_v_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_e−i_</sup> <sup>(</sup> <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> <sup>)</sup> <sup>_·_</sup> <sup>r</sup> <sup>_′Bβ_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> - _G_ <sup>k</sup> _α,c_ <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> _c_ - _G_ <sup>k</sup> _α,c_ <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> - _∗_ _Gβ,v_ <sup>k</sup> <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> _v_ - _∗_ _Gβ,v_ <sup>k</sup> <sup>_′_</sup> <sup>k</sup> _αβ_ <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> _,_ - _∗_ _G_ <sup>k</sup> _β,v_ <sup>_′_</sup> <sup>k</sup> <sup>k</sup> _β,v_ <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> _v_ <sup>_V_</sup> _αβ_ <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> where we have introduced the matrices _Gα,nn_ <sup>kk</sup> <sup>_′_</sup> <sup>_′_</sup> <sup>=</sup> _Nb_ _i,j_ =1 <sup>_n_</sup> _i_ <sup>k</sup> <sup>)</sup> <sup>_∗_</sup> <sup>˜</sup> <sup>_b_</sup> _j_ <sup>_n′_</sup> <sup>k</sup> <sup>_′_</sup> ( <sup>˜</sup> _b_ <sup>_n_</sup> _i_ <sup>k</sup> _j_ <sup>_n′_</sup> <sup>k</sup> <sup>_′_</sup> _Fij_ <sup>_α_</sup> _ij_ <sup>_α._</sup> (30) 13 The correlation part of the direct operator instead reads _v_ <sup>_∗′_</sup> k <sup>_′_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> _Kvc_ <sup>_d,c_</sup> k _,v_ <sup>_′_</sup> _c_ <sup>_′_</sup> k <sup>_′_</sup> = _−_ _≃_ _−_ = _−_ _d_ x _d_ x <sup>_′_</sup> _u_ <sup>_∗_</sup> _c_ _Np_ _α,β_ =1 _Np_ _α,β_ =1 - _G_ <sup>k</sup> _α,c_ <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> _c_ - _G_ <sup>k</sup> _α,c_ <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> <sup>_∗_</sup> _c_ k <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_uc′_</sup> <sup>k</sup> <sup>_′_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_ei_</sup> <sup>(</sup> <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> <sup>)</sup> <sup>_·_</sup> <sup>r</sup> <sup>_Wc_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_e−i_</sup> <sup>(</sup> <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> <sup>)</sup> <sup>_·_</sup> <sup>r</sup> <sup>_′uv_</sup> <sup>k</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> <sup>_u_</sup> _v_ <sup>_∗_</sup> _d_ x _d_ x <sup>_′_</sup> _e_ <sup>_i_</sup> <sup>(</sup> <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> <sup>)</sup> <sup>_·_</sup> <sup>r</sup> _Bα_ <sup>_∗_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_Wc_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_e−i_</sup> <sup>(</sup> <sup>k</sup> <sup>_′−_</sup> <sup>k</sup> <sup>)</sup> <sup>_·_</sup> <sup>r</sup> <sup>_′Bβ_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> - _G_ <sup>k</sup> _α,c_ <sup>_′,_</sup> <sup>k</sup> <sup>_′_</sup> _c_ - _G_ <sup>k</sup> _α,c_ <sup>_′,_</sup> <sup>k</sup> <sup>_′_</sup> _c_ - _∗_ _G_ <sup>k</sup> _β,v_ <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> _v_ <sup>k</sup> _c,αβ_ <sup>_′−_</sup> <sup>k</sup> <sup>_,_</sup> - _∗_ _G_ <sup>k</sup> _β,v_ <sup>_′_</sup> <sup>k</sup> <sup>k</sup> _β,v_ <sup>_′_</sup> <sup>k</sup> <sup>_′_</sup> _v_ <sup>_W_</sup> <sup>k</sup> _c,αβ_ <sup>_′−_</sup> <sup>k</sup> where we have defined _Wc,αβ_ <sup>k</sup> <sup>_′′_</sup> <sup>=</sup> _d_ x _d_ x <sup>_′_</sup> _Bα_ <sup>_∗_</sup> <sup>(</sup> <sup>x</sup> <sup>)</sup> <sup>_ei_</sup> <sup>k</sup> <sup>_′′·_</sup> <sup>r</sup> <sup>_Wc_</sup> <sup>(</sup> <sup>r</sup> <sup>_,_</sup> <sup>r</sup> <sup>_′_</sup> <sup>)</sup> <sup>_e−i_</sup> <sup>k</sup> <sup>_′′·_</sup> <sup>r</sup> <sup>_′Bβ_</sup> <sup>(</sup> <sup>x</sup> <sup>_′_</sup> <sup>)</sup> <sup>_._</sup> (31) _Treatment_ _of_ _the_ _Coulomb_ _interaction_ We evaluate Eq. 29 and Eq. 31 in a plane-wave basis where the Coulomb interaction is diagonal. However, some care is needed because in reciprocal space terms like <u>1</u> _|_ k <sup>_′_</sup> _−_ k + G _|_ <sup>2</sup> <sup>_,_</sup> (32) appear, which diverge for k <sup>_′_</sup> _−_ k _→_ 0 _,_ G _→_ 0 (it is worth noting that these divergencies are not physical but come from the numerical discretization of the BZ). To avoid these divergencies we perform the following replacement _|_ k <sup>_′_</sup> _−_ k <u>1 +</u> G _|_ <sup>2</sup> <sup>=</sup> (2 <sup><u>Ω</u></sup> _π_ <sup>_<u>N</u>_</sup> ) <sup>_<u>q</u>_</sup> <sup>3</sup> BZR <u>1</u> _d_ q <sup>_′_</sup> _|_ k <sup>_′_</sup> _−_ k + q <sup>_′_</sup> + G _|_ <sup>2</sup> <sup>_,_</sup> (33) i.e. we integrate numerically over the reduced volume of the Brillouin’s zone (BZR) centered in k <sup>_′_</sup> _−_ k and of volume <sup><u>(2</u></sup> <sup>_<u>π</u>_</sup> <sup><u>)3</u></sup> Ω _Nq_ <sup>,</sup> <sup>where</sup> <sup>Ωis</sup> <sup>the</sup> <sup>volume</sup> <sup>of</sup> the simulation cell and _Nq_ is the total number of k-points of a uniform mesh in the BZ. The integration is performed as a sum over an equally-spaced grid which does not contain the Γ point. This is equivalent to the strategy of Ref. [33], where instead the sum is performed through Monte-Carlo sampling. In the present implementation the correlation part of the screened Coulomb interaction ( _Wc_ ) is either approximated using the model described in Ref. [34] or is taken from a _GW_ calculation performed with the `GWL` package of the QE distribution [20]. 14 The model screened Coulomb interaction is obtained from the following expression for the inverse microscopic dielectric function _ε_ <sup>_−_</sup> model <sup>1</sup> <sup>(</sup> <sup>G</sup> <sup>_,_</sup> <sup>G</sup> <sup>_′_</sup> <sup>;</sup> <sup>q</sup> <sup>) =</sup> <sup>_δ_</sup> <sup>(</sup> <sup>G</sup> <sup>_,_</sup> <sup>G</sup> <sup>_′_</sup> <sup>)</sup> 1 _−_ �1 _−_ _ϵ_ <sup>_−_</sup> _m_ <sup>1</sup> - _e_ _<u>−</u>_ <u>2</u> _<u>π|</u>_ <u>q</u> <u>+</u> <u>G</u> _<u>|</u>_ <sup>2</sup> 4 _λ_ <sup>~~<u>2</u>~~</sup> _._ (34) The model depends on two parameters: the macroscopic dielectric constant _ϵm_ and the screening length _λ_ . From _ε_ <sup>_−_</sup> model <sup>1</sup> <sup>(</sup> <sup>G</sup> <sup>_,_</sup> <sup>G</sup> <sup>_′_</sup> <sup>;</sup> <sup>q</sup> <sup>)</sup> <sup>an</sup> <sup>approximated</sup> screened interaction is earned <u>1</u> _W_ model( G _,_ G <sup>_′_</sup> ; q ) = _ε_ <sup>_−_</sup> model <sup>1</sup> <sup>(</sup> <sup>G</sup> <sup>_,_</sup> <sup>G</sup> <sup>_′_</sup> <sup>;</sup> <sup>q</sup> <sup>)</sup> (35) _|_ G + q _|_ <sup>2</sup> where q = k <sup>_′_</sup> _−_ k is the transferred momentum. _W_ model( G _,_ G <sup>_′_</sup> ; q ) is then Fourier transformed to be inserted in Eq. 31. If _Wc_ is taken instead from a `GWL` calculation, some care is required because `GWL` samples the BZ at the Γ point only, even if the long-range parts of the dielectric matrix (commonly known as “wings” of the matrix) are properly calculated on a discrete k-points mesh. In this way the convergence of _GW_ energies is achieved for not too large simulation cells. Indeed, the `GWL` code is optimized to work with large model structures, as described in Ref. [35]. However, denser k-point samplings are required for a subsequent BSE calculation. For this purpose, we extrapolate _Wc_ at any k-point q from the polarizability matrix Π calculated at the Γ point and at zero frequency <u>Φ</u> _<u>ν</u>_ <u>(</u> <u>G</u> <sup>_′_</sup> <u>)</u> (36) _|_ q + G <sup>_′_</sup> _|_ <sup>2</sup> <u>Φ</u> _<u>µ</u>_ <u>(</u> <u>G</u> <u>)</u> _|_ q + G _|_ <sup>2</sup> <sup>Π</sup> <sup>_µν_</sup> _Wc_ ( G _,_ G <sup>_′_</sup> ; q ) = _µν_ where _{_ Φ _µ}_ is a generic and real basis set used to represent the polarizability operator. Although in our calculations the _{_ Φ _µ}_ are found according to the so-called optimal polarizability basis recipe [36, 35], our formalism remains unaltered if a plane-waves basis set is chosen. We stress that the expression above is formally exact only at q = 0 and its use at a generic q = k <sup>_′_</sup> _−_ k _̸_ = 0 is justified only if we assume that KS bands and wavefunctions do not change significantly at different k-points. This flat band approximation works well in the case of large simulation cells (or supercells). _Single_ _excitonic_ _states_ We find the lowest eigenvalues and eigenvectors of the excitonic Hamiltonian matrix by solving Eq. 4. Instead of the direct diagonalization of the entire 15 matrix, which would be too costly, we use an iterative conjugate-gradient (CG) algorithm [37] so that only the lowest states are found. The CG algorithm proceeds optimizing the search direction: at each minimization step the minimum along the search direction is found, assuming a parabolic behaviour for the excitonic energy. The minimum is found from the energy and its line derivative at the initial point and the energy calculated at a trial point, which is defined by a factor _µ_ and is given as an input parameter. _Dielectric_ _function_ For the calculation of the dielectric function given in Eq. 9 we neglect, in the present implementation, the contribution coming from the non-local commutator (see Eq. 21). In principle, all the excitonic eigenvectors are required so that a full diagonalization of the excitonic Hamiltonian would be necessary. However, iterative algorithms can be used for evaluating directly the frequency-dependent dielectric function. We adopt here the Haydock’s recursive method [38], so that we can calculate _ε_ BSE(ˆ q _, ω_ ) without the need to diagonalize the excitonic Hamiltonian. Within this formalism Eq. 9 can be rewritten as _._ (37) <sup>_<u>A</u>_</sup> <sup>(</sup> _<u>λ</u>_ <sup>_vc_</sup> <sup>k</sup> <sup>)</sup> <sup>_∗_</sup> _<u>A</u>_ <sup>(</sup> _<u>λ</u>_ <sup>_vc_</sup> <sup>k</sup> <sup>)</sup> _<u>Pvc</u>_ <u>k</u> _ω −_ _E_ <sup>˜</sup> _λ_ + _iη_ <sup>(</sup> _<u>λ</u>_ <sup>_vc_</sup> <sup>k</sup> <sup>)</sup> <sup>_∗_</sup> _<u>A</u>_ <sup>(</sup> _<u>λ</u>_ <sup>_vc_</sup> <sup>k</sup> <sup>)</sup> _ε_ BSE(ˆ q _, ω_ ) = 1 _−_ <sup><u>4</u></sup> <sup>_<u>π</u>_</sup> _V_ _λ_ _vc_ k _<u>Pvc</u>_ <sup>_∗_</sup> _<u>vc</u>_ <sup>_∗_</sup> <u>k</u> <sup>_<u>A</u>_</sup> <sup>(</sup> _<u>λ</u>_ <sup>_vc_</sup> <sup>k</sup> <sup>)</sup> <sup>_∗_</sup> In the case of isolated systems the components of the vectors _|P_ _⟩_ are _Pvc_ k = _⟨ψv_ k _|_ q ˆ _·_ r _|ψc_ k _⟩_ (38) for which only Γ-point sampling is meaningful, while for extended systems they read _Pvc_ k = <sup>_<u>⟨ψv</u>_</sup> <sup><u>k</u></sup> <sup>_<u>|</u>_</sup> <sup><u>ˆ</u></sup> <sup><u>q</u></sup> <sup>_<u>·</u>_</sup> <sup><u>v</u></sup> <sup>_<u>|ψc</u>_</sup> <sup><u>k</u></sup> <sup>_<u>⟩</u>_</sup> _Ec_ k _−_ _Ev_ k _._ (39) This allows to eliminate the explicit sum over _λ_ in Eq. 37: _ε_ BSE(ˆ q _, ω_ ) = 1 _−_ <sup><u>4</u></sup> _V_ <sup>_<u>π</u>_</sup> <sup>_⟨P_</sup> <sup>_|_</sup> <sup>(</sup> <sup>_ω −_</sup> <sup>_H_</sup> <sup>_exc_</sup> <sup>+</sup> <sup>_iη_</sup> <sup>)</sup> <sup>_−_</sup> <sup>1</sup> <sup>_|P_</sup> <sup>_⟩_</sup> <sup>_._</sup> (40) The Haydock’s recursive method provides us with two series of coefficients _αi_ and _βi_ so that we can write the continuous fraction as _⟨P_ _|_ ( _ω −_ _H_ <sup>_exc_</sup> + _iη_ ) <sup>_−_</sup> <sup>1</sup> _|P_ _⟩_ = <u>1</u> _ω_ + _iη −_ _α_ 1 _−_ _<u>β</u>_ <u>1</u> <sup>2</sup> _._ (41) <u>1</u> _β_ <sup>2</sup> <u>2</u> _ω_ + _iη−α_ 3 _..._ _ω_ + _iη−α_ 2 _−_ 16 The factors _αi_ and _βi_ converge to the values _α∞_ and _β∞_ for large _i_ . This permits to terminate the fraction substituting the final _βn_ <sup>2</sup> <sup>_/·_</sup> <sup>with the terminator</sup> mits to terminate the fraction substituting the final _βn_ <sup>2</sup> <sup>_/·_</sup> <sup>with the terminator</sup> _βn_ <sup>2</sup> <sup>_/T_</sup> <sup>(</sup> <sup>_ω_</sup> <sup>),</sup> <sup>where</sup> _n_ <sup>2</sup> <sup>_/T_</sup> <sup>(</sup> <sup>_ω_</sup> <sup>),</sup> <sup>where</sup> _T_ ( _ω_ ) = <sup>_ω −_</sup> <sup>_a∞_</sup> <sup>+</sup> 4. Details of the code ~~�~~ ( _a∞_ _−_ _ω_ ) <sup>2</sup> _−_ 4 _b_ <sup>2</sup> _<u>∞</u>_ _._ (42) 2 The `SIMPLE` code is implemented as a post-processing code of the QE distribution, directly inserted within the `GWL` package, and its structure is schematically depicted in Fig. 1. It is divided into three different executable: `simple.x`, `simple` ~~`i`~~ `p.x` and `simple` `bse.x` . These could be easily interfaced with different DFT codes as they are separate from the other routines of `GWL` . The executable `simple.x` builds the OB and saves to disk all the relevant matrix elements needed for the calculation of the optical properties. The actual IP or BSE calculation is then performed by `simple` ~~`i`~~ `p.x` or `simple` ~~`b`~~ `se.x`, respectively. `simple.x` uses the QE environment while `simple` `ip.x` and `simple` `bse.x` are independent from this environment but make use of several routines and modules of QE. Throughout the `SIMPLE` code, MPI parallelization is exploited and linear algebra operations are efficiently performed through calls to BLAS and LAPACK libraries. The code works only with norm-conserving pseudopotentials. Spin-orbit interactions are implemented and can be included for both IP and BSE calculations. Two test examples, i.e. bulk silver for `simple` `ip.x` and bulk silicon for `simple` `bse.x`, are included within the `SIMPLE` code. _simple.x_ `simple.x` relies, as a starting point, on the results of a _nscf_ calculation of QE performed on a uniform grid of k-points without the use of symmetry ( `nosym=.true.` and `noinv=.true.` in the input of `pw.x` ). A list of the input parameters of `simple.x` is reported in Table 1. As a first step it builds the OB functions as described in Section 3.1 where the threshold _sb_ controlling the precision of the OB is specified by the input variable `s` `bands` (in bohr <sup>3</sup> ). The number of valence bands _Nv_ included, starting from the highest occupied band (HOMO), and the number of conduction bands _Nc_ included, starting from the lowest unoccupied band (LUMO), are 17 specified by `num` `val` and `num` ~~`c`~~ `ond`, respectively. It then computes and saves to disk the matrix elements needed for the subsequent BSE calculation (if `calc` `mode=0` in input) or for the subsequent IP calculation (if `calc` `mode=1` in input). For a IP calculation the k-independent matrix elements K <sup>(1)</sup> _ij_ <sup>,</sup> <sup>_K_</sup> _ij_ <sup>(0)</sup> and _Vij_ <sup>_loc_</sup> (see Eq. 17, Eq. 18 and Eq. 19 respectively) of the KS Hamiltonian in the OB are computed. For the non-local part of the pseudopotential we store the k-dependent projectors _βλj_ ( k ) of Eq. 20, as originally proposed in Ref. [32], at each k-point k on a uniform _n_ 1 _× n_ 2 _× n_ 3 k-grid in the BZ defined by the input parameter `nkpoints` . Besides, if `nonlocal` ~~`c`~~ `ommutator=.true.` as it is by default, the matrix elements _⟨bi|_ [ r _, V_ <sup>_nl_</sup> ( k )] _|bj⟩_ giving the non-local contribution to the velocity operator (see last term of Eq. 22) are also computed on the k-grid defined by `nkpoints` . The calculation of the non-local commutator is the most time and memory consuming part of the simulation. By neglecting this term the computational cost is significantly reduced but the error introduced in the final optical spectra should be checked for each system and pseudopotential considered. For a BSE calculation the OPB is first constructed following the procedure described in Section 3.3 where the threshold _sp_ controlling the precision of the OPB is specified by the input parameter `s` ~~`p`~~ `roduct` (in bohr <sup>3</sup> ). The matrix elements in the OPB defined in Eq. 29 and Eq. 31 are then computed ( k <sup>_′′_</sup> in Eq. 29 and Eq. 31 is constructed from the same input parameter `nkpoints` described above which now, differently from the IP case, has to be the same as the initial _nscf_ k-grid). The screened Coulomb interaction is either approximated with the model of Eq. 34 if `w` ~~`t`~~ `ype` is set to 1, or is taken from a previous `GWL` calculation if `w` `type` is set to 0. In the first case, the macroscopic dielectric constant ( `epsm` ) and the screening length ( `lambdam` ) must be given. In the second case, a complete _G_ 0 _W_ 0 calculation is performed in order to obtain the screened Coulomb interaction. The polarizability is represented either on a common plane-waves basis or on an optimal polarizability basis set. In both cases its dimension `numpw` is required as an input parameter. If `l` ~~`t`~~ `runcated` ~~`c`~~ `oulomb` is `.false.` the complete long-range Coulomb interaction is considered, in the opposite case the Coulomb interaction is truncated at a distance `truncation` ~~`r`~~ `adius` . The latter case is meaningful exclusively for Γ-only sampling. <sup>(1)</sup> _ij_ <sup>,</sup> <sup>_K_</sup> _ij_ <sup>(0)</sup> _ij_ <sup>(0)</sup> and _Vij_ <sup>_loc_</sup> 18 _simple_ _~~i~~_ _p.x_ The IP calculation is performed by the executable `simple` ~~`i`~~ `p.x` and a list of its input parameters is reported in Table 2. For a IP calculation in which a k-space interpolation is performed, the uniform k-grid specified in the starting _nscf_ calculation should include also the seven periodic images of Γ at the corners of the unit cube (in units of the reciprocal lattice vectors) in order to better preserve the periodicity in reciprocal space of the k-dependent Hamiltonian (see Ref. [32] for a more detailed discussion). For this purpose we supply a `python` script ( `gen` ~~`k`~~ `grid.py` ) that can generate a uniform grid of k-points for the QE input with or without periodic images of Γ starting from a user-defined k-grid. The uniform _m_ 1 _×_ _m_ 2 _×_ _m_ 3 k-grid on which the IP dielectric function is computed is defined by `interp` ~~`g`~~ `rid` and it should be the same as the variable `nkpoints` of `simple.x` . However, in order to reduce the computational cost, a simple linear interpolation of the non-local contributions, i.e. _βλj_ ( k ) and _⟨bi|_ [ r _, V_ <sup>_nl_</sup> ( k )] _|bj⟩_, is also implemented so that it is possible to use a denser k-grid in `interp` ~~`g`~~ `rid` with respect to `nkpoints` (by specifying `nonlocal` ~~`i`~~ `nterpolation` `=` `.true.` ). To have good precision it is not suggested to use a grid larger than the double of the grid specified by `nkpoints` and the reliability of the results should be always carefully checked. The code performs the band interpolation on `interp` ~~`g`~~ `rid` and calculates the Fermi energy if it is not already specified in input by `fermi` ~~`e`~~ `nergy` . The broadening type and the value of the broadening (in Ry) can be specified in input by the parameters `fermi` ~~`n`~~ `gauss` and `fermi` ~~`d`~~ `egauss`, respectively. The occupations of the states are then computed according to the FermiDirac distribution with a broadening specified by `elec` `temp` (in Ry) that by default is set to room temperature. The IP dielectric function is then calculated on an equispaced energy grid of `nw` points in the energy interval [ `wmin`, `wmax` ] (in Ry). The derivative of the Fermi-Dirac distribution appearing in the expression of the Drude plasma frequency (see Eq. 8) should be in principle computed with the broadening specified by `elec` ~~`t`~~ `emp`, which however can require extremely dense k-grids. Therefore, a Gaussian broadening is used instead, defined in input by `drude` ~~`d`~~ `egauss`, because converged results can be obtained in practice using coarser k-grids and larger broadenings. The empirical interband and intraband broadenings, i.e. _η_ of Eq. 6 and _γ_ of Eq. 7, are defined by `inter` ~~`b`~~ `roadening` and `intra` ~~`b`~~ `roadening`, respectively. 19 The code writes in standard output the Drude plasma frequency _ω_ D(ˆ q ), computed in the limit q _→_ 0 along the three Cartesian directions (i.e. with q ˆ = x ˆ _,_ ˆ y _,_ ˆ z ), and provides two data files with the real and imaginary part of the interband contribution to the IP dielectric function, _ℜ_ - _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> - and the interband contribution to the IP dielectric function, _ℜ_ - _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> - and _ℑ_ - _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> �, also computed along the three Cartesian limits. The real and - _ε_ <sup>inter</sup> IP _ℑ_ - _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> �, also computed along the three Cartesian limits. The real and imaginary part of the total IP dielectric function of Eq. 5 and the electron energy loss spectrum (EELS), which is given by _−ℑ_ - _ε_ <sup>_−_</sup> IP <sup>1(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> �, are also pro - _ε_ <sup>inter</sup> IP <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> - _ε_ <sup>_−_</sup> IP <sup>1</sup> energy loss spectrum (EELS), which is given by _−ℑ_ - _ε_ <sup>_−_</sup> IP <sup>1(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> �, are also pro vided. For completeness the code also computes and writes on file the total dielectric function averaged over the three Cartesian directions <sup>_−_</sup> IP <sup>1(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> _⟨ε_ IP( _ω_ ) _⟩_ = <sup>_<u>ε</u>_</sup> <sup><u>IP(ˆ</u></sup> <sup><u>x</u></sup> <sup>_<u>, ω</u>_</sup> <sup><u>) +</u></sup> <sup>_<u>ε</u>_</sup> <sup><u>IP(ˆ</u></sup> <sup><u>y</u></sup> <sup>_<u>, ω</u>_</sup> <sup><u>) +</u></sup> <sup>_<u>ε</u>_</sup> <sup><u>IP(ˆ</u></sup> <sup><u>z</u></sup> <sup>_<u>, ω</u>_</sup> <sup><u>)</u></sup> _,_ (43) 3 together with the averaged refractive index _n_ ( _ω_ ), extinction coefficient _k_ ( _ω_ ) and reflectivity at normal incidence _R_ ( _ω_ ). The density of states (DOS) and the joint density of states (JDOS) are also computed. _simple_ _~~b~~_ _se.x_ The BSE calculation is performed by the executable `simple` ~~`b`~~ `se.x` and a list of its input parameters is reported in Table 3. The number of terms in the excitonic Hamiltonian can be chosen through the parameter `h` ~~`l`~~ `evel` . Considering only the diagonal term in Eq. 10 corresponds to the IP approximation, adding also the exchange term gives the time-dependent Hartree approximation while adding also the bare Coulomb part of the direct term yields the time-dependent Hartree-Fock approximation. If the correlation part of the direct term is also included, the full BSE approach is recovered. The code supports either spin collinear calculations with doubly occupied DFT states or the general case of non collinear spin (option `spin` ~~`s`~~ `tate` ). In the first case, exciton states have either singlet or triplet symmetry [31]. The code performs two different tasks (option `task` ): the evaluation of the lowest eigenvectors of the excitonic Hamitonian and of the corresponding energies through the CG algorithm ( `task` =0), and the computation of the _αi_ and _βi_ coefficients of Eq. 41 through the Haydock’s recursive scheme ( `task` =1). In the latter case, three series of coefficients relative to the three Cartesian directions are written on disk in a file named `ab` ~~`c`~~ `oeff.dat` for later calculation of the continuous fraction in order to get the components _ε_ BSE(ˆ x _, ω_ ), _ε_ BSE(ˆ y _, ω_ ) and _ε_ BSE(ˆ z _, ω_ ) of the complex frequency-dependent dielectric function. For 20 this purpose we include in the distribution a basic post-processing program ( `abcoeff` `to` ~~`e`~~ `ps.f90` ). 5. Convergence and verification In this section, first we study the convergence of the optical properties calculated with the `SIMPLE` code with respect to the relevant computational parameters controlling the precision of the simulations. Subsequently we verify the code by comparing our results for test systems with other wellestablished and publicly available codes and/or with results in the literature. _5.1._ _IP_ We consider as test system for the IP implementation bulk silver in the FCC primitive cell with lattice parameter _a_ = 7 _._ 869 bohr. The DFT calculations with the `pw.x` code of QE are performed with the PBE approximation [39] for the exchange-correlation functional at a wavefunction cutoff of 55 Ry and using the scalar-relativistic norm-conserving pseudopotential from the SG15 library [40]. For the ground-state calculation ( _scf_ calculation in `pw.x` ) we use a 24 _×_ 24 _×_ 24 Monkhorst-Pack [41] k-grid while the periodic functions _{un_ k _}_ needed for the construction of the OB are obtained on a 2 _×_ 2 _×_ 2 uniform k-grid including the seven periodic images of Γ and considering 11 conduction bands <sup>5</sup> ( _nscf_ calculation in `pw.x` ). The IP optical properties are calculated on a 44 _×_ 44 _×_ 44 uniform k-grid with the inclusion of the non-local contribution to the velocity matrix elements and broadening parameters (i.e. `inter` ~~`b`~~ `roadening`, `intra` ~~`b`~~ `roadening` and `drude` `degauss` of Table 2) of 0.1 eV. Because we are considering a FCC cubic crystal, the dielectric function is isotropic and is simply a scalar (i.e. independent from the direction q ˆ). The same holds for the test example of the BSE implementation, i.e. bulk silicon, which has the diamond structure. First, we investigate the convergence of the IP dielectric function with respect to the threshold _sb_ which controls the quality of the OB used for representing the periodic part of the Bloch wavefunctions. In Fig. 2 we show how _ℑ_ - _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> - for Ag is fully converged at _sb_ = 0 _._ 01 bohr <sup>3</sup>, or equivalently - _ε_ <sup>inter</sup> IP - for Ag is fully converged at _sb_ = 0 _._ 01 bohr <sup>3</sup>, or equivalently <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> 5Convergence of the optical spectra with respect to the _nscf_ k-grid has also been studied. In a primitive cell, a 2 _×_ 2 _×_ 2 k-grid is more than enough to obtain converged results (see Supplementary Material) while in a supercell the Γ point is already sufficient (in both cases including the seven periodic images of Γ). 21 with _Nb_ = 103 basis functions (to be compared with the value _Nb_ = 315 corresponding to the complete basis, i.e. to _sb_ = 0 _._ 0 bohr <sup>3</sup> ). Similar results are found for the convergence of _ℜ_ - _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> - and _ω_ D(ˆ q ), and are not shown are found for the convergence of _ℜ_ - _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> - and _ω_ D(ˆ q ), and are not shown here (see Supplementary Material). Then, we verify the IP implementation of the `SIMPLE` code by comparing the results obtained for Ag with respect to equivalent simulations performed with the Yambo code [11] for the interband contribution to _ε_ IP(ˆ q _, ω_ ), and with the BoltzWann module [42] of the Wannier90 code [43] for the intraband contribution to _ε_ IP(ˆ q _, ω_ ). As both codes are interfaced with the QE distribution we can perform a straightforward comparison starting from the same DFT ground-state density used for the `SIMPLE` calculation using all the same relevant computational parameters (k-grid, number of bands, broadenings, etc.). To note that, in order to calculate the optical properties, Yambo does not use any interpolation method in k-space while BoltzWann, instead, uses the Wannier’s interpolation method [44]. For the `SIMPLE` calculation we use an OB constructed setting _sb_ = 0 _._ 01 bohr <sup>3</sup> that, as shown above, gives well converged spectra. Fig. 3 shows that `SIMPLE` and Yambo give almost identical results for _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>).</sup> <sup>For</sup> <sup>the</sup> <sup>intraband</sup> <sup>contribution</sup> <sup>we</sup> <sup>find</sup> <sup>that</sup> - _ε_ <sup>inter</sup> IP <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> identical results for _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>).</sup> <sup>For</sup> <sup>the</sup> <sup>intraband</sup> <sup>contribution</sup> <sup>we</sup> <sup>find</sup> <sup>that</sup> the Drude plasma frequency of Ag is _ω_ D(ˆ q ) = 8 _._ 93 eV with the `SIMPLE` code while it is _ω_ D(ˆ q ) = 8 _._ 96 eV with the BoltzWann code. Therefore we conclude that for both the interband and intraband contributions the agreement between SIMPLE and the other codes is excellent. It is worth mentioning here that a powerful approach for the interpolation of band-structure properties is the interpolation mentioned above based on the use of maximally localized Wannier functions (MLWF) as basis [45]. Wannier functions are physically appealing since they are localized in real space and can be used as an exact tight-binding basis. Moreover, Wannier interpolation is both an efficient and precise method for the evaluation of quantities that require a fine sampling of the BZ; in particular, in the Wannier representation the k-dependent KS Hamiltonian does not need to be explicitly constructed and the matrix elements of the velocity operator are analytic if written in terms of Wannier functions [46]. On the other hand, the method has the drawback that the construction of the MLWF’s is not an easily automatizable procedure, especially for metals, for which an additional disentanglement step of the empty bands is required [47]. However, in recent years there have been promising advances towards the development of an automatic procedure for the “Wannierization” of periodic systems [48], including also the more complex case of metals [49]. Once these new approaches will be inter 22 faced with DFT engines, it would be interesting to systematically assess and compare performance and precision of Shirley’s and Wannier’s interpolations. _5.2._ _BSE_ We test the BSE branch of the code considering bulk silicon as this was used, historically, as a test case for the introduction of a variety of BSE implementations [50, 3, 31, 51]. As the correlation part of the screened Coulomb interaction is taken from a `GWL` calculation, performed at the sole Γ-point and then extrapolated as described in Section 3.3, we study a 8 atoms cubic supercell. We work with the local-density approximation [52] (LDA) for the DFT exchange-correlation functional, with a norm-conserving pseudopotential (Si.pz-vbc.UPF) from the QE library and with a wavefunction cutoff of 20 Ry for defining the plane-wave basis sets for the KS wavefunctions. These parameters yield a theoretical lattice constant of 10 _._ 26 bohr. While for the starting DFT self-consistent run we use a regular 4 _×_ 4 _×_ 4 mesh k-points, for the convergence tests of the BSE implementation we use a regular 6 _×_ 6 _×_ 6 mesh of k-points, shifted not to include the Γ-point. We include in the BSE simulations all the 16 valence states, and 24 conduction states. We focus on the complex dielectric function which is obtained using a rigid shift of the valence band manifold, with a scissor parameter of 0 _._ 6 eV for opening the electronic gap, as done in previous studies [50, 31, 3], 1000 iterative steps for the Haydock’s recursive algorithm and a broadening parameter _η_ of 0 _._ 2 eV. We note that using only _∼_ 50 steps is enough to ensure convergence. A polarizability basis [36, 35] of 100 vectors is enough to converge the screened Coulomb interaction (see Supplementary Material). We show in Fig. 4 (left panel) the calculated _ℑ_ [ _ε_ BSE(ˆ q _, ω_ )] as a function of the _sb_ threshold that controls the quality of the OB: a value of 0 _._ 1 bohr <sup>3</sup> is sufficient for converging the spectrum, so that the OB comprises only 91 vectors. This number, 8640, should be contrasted with the theoretical dimension of a complete basis (i.e. _sb_ = 0 _._ 0 bohr <sup>3</sup> ), and with the dimension of the plane-wave basis sets for representing the KS wavefunctions, that has 2205 elements. We show in Fig. 4 (right panel) how _ℑ_ [ _ε_ BSE(ˆ q _, ω_ )] behaves if we lower the _sp_ threshold controlling the quality of the OPB. For this test the OB threshold is kept fixed to _sb_ = 0 _._ 1 bohr <sup>3</sup> giving a basis dimension _Nb_ = 91. We see how the choice _sp_ = 1 _._ 0 bohr <sup>3</sup> provides a spectrum almost indistinguishable from the one obtained with _sp_ = 0 _._ 5 bohr <sup>3</sup>, while the dimension of the OPB raises from _Np_ = 160 to _Np_ = 443. From our tests of the sensitivity of the dielectric function on the _sb_ and _sp_ thresholds we opt for the choice _sb_ = 0 _._ 1 bohr <sup>3</sup> and 23 _sp_ = 1 _._ 0 bohr <sup>3</sup> for verifying our BSE implementation. As the spectra are quite sensitive to k-points sampling [53, 51], we take a denser k-point mesh comprising 448 points. We compare in Fig. 5 the resulting _ℑ_ [ _ε_ BSE(ˆ q _, ω_ )] spectrum with those taken from Refs. [50, 31, 3, 51], registering good agreement despite the different approximations the various implementations rely on. In particular, the strategy used for extrapolating the _Wc_ operator is verified. 6. Performance _6.1._ _Efficiency_ _of_ _the_ _optimal_ _basis_ As the core of the present approach is the reduction of the basis sets for representing wavefunctions and their products, we are compelled to assess how such reduction improves the computational performance. _6.1.1._ _IP_ For IP calculations we have to deal with matrices of dimensions _Nb_ _× Nb_ (i.e. the k-dependent Hamiltonian _Hij_ <sup>KS(</sup> <sup>k</sup> <sup>) of Eq. 16) and the computational</sup> cost is dictated by the construction (or “filling”) of this matrix through the computation of the k-dependent contributions coming from the non-local part of the pseudopotentials, rather than by its diagonalization. For this reason the wall time of a IP calculation is expected to scale quadratically with respect to _Nb_ . We study the computational cost of the IP approach performed with the `SIMPLE` code as the number of OB functions _Nb_ is varied, as shown in Fig. 6 for bulk silver. We set as reference time the computer time (or wall time) of the calculation with the smallest number of OB functions. As expected, timing scales with the square of _Nb_ . In Fig. 6 we also show how the inclusion of the non-local commutator in the computation of the velocity matrix elements significantly slows down the calculations. _6.1.2._ _BSE_ For BSE calculations we work with matrices of dimensions _Nb × Nv_, _Nb × Nc_ and _Np × Nπ_ where _Nπ_ is the dimension of the basis used to represent the polarizability operator (see Eq. 36). As _Nπ_ does not depend on OB or OPB, we expect the wall time of a BSE calculation to scale linearly with respect to _Np_ . Besides, we also know that the number of vectors of the OPB _Np_ scales linearly with _Nb_, instead of its square, because of the threshold _sp_ used in the construction of the basis (see Section 3.3). As a consequence, the wall 24 time of a BSE calculation is also expected to scale linearly with respect to _Nb_ . We show in Fig. 7 (left panel) how the total computational cost depends almost linearly on the dimension _Np_ of the OPB, as expected (with the _sb_ threshold kept fixed). Indeed, we register a scaling better than linear likely due to a more efficient use of the cache memory. In Fig. 7 (right panel) we show that linear scaling is also found for the variation of the _Nb_ size of the OB (with the _sp_ threshold kept fixed). In this case the slightly worse than ideal behavior should be traced to the requirement of storing and working with larger matrices, implying significant transfers from memory to CPU and back. _6.2._ _Core_ _scaling_ In order to assess the performances of the `SIMPLE` code for its use in parallel architectures, we investigate the speedup of the code as a function of the number of single processing units, or cores, both for the IP and BSE implementation. _6.2.1._ _IP_ For the IP part we consider Ag in a 4 _×_ 4 _×_ 4 FCC supercell with 64 atoms and 1216 electrons. The total number of OB functions considered in the simulations is 2687, corresponding to _sb_ = 0 _._ 01 bohr <sup>3</sup> . In general, for IP calculations, a significant part of the total computational cost is due to the `simple.x` run. Therefore the speedup of the IP section is calculated by summing the wall times of the `simple.x` and `simple` `ip.x` runs performed with the same number of cores. In Fig. 8 we show the results for the case in which the number of cores corresponds to the number of MPI tasks and we compare simulations performed including and not including the computation of the non-local commutator entering in the estimation of the velocity matrix elements. In order to obtain similar wall times for a given number of cores, we use an interpolation k-grid of 8 _×_ 8 _×_ 8 and 16 _×_ 16 _×_ 16 when including and not including the non-local commutator, respectively. Although the scaling of `simple` ~~`i`~~ `p.x` alone is close to linear, the total scaling of the combined simulations deviates from the ideal linear scaling, mainly because of the computations of the k-dependent matrix elements due to the non-local part of the pseudopotentials (see Eq. 20 and Eq. 22) performed by `simple.x` . Indeed, if the calculation of the non-local commutator of Eq. 22 is avoided, the scaling is significantly improved, as shown in Fig. 8. 25 _6.2.2._ _BSE_ For the BSE part, in order to illustrate the capabilities of the code, we choose the mixed organic-inorganic perovskite CH3NH3PbI3 which is widely studied for organic/inorganic perovskite solar cells [54]. It involves a primitive cell, comprising 48 inequivalent atoms, fully relativistic calculations and 200 electron. We test the evaluation of the dielectric function through the Haydock’s recursive algorithm. The code is optimized for a mixed OpenMP-MPI parallelization as it strongly relies on BLAS routines and in particular on the DGEMM matrix-matrix multiplication. First, we check the scaling with respect to the number of OpenMP threads keeping fixed the number of MPI tasks. The corresponding results are displayed in Fig. 9 (left panel), where we do not consider the cost of the preceding `simple.x` run as this is smaller: 3369 s of wall time on only 128 cores, to be contrasted with 8782 s for the `simple` `bse.x` run with 256 cores. We note that changing from 4 to 16 the number of OpenMP threads per MPI task determines a reduction of the wall time by a factor 2 _._ 1. Although this figure is lower than the ideal factor 4, we register an almost linear scaling with the number of OpenMP threads. Indeed, an only slightly larger factor (2 _._ 3) would be expected extrapolating the scaling from 256 to 512 cores. Such linear scaling supports the parallelization of the single MPI tasks on a relatively large number of OpenMP threads. The scaling of the required wall time with respect to the number of MPI tasks keeping fixed the distribution of the single tasks on OpenMP threads is displayed in Fig. 9 (right panel). Also in this test we focus only on the `simple` `bse.x` run as the `simple.x` one is much less demanding (7840 s of wall time on only 128 cores versus 12251 s for the `simple` ~~`b`~~ `se.x` calculation on 3672 cores). The number of OpenMP threads per MPI task is kept fixed to 68 while the number of MPI tasks varies from 54 to 108. We register linear scaling and, in this case, we note also an almost ideal behavior. The favorable scaling both with respect to the number of OpenMP threads and of MPI tasks will allow the use of our BSE code on the latest high-performance computing infrastructures running on up to few tens of thousands of cores. 7. Conclusions We have developed a new code, named `SIMPLE`, to calculate optical properties using the Shirley’s optimal basis method proposed in Ref. [21], both within the framework of the independent-particle approximation (for metals) and of the Bethe-Salpeter equation (for insulators). 26 In the independent-particle implementation, we highlight that the code computes both interband and intraband contributions to the complex dielectric function and that the matrix elements of the velocity operator are correctly calculated by including, if desired, the non-local contribution of the normconserving pseudopotentials. In the Bethe-Salpeter part, a generalization of the optimal basis method has been developed and implemented to deal in an efficient way also with products of periodic Kohn-Sham states. The screened Coulomb interaction is obtained either through a model for the microscopic dielectric function or starting from the results of a previous `GWL` calculation. To avoid the diagonalization of the excitonic Hamiltonian matrix, the lowest eigenvectors and corresponding energies can be obtained exploiting an iterative conjugate-gradient algorithm while the complex dielectric function is calculated with the Haydock’s recursive method. The `SIMPLE` code has been included within the `GWL` package of the Quantum ESPRESSO distribution. It has been developed and optimized, as demonstrated by scalability tests, in order to run efficiently in laptops as well as in massively parallel architectures by deploying both fast linear algebra routines (BLAS, LAPACK) and parallelization strategies (MPI and OpenMP). We have verified the results of our code obtained within the framework of the independent-particle approximation and of the Bethe-Salpeter equation on bulk silver and bulk silicon, respectively. In the case of silver we have compared `SIMPLE` with the publicly available codes Yambo and BoltzWann and have found very good agreement. In the case of silicon, for which the Bethe-Salpeter equation is solved, `SIMPLE` has been compared with the literature, finding also here a good agreement for the results, considering the use of different base codes and pseudopotentials. The systematic improvement of the optimal basis set and, as a consequence, of the precision of the results by simply increasing the number of basis functions included, provides the notable advantage that our code can be used to perform efficient computations in a straightforward way for the users: precision is controlled simply by a few input parameters, i.e. _sb_ and _sp_ . Moreover, the simplicity of the method and the fact that all the calculations needed to obtain the optical properties from a given initial crystal structure can be run within a single open-source software, i.e. the Quantum ESPRESSO distribution, makes the automation of the sequence of computational steps required and thus the systematic evaluation of the complex dielectric function for a large number of materials much easier. Because of all these considerations, we hope that the `SIMPLE` code will have an impact in the field of computa 27 tional materials science by helping researchers to perform efficient, systematic, and reliable first-principles studies of the optical properties of materials. Acknowledgments G. P. acknowledges funding from Varinor SA (CH 2800 Del´emont, Switzerland). P. U. acknowledges funding from the EU-H2020 research and innovation programme under Grant Agreement No. 654360 NFFA-Europe. This research was partially supported by the NCCR MARVEL, funded by the Swiss National Science Foundation. We acknowledge PRACE (project ID 2016163963) for awarding us access to Marconi at CINECA, Italy. G. P. warmly thanks Gian-Marco Rignanese for originally suggesting the use of the optimal basis method. Declarations of interest: none References References [1] R. M. Martin, Electronic Structure: Basic [Theory](https://www.cambridge.org/core/books/electronic-structure/DDFE838DED61D7A402FDF20D735BC63A) and Practical Meth [ods,](https://www.cambridge.org/core/books/electronic-structure/DDFE838DED61D7A402FDF20D735BC63A) Cambridge University Press, 2004. [2] [G. Strinati, Application of the Green’s Functions Method to the Study of](https://link.springer.com/article/10.1007%2FBF02725962) the Optical [Properties](https://link.springer.com/article/10.1007%2FBF02725962) of Semiconductors, Riv. Nuovo Cimento 11 (12) (1988) 1–86. [3] G. Onida, L. Reining, A. Rubio, Electronic [excitations:](https://journals.aps.org/rmp/abstract/10.1103/RevModPhys.74.601) densityfunctional versus [many-body](https://journals.aps.org/rmp/abstract/10.1103/RevModPhys.74.601) Greens-function approaches, Rev. Mod. Phys. 74 (2002) 601–659. [4] R. Martin, L. Reining, D. Ceperley, Interacting [Electrons:](https://books.google.ch/books?id=ch1CDAAAQBAJ) Theory and [Computational](https://books.google.ch/books?id=ch1CDAAAQBAJ) Approaches, Cambridge University Press, 2016. [5] M. S. Hybertsen, S. G. Louie, Electron [correlation](https://link.aps.org/doi/10.1103/PhysRevB.34.5390) in semiconductors and insulators: Band gaps and quasiparticle energies, Phys. Rev. B 34 (1986) 5390–5413. 28 [6] I. Dabo, A. Ferretti, N. Poilvert, Y. Li, N. Marzari, M. Cococcioni, Koopmans’ condition for density-functional theory, Phys. Rev. B 82 (2010) 115121. [7] G. Borghi, A. Ferretti, N. L. Nguyen, I. Dabo, N. Marzari, [Koopmans-](https://link.aps.org/doi/10.1103/PhysRevB.90.075135) [compliant functionals and their performance against reference molecular](https://link.aps.org/doi/10.1103/PhysRevB.90.075135) [data,](https://link.aps.org/doi/10.1103/PhysRevB.90.075135) Phys. Rev. B 90 (2014) 075135. [8] [N. L. Nguyen, N. Colonna, A. Ferretti, N. Marzari, Koopmans-compliant](https://link.aps.org/doi/10.1103/PhysRevX.8.021051) [spectral functionals for extended systems, Phys. Rev. X 8 (2018) 021051.](https://link.aps.org/doi/10.1103/PhysRevX.8.021051) [9] [N. Colonna, N. L. Nguyen, A. Ferretti, N. Marzari, Screening in orbital-](https://doi.org/10.1021/acs.jctc.7b01116) [density-dependent](https://doi.org/10.1021/acs.jctc.7b01116) functionals, J. Chem. Theory Comput. 14 (5) (2018) 2549–2557. [10] N. Marzari, Materials modelling: The [frontiers](https://doi.org/10.1038/nmat4613) and the challenges, Nat. Mater. 15 (2016) 381. [11] A. Marini, C. Hogan, M. Gr¨uning, D. Varsano, yambo: An _[ab initio](http://www.sciencedirect.com/science/article/pii/S0010465509000472)_ tool for excited [state](http://www.sciencedirect.com/science/article/pii/S0010465509000472) calculations, Comput. Phys. Commun. 180 (8) (2009) 1392–1403. [12] J. Deslippe, G. Samsonidze, D. A. Strubbe, M. Jain, M. L. Cohen, S. G. Louie, BerkeleyGW: A massively [parallel](http://www.sciencedirect.com/science/article/pii/S0010465511003912) computer package for the calculation of the quasiparticle and optical properties of materials [and nanostructures, Comput. Phys. Commun. 183 (6) (2012) 1269–1289.](http://www.sciencedirect.com/science/article/pii/S0010465511003912) [13] X. Leng, F. Jin, M. Wei, Y. Ma, GW method and [Bethe-Salpeter](https://onlinelibrary.wiley.com/doi/full/10.1002/wcms.1265) equa tion for calculating [electronic](https://onlinelibrary.wiley.com/doi/full/10.1002/wcms.1265) excitations, WIREs Comput. Mol. Sci. 6 (2016) 532–550. [14] P. Giannozzi, S. Baroni, N. Bonini, M. Calandra, R. Car, C. Cavaz zoni, D. Ceresoli, G. L. Chiarotti, M. Cococcioni, I. Dabo, A. Dal Corso, S. de Gironcoli, S. Fabris, G. Fratesi, R. Gebauer, U. Gerstmann, C. Gougoussis, A. Kokalj, M. Lazzeri, L. Martin-Samos, N. Marzari, F. Mauri, R. Mazzarello, S. Paolini, A. Pasquarello, L. Paulatto, C. Sbraccia, S. Scandolo, G. Sclauzero, A. P. Seitsonen, A. Smogunov, P. Umari, R. M. Wentzcovitch, QUANTUM ESPRESSO: a modular and open-source software project for quantum simulations of materials., J. Phys.: Condens. Matter 21 (39) (2009) 395502. 29 [15] X. Gonze, B. Amadon, P.-M. Anglade, J.-M. Beuken, F. Bottin, P. Boulanger, F. Bruneval, D. Caliste, R. Caracas, M. Ct, T. Deutsch, L. Genovese, P. Ghosez, M. Giantomassi, S. Goedecker, D. Hamann, P. Hermet, F. Jollet, G. Jomard, S. Leroux, M. Mancini, S. Mazevet, M. Oliveira, G. Onida, Y. Pouillon, T. Rangel, G.-M. Rignanese, D. Sangalli, R. Shaltaf, M. Torrent, M. Verstraete, G. Zerah, J. Zwanziger, ABINIT: First-principles approach [to](http://www.sciencedirect.com/science/article/pii/S0010465509002276) material and nanosystem proper[ties,](http://www.sciencedirect.com/science/article/pii/S0010465509002276) Comput. Phys. Commun. 180 (12) (2009) 2582–2615. [16] J. M. Soler, E. Artacho, J. D. Gale, A. Garc´ıa, J. Junquera, P. Ordej´on, D. S´anchez-Portal, The SIESTA method for _[ab](http://stacks.iop.org/0953-8984/14/i=11/a=302)_ _initio_ order-N materials [simulation,](http://stacks.iop.org/0953-8984/14/i=11/a=302) J. Phys.: Condens. Matter 14 (11) (2002) 2745. [17] [G. Kresse, J. Furthmller, Efficiency of ab-initio total energy calculations](http://www.sciencedirect.com/science/article/pii/0927025696000080) for metals and [semiconductors](http://www.sciencedirect.com/science/article/pii/0927025696000080) using a plane-wave basis set, Comput. Mater. Sci. 6 (1) (1996) 15–50. [18] J. Hutter, M. Iannuzzi, F. Schiffmann, J. VandeVondele, cp2k: atom istic simulations of [condensed](https://onlinelibrary.wiley.com/doi/abs/10.1002/wcms.1159) matter systems, Wiley Interdiscip. Rev. Comput. Mol. Sci. 4 (1) (2014) 15–25. [19] X. Gonze, F. Jollet, F. A. Araujo, D. Adams, B. Amadon, T. Applen court, C. Audouze, J.-M. Beuken, J. Bieder, A. Bokhanchuk, E. Bousquet, F. Bruneval, D. Caliste, M. Ct, F. Dahm, F. D. Pieve, M. Delaveau, M. D. Gennaro, B. Dorado, C. Espejo, G. Geneste, L. Genovese, A. Gerossier, M. Giantomassi, Y. Gillet, D. Hamann, L. He, G. Jomard, J. L. Janssen, S. L. Roux, A. Levitt, A. Lherbier, F. Liu, I. Lukaevi, A. Martin, C. Martins, M. Oliveira, S. Ponc, Y. Pouillon, T. Rangel, G.-M. Rignanese, A. Romero, B. Rousseau, O. Rubel, A. Shukri, M. Stankovski, M. Torrent, M. V. Setten, B. V. Troeye, M. Verstraete, D. Waroquiers, J. Wiktor, B. Xu, A. Zhou, J. Zwanziger, Recent developments in [the](http://www.sciencedirect.com/science/article/pii/S0010465516300923) ABINIT software package, Comput. Phys. Commun. 205 (2016) 106–131. [20] P. Giannozzi, O. Andreussi, T. Brumme, O. Bunau, M. B. Nardelli, M. Calandra, R. Car, C. Cavazzoni, D. Ceresoli, M. Cococcioni, N. Colonna, I. Carnimeo, A. D. Corso, S. de Gironcoli, P. Delugas, R. A. D. Jr, A. Ferretti, A. Floris, G. Fratesi, G. Fugallo, R. Gebauer, U. Gerstmann, F. Giustino, T. Gorni, J. Jia, M. Kawamura, H.-Y. 30 Ko, A. Kokalj, E. Kucukbenli, M. Lazzeri, M. Marsili, N. Marzari, F. Mauri, N. L. Nguyen, H.-V. Nguyen, A. O. de-la Roza, L. Paulatto, S. Ponc, D. Rocca, R. Sabatini, B. Santra, M. Schlipf, A. P. Seitsonen, A. Smogunov, I. Timrov, T. Thonhauser, P. Umari, N. Vast, X. Wu, [S. Baroni, Advanced capabilities for materials modelling with Quantum](http://iopscience.iop.org/article/10.1088/1361-648X/aa8f79) [ESPRESSO,](http://iopscience.iop.org/article/10.1088/1361-648X/aa8f79) J. Phys.: Condens. Matter 29 (46) (2017) 465901. [21] [E. L. Shirley, Optimal basis sets for detailed Brillouin-zone integrations,](https://link.aps.org/doi/10.1103/PhysRevB.54.16464) Phys. Rev. B 54 (1996) 16464–16469. [22] Y. Yao, L. Kleinman, A. H. MacDonald, J. Sinova, T. Jungwirth, D. s. Wang, E. Wang, Q. Niu, First Principles [Calculation](https://link.aps.org/doi/10.1103/PhysRevLett.92.037204) of Anomalous Hall Conductivity in [Ferromagnetic](https://link.aps.org/doi/10.1103/PhysRevLett.92.037204) bcc Fe, Phys. Rev. Lett. 92 (2004) 037204. [23] D. Sangalli, A. Marini, A. Debernardi, [Pseudopotential-based](https://link.aps.org/doi/10.1103/PhysRevB.86.125139) first principles approach to the [magneto-optical](https://link.aps.org/doi/10.1103/PhysRevB.86.125139) Kerr effect: From metals to the inclusion of local [fields](https://link.aps.org/doi/10.1103/PhysRevB.86.125139) and excitonic effects, Phys. Rev. B 86 (2012) 125139. [24] D. Sangalli, J. A. Berger, C. Attaccalite, M. Gr¨uning, P. Romaniello, Optical properties of periodic [systems](https://link.aps.org/doi/10.1103/PhysRevB.95.155203) within the current-current response framework: [Pitfalls and remedies, Phys. Rev. B 95 (2017) 155203.](https://link.aps.org/doi/10.1103/PhysRevB.95.155203) [25] [M. Gatti, F. Sottile, Exciton dispersion from first principles, Phys. Rev.](https://link.aps.org/doi/10.1103/PhysRevB.88.155113) B 88 (2013) 155113. [26] F. Wooten, Optical [properties](https://books.google.ch/books?id=Vzl0oAEACAAJ) of solids, Academic Press, 1972. [27] A. Marini, G. Onida, R. Del Sole, Plane-wave [DFT-LDA](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.64.195125) calculation of the electronic structure and [absorption](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.64.195125) spectrum of copper, Phys. Rev. B 64 (19) (2001) 195125. [28] [J. Harl, The linear response function in density functional theory:](http://othes.univie.ac.at/2622/) Opti cal spectra and improved [description](http://othes.univie.ac.at/2622/) of the electron correlation, Ph.D. thesis, Universit¨at Wien (2008). [29] [J. I. Mustafa, M. Bernardi, J. B. Neaton, S. G. Louie, Ab initio electronic](https://link.aps.org/doi/10.1103/PhysRevB.94.155105) relaxation times and [transport](https://link.aps.org/doi/10.1103/PhysRevB.94.155105) in noble metals, Phys. Rev. B 94 (2016) 155105. 31 [30] S. Albrecht, L. Reining, R. Del Sole, G. Onida, Ab Initio [Calculation](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.80.4510) of Excitonic Effects in the [Optical](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.80.4510) Spectra of Semiconductors, Phys. Rev. Lett. 80 (1998) 4510–4513. [31] M. Rohlfing, S. G. Louie, Electron-hole [excitations](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.62.4927) and optical spectra from first principles, Phys. Rev. B 62 (8) (2000) 4927–4944. [32] D. Prendergast, S. G. Louie, Bloch-state-based [interpolation:](https://link.aps.org/doi/10.1103/PhysRevB.80.235126) An effi cient generalization of the Shirley [approach](https://link.aps.org/doi/10.1103/PhysRevB.80.235126) to interpolating electronic [structure,](https://link.aps.org/doi/10.1103/PhysRevB.80.235126) Phys. Rev. B 80 (2009) 235126. [33] C. A. Rozzi, D. Varsano, A. Marini, E. K. U. Gross, A. Rubio, [Exact](https://link.aps.org/doi/10.1103/PhysRevB.73.205119) coulomb cutoff technique for supercell calculations, Phys. Rev. B 73 (2006) 205119. [34] [F. Bechstedt, R. Del Sole, G. Cappellini, L. Reining, An efficient method](https://www.sciencedirect.com/science/article/pii/003810989290476P?via%3Dihub) for calculating quasiparticle energies in semiconductors, Solid State Commun. 84 (7) (1992) 765–770. [35] [P. Umari, G. Stenuit, S. Baroni, GW quasiparticle spectra from occupied](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.81.115104) [states](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.81.115104) only, Phys. Rev. B 81 (2010) 115104. [36] [P. Umari, G. Stenuit, S. Baroni, Optimal representation of the polariza-](https://link.aps.org/doi/10.1103/PhysRevB.79.201104) [tion propagator for large-scale](https://link.aps.org/doi/10.1103/PhysRevB.79.201104) _GW_ calculations, Phys. Rev. B 79 (2009) 201104. [37] W. H. Press, [S. A. Teukolsky, W. T. Vetterling, B. P. Flannery, Numer-](http://www.cambridge.org/ch/academic/subjects/mathematics/numerical-recipes/numerical-recipes-art-scientific-computing-3rd-edition?format=HB&utm_source=shortlink&utm_medium=shortlink&utm_campaign=numericalrecipes) ical Recipes: The Art [of](http://www.cambridge.org/ch/academic/subjects/mathematics/numerical-recipes/numerical-recipes-art-scientific-computing-3rd-edition?format=HB&utm_source=shortlink&utm_medium=shortlink&utm_campaign=numericalrecipes) Scientific Computing, 3rd Edition, Cambridge University Press, New York, NY, USA, 2007. [38] L. Benedict, E. Shirley, Ab initio calculation [of](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.59.5441) _ϵ_ 2( _ω_ ) including the electron-hole interaction: [Application](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.59.5441) to gan and caf2, Phys. Rev. B 59 (8) (1999) 5441–5451. [39] J. Perdew, K. Burke, M. Ernzerhof, Generalized [Gradient](http://www.ncbi.nlm.nih.gov/pubmed/10062328) Approxima tion [Made](http://www.ncbi.nlm.nih.gov/pubmed/10062328) Simple., Phys. Rev. Lett. 77 (18) (1996) 3865–3868. [40] [M. Schlipf, F. Gygi, Optimization algorithm for the generation of ONCV](http://dx.doi.org/10.1016/j.cpc.2015.05.011) [pseudopotentials,](http://dx.doi.org/10.1016/j.cpc.2015.05.011) Comput. Phys. Commun. 196 (2015) 36–44. [41] H. J. Monkhorst, J. D. Pack, Special points for [Brillouin-zone](https://link.aps.org/doi/10.1103/PhysRevB.13.5188) integra [tions,](https://link.aps.org/doi/10.1103/PhysRevB.13.5188) Phys. Rev. B 13 (1976) 5188–5192. 32 [42] G. Pizzi, D. Volja, B. Kozinsky, M. Fornari, N. Marzari, An [updated](https://www.sciencedirect.com/science/article/pii/S0010465514001581?via%3Dihub) version of BOLTZWANN: A code [for](https://www.sciencedirect.com/science/article/pii/S0010465514001581?via%3Dihub) the evaluation of thermoelectric and electronic transport properties [with](https://www.sciencedirect.com/science/article/pii/S0010465514001581?via%3Dihub) a maximally-localized Wannier [functions](https://www.sciencedirect.com/science/article/pii/S0010465514001581?via%3Dihub) basis, Comput. Phys. Commun. 185 (8) (2014) 2311–2312. [43] A. A. Mostofi, J. R. Yates, Y.-S. Lee, I. Souza, D. Vanderbilt, N. Marzari, wannier90: A tool for [obtaining](https://www.sciencedirect.com/science/article/pii/S0010465507004936?via%3Dihub) maximally-localised Wannier [functions,](https://www.sciencedirect.com/science/article/pii/S0010465507004936?via%3Dihub) Comput. Phys. Commun. 178 (9) (2008) 685–699. [44] N. Marzari, A. A. Mostofi, J. R. Yates, I. Souza, D. Vanderbilt, [Maxi-](https://link.aps.org/doi/10.1103/RevModPhys.84.1419) mally localized wannier [functions:](https://link.aps.org/doi/10.1103/RevModPhys.84.1419) Theory and applications, Rev. Mod. Phys. 84 (2012) 1419–1475. [45] N. Marzari, D. Vanderbilt, Maximally localized generalized wannier functions for [composite](https://link.aps.org/doi/10.1103/PhysRevB.56.12847) energy bands, Phys. Rev. B 56 (1997) 12847– 12865. [46] [J. R. Yates, X. Wang, D. Vanderbilt, I. Souza, Spectral and fermi surface](https://link.aps.org/doi/10.1103/PhysRevB.75.195121) properties from [wannier](https://link.aps.org/doi/10.1103/PhysRevB.75.195121) interpolation, Phys. Rev. B 75 (2007) 195121. [47] I. Souza, N. Marzari, D. Vanderbilt, Maximally [localized](https://link.aps.org/doi/10.1103/PhysRevB.65.035109) wannier func tions for [entangled](https://link.aps.org/doi/10.1103/PhysRevB.65.035109) energy bands, Phys. Rev. B 65 (2001) 035109. [48] A. Damle, L. Lin, L. Ying, SCDM-k: Localized [orbitals](http://www.sciencedirect.com/science/article/pii/S0021999116307215) for solids via selected columns of the density matrix, J. Comput. Phys. 334 (2017) 1–15. [49] A. Damle, L. Lin, Disentanglement via [Entanglement:](https://doi.org/10.1137/17M1129696) A Unified Method for [Wannier](https://doi.org/10.1137/17M1129696) Localization, Multiscale Model. Simul. 16 (3) (2018) 1392–1410. [50] S. Albrecht, L. Reining, R. Del Sole, G. Onida, Ab initio [calculation](https://link.aps.org/doi/10.1103/PhysRevLett.80.4510) of excitonic effects in the [optical](https://link.aps.org/doi/10.1103/PhysRevLett.80.4510) spectra of semiconductors, Phys. Rev. Lett. 80 (1998) 4510–4513. [51] D. Kammerlander, S. Botti, M. A. L. Marques, A. Marini, C. Attaccalite, [Speeding up the solution of the Bethe-Salpeter equation by a double-grid](https://link.aps.org/doi/10.1103/PhysRevB.86.125203) method and [Wannier](https://link.aps.org/doi/10.1103/PhysRevB.86.125203) interpolation, Phys. Rev. B 86 (2012) 125203. [52] [J. P. Perdew, A. Zunger, Self-interaction correction to density-functional](https://link.aps.org/doi/10.1103/PhysRevB.23.5048) approximations for [many-electron](https://link.aps.org/doi/10.1103/PhysRevB.23.5048) systems, Phys. Rev. B 23 (1981) 5048–5079. 33 [53] S. Albrecht, L. Reining, G. Onida, V. Olevano, R. Del Sole, [Albrecht](https://link.aps.org/doi/10.1103/PhysRevLett.83.3971) et al. [reply:,](https://link.aps.org/doi/10.1103/PhysRevLett.83.3971) Phys. Rev. Lett. 83 (1999) 3971–3971. [54] P. Umari, E. Mosconi, F. De Angelis, Relativistic [GW](http://dx.doi.org/10.1038/srep04467) calculations on [CH3NH3PbI3 and CH3NH3SnI3 Perovskites for Solar Cell Applications,](http://dx.doi.org/10.1038/srep04467) Scientific Reports 4 (2014) 4467. [55] P. Lautenschlager, M. Garriga, L. Vina, M. Cardona, [Temperature](https://link.aps.org/doi/10.1103/PhysRevB.36.4821) de pendence of the dielectric function [and](https://link.aps.org/doi/10.1103/PhysRevB.36.4821) interband critical points in sili[con,](https://link.aps.org/doi/10.1103/PhysRevB.36.4821) Phys. Rev. B 36 (1987) 4821–4830. 34 Tables _<u>Input</u>_ _<u>flag</u>_ _<u>Description</u>_ `prefix` Same as in `pw.x` `outdir` Same as in `pw.x` `calc` `mode` Calculation mode (0 for BSE, 1 for IP) `s` ~~`b`~~ `ands` Threshold for the construction of the OB [bohr <sup>3</sup> ] `num` ~~`n`~~ `bndv` Occupied bands `num` ~~`v`~~ `al` Valence bands (starting from HOMO) `num` ~~`c`~~ `ond` Conduction bands (starting from LUMO) `nkpoints(1)` k-grid ( _n_ 1) `nkpoints(2)` k-grid ( _n_ 2) `nkpoints(3)` k-grid ( _n_ 3) `s` ~~`p`~~ `roduct` Threshold for the construction of the OPB [bohr <sup>3</sup> ] (BSE) `w` ~~`t`~~ `ype` Screened Coulomb interaction from `GWL` calculation (0) or from model microscopic dielectric function (1) (BSE) `nonlocal` `commutator` Flag to calculate the non-local commutator (IP) `epsm` Macroscopic dielectric constant _ϵm_ from model microscopic dielectric function (if `w` ~~`t`~~ `ype` =1) (BSE) `lambdam` Screening length _λ_ from model microscopic dielectric function (if `w` ~~`t`~~ `ype` =1) [bohr <sup>_−_</sup> <sup>1</sup> ] (BSE) `numpw` Dimension of polarizability basis (if `w` ~~`t`~~ `ype` =0) (BSE) `l` ~~`t`~~ `runcated` `coulomb` Flag to activate truncation of Coulomb interaction (BSE) `truncation` `radius` Radius at which Coloumb interaction <u>is</u> <u>truncated</u> <u>[bohr]</u> <u>(BSE)</u> Table 1: Input keywords for `simple.x` . The input file must contain the string `&inputsimple` before inserting any input flag. 35 _<u>Input</u>_ _<u>flag</u>_ _<u>Description</u>_ `simpleip` `in%prefix` Same as in `pw.x` `simpleip` `in%outdir` Same as in `pw.x` `simpleip` `in%interp` `grid(1)` Interpolation k-grid ( _m_ 1) `simpleip` `in%interp` `grid(2)` Interpolation k-grid ( _m_ 2) `simpleip` `in%interp` `grid(3)` Interpolation k-grid ( _m_ 3) `simpleip` `in%fermi` `ngauss` Broadening type for Fermi energy (integer _n_ ) _n_ = _−_ 99 Fermi-Dirac, _n_ = _−_ 1 Marzari-Vanderbilt, _n ≥_ 0 Methfessel-Paxton `simpleip` `in%fermi` `degauss` Broadening for Fermi energy [Ry] `simpleip` `in%drude` `degauss` Broadening for Drude plasma frequency [Ry] `simpleip` `in%inter` `broadening` Empirical broadening for _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> <sup>[Ry]</sup> `simpleip` `in%inter` `broadening` Empirical broadening for _ε_ <sup>inter</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> <sup>[Ry]</sup> `simpleip` `in%intra` `broadening` Empirical broadening for _ε_ <sup>intra</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> <sup>[Ry]</sup> `simpleip` `in%intra` `broadening` Empirical broadening for _ε_ <sup>intra</sup> IP <sup>(ˆ</sup> <sup>q</sup> <sup>_, ω_</sup> <sup>)</sup> <sup>[Ry]</sup> `simpleip` `in%wmin` Minimum frequency for _ε_ IP(ˆ q _, ω_ ) [Ry] `simpleip` `in%wmax` Maximum frequency for _ε_ IP(ˆ q _, ω_ ) [Ry] `simpleip` `in%nw` Number of frequencies in the range [ `wmin`, `wmax` ] `simpleip` `in%nonlocal` ~~`c`~~ `ommutator` Flag to include the non-local commutator `simpleip` `in%nonlocal` ~~`i`~~ `nterpolation` Flag to use linear interpolation of non-local <u>contributions</u> <u>(experimental</u> <u>feature)</u> Table 2: Input keywords for `simple` ~~`i`~~ `p.x` . The input file must contain the string `&inputsimpleip` before inserting any input flag. The prefix of each input flag is `simpleip` ~~`i`~~ `n%` as reported in the table. 36 _<u>Input</u>_ _<u>flag</u>_ _<u>Description</u>_ `simple` `in%prefix` Same as in `pw.x` `simple` `in%outdir` Same as in `pw.x` `simple` `in%scissor` Rigid scissor energy for opening DFT gap [eV] `simple` `in%spin` ~~`s`~~ `tate` In case of collinear spin calculation selects triplet (0) or or singlet (1) excitons, (2) for the case of non-collinear spin `simple` `in%h` `level` Terms in excitonic Hamiltonian: (0) only diagonal, (1) as (0) plus exchange term, (2) as (1) plus direct term of bare Coulomb part, (3) as (2) plus direct term of correlation part `simple` `in%task` If set to 0 find the lowest excitons, if set to 1 find the _αi_ and _βi_ coefficients of the Haydock recursive method `simple` `in%nvec` Number of excitons to be found `simple` `in%thr` `evc` Threshold for defining converged excitonic eigenenergies [eV] `simple` `in%diago` Algorithm for finding excitonic eigenvectors: (0) steepest descent (1) conjugate gradient `simple` `in%max` `nstep` Maximum number of steps during minimizations <u>`simple`</u> <u>`in%lanczos`</u> <u>`step`</u> <u>Number</u> <u>of</u> <u>steps</u> <u>for</u> <u>the</u> <u>Haydock</u> <u>recursive</u> <u>method</u> Table 3: Input keywords for `simple` `bse.x` . The input file must contain the string `&inputsimple` before inserting any input flag. The prefix of each input flag is `simple` ~~`i`~~ `n%` as reported in the table. 37 Figures calc_mode=1 (IP) Compute matrix elements: nonlocal_commutator=.true. pw.x _nscf_ calculation simple.x Construct the OB calc_mode=0 (BSE) Construct the OPB Compute matrix elements: simple_ip.x simple_bse.x w_type=1 Model for W w_type=0 GWL calculation Read matrix elements <u>For each k-point in interp_grid:</u> Build and diagonalize Compute Dielectric function Read matrix elements Construct the excitonic Hamiltonian task=0 task=1 Iterative diagonalization Haydock recursive method (conjugate-gradient) Lowest excitonic states Dielectric function Figure 1: Schematic structure of the `SIMPLE` code. Two steps are required for the calculation of the optical properties. In the first step `simple.x` reads the data produced by a previous _nscf_ calculation performed with `pw.x` of QE, builds the optimal basis and saves to disk the matrix elements needed for the subsequent IP or BSE calculation. In the second step, `simple` ~~`i`~~ `p.x` or `simple` ~~`b`~~ `se.x` reads the matrix elements and performs the actual IP or BSE calculation, respectively. 38 Figure 2: Convergence of the IP complex dielectric function (here we show the imaginary part of the interband contribution _ℑ_ - _ε_ <sup>inter</sup> IP (ˆ q _, ω_ )�) for bulk Ag with respect to the size - _ε_ <sup>inter</sup> IP part of the interband contribution _ℑ_ - _ε_ <sup>inter</sup> IP (ˆ q _, ω_ )�) for bulk Ag with respect to the size of the optimal basis, which is controlled by the _sb_ threshold ( `s` ~~`b`~~ `ands` input variable for `simple.x`, in bohr <sup>3</sup> ). The corresponding dimension _Nb_ of the optimal basis is also reported. <sup>inter</sup> IP (ˆ q _, ω_ ) 39 Figure 3: Comparison of the interband contribution to the IP complex dielectric function of bulk Ag calculated with the `SIMPLE` code and with the Yambo code. We show both the real (right panel) and imaginary parts (left panel) of _ε_ <sup>inter</sup> IP (ˆ q _, ω_ ). Figure 4: Convergence of the imaginary part of the BSE complex dielectric function _ℑ_ [ _ε_ BSE(ˆ q _, ω_ )] for bulk Si with respect to the _sb_ threshold (in bohr <sup>3</sup> ) while the _sp_ threshold is kept fixed to 1 _._ 0 bohr <sup>3</sup> (left panel) and with respect to the _sp_ threshold (in bohr <sup>3</sup> ) while the _sb_ threshold is kept fixed to 0 _._ 1 bohr <sup>3</sup> (right panel). The corresponding dimensions _Nb_ and _Np_ of the optimal basis and of the optimal product basis, respectively, are also reported. 40 Figure 5: Comparison of the imaginary part of the BSE complex dielectric function _ℑ_ [ _ε_ BSE(ˆ q _, ω_ )] for bulk Si obtained with the `SIMPLE` code (solid red) with respect to previous BSE calculations: S. Albrecht _et_ _al_ . [30] (dashed blue), G. Onida _et_ _al_ . [3] (solid blue), D. Kammerlander _et_ _al_ . [51] (dotted blue) and with respect to experiments (exp.): P. Lautenschlager _et_ _al_ . [55] (solid black). 41 Figure 6: Relative computational time for a IP calculation performed with the `SIMPLE` code on bulk Ag, both including and not including the non-local commutator in the evaluation of the velocity matrix elements, with respect to the square of the number of optimal basis functions _Nb_ . The reference wall time is set as the one resulting from the calculation with the smallest number of vectors. Figure 7: Relative computational time for a BSE calculation performed with the `SIMPLE` code on bulk Si with respect to the number of optimal product basis functions _Np_ (left panel) and to the number of optimal basis functions _Nb_ (right panel). The reference wall time is set as the one resulting from the calculation with the smallest number of vectors. 42 Figure 8: Speedup of an IP calculation performed with the `SIMPLE` code ( `simple.x` and `simple` ~~`i`~~ `p.x` ) as a function of the number of cores for bulk Ag in a 4 _×_ 4 _×_ 4 supercell with 64 atoms including and not including the contribution to the velocity matrix elements coming from the non-local commutator. The test is performed on Intel _⃝_ <sup>R</sup> Skylake _⃝_ R processors. Figure 9: Speedup of a BSE calculation performed with the `SIMPLE` code ( `simple` ~~`b`~~ `se.x` ) as a function of the number of computing cores for bulk CH3NH3PbI3 (48 atoms) with a 4 _×_ 4 _×_ 4 mesh of k-points. The cost of the foregoing `simple.x` run is negligible. (Left panel) The number of MPI tasks is kept fixed to 64 while the number of OpenMP threads for each task varies from 4 to 16. (Right panel) The number of OpenMP threads for each MPI task is kept fixed to 68 while the number of the latter varies from 54 to 108. The test is performed on Intel _⃝_ <sup>R</sup> Xeon Phi7250 _⃝_ R (KnightLandings _⃝_ R ) processors. 43

섹션 본문

섹션 본문이 없습니다.

참고문헌

참고문헌 정보가 없습니다.