pairinteraction
A Rydberg Interaction Calculator
spherical.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 Pairinteraction Developers
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#pragma once
5
9
10#include <Eigen/Dense>
11#include <array>
12#include <complex>
13#include <limits>
14#include <stdexcept>
15#include <unsupported/Eigen/KroneckerProduct>
16
17using namespace std::complex_literals;
18
20
22extern const Eigen::Matrix<std::complex<double>, 6, 9> CARTESIAN_TO_SPHERICAL_KAPPA2;
23
24template <typename Scalar>
25inline const Eigen::MatrixX<Scalar> &get_transformator(int kappa) {
26 if (kappa == 1) {
28 static const auto mat = Eigen::MatrixX<Scalar>(
29 spherical::CARTESIAN_TO_SPHERICAL_KAPPA1.template cast<Scalar>());
30 return mat;
31 }
32 static const auto mat = Eigen::MatrixX<Scalar>(
33 spherical::CARTESIAN_TO_SPHERICAL_KAPPA1.real().template cast<Scalar>());
34 return mat;
35 }
36 if (kappa == 2) {
38 static const auto mat = Eigen::MatrixX<Scalar>(
39 spherical::CARTESIAN_TO_SPHERICAL_KAPPA2.template cast<Scalar>());
40 return mat;
41 }
42 static const auto mat = Eigen::MatrixX<Scalar>(
43 spherical::CARTESIAN_TO_SPHERICAL_KAPPA2.real().template cast<Scalar>());
44 return mat;
45 }
46 throw std::invalid_argument("Invalid kappa value. Must be 1 or 2.");
47}
48} // namespace pairinteraction::spherical
Matrix< Type, 3, 3 > Matrix3
Matrix< Type, Dynamic, Dynamic > MatrixX
const Eigen::Matrix< std::complex< double >, 6, 9 > CARTESIAN_TO_SPHERICAL_KAPPA2
Definition: spherical.cpp:33
const Eigen::Matrix3< std::complex< double > > CARTESIAN_TO_SPHERICAL_KAPPA1
Definition: spherical.cpp:22
const Eigen::MatrixX< Scalar > & get_transformator(int kappa)
Definition: spherical.hpp:25
Helper struct to extract types from a numerical type.
Definition: traits.hpp:35