Line data Source code
1 : /* 2 : * Copyright (c) 2016 Sebastian Weber, Henri Menke. All rights reserved. 3 : * 4 : * This file is part of the pairinteraction library. 5 : * 6 : * The pairinteraction library is free software: you can redistribute it and/or modify 7 : * it under the terms of the GNU Lesser General Public License as published by 8 : * the Free Software Foundation, either version 3 of the License, or 9 : * (at your option) any later version. 10 : * 11 : * The pairinteraction library is distributed in the hope that it will be useful, 12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 : * GNU Lesser General Public License for more details. 15 : * 16 : * You should have received a copy of the GNU Lesser General Public License 17 : * along with the pairinteraction library. If not, see <http://www.gnu.org/licenses/>. 18 : */ 19 : 20 : #ifndef HAMILTONIAN_H 21 : #define HAMILTONIAN_H 22 : 23 : #include "Hamiltonianmatrix.hpp" 24 : 25 : #include <vector> 26 : 27 : template <typename Scalar, class Basisnames> 28 : class Hamiltonian { 29 : public: 30 5 : Hamiltonian() = default; 31 12 : std::shared_ptr<Hamiltonianmatrix<Scalar>> get(size_t idx) { return matrix_diag[idx]; } 32 : std::shared_ptr<const Hamiltonianmatrix<Scalar>> get(size_t idx) const { 33 : return matrix_diag[idx]; 34 : } 35 2 : std::shared_ptr<const Configuration> getParams(size_t idx) const { return params[idx]; } 36 6 : size_t size() const { return matrix_diag.size(); } 37 6 : std::shared_ptr<const Basisnames> names() const { return basis; } 38 2 : void removeUnnecessaryStates(std::vector<bool> &necessary) { 39 2 : basis->removeUnnecessaryStates(necessary); 40 4 : for (auto &p : matrix_diag) { 41 2 : p->removeUnnecessaryStates(necessary); 42 : } 43 2 : } 44 : 45 : protected: 46 : std::vector<std::shared_ptr<Hamiltonianmatrix<Scalar>>> matrix_diag; 47 : std::vector<std::string> matrix_path; 48 : std::vector<std::shared_ptr<Configuration>> params; 49 : std::shared_ptr<Basisnames> basis; 50 : }; 51 : 52 : #endif // HAMILTONIAN_H