GQCP
Loading...
Searching...
No Matches
SimpleSpinorBasis.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
24#include "Utilities/CRTP.hpp"
26
27
28namespace GQCP {
29
30/*
31 * MARK: SpinorBasisTraits
32 */
33
37template <typename SpinorBasis>
39
40
41/*
42 * MARK: SimpleSpinorBasis
43 */
44
51template <typename _ExpansionScalar, typename _FinalSpinorBasis>
53 public CRTP<_FinalSpinorBasis>,
54 public BasisTransformable<_FinalSpinorBasis>,
55 public JacobiRotatable<_FinalSpinorBasis> {
56
57public:
58 // The scalar type used to represent an expansion coefficient of the spinors in the underlying scalar orbitals: real or complex.
59 using ExpansionScalar = _ExpansionScalar;
60
61 // The spinor basis that ultimately derives from this class, enabling CRTP and compile-time polymorphism.
62 using FinalSpinorBasis = _FinalSpinorBasis;
63
64 // The type of transformation that is naturally related to the final spinor basis.
66
67 // The type of Jacobi rotation that is naturally related to the final spinor basis.
69
70 // The second-quantized representation of the overlap operator related to the final spinor basis.
72
73
74protected:
75 // The transformation that relates the current set of spinors with the atomic spinors.
77
78
79public:
80 /*
81 * MARK: Constructors
82 */
83
88 C {C} {}
89
90
91 /*
92 * MARK: Coefficient access
93 */
94
98 const Transformation& expansion() const { return this->C; }
99
100
101 /*
102 * MARK: General information
103 */
104
108 size_t simpleDimension() const { return this->expansion().dimension(); }
109
110
111 /*
112 * MARK: Orthonormality
113 */
114
118 SQOverlapOperator overlap() const { return this->derived().quantize(OverlapOperator()); }
119
127 bool isOrthonormal(const double precision = 1.0e-08) const {
128
129 const auto S = this->overlap().parameters();
130
131 const auto dim = this->simpleDimension();
132 return S.isApprox(SquareMatrix<ExpansionScalar>::Identity(dim), precision);
133 }
134
139
140 // Calculate S^{-1/2}, where S is expressed with respect to the current spinors.
141 const auto S = this->overlap().parameters();
142 Eigen::SelfAdjointEigenSolver<Eigen::Matrix<ExpansionScalar, Eigen::Dynamic, Eigen::Dynamic>> eigensolver {S};
143 return Transformation {eigensolver.operatorInverseSqrt()};
144 }
145
149 void lowdinOrthonormalize() { this->C = this->lowdinOrthonormalization(); }
150
151
152 /*
153 * MARK: Conforming to `BasisTransformable`
154 */
155
163 FinalSpinorBasis transformed(const Transformation& T) const override {
164
165 auto result = this->derived();
166 result.C.transform(T);
167 return result;
168 }
169
170 // Allow the `rotate` method from `BasisTransformable`, since there's also a `rotate` from `JacobiRotatable`.
172
173 // Allow the `rotated` method from `BasisTransformable`, since there's also a `rotated` from `JacobiRotatable`.
175
176
177 /*
178 * MARK: Conforming to `JacobiRotatable`.
179 */
180
188 FinalSpinorBasis rotated(const JacobiRotationType& jacobi_rotation) const override {
189
190 const auto J = Transformation::FromJacobi(jacobi_rotation, this->simpleDimension());
191 return this->rotated(J);
192 }
193
194 // Allow the `rotate` method from `JacobiRotatable`, since there's also a `rotate` from `BasisTransformable`.
196};
197
198
199} // namespace GQCP
Definition: BasisTransformable.hpp:50
void rotate(const Transformation &U)
Definition: BasisTransformable.hpp:107
Definition: CRTP.hpp:32
Derived & derived()
Definition: CRTP.hpp:46
Definition: JacobiRotatable.hpp:50
Definition: OverlapOperator.hpp:31
Definition: SimpleSpinorBasis.hpp:55
FinalSpinorBasis rotated(const JacobiRotationType &jacobi_rotation) const override
Definition: SimpleSpinorBasis.hpp:188
SQOverlapOperator overlap() const
Definition: SimpleSpinorBasis.hpp:118
void lowdinOrthonormalize()
Definition: SimpleSpinorBasis.hpp:149
typename SpinorBasisTraits< FinalSpinorBasis >::SQOverlapOperator SQOverlapOperator
Definition: SimpleSpinorBasis.hpp:71
const Transformation & expansion() const
Definition: SimpleSpinorBasis.hpp:98
Transformation lowdinOrthonormalization() const
Definition: SimpleSpinorBasis.hpp:138
Transformation C
Definition: SimpleSpinorBasis.hpp:76
bool isOrthonormal(const double precision=1.0e-08) const
Definition: SimpleSpinorBasis.hpp:127
typename JacobiRotatableTraits< FinalSpinorBasis >::JacobiRotationType JacobiRotationType
Definition: SimpleSpinorBasis.hpp:68
_FinalSpinorBasis FinalSpinorBasis
Definition: SimpleSpinorBasis.hpp:62
FinalSpinorBasis transformed(const Transformation &T) const override
Definition: SimpleSpinorBasis.hpp:163
typename BasisTransformableTraits< FinalSpinorBasis >::Transformation Transformation
Definition: SimpleSpinorBasis.hpp:65
size_t simpleDimension() const
Definition: SimpleSpinorBasis.hpp:108
_ExpansionScalar ExpansionScalar
Definition: SimpleSpinorBasis.hpp:59
SimpleSpinorBasis(const Transformation &C)
Definition: SimpleSpinorBasis.hpp:87
Definition: SquareMatrix.hpp:39
Definition: BaseOneElectronIntegralBuffer.hpp:25
Definition: BasisTransformable.hpp:37
Definition: JacobiRotatable.hpp:37
Definition: SimpleSpinorBasis.hpp:38