GQCP
Loading...
Searching...
No Matches
BasisTransformable.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 <stdexcept>
22
23
24namespace GQCP {
25
26
27/*
28 * MARK: BasisTransformableTraits
29 */
30
36template <typename Type>
38
39
40/*
41 * MARK: BasisTransformable
42 */
43
49template <typename Type>
51public:
52 // The type of the transformation for which the basis transformation should be defined.
54
55public:
56 /*
57 * MARK: Pure virtual methods
58 */
59
67 virtual Type transformed(const Transformation& T) const = 0;
68
69
70 /*
71 * MARK: Implementations enabled by pure virtual methods
72 */
73
79 virtual void transform(const Transformation& T) {
80 static_cast<Type&>(*this) = this->transformed(T);
81 }
82
83
91 virtual Type rotated(const Transformation& U) const {
92
93 // Check if the given transformation is actually unitary.
94 if (!U.isUnitary(1.0e-12)) {
95 throw std::invalid_argument("BasisTransformable::rotated(const Transformation<Scalar>&): The given transformation is not unitary.");
96 }
97
98 return this->transformed(U);
99 }
100
101
107 void rotate(const Transformation& U) {
108 static_cast<Type&>(*this) = this->rotated(U);
109 }
110};
111
112
113} // namespace GQCP
Definition: BasisTransformable.hpp:50
void rotate(const Transformation &U)
Definition: BasisTransformable.hpp:107
virtual Type transformed(const Transformation &T) const =0
typename BasisTransformableTraits< Type >::Transformation Transformation
Definition: BasisTransformable.hpp:53
virtual void transform(const Transformation &T)
Definition: BasisTransformable.hpp:79
virtual Type rotated(const Transformation &U) const
Definition: BasisTransformable.hpp:91
Definition: BaseOneElectronIntegralBuffer.hpp:25
Definition: BasisTransformable.hpp:37