GQCP
Loading...
Searching...
No Matches
UHFSCFSolver.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
60 static IterativeAlgorithm<UHFSCFEnvironment<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) {
61
62 // Create the iteration cycle that effectively 'defines' a DIIS UHF SCF solver.
63 StepCollection<UHFSCFEnvironment<Scalar>> diis_uhf_scf_cycle {};
64 diis_uhf_scf_cycle
68 .add(UHFFockMatrixDIIS<Scalar>(minimum_subspace_dimension, maximum_subspace_dimension)) // This also calculates the next coefficient matrix.
70
71 // Create a convergence criterion on the norm of subsequent density matrices.
72 const std::function<std::deque<SpinResolved1DM<Scalar>>(const UHFSCFEnvironment<Scalar>&)> density_matrix_extractor = [](const UHFSCFEnvironment<Scalar>& environment) { return environment.density_matrices; };
73
75 const ConvergenceType convergence_criterion {threshold, density_matrix_extractor, "the UHF spin resolved density matrix in AO basis"};
76
77 return IterativeAlgorithm<UHFSCFEnvironment<Scalar>>(diis_uhf_scf_cycle, convergence_criterion, maximum_number_of_iterations);
78 }
79
80
87 static IterativeAlgorithm<UHFSCFEnvironment<Scalar>> Plain(const double threshold = 1.0e-08, const size_t maximum_number_of_iterations = 128) {
88
89 // Create the iteration cycle that effectively 'defines' a plain UHF SCF solver.
90 StepCollection<UHFSCFEnvironment<Scalar>> plain_uhf_scf_cycle {};
91 plain_uhf_scf_cycle
96
97 // Create a convergence criterion on the norm of subsequent density matrices.
98 const std::function<std::deque<SpinResolved1DM<Scalar>>(const UHFSCFEnvironment<Scalar>&)> density_matrix_extractor = [](const UHFSCFEnvironment<Scalar>& environment) { return environment.density_matrices; };
99
101 const ConvergenceType convergence_criterion {threshold, density_matrix_extractor, "the UHF spin resolved density matrix in AO basis"};
102
103 return IterativeAlgorithm<UHFSCFEnvironment<Scalar>>(plain_uhf_scf_cycle, convergence_criterion, maximum_number_of_iterations);
104 }
105};
106
107
108} // namespace GQCP
Definition: ConsecutiveIteratesNormConvergence.hpp:40
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: UHFDensityMatrixCalculation.hpp:36
Definition: UHFElectronicEnergyCalculation.hpp:37
Definition: UHFErrorCalculation.hpp:36
Definition: UHFFockMatrixCalculation.hpp:36
Definition: UHFFockMatrixDIIS.hpp:40
Definition: UHFFockMatrixDiagonalization.hpp:37
Definition: UHFSCFEnvironment.hpp:45
std::deque< SpinResolved1DM< Scalar > > density_matrices
Definition: UHFSCFEnvironment.hpp:61
Definition: UHFSCFSolver.hpp:42
static IterativeAlgorithm< UHFSCFEnvironment< 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: UHFSCFSolver.hpp:60
static IterativeAlgorithm< UHFSCFEnvironment< Scalar > > Plain(const double threshold=1.0e-08, const size_t maximum_number_of_iterations=128)
Definition: UHFSCFSolver.hpp:87
_Scalar Scalar
Definition: UHFSCFSolver.hpp:44
Definition: BaseOneElectronIntegralBuffer.hpp:25