sisi4s
Loading...
Searching...
No Matches
ClusterSinglesDoublesAlgorithm.hpp
Go to the documentation of this file.
1#ifndef CLUSTER_SINGLES_DOUBLES_ALGORITHM_DEFINED
2#define CLUSTER_SINGLES_DOUBLES_ALGORITHM_DEFINED
3
5#include <math/FockVector.hpp>
6#include <DryTensor.hpp>
8
9#include <util/Tensor.hpp>
10
11#include <string>
12#include <vector>
13
14namespace sisi4s {
23public:
24 ClusterSinglesDoublesAlgorithm(std::vector<Argument> const &argumentList);
29 virtual void run();
30
31 // TODO: dryRun
32
37 virtual std::string getAbbreviation() = 0;
38
42 static int constexpr DEFAULT_MAX_ITERATIONS = 16;
43 static double constexpr DEFAULT_ENERGY_CONVERGENCE = 1E-6;
44 static double constexpr DEFAULT_AMPLITUDES_CONVERGENCE = 1E-5;
45
46 static double constexpr DEFAULT_LEVEL_SHIFT = 0.0;
47
48protected:
49 template <typename F>
50 F run();
51
55 virtual PTR(FockVector<double>)
56 getResiduum(const int iteration,
57 const PTR(const FockVector<double>) &amplitudes) = 0;
58
62 virtual PTR(FockVector<complex>)
63 getResiduum(const int iteration,
64 const PTR(const FockVector<complex>) &amplitudes) = 0;
65
69 template <typename F>
70 F getEnergy(const PTR(const FockVector<F>) &amplitdues);
71
82 template <typename F>
83 void
85 const PTR(const FockVector<F>) &amplitudes);
86
90 template <typename F>
91 void calculateExcitationEnergies(Tensor<F> &D, const std::string &indices);
92
97 template <typename F>
99
100 template <typename F>
101 PTR(FockVector<F>)
102 createAmplitudes(std::vector<std::string> amplitudeNames,
103 std::vector<std::vector<TensorIndex>> amplitudeLens,
104 std::vector<std::string> amplitudeIndices);
105
106 template <typename F>
107 void storeAmplitudes(const PTR(const FockVector<F>) &amplitudes,
108 std::vector<std::string> names);
109
120 Tensor<double> *
121 sliceCoupledCoulombIntegrals(const PTR(const FockVector<double>) &amplitudes,
122 int a,
123 int b,
124 int integralsSliceSize);
125
126 Tensor<complex> *
128 int a,
129 int b,
130 int integralsSliceSize);
131
143 const PTR(const FockVector<double>) &amplitudes,
144 int a,
145 int b,
146 int factorsSliceSize);
148 const PTR(const FockVector<complex>) &amplitudes,
149 int a,
150 int b,
151 int factorsSliceSize);
152
161 template <typename F>
162 void sliceIntoResiduum(Tensor<F> &Rxyij, int a0, int b0, Tensor<F> &Rabij);
163
167 std::string getCapitalizedAbbreviation();
168
169 std::string getDataName(const std::string &type, const std::string &data);
170};
171} // namespace sisi4s
172
173#endif
#define PTR(TYPE)
Definition SharedPointer.hpp:8
Definition Algorithm.hpp:26
Contains all the necessary tools for an algorithm with singles and doubles amplitudes....
Definition ClusterSinglesDoublesAlgorithm.hpp:22
std::string getCapitalizedAbbreviation()
The abbreviation of the algorithm in capital letters.
Definition ClusterSinglesDoublesAlgorithm.cxx:929
static double constexpr DEFAULT_ENERGY_CONVERGENCE
Definition ClusterSinglesDoublesAlgorithm.hpp:43
virtual std::shared_ptr< FockVector< double > > getResiduum(const int iteration, const std::shared_ptr< const FockVector< double > > &amplitudes)=0
Computes and returns the residuum of the given amplitudes.
static double constexpr DEFAULT_AMPLITUDES_CONVERGENCE
Definition ClusterSinglesDoublesAlgorithm.hpp:44
static double constexpr DEFAULT_LEVEL_SHIFT
Definition ClusterSinglesDoublesAlgorithm.hpp:46
std::shared_ptr< FockVector< F > > createAmplitudes(std::vector< std::string > amplitudeNames, std::vector< std::vector< TensorIndex > > amplitudeLens, std::vector< std::string > amplitudeIndices)
Definition ClusterSinglesDoublesAlgorithm.cxx:240
virtual void run()
Calculates the energy of a ClusterSinglesDoubles algorithm.
Definition ClusterSinglesDoublesAlgorithm.cxx:25
Tensor< double > * sliceCoupledCoulombIntegrals(const std::shared_ptr< const FockVector< double > > &amplitudes, int a, int b, int integralsSliceSize)
Calculates and returns one slice Xxycd of the Coulomb integrals coupled to the singles amplitudes....
Definition ClusterSinglesDoublesAlgorithm.cxx:388
void sliceIntoResiduum(Tensor< F > &Rxyij, int a0, int b0, Tensor< F > &Rabij)
Adds the given slice of the residuum tensor Rxyij to the entire residuum tensor Rabij at the respecti...
Definition ClusterSinglesDoublesAlgorithm.cxx:888
void estimateAmplitudesFromResiduum(const std::shared_ptr< FockVector< F > > &residuum, const std::shared_ptr< const FockVector< F > > &amplitudes)
Calculates an improved estimate of the amplitudes provided the given the residuum....
Definition ClusterSinglesDoublesAlgorithm.cxx:302
void storeAmplitudes(const std::shared_ptr< const FockVector< F > > &amplitudes, std::vector< std::string > names)
Definition ClusterSinglesDoublesAlgorithm.cxx:288
F getEnergy(const std::shared_ptr< const FockVector< F > > &amplitdues)
Computes and returns the energy of the given amplitudes.
Definition ClusterSinglesDoublesAlgorithm.cxx:131
Tensor< double > * sliceAmplitudesFromCoupledCoulombFactors(const std::shared_ptr< const FockVector< double > > &amplitudes, int a, int b, int factorsSliceSize)
Calculates and returns one slice Fabij of the residuum from the dressed Coulomb factors....
Definition ClusterSinglesDoublesAlgorithm.cxx:568
virtual std::string getAbbreviation()=0
Returns the abbreviation of the concrete algorithm, e.g. "Ccd", "Dcd".
static int constexpr DEFAULT_MAX_ITERATIONS
Defines the default number of iterations (16).
Definition ClusterSinglesDoublesAlgorithm.hpp:42
std::string getDataName(const std::string &type, const std::string &data)
Definition ClusterSinglesDoublesAlgorithm.cxx:939
void dryAmplitudesFromResiduum(sisi4s::DryTensor< F > &R)
Dry run for amplitudesFromResiduum.
Definition ClusterSinglesDoublesAlgorithm.cxx:375
void calculateExcitationEnergies(Tensor< F > &D, const std::string &indices)
Calculates eps_a+eps_b+...-eps_i-eps_j-... into D^ab..._ij...
Definition ClusterSinglesDoublesAlgorithm.cxx:343
virtual ~ClusterSinglesDoublesAlgorithm()
Definition ClusterSinglesDoublesAlgorithm.cxx:23
Definition DryTensor.hpp:36
Represents the direct sum of Tensors and provides the vector space operations of addition,...
Definition FockVector.hpp:26
Definition Algorithm.hpp:10
CTF::Tensor< F > Tensor
Definition Tensor.hpp:9
int64_t TensorIndex
Definition Tensor.hpp:11
Complex< real > complex
Definition Complex.hpp:17