Line data Source code
1 : // SPDX-FileCopyrightText: 2024 Pairinteraction Developers 2 : // SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : #include "pairinteraction/utils/spherical.hpp" 5 : 6 : #include <doctest/doctest.h> 7 : 8 : namespace pairinteraction { 9 2 : DOCTEST_TEST_CASE("convert cartesian to spherical basis") { 10 2 : DOCTEST_SUBCASE("kappa == 1") { 11 : auto identity = spherical::CARTESIAN_TO_SPHERICAL_KAPPA1 * 12 1 : spherical::CARTESIAN_TO_SPHERICAL_KAPPA1.adjoint(); 13 : 14 1 : DOCTEST_CHECK(identity.isApprox(Eigen::Matrix3<double>::Identity(), 1e-9)); 15 2 : } 16 : 17 2 : DOCTEST_SUBCASE("kappa == 2") { 18 : auto diagonal = spherical::CARTESIAN_TO_SPHERICAL_KAPPA2 * 19 1 : spherical::CARTESIAN_TO_SPHERICAL_KAPPA2.adjoint(); 20 : 21 1 : DOCTEST_CHECK(diagonal.isDiagonal(1e-9)); 22 2 : } 23 2 : } 24 : } // namespace pairinteraction