GQCP
Loading...
Searching...
No Matches
ConstantDamper.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
21namespace GQCP {
22
23
28private:
29 double alpha; // the damping factor
30
31
32public:
33 /*
34 * CONSTRUCTORS
35 */
36
40 ConstantDamper(const double alpha) :
41 alpha {alpha} {
42
43 if ((this->alpha > 1.0) || (this->alpha < 0)) {
44 throw std::invalid_argument("ConstantDamper::ConstantDamper(const double): The given damping factor must be between 0.0 and 1.0.");
45 }
46 }
47
48
49 /*
50 * PUBLIC METHODS
51 */
52
63 template <typename Subject>
64 Subject accelerate(const Subject& last, const Subject& next_to_last) {
65
66 Subject accelerated_subject = last * this->alpha + next_to_last * (1 - this->alpha);
67 return accelerated_subject;
68 }
69};
70
71
72} // namespace GQCP
Definition: ConstantDamper.hpp:27
ConstantDamper(const double alpha)
Definition: ConstantDamper.hpp:40
Subject accelerate(const Subject &last, const Subject &next_to_last)
Definition: ConstantDamper.hpp:64
Definition: BaseOneElectronIntegralBuffer.hpp:25
@ alpha
Definition: Spin.hpp:28