GQCP
Loading...
Searching...
No Matches
expectation_values.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
25
26namespace GQCP {
27
28
39template <typename Scalar>
41
42 double sz = calculateSpinZ(one_DMs);
43 double s_squared = -sz;
44 const size_t K = one_DMs.alpha().numberOfOrbitals();
45 for (size_t p = 0; p < K; p++) {
46 s_squared += one_DMs.alpha().matrix()(p, p); // One-electron partition of S+S_
47 s_squared += (one_DMs.alpha().matrix()(p, p) + one_DMs.beta().matrix()(p, p)) / 4; // One-electron partition of S^2
48 for (size_t q = 0; q < K; q++) {
49 s_squared += -two_DMs.alphaBeta().tensor()(p, q, q, p); // Two-electron partition S+S_ .
50 s_squared += (two_DMs.alphaAlpha().tensor()(p, p, q, q) + two_DMs.betaBeta().tensor()(p, p, q, q) - two_DMs.alphaBeta().tensor()(p, p, q, q) - two_DMs.betaAlpha().tensor()(p, p, q, q)) / 4; // Two-electron partition of S^2 .
51 }
52 }
53 return s_squared;
54}
55
56
66template <typename Scalar>
68 return one_DMs.spinDensity().matrix().trace() / 2;
69}
70
71
72} // namespace GQCP
const Mixed & betaAlpha() const
Definition: DoublySpinResolvedBase.hpp:112
const Mixed & alphaBeta() const
Definition: DoublySpinResolvedBase.hpp:102
const Pure & alphaAlpha() const
Definition: DoublySpinResolvedBase.hpp:92
const Pure & betaBeta() const
Definition: DoublySpinResolvedBase.hpp:122
const SquareRankFourTensor< Scalar > & tensor() const
Definition: MixedSpinResolved2DMComponent.hpp:79
size_t numberOfOrbitals() const
Definition: Simple1DM.hpp:111
const SquareMatrix< Scalar > & matrix() const
Definition: Simple1DM.hpp:96
const SquareRankFourTensor< Scalar > & tensor() const
Definition: Simple2DM.hpp:98
Definition: SpinResolved1DM.hpp:44
SpinDensity1DM< Scalar > spinDensity() const
Definition: SpinResolved1DM.hpp:123
Definition: SpinResolved2DM.hpp:44
const Of & beta() const
Definition: SpinResolvedBase.hpp:140
const Of & alpha() const
Definition: SpinResolvedBase.hpp:130
Definition: BaseOneElectronIntegralBuffer.hpp:25
double calculateSpinSquared(const SpinResolved1DM< Scalar > &one_DMs, const SpinResolved2DM< Scalar > &two_DMs)
Definition: expectation_values.hpp:40
double calculateSpinZ(const SpinResolved1DM< Scalar > &one_DMs)
Definition: expectation_values.hpp:67