GQCP
Loading...
Searching...
No Matches
DoublySpinResolvedBase.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
21#include <array>
22#include <vector>
23
24
25namespace GQCP {
26
27
35template <typename _Pure, typename _Mixed, typename _Derived>
37public:
38 // The type that represents a 'pure' combination of spin components, i.e. the alpha-alpha or beta-beta type.
39 using Pure = _Pure;
40
41 // The type that represents a 'mixed' combination of spin components, i.e. the alpha-beta or beta-alpha type.
42 using Mixed = _Mixed;
43
44 // The type that derives from this type, given as a template argument, enabling CRTP and compile-time polymorphism.
45 using Derived = _Derived;
46
47 // The type of 'this'.
49
50
51private:
52 // The alpha-alpha-object.
53 Pure aa;
54
55 // The alpha-beta object.
56 Mixed ab;
57
58 // The beta-alpha object.
59 Mixed ba;
60
61 // The beta-beta object.
62 Pure bb;
63
64
65public:
66 /*
67 * MARK: Constructors
68 */
69
78 DoublySpinResolvedBase(const Pure& aa, const Mixed& ab, const Mixed& ba, const Pure& bb) :
79 aa {aa},
80 ab {ab},
81 ba {ba},
82 bb {bb} {}
83
84
85 /*
86 * MARK: Accessing spin components
87 */
88
92 const Pure& alphaAlpha() const { return this->aa; }
93
97 Pure& alphaAlpha() { return this->aa; }
98
102 const Mixed& alphaBeta() const { return this->ab; }
103
107 Mixed& alphaBeta() { return this->ab; }
108
112 const Mixed& betaAlpha() const { return this->ba; }
113
117 Mixed& betaAlpha() { return this->ba; }
118
122 const Pure& betaBeta() const { return this->bb; }
123
127 Pure& betaBeta() { return this->bb; }
128
134 const Pure& pureComponent(const Spin& sigma) const {
135
136 if (sigma == Spin::alpha) {
137 return this->aa;
138 } else {
139 return this->bb;
140 }
141 }
142
148 Pure& pureComponent(const Spin& sigma) {
149
150 if (sigma == Spin::alpha) {
151 return this->aa;
152 } else {
153 return this->bb;
154 }
155 }
156};
157
158
159} // namespace GQCP
Definition: DoublySpinResolvedBase.hpp:36
Mixed & betaAlpha()
Definition: DoublySpinResolvedBase.hpp:117
_Derived Derived
Definition: DoublySpinResolvedBase.hpp:45
_Mixed Mixed
Definition: DoublySpinResolvedBase.hpp:42
Pure & alphaAlpha()
Definition: DoublySpinResolvedBase.hpp:97
Pure & pureComponent(const Spin &sigma)
Definition: DoublySpinResolvedBase.hpp:148
const Mixed & betaAlpha() const
Definition: DoublySpinResolvedBase.hpp:112
Mixed & alphaBeta()
Definition: DoublySpinResolvedBase.hpp:107
DoublySpinResolvedBase(const Pure &aa, const Mixed &ab, const Mixed &ba, const Pure &bb)
Definition: DoublySpinResolvedBase.hpp:78
const Mixed & alphaBeta() const
Definition: DoublySpinResolvedBase.hpp:102
Pure & betaBeta()
Definition: DoublySpinResolvedBase.hpp:127
const Pure & alphaAlpha() const
Definition: DoublySpinResolvedBase.hpp:92
const Pure & pureComponent(const Spin &sigma) const
Definition: DoublySpinResolvedBase.hpp:134
_Pure Pure
Definition: DoublySpinResolvedBase.hpp:39
const Pure & betaBeta() const
Definition: DoublySpinResolvedBase.hpp:122
Definition: BaseOneElectronIntegralBuffer.hpp:25
Spin
Definition: Spin.hpp:27
@ alpha
Definition: Spin.hpp:28