GQCP
Loading...
Searching...
No Matches
RHFSCFSolver.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
31
32
33namespace GQCP {
34
35
41template <typename _Scalar>
43public:
44 using Scalar = _Scalar;
45
46
47public:
48 /*
49 * PUBLIC STATIC METHODS
50 */
51
59 static IterativeAlgorithm<RHFSCFEnvironment<Scalar>> DensityDamped(const double alpha, const double threshold = 1.0e-08, const size_t maximum_number_of_iterations = 128) {
60
61 // Create the iteration cycle that effectively 'defines' a damped RHF SCF solver.
62 StepCollection<RHFSCFEnvironment<Scalar>> damped_rhf_scf_cycle {};
63 damped_rhf_scf_cycle
69
70 // Create a convergence criterion on the norm of subsequent density matrices.
71 const std::function<std::deque<Orbital1DM<Scalar>>(const RHFSCFEnvironment<Scalar>&)> density_matrix_extractor = [](const RHFSCFEnvironment<Scalar>& environment) { return environment.density_matrices; };
72
74 const ConvergenceType convergence_criterion {threshold, density_matrix_extractor, "the RHF density matrix in AO basis"};
75
76 return IterativeAlgorithm<RHFSCFEnvironment<Scalar>>(damped_rhf_scf_cycle, convergence_criterion, maximum_number_of_iterations);
77 }
78
79
88 static IterativeAlgorithm<RHFSCFEnvironment<Scalar>> DIIS(const size_t minimum_subspace_dimension = 6, const size_t maximum_subspace_dimension = 6, const double threshold = 1.0e-08, const size_t maximum_number_of_iterations = 128) {
89
90 // Create the iteration cycle that effectively 'defines' a DIIS RHF SCF solver.
91 StepCollection<RHFSCFEnvironment<Scalar>> diis_rhf_scf_cycle {};
92 diis_rhf_scf_cycle
96 .add(RHFFockMatrixDIIS<Scalar>(minimum_subspace_dimension, maximum_subspace_dimension)) // This also calculates the next coefficient matrix.
98
99 // Create a convergence criterion on the norm of subsequent density matrices.
100 const std::function<std::deque<Orbital1DM<Scalar>>(const RHFSCFEnvironment<Scalar>&)> density_matrix_extractor = [](const RHFSCFEnvironment<Scalar>& environment) { return environment.density_matrices; };
101
103 const ConvergenceType convergence_criterion {threshold, density_matrix_extractor, "the RHF density matrix in AO basis"};
104
105 return IterativeAlgorithm<RHFSCFEnvironment<Scalar>>(diis_rhf_scf_cycle, convergence_criterion, maximum_number_of_iterations);
106 }
107
108
115 static IterativeAlgorithm<RHFSCFEnvironment<Scalar>> Plain(const double threshold = 1.0e-08, const size_t maximum_number_of_iterations = 128) {
116
117 // Create the iteration cycle that effectively 'defines' a plain RHF SCF solver.
118 StepCollection<RHFSCFEnvironment<Scalar>> plain_rhf_scf_cycle {};
119 plain_rhf_scf_cycle
124
125 // Create a convergence criterion on the norm of subsequent density matrices.
126 const auto density_matrix_extractor = [](const RHFSCFEnvironment<Scalar>& environment) { return environment.density_matrices; };
127
129 const ConvergenceType convergence_criterion {threshold, density_matrix_extractor, "the RHF density matrix in AO basis"};
130
131 return IterativeAlgorithm<RHFSCFEnvironment<Scalar>>(plain_rhf_scf_cycle, convergence_criterion, maximum_number_of_iterations);
132 }
133};
134
135
136} // namespace GQCP
Definition: ConsecutiveIteratesNormConvergence.hpp:40
Definition: IterativeAlgorithm.hpp:38
Definition: RHFDensityMatrixCalculation.hpp:36
Definition: RHFDensityMatrixDamper.hpp:37
Definition: RHFElectronicEnergyCalculation.hpp:36
Definition: RHFErrorCalculation.hpp:36
Definition: RHFFockMatrixCalculation.hpp:36
Definition: RHFFockMatrixDIIS.hpp:40
Definition: RHFFockMatrixDiagonalization.hpp:37
Definition: RHFSCFEnvironment.hpp:45
std::deque< Orbital1DM< Scalar > > density_matrices
Definition: RHFSCFEnvironment.hpp:60
Definition: RHFSCFSolver.hpp:42
static IterativeAlgorithm< RHFSCFEnvironment< Scalar > > DensityDamped(const double alpha, const double threshold=1.0e-08, const size_t maximum_number_of_iterations=128)
Definition: RHFSCFSolver.hpp:59
static IterativeAlgorithm< RHFSCFEnvironment< Scalar > > DIIS(const size_t minimum_subspace_dimension=6, const size_t maximum_subspace_dimension=6, const double threshold=1.0e-08, const size_t maximum_number_of_iterations=128)
Definition: RHFSCFSolver.hpp:88
_Scalar Scalar
Definition: RHFSCFSolver.hpp:44
static IterativeAlgorithm< RHFSCFEnvironment< Scalar > > Plain(const double threshold=1.0e-08, const size_t maximum_number_of_iterations=128)
Definition: RHFSCFSolver.hpp:115
Definition: StepCollection.hpp:41
enable_if_t< std::is_same< Environment, typename Z::Environment >::value, StepCollection< Environment > & > add(const Z &step)
Definition: StepCollection.hpp:92
Definition: BaseOneElectronIntegralBuffer.hpp:25
@ alpha
Definition: Spin.hpp:28