TRIQS/triqs_modest 3.3.0
Modular Electronic Structure Toolkit
Loading...
Searching...
No Matches
spherical_rotation.cpp
Go to the documentation of this file.
1// Copyright (c) 2025--present, The Simons Foundation
2// This file is part of TRIQS/modest and is licensed under the terms of GPLv3 or later.
3// SPDX-License-Identifier: GPL-3.0-or-later
4// See LICENSE in the root of this distribution for details.
5
6#include "../spherical_rotation.hpp"
7#include <stdexcept>
8
10
11 nda::matrix<dcomplex> get_spherical_to_dft_rotation(long l) {
12 if (l == 0) throw std::runtime_error("No l=0 implementation");
13
14 auto sqrt2 = std::numbers::sqrt2;
15 auto I = dcomplex(0, 1.0);
16 auto size = 2 * l + 1;
17 auto Ylm = nda::zeros<dcomplex>(size, size);
18
19 // l = 1: "z", "x" , "y"
20 if (l == 1) {
21 Ylm(1, 0) = 1.0 / sqrt2;
22 Ylm(2, 0) = I / sqrt2;
23 Ylm(0, 1) = 1.0;
24 Ylm(1, 2) = -1.0 / sqrt2;
25 Ylm(2, 2) = I / sqrt2;
26 }
27 // l = 2: "z^2", "xz", "yz", "x^2-y^2", "xy"
28 else if (l == 2) {
29 Ylm(0, 0) = I / sqrt2;
30 Ylm(1, 1) = I / sqrt2;
31 Ylm(2, 2) = 1.0;
32 Ylm(3, 1) = 1 / sqrt2;
33 Ylm(4, 1) = 1 / sqrt2;
34 Ylm(0, 4) = -I / sqrt2;
35 Ylm(1, 3) = I / sqrt2;
36 Ylm(3, 3) = -1.0 / sqrt2;
37 Ylm(4, 4) = 1.0 / sqrt2;
38 }
39 // l = 3: "x(x^2-3y^2)","z(x^2-y^2)","xz^2","z^3","yz^2","xyz","y(3x^2-y^2)"
40 else if (l == 3) {
41 Ylm(0, 0) = 1.0 / sqrt2;
42 Ylm(1, 1) = 1.0 / sqrt2;
43 Ylm(2, 2) = 1.0 / sqrt2;
44 Ylm(0, 6) = 1.0 / sqrt2;
45 Ylm(1, 5) = 1.0 / sqrt2;
46 Ylm(2, 4) = 1.0 / sqrt2;
47 Ylm(3, 3) = 1.0;
48 Ylm(4, 2) = I / sqrt2;
49 Ylm(5, 1) = I / sqrt2;
50 Ylm(6, 0) = I / sqrt2;
51 Ylm(4, 4) = I / sqrt2;
52 Ylm(5, 5) = -I / sqrt2;
53 Ylm(6, 6) = I / sqrt2;
54 }
55 return Ylm;
56 }
57} // namespace triqs::modest::dft_tools::qe
nda::matrix< dcomplex > get_spherical_to_dft_rotation(long l)
std::complex< double > dcomplex
Definition nda_supp.hpp:8