GQCP
Loading...
Searching...
No Matches
QCStructure.hpp
Go to the documentation of this file.
1// This file is part of GQCG-GQCP.
2//
3// Copyright (C) 2017-2020 the GQCG developers
4//
5// GQCG-GQCP is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// GQCG-GQCP is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GQCG-GQCP. If not, see <http://www.gnu.org/licenses/>.
17
18#pragma once
19
20
21#include <stdexcept>
22
23#include <vector>
24
25
26namespace GQCP {
27
28
35template <typename _QCModel, typename _Scalar = double>
37public:
38 // The type of the optimal model parameters.
39 using QCModel = _QCModel;
40
41 // The scalar type of the energy: real or complex.
42 using Scalar = _Scalar;
43
44
45private:
46 // The electronic energies for the ground state and possibly for the excited states.
47 std::vector<Scalar> energies;
48
49 // The optimal model parameters for the ground state and possibly for the excited states.
50 std::vector<QCModel> model_parameters;
51
52
53public:
54 /*
55 * MARK: Constructors
56 */
57
62 QCStructure(const std::vector<Scalar>& energies, const std::vector<QCModel>& model_parameters) :
63 energies {energies},
64 model_parameters {model_parameters} {
65
66 const auto n = energies.size();
67
68 if (n < 1) {
69 throw std::invalid_argument("QCStructure(const std::vector<Scalar>&, const std::vector<QCModel>&): You have given an empty number of energies.");
70 }
71
72 if (n != model_parameters.size()) {
73 throw std::invalid_argument("QCStructure(const std::vector<Scalar>&, const std::vector<QCModel>&): The number of energies and sets of parameters do not match.");
74 }
75 }
76
77
78 /*
79 * MARK: Energy
80 */
81
87 Scalar energy(const size_t i = 0) const { return this->energies[i]; }
88
92 Scalar groundStateEnergy() const { return this->energy(); }
93
94
95 /*
96 * MARK: Parameters
97 */
98
104 const QCModel& parameters(const size_t i = 0) const { return this->model_parameters[i]; }
105
109 const QCModel& groundStateParameters() const { return this->parameters(); }
110};
111
112
113} // namespace GQCP
Definition: QCStructure.hpp:36
const QCModel & parameters(const size_t i=0) const
Definition: QCStructure.hpp:104
_QCModel QCModel
Definition: QCStructure.hpp:39
Scalar groundStateEnergy() const
Definition: QCStructure.hpp:92
Scalar energy(const size_t i=0) const
Definition: QCStructure.hpp:87
const QCModel & groundStateParameters() const
Definition: QCStructure.hpp:109
QCStructure(const std::vector< Scalar > &energies, const std::vector< QCModel > &model_parameters)
Definition: QCStructure.hpp:62
_Scalar Scalar
Definition: QCStructure.hpp:42
Definition: BaseOneElectronIntegralBuffer.hpp:25