5 #ifndef MADNESS_LOWRANKFUNCTION_H
6 #define MADNESS_LOWRANKFUNCTION_H
25 initialize<double>(
"radius",2.0,
"the radius");
26 initialize<double>(
"gamma",1.0,
"the exponent of the correlation factor");
27 initialize<double>(
"volume_element",0.1,
"volume covered by each grid point");
28 initialize<double>(
"tol",1.e-8,
"rank-reduced cholesky tolerance");
29 initialize<std::string>(
"f12type",
"Slater",
"correlation factor",{
"Slater",
"SlaterF12"});
30 initialize<std::string>(
"orthomethod",
"cholesky",
"orthonormalization",{
"cholesky",
"canonical",
"symmetric"});
31 initialize<std::string>(
"transpose",
"slater2",
"transpose of the matrix",{
"slater1",
"slater2"});
32 initialize<std::string>(
"gridtype",
"random",
"the grid type",{
"random",
"cartesian",
"dftgrid"});
33 initialize<std::string>(
"rhsfunctiontype",
"exponential",
"the type of function",{
"exponential"});
34 initialize<int>(
"optimize",1,
"number of optimization iterations");
41 double radius()
const {
return get<double>(
"radius");}
42 double gamma()
const {
return get<double>(
"gamma");}
44 double tol()
const {
return get<double>(
"tol");}
45 int optimize()
const {
return get<int>(
"optimize");}
46 std::string
gridtype()
const {
return get<std::string>(
"gridtype");}
47 std::string
orthomethod()
const {
return get<std::string>(
"orthomethod");}
49 std::string
f12type()
const {
return get<std::string>(
"f12type");}
60 template<std::
size_t NDIM>
63 print(
"a total of",grid.size(),
"grid points");
65 for (
const auto& r : grid) {
67 file << std::fixed << std::setprecision(6);
68 for (
int i=0; i<
NDIM; ++i) file << r[i] <<
" ";
80 template<std::
size_t NDIM>
86 double current_ve=1.0;
87 std::size_t nradial=10;
90 print(
"trying nradial",nradial);
97 current_ve=volume/npoints;
98 print(
"volume, npoints, volume element",volume,npoints,current_ve);
106 static_assert(
NDIM==3,
"DFT Grids only defined for NDIM=3");
113 std::vector<Vector<double,NDIM>>
get_grid()
const {
120 template<std::
size_t NDIM>
129 std::vector<Vector<double,NDIM>>
get_grid()
const {
130 std::vector<Vector<double, NDIM>> grid;
132 if (
do_print)
print(
"npoint_within_volume",npoint_within_volume);
136 for (
int d = 0;
d <
NDIM; ++
d)
if (r[
d] < cell(
d, 0) or r[
d] > cell(
d, 1))
return false;
142 return ((r-o).normf()<rad);
149 long maxrank=10*npoint_within_volume;
151 for (
int r=0; r<maxrank; ++r) {
153 if (not is_in_cell(tmp))
continue;
154 if (is_in_sphere(tmp)) ++rank;
156 if (rank==npoint_within_volume)
break;
161 print(
"grid points in volume ",rank);
162 print(
"total grid points ",grid.size());
163 print(
"ratio ",rank/
double(grid.size()));
183 std::random_device rd{};
184 std::mt19937 gen{rd()};
186 for (
int i = 0; i <
NDIM; ++i) {
187 std::normal_distribution<>
d{
origin[i], variance};
198 template<std::
size_t NDIM>
209 n_per_dim=ceil(2.0*radius/length_per_gridpoint);
210 print(
"length per gridpoint, n_per_dim",length_per_gridpoint,
n_per_dim);
259 for (
int idim=0; idim<
NDIM; ++idim) {
268 template<std::
size_t NDIM>
279 else if (params.
gridtype()==
"dftgrid") {
280 if constexpr (
NDIM==3) {
300 std::vector<Vector<double,NDIM>>
get_grid()
const {
303 std::vector<Vector<double,NDIM>> grid;
304 for (
const auto& coords :
centers) {
305 print(
"atom sites",coords);
307 if constexpr (
NDIM==3) {
310 grid.insert(grid.end(),atomgrid.begin(),atomgrid.end());
315 randomgrid<NDIM> b1(builder->get_volume_element(),builder->get_radius(),coords);
317 grid.insert(grid.end(),atomgrid.begin(),atomgrid.end());
331 template<std::
size_t PDIM>
341 for (
int i=0; i<PDIM; ++i)
p.dims[i]=i;
347 for (
int i=0; i<PDIM; ++i)
p.dims[i]=i+PDIM;
362 for (
int i=0; i<PDIM; ++i)
dims[i]=
p[i];
366 std::stringstream ss;
383 template<std::
size_t DUMMYDIM=PDIM>
384 typename std::enable_if_t<DUMMYDIM==1, std::tuple<int>>
387 template<std::
size_t DUMMYDIM=PDIM>
388 typename std::enable_if_t<DUMMYDIM==2, std::tuple<int,int>>
391 template<std::
size_t DUMMYDIM=PDIM>
392 typename std::enable_if_t<DUMMYDIM==3, std::tuple<int,int,int>>
396 template<std::
size_t PDIM>
399 for (
auto i=0; i<PDIM-1; ++i) os <<
p.dims[i] <<
";";
400 os <<
p.dims[PDIM-1] <<
")";
409 template<
typename T, std::size_t
NDIM, std::size_t LDIM=
NDIM/2>
428 return functor.
inner(rhs,p1,p2);
432 return functor.
inner(rhs,p1,p2);
437 template<
typename T, std::size_t
NDIM, std::size_t LDIM=
NDIM/2>
445 if (
a.size()>0 and
b.size()>0)
447 if (
a.size()==0) this->
a.resize(
b.size());
448 if (
b.size()==0) this->
b.resize(
a.size());
459 std::shared_ptr<SeparatedConvolution<T,LDIM>>
f12;
460 std::vector<Function<T,LDIM>>
a,
b;
467 std::vector<Function<T,LDIM>> result;
474 for (
int i=0; i<rhs.size(); i+=nbatch) {
475 std::vector<Function<T,LDIM>> rhs_batch;
476 auto begin= rhs.begin()+i;
477 auto end= (i+nbatch)<rhs.
size() ? rhs.begin()+i+nbatch : rhs.end();
478 std::copy(begin,end, std::back_inserter(rhs_batch));
479 auto tmp2= zero_functions_compressed<T,LDIM>(
world,rhs_batch.
size());
483 for (
int ia=0; ia<
a.size(); ia++) {
484 auto premultiply= p1.
is_first() ?
a[ia] :
b[ia];
485 auto postmultiply= p1.
is_first() ?
b[ia] :
a[ia];
488 if (premultiply.is_initialized()) tmp=rhs_batch*premultiply;
490 if (postmultiply.is_initialized()) tmp1=tmp1*postmultiply;
494 for (
auto& t : tmp2) result.push_back(t);
502 std::vector<Function<T, LDIM>> pre, post;
503 std::size_t sz =
a.size();
505 pre = std::vector<Function<T, LDIM>>(1, one);
506 post = std::vector<Function<T, LDIM>>(1, one);
517 std::vector<Function<T,LDIM>>
aa,bb;
518 for (std::size_t i=0; i<pre.size(); ++i) {
520 bb=
append(bb,(post[i]*post));
530 if (
a.size()==0)
return 0.0;
533 for (
int i=0; i<LDIM; ++i) {
537 return std::make_pair(first,second);
540 double gamma=
f12->info.mu;
541 auto [first,second]=
split(r);
545 for (std::size_t ia=0; ia<
a.size(); ++ia) {
547 if (
a[ia].is_initialized()) result1*=
a[ia](first);
548 if (
b[ia].is_initialized()) result1*=
b[ia](first);
549 if (
f12->info.type==
OT_SLATER) result1*=exp(-gamma*(first-second).normf());
561 template<
typename T, std::size_t
NDIM, std::size_t LDIM=
NDIM/2>
592 template<
typename T, std::size_t
NDIM, std::size_t LDIM=
NDIM/2>
600 std::vector<Function<T,LDIM>>
g,
h;
615 g(other.
g),
h(other.
h) {
633 for (
int i=0; i<LDIM; ++i) {
638 for (
int i=0; i<
rank(); ++i) result+=
g[i](first)*
h[i](second);
700 return sqrt(tmp1.trace(tmp2));
705 if (
p.is_first())
return g;
709 std::vector<Function<T,LDIM>>
get_g()
const {
return g;}
710 std::vector<Function<T,LDIM>>
get_h()
const {
return h;}
712 long rank()
const {
return g.size();}
731 std::vector<Function<T,LDIM>> g2;
755 for (
int i=0; i<nopt; ++i) {
789 auto [eval_g, evec_g] =
syev(ovlp_g);
790 auto [eval_h, evec_h] =
syev(ovlp_h);
794 auto get_slice = [](
auto eval,
double thresh) {
798 for (
int i=0; i<eval.size(); ++i) {
801 return s=
Slice(i,-1);
808 Slice gslice=get_slice(eval_g,1.e-13);
809 Slice hslice=get_slice(eval_h,1.e-13);
815 eval_g=
copy(eval_g(gslice));
816 eval_h=
copy(eval_h(hslice));
818 for (
int i=0; i<eval_g.size(); ++i) Xplus(
_,i)*=
std::pow(eval_g(i),0.5);
819 for (
int i=0; i<eval_g.size(); ++i) Xminus(
_,i)*=
std::pow(eval_g(i),-0.5);
820 for (
int i=0; i<eval_h.size(); ++i) Yplus(
_,i)*=
std::pow(eval_h(i),0.5);
821 for (
int i=0; i<eval_h.size(); ++i) Yminus(
_,i)*=
std::pow(eval_h(i),-0.5);
824 auto [U,s,VT]=
svd(M);
831 if (s_accumulated>
thresh) {
836 for (
int j=0; j<s.size(); ++j) VT(j,
_)*=s[j];
854 for (
int i=0; i<ovlp2.
dim(0); ++i) ovlp2(i,i)-=1.0;
859 t.
tag(
"check_orthonoramality");
873 double term1 = lrfunctor1.
norm2();
875 t.
tag(
"computing term1");
880 t.
tag(
"computing term2");
888 if (zero>1.e-10)
print(
"g is not orthonormal",zero);
892 double term3=tmp1.trace(tmp2);
894 t.
tag(
"computing term3");
896 double arg=term1-2.0*term2+term3;
898 print(
"negative l2 error");
904 print(
"term1,2,3, error",term1, term2, term3,
" --",
error);
913 template<
typename T, std::
size_t NDIM>
952 template<
typename T, std::
size_t NDIM, std::
size_t PDIM>
966 template<
typename T, std::
size_t NDIM, std::
size_t PDIM>
971 static_assert(2*PDIM==
NDIM);
993 template<
typename T, std::
size_t NDIM, std::
size_t PDIM>
997 static_assert(2*PDIM==
NDIM);
1012 template<
typename T, std::
size_t NDIM, std::
size_t PDIM>
1016 static_assert(2*PDIM==
NDIM);
1030 template<
typename T, std::
size_t NDIM, std::
size_t PDIM>
1036 template<
typename T, std::size_t
NDIM, std::size_t LDIM=
NDIM/2>
1083 if (world.
rank()==0)
print(
"grid size",grid.size());
1089 t1.
tag(
"compute ovlp");
1091 t1.
tag(
"rrcd/truncate/thresh");
1093 if (world.
rank()==0 and do_print)
print(
"gsize",sz);
1096 if (world.
rank()==0 and do_print) {
1097 print(
"Y.size()",Y.size());
1098 print(
"g.size()",
g.size());
1102 t1.
tag(
"Y backprojection with truncation");
1109 const std::string rhsfunctiontype,
const double exponent=30.0)
const {
1112 std::vector<Function<double,LDIM>> Y;
1113 if (rhsfunctiontype==
"exponential") {
1114 std::vector<Function<double,LDIM>>
omega;
1116 for (
const auto& point : grid) {
1128 auto norms=
norm2s(world,Y);
1129 std::vector<Function<double,LDIM>> Ynormalized;
1131 for (
int i=0; i<Y.size(); ++i)
if (norms[i]>
parameters.
tol()) Ynormalized.push_back(Y[i]);
Definition: IntegratorXX.h:29
void set_nradial(const std::size_t nradial1)
number of radial gridpoints on the interval [0,\inf)
Definition: IntegratorXX.h:69
void set_angular_order(const std::size_t order)
a quadrature of a give order will integrate a spherical harmonic of that order exactly
Definition: IntegratorXX.h:59
std::size_t get_angular_order() const
a quadrature of a give order will integrate a spherical harmonic of that order exactly
Definition: IntegratorXX.h:64
void set_origin(const madness::Vector< double, 3 > &o)
the origin/center of the grid
Definition: IntegratorXX.h:79
std::size_t get_nradial() const
number of radial gridpoints on the interval [0,\inf)
Definition: IntegratorXX.h:74
void make_grid()
Definition: IntegratorXX.h:83
std::vector< madness::Vector< double, 3 > > get_points() const
get the grid points
Definition: IntegratorXX.h:105
long dim(int i) const
Returns the size of dimension i.
Definition: basetensor.h:147
long size() const
Returns the number of elements in the tensor.
Definition: basetensor.h:138
static const double & get_thresh()
Returns the default threshold.
Definition: funcdefaults.h:279
static const Tensor< double > & get_cell()
Gets the user cell for the simulation.
Definition: funcdefaults.h:446
FunctionFactory implements the named-parameter idiom for Function.
Definition: function_factory.h:86
FunctionFactory & f(T(*f)(const coordT &))
Definition: function_factory.h:180
Definition: lowrankfunction.h:1037
LowRankFunctionFactory(const LowRankFunctionParameters param, const Molecule &molecule)
Definition: lowrankfunction.h:1050
const particle< LDIM > p2
Definition: lowrankfunction.h:1041
const particle< LDIM > p1
Definition: lowrankfunction.h:1040
LowRankFunction< T, NDIM > project(const LRFunctorBase< T, NDIM > &lrfunctor) const
Definition: lowrankfunction.h:1072
LowRankFunctionFactory(const LowRankFunctionParameters param, const std::vector< Vector< double, LDIM >> origins={})
Definition: lowrankfunction.h:1047
LowRankFunctionFactory & set_orthomethod(const std::string orthomethod)
Definition: lowrankfunction.h:1067
std::vector< Function< T, LDIM > > Yformer(const LRFunctorBase< T, NDIM > &lrfunctor1, const std::vector< Vector< double, LDIM >> &grid, const std::string rhsfunctiontype, const double exponent=30.0) const
apply a rhs (delta or exponential) on grid points to the hi-dim function and form Y = A_ij w_j (in Ha...
Definition: lowrankfunction.h:1108
LowRankFunctionFactory & set_rank_revealing_tol(const double rrtol)
Definition: lowrankfunction.h:1063
LowRankFunctionFactory & set_volume_element(const double volume_element)
Definition: lowrankfunction.h:1059
LowRankFunctionFactory()=default
LowRankFunctionParameters parameters
Definition: lowrankfunction.h:1043
LowRankFunctionFactory & set_radius(const double radius)
Definition: lowrankfunction.h:1055
std::vector< Vector< double, LDIM > > origins
origins of the molecular grid
Definition: lowrankfunction.h:1044
LowRankFunctionFactory(const LowRankFunctionFactory &other)=default
LowRankFunction represents a hi-dimensional (NDIM) function as a sum of products of low-dimensional (...
Definition: lowrankfunction.h:593
void optimize(const LRFunctorBase< T, NDIM > &lrfunctor1, const long nopt=1)
optimize the lrf using the lrfunctor
Definition: lowrankfunction.h:752
LowRankFunction & operator+=(const LowRankFunction &b)
in-place addition
Definition: lowrankfunction.h:660
friend LowRankFunction operator*(const T a, const LowRankFunction &other)
multiplication with a scalar
Definition: lowrankfunction.h:686
double rank_revealing_tol
Definition: lowrankfunction.h:597
std::string orthomethod
Definition: lowrankfunction.h:598
LowRankFunction & operator=(const LowRankFunction &f)
Definition: lowrankfunction.h:623
std::vector< Function< T, LDIM > > get_g() const
Definition: lowrankfunction.h:709
std::vector< Function< T, LDIM > > orthonormalize(const std::vector< Function< T, LDIM >> &g) const
orthonormalize the argument vector
Definition: lowrankfunction.h:728
LowRankFunction operator-(const LowRankFunction &b) const
subtraction
Definition: lowrankfunction.h:653
TensorTypeData< T >::scalar_type norm2() const
l2 norm
Definition: lowrankfunction.h:697
std::vector< Function< T, LDIM > > get_functions(const particle< LDIM > &p) const
Definition: lowrankfunction.h:703
LowRankFunction operator*(const Q a) const
scale by a scalar
Definition: lowrankfunction.h:676
std::vector< Function< T, LDIM > > get_h() const
Definition: lowrankfunction.h:710
LowRankFunction operator*(const T a) const
out-of-place scale by a scalar (no type conversion)
Definition: lowrankfunction.h:681
long rank() const
Definition: lowrankfunction.h:712
LowRankFunction(std::vector< Function< T, LDIM >> g, std::vector< Function< T, LDIM >> h, double tol, std::string orthomethod)
Definition: lowrankfunction.h:606
LowRankFunction(const LowRankFunction &other)
shallow copy ctor
Definition: lowrankfunction.h:613
bool do_print
Definition: lowrankfunction.h:599
void reorthonormalize(double thresh=-1.0)
after external operations g might not be orthonormal and/or optimal – reorthonormalize
Definition: lowrankfunction.h:785
const particle< LDIM > p2
Definition: lowrankfunction.h:602
const particle< LDIM > p1
Definition: lowrankfunction.h:601
double check_orthonormality(const std::vector< Function< T, LDIM >> &v) const
Definition: lowrankfunction.h:845
std::vector< Function< T, LDIM > > h
Definition: lowrankfunction.h:600
LowRankFunction & operator*=(const T a)
in-place scale by a scalar (no type conversion)
Definition: lowrankfunction.h:691
LowRankFunction & operator-=(const LowRankFunction &b)
in-place subtraction
Definition: lowrankfunction.h:668
double l2error(const LRFunctorBase< T, NDIM > &lrfunctor1) const
compute the l2 error |functor - \sum_i g_ih_i|_2
Definition: lowrankfunction.h:867
LowRankFunction(World &world)
Definition: lowrankfunction.h:604
LowRankFunction operator+(const LowRankFunction &b) const
addition
Definition: lowrankfunction.h:647
double check_orthonormality(const Tensor< T > &ovlp) const
Definition: lowrankfunction.h:850
std::vector< Function< T, LDIM > > g
Definition: lowrankfunction.h:600
World & world
Definition: lowrankfunction.h:596
friend LowRankFunction copy(const LowRankFunction &other)
deep copy
Definition: lowrankfunction.h:619
void remove_linear_depdencies(double thresh=-1.0)
remove linear dependencies without orthonormalization
Definition: lowrankfunction.h:769
double size() const
return the size in GByte
Definition: lowrankfunction.h:715
Function< T, NDIM > reconstruct() const
Definition: lowrankfunction.h:721
T operator()(const Vector< double, NDIM > &r) const
function evaluation
Definition: lowrankfunction.h:631
Definition: molecule.h:124
class for holding the parameters for calculation
Definition: QCCalculationParametersBase.h:290
virtual void read_input_and_commandline_options(World &world, const commandlineparser &parser, const std::string tag)
Definition: QCCalculationParametersBase.h:325
void set_user_defined_value(const std::string &key, const T &value)
Definition: QCCalculationParametersBase.h:533
Convolutions in separated form (including Gaussian)
Definition: operator.h:136
static SeparatedConvolution< Q, NDIM > combine(const SeparatedConvolution< Q, NDIM > &left, const SeparatedConvolution< Q, NDIM > &right)
combine 2 convolution operators to one
Definition: operator.h:1690
A slice defines a sub-range or patch of a dimension.
Definition: slice.h:103
Traits class to specify support of numeric types.
Definition: type_data.h:56
A tensor is a multidimension array.
Definition: tensor.h:317
scalar_type absmax(long *ind=0) const
Return the absolute maximum value (and if ind is non-null, its index) in the Tensor.
Definition: tensor.h:1754
float_scalar_type normf() const
Returns the Frobenius norm of the tensor.
Definition: tensor.h:1726
TensorTypeData< T >::scalar_type scalar_type
C++ typename of the real type associated with a complex type.
Definition: tensor.h:409
void fill(const T &t)
Fill the Vector with the specified value.
Definition: vector.h:355
A parallel world class.
Definition: world.h:132
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition: world.h:318
ProcessID size() const
Returns the number of processes in this World (same as MPI_Comm_size()).
Definition: world.h:328
Definition: lowrankfunction.h:81
std::vector< Vector< double, NDIM > > get_grid() const
Definition: lowrankfunction.h:113
dftgrid(const double volume_element, const double radius)
Definition: lowrankfunction.h:84
GridBuilder builder
Definition: lowrankfunction.h:83
dftgrid(const std::size_t nradial, const std::size_t angular_order, const coord_3d origin=coord_3d())
Definition: lowrankfunction.h:105
Definition: lowrankfunction.h:53
bool do_print
Definition: lowrankfunction.h:77
double get_radius() const
Definition: lowrankfunction.h:56
double volume_element
Definition: lowrankfunction.h:75
double radius
Definition: lowrankfunction.h:76
double get_volume_element() const
Definition: lowrankfunction.h:55
virtual ~gridbase()=default
void visualize(const std::string filename, const std::vector< Vector< double, NDIM >> &grid) const
Definition: lowrankfunction.h:61
given a molecule, return a suitable grid
Definition: lowrankfunction.h:269
molecular_grid(const std::vector< Vector< double, NDIM >> origins, const LowRankFunctionParameters ¶ms)
ctor takes centers of the grid and the grid parameters
Definition: lowrankfunction.h:273
std::vector< Vector< double, NDIM > > centers
Definition: lowrankfunction.h:326
std::shared_ptr< gridbase > grid_builder
Definition: lowrankfunction.h:327
molecular_grid(const std::vector< Vector< double, NDIM >> origins, std::shared_ptr< gridbase > grid)
ctor takes centers of the grid and the grid builder
Definition: lowrankfunction.h:292
std::vector< Vector< double, NDIM > > get_grid() const
Definition: lowrankfunction.h:300
molecular_grid(const Molecule &molecule, std::shared_ptr< gridbase > grid)
ctor takes molecule and grid builder
Definition: lowrankfunction.h:298
grid with random points around the origin, with a Gaussian distribution
Definition: lowrankfunction.h:121
Vector< double, NDIM > get_origin() const
Definition: lowrankfunction.h:169
randomgrid(const double volume_element, const double radius, const Vector< double, NDIM > origin=Vector< double, NDIM >(0.0))
Definition: lowrankfunction.h:123
std::vector< Vector< double, NDIM > > get_grid() const
Definition: lowrankfunction.h:129
static Vector< double, NDIM > gaussian_random_distribution(const Vector< double, NDIM > origin, double variance)
Definition: lowrankfunction.h:182
Vector< double, NDIM > origin
Definition: lowrankfunction.h:194
double volume() const
Definition: lowrankfunction.h:175
double(* f1)(const coord_3d &)
Definition: derivatives.cc:55
double(* f2)(const coord_3d &)
Definition: derivatives.cc:56
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition: derivatives.cc:72
static double lo
Definition: dirac-hatom.cc:23
Fcwf copy(Fcwf psi)
Definition: fcwf.cc:338
auto T(World &world, response_space &f) -> response_space
Definition: global_functions.cc:34
Tensor< typename Tensor< T >::scalar_type > arg(const Tensor< T > &t)
Return a new tensor holding the argument of each element of t (complex types only)
Definition: tensor.h:2502
static const double v
Definition: hatom_sf_dirac.cc:20
static double pow(const double *a, const double *b)
Definition: lda.h:74
#define MADNESS_CHECK(condition)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition: madness_exception.h:190
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition: madness_exception.h:119
#define MADNESS_CHECK_THROW(condition, msg)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition: madness_exception.h:210
Main include file for MADNESS and defines Function interface.
const double pi
Mathematical constant .
Definition: constants.h:48
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
Function< T, KDIM+LDIM > hartree_product(const std::vector< Function< T, KDIM >> &left, const std::vector< Function< T, LDIM >> &right)
Performs a Hartree/outer product on the two given low-dimensional function vectors.
Definition: mra.h:1832
static const char * filename
Definition: legendre.cc:96
std::vector< Function< T, NDIM > > orthonormalize_canonical(const std::vector< Function< T, NDIM > > &v, const Tensor< T > &ovlp, double lindep)
Definition: vmra.h:501
std::vector< Function< T, NDIM > > append(const std::vector< Function< T, NDIM > > &lhs, const std::vector< Function< T, NDIM > > &rhs)
combine two vectors
Definition: vmra.h:649
std::vector< Function< T, NDIM > > orthonormalize_rrcd(const std::vector< Function< T, NDIM > > &v, Tensor< T > &ovlp, const double tol, Tensor< integer > &piv, int &rank)
Definition: vmra.h:594
response_space apply(World &world, std::vector< std::vector< std::shared_ptr< real_convolution_3d >>> &op, response_space &f)
Definition: basic_operators.cc:39
void truncate(World &world, response_space &v, double tol, bool fence)
Definition: basic_operators.cc:30
const std::vector< Function< T, NDIM > > & change_tree_state(const std::vector< Function< T, NDIM >> &v, const TreeState finalstate, const bool fence=true)
change tree state of the functions
Definition: vmra.h:277
@ reconstructed
s coeffs at the leaves only
Definition: funcdefaults.h:59
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence.
Definition: mra.h:2002
static const Slice _(0,-1, 1)
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition: lowrankfunction.h:397
@ OT_SLATER
1/r
Definition: operatorinfo.h:15
@ OT_GAUSS
exp(-r)
Definition: operatorinfo.h:16
void svd(const Tensor< T > &a, Tensor< T > &U, Tensor< typename Tensor< T >::scalar_type > &s, Tensor< T > &VT)
Compute the singluar value decomposition of an n-by-m matrix using *gesvd.
Definition: lapack.cc:739
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition: print.h:225
NDIM & f
Definition: mra.h:2416
void error(const char *msg)
Definition: world.cc:139
NDIM const Function< R, NDIM > & g
Definition: mra.h:2416
double inner(response_space &a, response_space &b)
Definition: response_functions.h:442
void normalize(World &world, std::vector< Function< T, NDIM > > &v, bool fence=true)
Normalizes a vector of functions — v[i] = v[i].scale(1.0/v[i].norm2())
Definition: vmra.h:1614
Vector< double, 3 > coord_3d
Definition: funcplot.h:1042
std::vector< Function< TENSOR_RESULT_TYPE(T, R), NDIM > > transform(World &world, const std::vector< Function< T, NDIM > > &v, const Tensor< R > &c, bool fence=true)
Transforms a vector of functions according to new[i] = sum[j] old[j]*c[j,i].
Definition: vmra.h:689
void matrix_inner(DistributedMatrix< T > &A, const std::vector< Function< T, NDIM > > &f, const std::vector< Function< T, NDIM > > &g, bool sym=false)
Definition: distpm.cc:46
double get_size(World &world, const std::vector< Function< T, NDIM > > &v)
Definition: vmra.h:1636
std::vector< double > norm2s(World &world, const std::vector< Function< T, NDIM > > &v)
Computes the 2-norms of a vector of functions.
Definition: vmra.h:827
void swap(Vector< T, N > &l, Vector< T, N > &r)
Swap the contents of two Vectors.
Definition: vector.h:497
void syev(const Tensor< T > &A, Tensor< T > &V, Tensor< typename Tensor< T >::scalar_type > &e)
Real-symmetric or complex-Hermitian eigenproblem.
Definition: lapack.cc:969
static const double b
Definition: nonlinschro.cc:119
static const double a
Definition: nonlinschro.cc:118
double Q(double a)
Definition: relops.cc:20
static const double thresh
Definition: rk.cc:45
the low-rank functor is what the LowRankFunction will represent
Definition: lowrankfunction.h:410
virtual ~LRFunctorBase()
Definition: lowrankfunction.h:412
virtual World & world() const =0
virtual Function< T, LDIM > inner(const Function< T, LDIM > &rhs, const particle< LDIM > p1, const particle< LDIM > p2) const
Definition: lowrankfunction.h:416
friend std::vector< Function< T, LDIM > > inner(const LRFunctorBase &functor, const std::vector< Function< T, LDIM >> &rhs, const particle< LDIM > p1, const particle< LDIM > p2)
Definition: lowrankfunction.h:426
virtual Tensor< T >::scalar_type norm2() const
Definition: lowrankfunction.h:421
virtual std::vector< Function< T, LDIM > > inner(const std::vector< Function< T, LDIM >> &rhs, const particle< LDIM > p1, const particle< LDIM > p2) const =0
friend Function< T, LDIM > inner(const LRFunctorBase &functor, const Function< T, LDIM > &rhs, const particle< LDIM > p1, const particle< LDIM > p2)
Definition: lowrankfunction.h:430
virtual T operator()(const Vector< T, NDIM > &r) const =0
Definition: lowrankfunction.h:438
LRFunctorF12(const std::shared_ptr< SeparatedConvolution< T, LDIM >> f12, const Function< T, LDIM > &a, const Function< T, LDIM > &b)
delegate to the other ctor with vector arguments
Definition: lowrankfunction.h:453
std::vector< Function< T, LDIM > > b
the lo-dim functions
Definition: lowrankfunction.h:460
std::vector< Function< T, LDIM > > inner(const std::vector< Function< T, LDIM >> &rhs, const particle< LDIM > p1, const particle< LDIM > p2) const
Definition: lowrankfunction.h:464
World & world() const
Definition: lowrankfunction.h:463
Tensor< T >::scalar_type norm2() const
Definition: lowrankfunction.h:499
LRFunctorF12(const std::shared_ptr< SeparatedConvolution< T, LDIM >> f12, const std::vector< Function< T, LDIM >> &a, const std::vector< Function< T, LDIM >> &b)
Definition: lowrankfunction.h:440
std::vector< Function< T, LDIM > > a
Definition: lowrankfunction.h:460
T operator()(const Vector< double, NDIM > &r) const
Definition: lowrankfunction.h:528
std::shared_ptr< SeparatedConvolution< T, LDIM > > f12
a two-particle function
Definition: lowrankfunction.h:459
Definition: lowrankfunction.h:562
std::vector< Function< T, LDIM > > inner(const std::vector< Function< T, LDIM >> &rhs, const particle< LDIM > p1, const particle< LDIM > p2) const
Definition: lowrankfunction.h:569
Tensor< T >::scalar_type norm2() const
Definition: lowrankfunction.h:581
LRFunctorPure(const Function< T, NDIM > &f)
Definition: lowrankfunction.h:564
Function< T, NDIM > f
a hi-dim function
Definition: lowrankfunction.h:567
World & world() const
Definition: lowrankfunction.h:565
T operator()(const Vector< double, NDIM > &r) const
Definition: lowrankfunction.h:577
Definition: lowrankfunction.h:20
std::string rhsfunctiontype() const
Definition: lowrankfunction.h:48
double tol() const
Definition: lowrankfunction.h:44
int optimize() const
Definition: lowrankfunction.h:45
double gamma() const
Definition: lowrankfunction.h:42
double volume_element() const
Definition: lowrankfunction.h:43
std::string gridtype() const
Definition: lowrankfunction.h:46
LowRankFunctionParameters()
Definition: lowrankfunction.h:22
std::string f12type() const
Definition: lowrankfunction.h:49
void read_and_set_derived_values(World &world, const commandlineparser &parser, std::string tag)
Definition: lowrankfunction.h:37
std::string orthomethod() const
Definition: lowrankfunction.h:47
double radius() const
Definition: lowrankfunction.h:41
Definition: lowrankfunction.h:199
long total_n
Definition: lowrankfunction.h:204
long index
Definition: lowrankfunction.h:202
void operator++()
Definition: lowrankfunction.h:249
bool operator()() const
Definition: lowrankfunction.h:253
Vector< double, NDIM > hivec
Definition: lowrankfunction.h:200
long n_per_dim
Definition: lowrankfunction.h:203
cartesian_grid(const double volume_per_gridpoint, const double radius)
Definition: lowrankfunction.h:207
Vector< double, NDIM > get_coordinates() const
Definition: lowrankfunction.h:257
cartesian_grid & operator=(const cartesian_grid< NDIM > &other)
Definition: lowrankfunction.h:227
double volume_per_gridpoint() const
Definition: lowrankfunction.h:243
void initialize(const double lo, const double hi)
Definition: lowrankfunction.h:233
Vector< double, NDIM > lovec
Definition: lowrankfunction.h:200
Vector< double, NDIM > increment
Definition: lowrankfunction.h:205
std::vector< long > stride
Definition: lowrankfunction.h:201
cartesian_grid(const long n_per_dim, const double lo, const double hi)
Definition: lowrankfunction.h:217
cartesian_grid(const cartesian_grid< NDIM > &other)
Definition: lowrankfunction.h:222
very simple command line parser
Definition: commandlineparser.h:15
Definition: lowrankfunction.h:332
std::array< int, PDIM > dims
Definition: lowrankfunction.h:333
particle(const int p1, const int p2, const int p3)
Definition: lowrankfunction.h:360
particle complement() const
return the other particle
Definition: lowrankfunction.h:352
std::enable_if_t< DUMMYDIM==1, std::tuple< int > > get_tuple() const
Definition: lowrankfunction.h:385
static particle particle1()
convenience for particle 1 (the left/first particle)
Definition: lowrankfunction.h:339
bool is_first() const
assuming two particles only
Definition: lowrankfunction.h:379
std::enable_if_t< DUMMYDIM==3, std::tuple< int, int, int > > get_tuple() const
Definition: lowrankfunction.h:393
bool is_last() const
assuming two particles only
Definition: lowrankfunction.h:381
particle(const std::vector< int > p)
Definition: lowrankfunction.h:361
static particle particle2()
convenience for particle 2 (the right/second particle)
Definition: lowrankfunction.h:345
particle(const int p)
Definition: lowrankfunction.h:358
std::enable_if_t< DUMMYDIM==2, std::tuple< int, int > > get_tuple() const
Definition: lowrankfunction.h:389
std::string str() const
Definition: lowrankfunction.h:365
particle()=default
default constructor
particle(const int p1, const int p2)
Definition: lowrankfunction.h:359
std::array< int, PDIM > get_array() const
type conversion to std::array
Definition: lowrankfunction.h:373
Definition: timing_utilities.h:9
double tag(const std::string msg)
Definition: timing_utilities.h:45
bool do_print
Definition: timing_utilities.h:12
InputParameters param
Definition: tdse.cc:203
static const double omega
Definition: tdse_example.cc:51
void split(const Range< ConcurrentHashMap< int, int >::iterator > &range)
Definition: test_hashthreaded.cc:63
void d()
Definition: test_sig.cc:79
double aa
Definition: testbsh.cc:68
double h(const coord_1d &r)
Definition: testgconv.cc:68
static const std::size_t NDIM
Definition: testpdiff.cc:42
static Molecule molecule
Definition: testperiodicdft.cc:38
Defines operations on vectors of Functions.