Line data Source code
1 : // SPDX-FileCopyrightText: 2024 Pairinteraction Developers 2 : // SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : #include "pairinteraction/operator/OperatorAtom.hpp" 5 : 6 : #include "pairinteraction/basis/BasisAtom.hpp" 7 : #include "pairinteraction/database/Database.hpp" 8 : #include "pairinteraction/enums/OperatorType.hpp" 9 : 10 : #include <limits> 11 : 12 : namespace pairinteraction { 13 : template <typename Scalar> 14 60 : OperatorAtom<Scalar>::OperatorAtom(std::shared_ptr<const basis_t> basis) 15 60 : : Operator<OperatorAtom<Scalar>>(std::move(basis)) {} 16 : 17 : template <typename Scalar> 18 223 : OperatorAtom<Scalar>::OperatorAtom(std::shared_ptr<const basis_t> basis, OperatorType type, int q) 19 223 : : Operator<OperatorAtom<Scalar>>(std::move(basis)) { 20 222 : if (type == OperatorType::ENERGY) { 21 57 : this->initialize_as_energy_operator(); 22 : } else { 23 166 : this->initialize_from_matrix( 24 165 : this->basis->get_database().get_matrix_elements(this->basis, this->basis, type, q)); 25 : } 26 223 : } 27 : 28 : template <typename Scalar> 29 0 : OperatorAtom<Scalar>::OperatorAtom(std::shared_ptr<const basis_t> basis, 30 : Eigen::SparseMatrix<Scalar, Eigen::RowMajor> &&matrix) 31 0 : : Operator<OperatorAtom<Scalar>>(std::move(basis)) { 32 0 : this->matrix = std::move(matrix); 33 0 : } 34 : 35 : // Explicit instantiations 36 : template class OperatorAtom<double>; 37 : template class OperatorAtom<std::complex<double>>; 38 : } // namespace pairinteraction