33#ifndef MADNESS_MRA_DISPLACEMENTS_H__INCLUDED
34#define MADNESS_MRA_DISPLACEMENTS_H__INCLUDED
38 template <std::
size_t NDIM>
41 static std::vector< Key<NDIM> >
disp;
47 if (
NDIM == 1) bmax = 7;
48 else if (
NDIM == 2) bmax = 5;
49 else if (
NDIM == 3) bmax = 3;
50 else if (
NDIM == 4) bmax = 3;
51 else if (
NDIM == 5) bmax = 3;
52 else if (
NDIM == 6) bmax = 3;
59 return a.distsq() <
b.distsq();
65 uint64_t suma=0, sumb=0;
66 for (std::size_t
d=0;
d<
NDIM; ++
d) {
68 if (la > twonm1) la -= twonm1*2;
69 if (la <-twonm1) la += twonm1*2;
73 if (lb > twonm1) lb -= twonm1*2;
74 if (lb <-twonm1) lb += twonm1*2;
85 for (std::size_t i=0; i<
NDIM; ++i) num *= (2*bmax + 1);
90 for (
d[0]=-bmax;
d[0]<=bmax; ++
d[0])
94 for (
d[0]=-bmax;
d[0]<=bmax; ++
d[0])
95 for (
d[1]=-bmax;
d[1]<=bmax; ++
d[1])
99 for (
d[0]=-bmax;
d[0]<=bmax; ++
d[0])
100 for (
d[1]=-bmax;
d[1]<=bmax; ++
d[1])
101 for (
d[2]=-bmax;
d[2]<=bmax; ++
d[2])
104 else if (
NDIM == 4) {
105 for (
d[0]=-bmax;
d[0]<=bmax; ++
d[0])
106 for (
d[1]=-bmax;
d[1]<=bmax; ++
d[1])
107 for (
d[2]=-bmax;
d[2]<=bmax; ++
d[2])
108 for (
d[3]=-bmax;
d[3]<=bmax; ++
d[3])
111 else if (
NDIM == 5) {
112 for (
d[0]=-bmax;
d[0]<=bmax; ++
d[0])
113 for (
d[1]=-bmax;
d[1]<=bmax; ++
d[1])
114 for (
d[2]=-bmax;
d[2]<=bmax; ++
d[2])
115 for (
d[3]=-bmax;
d[3]<=bmax; ++
d[3])
116 for (
d[4]=-bmax;
d[4]<=bmax; ++
d[4])
120 else if (
NDIM == 6) {
121 for (
d[0]=-bmax;
d[0]<=bmax; ++
d[0])
122 for (
d[1]=-bmax;
d[1]<=bmax; ++
d[1])
123 for (
d[2]=-bmax;
d[2]<=bmax; ++
d[2])
124 for (
d[3]=-bmax;
d[3]<=bmax; ++
d[3])
125 for (
d[4]=-bmax;
d[4]<=bmax; ++
d[4])
126 for (
d[5]=-bmax;
d[5]<=bmax; ++
d[5])
139 if (bmax > (twon-1)) bmax=twon-1;
146 if ((lx < 0) && (lx+twon > bmax))
b[i++] = lx + twon;
147 if ((lx > 0) && (lx-twon <-bmax))
b[i++] = lx - twon;
159 for (std::size_t i=0; i<
NDIM; ++i) {
179 if (
disp.size() == 0) {
Holds displacements for applying operators to avoid replicating for all operators.
Definition displacements.h:39
const std::vector< Key< NDIM > > & get_disp(Level n, bool isperiodicsum)
Definition displacements.h:191
static std::vector< Key< NDIM > > disp
Definition displacements.h:41
static bool cmp_keys_periodicsum(const Key< NDIM > &a, const Key< NDIM > &b)
Definition displacements.h:62
static bool cmp_keys(const Key< NDIM > &a, const Key< NDIM > &b)
Definition displacements.h:58
static void make_disp_periodicsum(int bmax, Level n)
Definition displacements.h:136
static void make_disp(int bmax)
Definition displacements.h:80
static std::vector< Key< NDIM > > disp_periodicsum[64]
Definition displacements.h:42
static int bmax_default()
Definition displacements.h:45
Displacements()
Definition displacements.h:175
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:66
A simple, fixed dimension vector.
Definition vector.h:64
#define MADNESS_PRAGMA_CLANG(x)
Definition madness_config.h:200
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#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 DFParameters.h:10
int64_t Translation
Definition key.h:54
int Level
Definition key.h:55
static double pop(std::vector< double > &v)
Definition SCF.cc:113
static const double b
Definition nonlinschro.cc:119
static const double d
Definition nonlinschro.cc:121
static const double a
Definition nonlinschro.cc:118
static const std::size_t NDIM
Definition testpdiff.cc:42