GQCP
Loading...
Searching...
No Matches
GHFSCFSolver.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
30
31
32namespace GQCP {
33
34
40template <typename _Scalar>
42public:
43 using Scalar = _Scalar;
44
45
46public:
47 /*
48 * PUBLIC STATIC METHODS
49 */
50
57 static IterativeAlgorithm<GHFSCFEnvironment<Scalar>> Plain(const double threshold = 1.0e-08, const size_t maximum_number_of_iterations = 128) {
58
59 // Create the iteration cycle that effectively 'defines' a plain GHF SCF solver.
60 StepCollection<GHFSCFEnvironment<Scalar>> plain_ghf_scf_cycle {};
61 plain_ghf_scf_cycle
66
67 // Create a convergence criterion on the norm of subsequent density matrices.
68 const auto density_matrix_extractor = [](const GHFSCFEnvironment<Scalar>& environment) { return environment.density_matrices; };
69
71 const ConvergenceType convergence_criterion {threshold, density_matrix_extractor, "the GHF density matrix in AO basis"};
72
73 return IterativeAlgorithm<GHFSCFEnvironment<Scalar>>(plain_ghf_scf_cycle, convergence_criterion, maximum_number_of_iterations);
74 }
75
76
85 static IterativeAlgorithm<GHFSCFEnvironment<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) {
86
87 // Create the iteration cycle that effectively 'defines' a DIIS GHF SCF solver.
88 StepCollection<GHFSCFEnvironment<Scalar>> diis_ghf_scf_cycle {};
89 diis_ghf_scf_cycle
93 .add(GHFFockMatrixDIIS<Scalar>(minimum_subspace_dimension, maximum_subspace_dimension)) // This also calculates the next coefficient matrix.
95
96 // Create a convergence criterion on the norm of subsequent density matrices.
97 const std::function<std::deque<G1DM<Scalar>>(const GHFSCFEnvironment<Scalar>&)> density_matrix_extractor = [](const GHFSCFEnvironment<Scalar>& environment) { return environment.density_matrices; };
98
100 const ConvergenceType convergence_criterion {threshold, density_matrix_extractor, "the GHF density matrix in AO basis"};
101
102 return IterativeAlgorithm<GHFSCFEnvironment<Scalar>>(diis_ghf_scf_cycle, convergence_criterion, maximum_number_of_iterations);
103 }
104};
105
106
107} // namespace GQCP
Definition: ConsecutiveIteratesNormConvergence.hpp:40
Definition: GHFDensityMatrixCalculation.hpp:36
Definition: GHFElectronicEnergyCalculation.hpp:36
Definition: GHFErrorCalculation.hpp:36
Definition: GHFFockMatrixCalculation.hpp:36
Definition: GHFFockMatrixDIIS.hpp:40
Definition: GHFFockMatrixDiagonalization.hpp:37
Definition: GHFSCFEnvironment.hpp:45
std::deque< G1DM< Scalar > > density_matrices
Definition: GHFSCFEnvironment.hpp:60
Definition: GHFSCFSolver.hpp:41
static IterativeAlgorithm< GHFSCFEnvironment< Scalar > > Plain(const double threshold=1.0e-08, const size_t maximum_number_of_iterations=128)
Definition: GHFSCFSolver.hpp:57
static IterativeAlgorithm< GHFSCFEnvironment< 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: GHFSCFSolver.hpp:85
_Scalar Scalar
Definition: GHFSCFSolver.hpp:43
Definition: IterativeAlgorithm.hpp:38
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