MADNESS 0.10.1
operatorinfo.h
Go to the documentation of this file.
1//
2// Created by Florian Bischoff on 11/2/23.
3//
4
5#ifndef MADNESS_OPERATORINFO_H
6#define MADNESS_OPERATORINFO_H
7
8namespace madness {
9
10/// operator types
11enum OpType {
13 OT_ONE, /// indicates the identity
14 OT_G12, /// 1/r
15 OT_SLATER, /// exp(-r)
16 OT_GAUSS, /// exp(-r2)
17 OT_F12, /// 1-exp(-r)
18 OT_FG12, /// (1-exp(-r))/r
19 OT_F212, /// (1-exp(-r))^2
20 OT_F2G12, /// (1-exp(-r))^2/r = 1/r + exp(-2r)/r - 2 exp(-r)/r
21 OT_BSH, /// exp(-r)/r
22 OT_INVRSQ, /// 1/r^2
23 OT_SIZE /// for ending loops
24};
25
26/// operator type to string
27template<std::size_t N=1> // dummy template argument to avoid ambiguity with the other operator<<
28std::ostream& operator<<(std::ostream& os, const OpType type) {
29 auto name = [](OpType type) {
30 switch (type) {
32 return "undefined";
33 case OpType::OT_ONE:
34 return "identity";
35 case OpType::OT_G12:
36 return "g12";
38 return "slater";
40 return "gauss";
41 case OpType::OT_F12:
42 return "f12";
43 case OpType::OT_FG12:
44 return "fg12";
45 case OpType::OT_F212:
46 return "f12^2";
48 return "f12^2g";
49 case OpType::OT_BSH:
50 return "bsh";
52 return "invrsq";
53 default:
54 return "undefined";
55 }
56 };
57 os << name(type);
58 return os;
59}
60
62 OperatorInfo() = default;
63 OperatorInfo(double mu, double lo, double thresh, OpType type, std::optional<bool> truncate = {}, std::vector<KernelRange> range = std::vector<KernelRange>(6)) : mu(mu), lo(lo), thresh(thresh), type(type), range(std::move(range)), truncate_lowexp_gaussians(truncate) { }
64 template <std::size_t NDIM>
65 OperatorInfo(double mu, double lo, double thresh, OpType type, std::optional<bool> truncate, const std::array<KernelRange, NDIM>& range) : mu(mu), lo(lo), thresh(thresh), type(type), range(range.begin(), range.end()), truncate_lowexp_gaussians(truncate) { }
66 double mu=0.0; ///< some introspection
67 double lo=1.e-5;
68 double thresh=1.e-4;
69 OpType type=OT_UNDEFINED; ///< introspection
70 double hi=-1.0;
71 std::vector<KernelRange> range = std::vector<KernelRange>(6);
72 bool debug=false;
73 std::optional<bool> truncate_lowexp_gaussians; // if given, overrides the default for whether to truncate low-exponent gaussians
74 /// if true, a lattice-summed operator excludes the home cell (L = 0): the rest-of-crystal
75 /// operator, see SeparatedConvolution::initialize_images_only. Consumed when the operator is
76 /// constructed (SeparatedConvolution::images_only()); changing it on a built operator has no effect.
77 bool images_only = false;
78
79 template <std::size_t NDIM>
80 std::array<KernelRange, NDIM> range_as_array() const {
81 std::array<KernelRange, NDIM> result;
82 MADNESS_ASSERT(range.size() >= NDIM);
83 std::copy(range.begin(), range.begin()+NDIM, result.begin());
84 return result;
85 }
86};
87
88
89
90}
91#endif //MADNESS_OPERATORINFO_H
static double lo
Definition dirac-hatom.cc:23
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition lowrankfunction.h:452
double FunctionDefaults< NDIM >::thresh
Definition mraimpl.h:3879
void truncate(World &world, std::vector< Function< T, NDIM > > &v, double tol=0.0, bool fence=true)
Truncates a vector of functions.
Definition vmra.h:336
OpType
operator types
Definition operatorinfo.h:11
@ OT_FG12
1-exp(-r)
Definition operatorinfo.h:18
@ OT_SLATER
1/r
Definition operatorinfo.h:15
@ OT_GAUSS
exp(-r)
Definition operatorinfo.h:16
@ OT_BSH
(1-exp(-r))^2/r = 1/r + exp(-2r)/r - 2 exp(-r)/r
Definition operatorinfo.h:21
@ OT_SIZE
1/r^2
Definition operatorinfo.h:23
@ OT_ONE
Definition operatorinfo.h:13
@ OT_INVRSQ
exp(-r)/r
Definition operatorinfo.h:22
@ OT_F12
exp(-r2)
Definition operatorinfo.h:17
@ OT_F212
(1-exp(-r))/r
Definition operatorinfo.h:19
@ OT_UNDEFINED
Definition operatorinfo.h:12
@ OT_G12
indicates the identity
Definition operatorinfo.h:14
@ OT_F2G12
(1-exp(-r))^2
Definition operatorinfo.h:20
std::string name(const FuncType &type, const int ex=-1)
Definition ccpairfunction.h:28
Definition mraimpl.h:53
const double mu
Definition navstokes_cosines.cc:95
double hi
Definition operatorinfo.h:70
OperatorInfo(double mu, double lo, double thresh, OpType type, std::optional< bool > truncate={}, std::vector< KernelRange > range=std::vector< KernelRange >(6))
Definition operatorinfo.h:63
double thresh
Definition operatorinfo.h:68
bool debug
Definition operatorinfo.h:72
OpType type
introspection
Definition operatorinfo.h:69
std::array< KernelRange, NDIM > range_as_array() const
Definition operatorinfo.h:80
double mu
some introspection
Definition operatorinfo.h:66
OperatorInfo(double mu, double lo, double thresh, OpType type, std::optional< bool > truncate, const std::array< KernelRange, NDIM > &range)
Definition operatorinfo.h:65
bool images_only
Definition operatorinfo.h:77
std::vector< KernelRange > range
Definition operatorinfo.h:71
std::optional< bool > truncate_lowexp_gaussians
Definition operatorinfo.h:73
double lo
Definition operatorinfo.h:67
constexpr std::size_t NDIM
Definition testgconv.cc:54