LCOV - code coverage report
Current view: top level - include/pairinteraction/basis - BasisAtomCreator.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2026-09-21 10:40:23 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // SPDX-FileCopyrightText: 2024 PairInteraction Developers
       2             : // SPDX-License-Identifier: LGPL-3.0-or-later
       3             : 
       4             : #pragma once
       5             : 
       6             : #include "pairinteraction/utils/Range.hpp"
       7             : #include "pairinteraction/utils/traits.hpp"
       8             : 
       9             : #include <complex>
      10             : #include <memory>
      11             : #include <optional>
      12             : #include <string>
      13             : #include <unordered_map>
      14             : #include <vector>
      15             : 
      16             : namespace pairinteraction {
      17             : template <typename Scalar>
      18             : class BasisAtom;
      19             : 
      20             : class KetAtom;
      21             : 
      22             : class Database;
      23             : 
      24             : /**
      25             :  * @class BasisAtomCreator
      26             :  *
      27             :  * @brief Builder class for creating BasisAtom objects.
      28             :  *
      29             :  * @tparam Scalar Complex number type.
      30             :  */
      31             : template <typename Scalar>
      32             : class BasisAtomCreator {
      33             :     static_assert(traits::NumTraits<Scalar>::from_floating_point_v);
      34             : 
      35             : public:
      36             :     using real_t = typename traits::NumTraits<Scalar>::real_t;
      37             :     using ket_t = KetAtom;
      38        1594 :     BasisAtomCreator() = default;
      39             :     BasisAtomCreator<Scalar> &set_species(const std::string &value);
      40             :     BasisAtomCreator<Scalar> &restrict_energy(real_t min, real_t max);
      41             :     // Set the quantum number range with the given logical name (e.g. "f", "m", "n", "l", ...).
      42             :     // The parity is restricted via the name "parity" with a value of +1 (even) or -1 (odd).
      43             :     BasisAtomCreator<Scalar> &restrict_quantum_number(const std::string &name, real_t min,
      44             :                                                       real_t max);
      45             :     BasisAtomCreator<Scalar> &set_quantum_number_standard_deviation_factor(real_t value);
      46             :     BasisAtomCreator<Scalar> &add_ket(const std::shared_ptr<const ket_t> &ket);
      47             :     std::shared_ptr<const BasisAtom<Scalar>> create(Database &database) const;
      48             : 
      49             : private:
      50             :     std::optional<std::string> species;
      51             :     Range<real_t> range_energy;
      52             :     std::unordered_map<std::string, Range<real_t>> quantum_number_ranges;
      53             :     real_t quantum_number_standard_deviation_factor{2};
      54             :     std::vector<size_t> additional_ket_ids;
      55             :     std::optional<std::string> additional_ket_species;
      56             : };
      57             : 
      58             : extern template class BasisAtomCreator<double>;
      59             : extern template class BasisAtomCreator<std::complex<double>>;
      60             : } // namespace pairinteraction

Generated by: LCOV version 1.16