5 #ifndef MADNESS_CCPAIRFUNCTION_H
6 #define MADNESS_CCPAIRFUNCTION_H
20 template<
typename T, std::
size_t NDIM>
21 class CCConvolutionOperator;
34 return std::to_string(ex) +
"_" +
"x";
44 template<
typename T=
double, std::
size_t NDIM=3>
54 i(ii),
type(type_) {};
81 void info(
World& world,
const std::string& msg =
" ")
const {
82 if (world.
rank() == 0) {
83 std::cout <<
"Information about 3D function: " <<
name() <<
" " << msg << std::endl;
84 std::cout << std::setw(10) << std::setfill(
' ') << std::setw(50) <<
" |f| : " <<
function.norm2()
86 std::cout << std::setw(10) << std::setfill(
' ') << std::setw(50) <<
" |error|: " <<
current_error << std::endl;
109 return function.inner(
f);
120 if (
i == other.
i and
type == other.
type)
return true;
125 void plot(
const std::string& msg =
"")
const {
129 template<
typename Archive>
147 virtual std::shared_ptr<TwoBodyFunctionComponentBase>
clone() = 0;
153 template<
typename T, std::
size_t NDIM>
156 static_assert(
NDIM%2==0,
"NDIM must be even");
166 std::shared_ptr<TwoBodyFunctionComponentBase>
clone()
override {
168 return std::make_shared<TwoBodyFunctionPureComponent<T,NDIM>>(result);
184 u.print_size(name1+
name(
false));
200 template<
typename Q, std::
size_t MDIM>
225 std::shared_ptr<CCConvolutionOperator<T,LDIM>>
op;
231 template<
typename T, std::
size_t NDIM>
234 static_assert(
NDIM%2==0,
"NDIM must be even");
249 std::shared_ptr<TwoBodyFunctionComponentBase>
clone()
override {
251 return std::make_shared<TwoBodyFunctionSeparatedComponent<T,NDIM>>(result);
256 if (
a.size()>0 and
a.front().is_initialized())
scale(
a.front().world(),
a,fac);
265 return a.front().world();
298 template<
typename Q, std::
size_t MDIM>
300 MADNESS_EXCEPTION(
"TwoBodyFunctionPureComponent<T> apply not yet implemented",1);
313 std::vector<Function<T,LDIM>>
get_a()
const {
return a;}
314 std::vector<Function<T,LDIM>>
get_b()
const {
return b;}
315 std::vector<Function<T,LDIM>>
get_vector(
const int i)
const {
318 else if (i==1)
return b;
330 std::vector<Function<T,LDIM>>
a;
331 std::vector<Function<T,LDIM>>
b;
332 std::shared_ptr<CCConvolutionOperator<T,LDIM>>
op;
372 template<
typename T=
double, std::
size_t NDIM=6>
376 static_assert(
NDIM%2==0,
"NDIM must be even");
450 if (not
f.is_assigned()) {
return hashT(); }
451 return f.component->hash();
455 std::vector<CCPairFunction>
consolidate(
const std::vector<CCPairFunction>& other,
456 const std::vector<std::string>& options,
460 static std::vector<CCPairFunction>
op_dec_to_dec(
const std::vector<CCPairFunction>& other,
464 static std::vector<CCPairFunction>
op_pure_to_pure(
const std::vector<CCPairFunction>& other);
467 static std::vector<CCPairFunction>
op_dec_to_pure(
const std::vector<CCPairFunction>& other);
470 static std::vector<CCPairFunction>
dec_to_pure(
const std::vector<CCPairFunction>& other);
476 static std::vector<CCPairFunction>
collect_same_types(
const std::vector<CCPairFunction>& other);
488 friend std::vector<CCPairFunction>
consolidate(
const std::vector<CCPairFunction>& other,
489 const std::vector<std::string> options=std::vector<std::string>(),
492 if (other.size()>0)
return other.front().consolidate(other,options,centers);
506 return pure().get_function();
511 return pure().get_function();
538 const std::vector<CCPairFunction>&
f) {
539 std::vector<CCPairFunction> result;
541 result.push_back(
copy(ff));
542 result.back().multiply_with_op_inplace(
op);
548 const std::array<int, LDIM>& v1) {
549 std::vector<CCPairFunction> result;
550 for (
auto& o : other) {
587 std::vector<Function<T,LDIM>>
get_a()
const {
592 std::vector<Function<T,LDIM>>
get_b()
const {
597 std::vector<Function<T,LDIM>>
get_vector(
const int i)
const {
604 if (
is_pure())
return *(
pure().get_operator_ptr());
632 auto tmp=
copy(*
this);
634 tmp.convert_to_pure_no_op_inplace();
650 print(
"CCPairFunction "+name1+
" not assigned");
659 print(
"anorm, bnorm",anorm,bnorm);
661 std::size_t fsize=
get_a().size();
664 snprintf(buf,
bufsize,
"%40s at time %.1fs: norm/ #functions: %7.5f %zu \n",
665 ((name1+
" "+
name()).c_str()), wall,
norm, fsize);
666 if (
world().rank()==0)
print(std::string(buf));
678 return pure().get_function().norm2();
680 double n2=
inner(*
this,*
this);
681 if (n2<0.0)
print(
"norm of ",
name(),
" is < 0.0");
688 if ((
imag>1.e-14) or (result<-1.e-14)) {
699 const std::array<int, LDIM>& v1) {
700 auto a012=std::array<int,LDIM>();
701 auto a345=std::array<int,LDIM>();
702 for (
int i=0; i<
LDIM; ++i) {
743 result.
component->swap_particles_inplace();
754 return a.inner_internal(
b,
R2);
759 return a.inner_internal(
b,
R2);
762 friend double inner(
const std::vector<CCPairFunction>& va,
const std::vector<CCPairFunction>& vb,
769 double tmp=
a.inner_internal(
b,
R2);
771 constexpr std::size_t
bufsize=256;
773 snprintf(buf,
bufsize,
"result from inner %10s %10s %12.8f %4.1fs",
a.name(
true).c_str(),
b.name().c_str(),tmp,wall1-wall0);
774 print(std::string(buf));
783 friend std::vector<CCPairFunction>
swap_particles(
const std::vector<CCPairFunction>& argument) {
784 std::vector<CCPairFunction> result;
785 for (
auto&
a : argument) result.push_back(
a.swap_particles());
791 std::shared_ptr<TwoBodyFunctionComponentBase>
component;
812 const std::pair<std::vector<Function<T,LDIM>>, std::vector<Function<T,LDIM>>>
assign_particles(
const size_t particle)
const;
820 const std::array<int, LDIM>& v1,
821 const std::array<int, LDIM>& v2)
const;
824 const std::array<int, LDIM>& v1,
825 const std::array<int, LDIM>& v2)
const;
830 template <
class archiveT,
class T, std::
size_t NDIM>
836 bool has_operator=
false;
839 ar & is_pure & has_operator;
847 std::vector<Function<T,LDIM>>
a(sz),
b(sz);
848 for (
auto&
aa :
a) ar &
aa;
849 for (
auto& bb :
b) ar & bb;
859 p.reset_operator(
op);
865 template <
class archiveT,
class T, std::
size_t NDIM>
868 bool exists=
f.is_assigned();
871 ar &
f.is_pure() &
f.has_operator();
872 if (
f.is_pure()) ar &
f.get_function();
873 if (
f.is_decomposed()) {
877 for (
const auto&
a : avec) ar &
a;
878 for (
const auto&
b : bvec) ar &
b;
881 if (
f.has_operator()) {
882 ar &
f.get_operator().parameters &
f.get_operator().type();
895 template<
typename T, std::
size_t NDIM>
897 bool convert_to_pure=(
arg.has_operator() or
arg.is_pure());
901 if (convert_to_pure) {
902 auto tmp=
arg.to_pure().get_function();
909 }
else if (
arg.is_decomposed_no_op()) {
911 if (
op.particle()==1) {
914 }
else if (
op.particle()==2) {
932 template<
typename T, std::
size_t NDIM>
934 std::vector<CCPairFunction<T, NDIM>> result;
939 template<
typename T, std::
size_t NDIM>
942 for (
const auto&
a : argument) result+=
G(
a);
950 template<
typename T, std::
size_t NDIM>
963 t1.
end(
"applying G to " + argument.
name());
974 template<
typename T, std::
size_t NDIM>
980 template<
typename T, std::
size_t NDIM>
987 template<
typename T, std::
size_t NDIM>
989 const std::tuple<int,int,int> v1,
const std::tuple<int,int,int> v2) {
991 auto v11=std::array<int,LDIM>({std::get<0>(v1),std::get<1>(v1),std::get<2>(v1)});
992 auto v22=std::array<int,LDIM>({std::get<0>(v2),std::get<1>(v2),std::get<2>(v2)});
994 return c.partial_inner(
f,v11,v22);
997 template<
typename T, std::
size_t NDIM>
1001 return c.partial_inner(
f,v1,v2);
1004 template<
typename T, std::
size_t NDIM>
1006 const std::tuple<int,int,int> v1,
const std::tuple<int,int,int> v2) {
1008 auto v11=std::array<int,LDIM>({std::get<0>(v1),std::get<1>(v1),std::get<2>(v1)});
1009 auto v22=std::array<int,LDIM>({std::get<0>(v2),std::get<1>(v2),std::get<2>(v2)});
1014 template<
typename T, std::
size_t NDIM>
1021 template<
typename T, std::
size_t NDIM>
1024 const std::tuple<int,int,int> v1,
const std::tuple<int,int,int> v2) {
1026 auto v11=std::array<int,LDIM>({std::get<0>(v1),std::get<1>(v1),std::get<2>(v1)});
1027 auto v22=std::array<int,LDIM>({std::get<0>(v2),std::get<1>(v2),std::get<2>(v2)});
1028 return inner(c1,c2,v11,v22);
1031 template<
typename T, std::
size_t NDIM>
1036 std::vector<CCPairFunction<T,NDIM>> result;
1037 for (
const auto& cc1 : c1) {
1038 for (
const auto& cc2 : c2) {
1039 print(
"inner of ",cc1.name(), cc2.name());
1040 result.push_back(
inner(cc1,cc2,v1,v2));
1046 template <
typename T, std::
size_t NDIM>
1048 std::vector<CCPairFunction<T,NDIM>> result;
1049 for (
const auto& l : c1) result.push_back(l);
1050 for (
const auto& l : c2) result.push_back(l);
1054 template <
typename T, std::
size_t NDIM>
1056 std::vector<CCPairFunction<T,NDIM>> result;
1057 for (
const auto& l : c1) result.push_back(l);
1058 for (
const auto& l : c2) result.push_back(-1.0*l);
1062 template <
typename T, std::
size_t NDIM>
1069 template <
typename T, std::
size_t NDIM>
1072 for (
const auto& l : lhs) rhs.push_back(l);
1076 template <
typename T, std::
size_t NDIM>
1079 for (
const auto& l : lhs) rhs.push_back(-1.0*l);
1083 template <
typename T, std::
size_t NDIM>
1085 std::vector<CCPairFunction<T,NDIM>> result;
1086 for (
const auto& l :
arg) result.push_back(fac*l);
1091 template<
typename T, std::
size_t NDIM>
Definition: test_derivative.cc:24
Definition: CCStructures.h:743
structure for a CC Function 3D which holds an index and a type
Definition: ccpairfunction.h:45
void set(const Function< T, NDIM > &other)
Definition: ccpairfunction.h:76
FuncType type
Definition: ccpairfunction.h:79
CCFunction()
Definition: ccpairfunction.h:47
void serialize(const Archive &ar)
Definition: ccpairfunction.h:130
std::string name() const
Definition: ccpairfunction.h:90
double current_error
Definition: ccpairfunction.h:69
CCFunction(const Function< T, NDIM > &f)
Definition: ccpairfunction.h:49
bool operator==(const CCFunction &other) const
Definition: ccpairfunction.h:119
Function< T, NDIM > function
Definition: ccpairfunction.h:70
CCFunction operator*(const double &fac) const
scalar multiplication
Definition: ccpairfunction.h:113
double inner(const CCFunction &f) const
Definition: ccpairfunction.h:104
friend CCFunction copy(const CCFunction &other)
deep copy
Definition: ccpairfunction.h:60
Function< T, NDIM > get() const
Definition: ccpairfunction.h:72
CCFunction(const Function< T, NDIM > &f, const size_t &ii, const FuncType &type_)
Definition: ccpairfunction.h:53
CCFunction(const CCFunction &other)
Definition: ccpairfunction.h:56
size_t i
Definition: ccpairfunction.h:78
double inner(const Function< T, NDIM > &f) const
Definition: ccpairfunction.h:108
void plot(const std::string &msg="") const
plotting
Definition: ccpairfunction.h:125
void info(World &world, const std::string &msg=" ") const
Definition: ccpairfunction.h:81
Function< T, NDIM > f() const
Definition: ccpairfunction.h:74
a 6D function, either in full or low rank form, possibly including an 2-particle function
Definition: ccpairfunction.h:373
void info() const
Definition: ccpairfunction.h:497
CCPairFunction(const std::vector< Function< T, LDIM >> &f1, const std::vector< Function< T, LDIM >> &f2)
takes a deep copy of the argument functions
Definition: ccpairfunction.h:396
static std::vector< CCPairFunction > op_pure_to_pure(const std::vector< CCPairFunction > &other)
turn pure functions with operator into pure functions without operators
Definition: ccpairfunction.cc:59
static std::vector< CCPairFunction > dec_to_pure(const std::vector< CCPairFunction > &other)
turn decomposed functions without operator into pure functions without operators
Definition: ccpairfunction.cc:110
const CCConvolutionOperator< T, LDIM > & get_operator() const
Definition: ccpairfunction.h:602
void convert_to_pure_no_op_inplace()
convert this into a pure hi-dim function
Definition: ccpairfunction.cc:33
CCPairFunction(const Function< T, LDIM > &f1, const Function< T, LDIM > &f2)
takes a deep copy of the argument functions
Definition: ccpairfunction.h:402
static constexpr std::size_t LDIM
Definition: ccpairfunction.h:375
std::vector< Function< T, LDIM > > get_vector(const int i) const
Definition: ccpairfunction.h:597
friend std::vector< CCPairFunction > operator*(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op, const std::vector< CCPairFunction > &f)
multiplication with a 2-particle function
Definition: ccpairfunction.h:537
CCPairFunction(const std::pair< std::vector< Function< T, LDIM >>, std::vector< Function< T, LDIM >>> &f)
takes a deep copy of the argument functions
Definition: ccpairfunction.h:407
std::vector< CCPairFunction > consolidate(const std::vector< CCPairFunction > &other, const std::vector< std::string > &options, const std::vector< Vector< double, LDIM >> ¢ers) const
TwoBodyFunctionSeparatedComponent< T, NDIM > & decomposed() const
Definition: ccpairfunction.h:582
friend CCPairFunction< T, NDIM > multiply(const CCPairFunction< T, NDIM > &other, const Function< T, LDIM > &f, const std::array< int, LDIM > &v1)
multiply CCPairFunction with a 3D function of one of the two particles
Definition: ccpairfunction.h:698
bool is_convertible_to_pure_no_op() const
can this be converted to a pure representation (depends on the operator, if present)
Definition: ccpairfunction.cc:23
static std::vector< CCPairFunction< T, NDIM > > apply(const ProjectorBase &P, const std::vector< CCPairFunction< T, NDIM >> &argument)
Definition: ccpairfunction.cc:626
std::vector< Function< T, LDIM > > get_b() const
Definition: ccpairfunction.h:592
Function< T, LDIM > project_out(const CCFunction< T, LDIM > &f, const size_t particle) const
Definition: ccpairfunction.cc:300
CCPairFunction< T, NDIM > & multiply_with_op_inplace(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op)
multiplication with a 2-particle function
Definition: ccpairfunction.cc:267
CCPairFunction(const CCPairFunction &other)=default
copy ctor – shallow
friend double inner(const std::vector< CCPairFunction > &va, const std::vector< CCPairFunction > &vb, const Function< T, LDIM > R2=Function< T, LDIM >())
Definition: ccpairfunction.h:762
Function< T, NDIM > & get_function()
Definition: ccpairfunction.h:504
friend CCPairFunction operator*(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op, const CCPairFunction &f)
multiplication with a 2-particle function
Definition: ccpairfunction.h:531
CCPairFunction operator*(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op)
multiplication with a 2-particle function
Definition: ccpairfunction.h:561
World & world() const
Definition: ccpairfunction.h:499
double inner_internal(const CCPairFunction &other, const Function< T, LDIM > &R2) const
compute the inner product of this and other
Definition: ccpairfunction.cc:548
void reset_operator(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op)
Definition: ccpairfunction.h:618
CCPairFunction operator*(const double fac) const
scalar multiplication: f*fac
Definition: ccpairfunction.h:519
void print_size(const std::string name1="") const
print the size of the functions
Definition: ccpairfunction.h:648
bool is_pure() const
Definition: ccpairfunction.h:570
Function< T, LDIM > dirac_convolution_decomposed(const CCFunction< T, LDIM > &x, const CCConvolutionOperator< T, LDIM > &op, const size_t particle) const
Definition: ccpairfunction.cc:518
static std::vector< CCPairFunction > op_dec_to_dec(const std::vector< CCPairFunction > &other, const std::vector< Vector< double, LDIM >> ¢ers)
turn decomposed functions with operator into decomposed functions using LowRankFunction
Definition: ccpairfunction.cc:83
friend double inner(const CCPairFunction &a, const CCPairFunction &b)
Definition: ccpairfunction.h:757
CCPairFunction(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op_, const Function< T, NDIM > &ket)
takes a shallow copy of the argument function
Definition: ccpairfunction.h:391
bool is_decomposed_no_op() const
Definition: ccpairfunction.h:575
CCPairFunction partial_inner(const CCPairFunction &other, const std::array< int, LDIM > &v1, const std::array< int, LDIM > &v2) const
friend std::vector< CCPairFunction > consolidate(const std::vector< CCPairFunction > &other, const std::vector< std::string > options=std::vector< std::string >(), const std::vector< Vector< double, LDIM >> centers=std::vector< Vector< double, LDIM >>())
collect the terms into a compact format
Definition: ccpairfunction.h:488
static bool is_collected(const std::vector< CCPairFunction< T, NDIM >> &other)
Definition: ccpairfunction.cc:217
bool is_assigned() const
Definition: ccpairfunction.h:445
std::vector< Function< T, LDIM > > get_a() const
Definition: ccpairfunction.h:587
static std::vector< CCPairFunction< T, NDIM > > apply(const SeparatedConvolution< T, NDIM > &G, const std::vector< CCPairFunction< T, NDIM >> &argument)
static std::vector< CCPairFunction > collect_same_types(const std::vector< CCPairFunction > &other)
collect all terms with of similiar type: pure, op_pure, decomposed, op_decomposed
Definition: ccpairfunction.cc:166
Function< T, LDIM > project_out_op_decomposed(const CCFunction< T, LDIM > &f, const size_t particle) const
Definition: ccpairfunction.cc:501
Function< T, LDIM > partial_inner(const Function< T, LDIM > &f, const std::array< int, LDIM > &v1, const std::array< int, LDIM > &v2) const
CCPairFunction(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op_, const Function< T, LDIM > &f1, const Function< T, LDIM > &f2)
takes a deep copy of the argument functions
Definition: ccpairfunction.h:424
friend hashT hash_value(const CCPairFunction &f)
Definition: ccpairfunction.h:449
CCPairFunction(const Function< T, NDIM > &ket)
takes a shallow copy of the argument function
Definition: ccpairfunction.h:386
double make_xy_u(const CCFunction< T, LDIM > &xx, const CCFunction< T, LDIM > &yy) const
Definition: ccpairfunction.cc:279
std::string name(const bool transpose=false) const
Definition: ccpairfunction.h:671
static std::vector< CCPairFunction > remove_linearly_dependent_terms(const std::vector< CCPairFunction > &other, double thresh=-1.0)
remove linear dependent terms in the low-rank parts
Definition: ccpairfunction.cc:144
bool has_operator() const
Definition: ccpairfunction.h:569
std::shared_ptr< TwoBodyFunctionComponentBase > component
the 3 types of 6D-function that occur in the CC potential which coupled doubles to singles
Definition: ccpairfunction.h:787
const std::shared_ptr< CCConvolutionOperator< T, LDIM > > get_operator_ptr() const
Definition: ccpairfunction.h:610
CCPairFunction & operator*=(const double fac)
Definition: ccpairfunction.h:641
CCPairFunction(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op_, const std::vector< Function< T, LDIM >> &f1, const std::vector< Function< T, LDIM >> &f2)
takes a deep copy of the argument functions
Definition: ccpairfunction.h:417
bool is_pure_no_op() const
Definition: ccpairfunction.h:572
friend std::vector< CCPairFunction > swap_particles(const std::vector< CCPairFunction > &argument)
Definition: ccpairfunction.h:783
static std::vector< CCPairFunction > op_dec_to_pure(const std::vector< CCPairFunction > &other)
turn decomposed functions with operator into pure functions without operators
Definition: ccpairfunction.cc:127
bool is_decomposed() const
Definition: ccpairfunction.h:573
CCPairFunction to_pure() const
out-of-place conversion to pure function
Definition: ccpairfunction.h:631
bool is_op_pure() const
Definition: ccpairfunction.h:571
TwoBodyFunctionPureComponent< T, NDIM > & pure() const
Definition: ccpairfunction.h:577
CCPairFunction & operator()(const CCPairFunction &other)
shallow assignment operator
Definition: ccpairfunction.h:430
CCPairFunction(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op_, const CCFunction< T, LDIM > &f1, const CCFunction< T, LDIM > &f2)
takes a deep copy of the argument functions
Definition: ccpairfunction.h:412
friend double inner(const CCPairFunction &a, const CCPairFunction &b, const Function< T, LDIM > &R2)
Definition: ccpairfunction.h:753
Tensor< T >::scalar_type norm2() const
Definition: ccpairfunction.h:676
static std::vector< CCPairFunction< T, NDIM > > apply(const SeparatedConvolution< T, NDIM > &G, const CCPairFunction< T, NDIM > &argument)
Function< T, NDIM > & get_function() const
Definition: ccpairfunction.h:509
CCPairFunction invert_sign()
Definition: ccpairfunction.cc:17
const std::pair< std::vector< Function< T, LDIM > >, std::vector< Function< T, LDIM > > > assign_particles(const size_t particle) const
small helper function that gives back (a,b) or (b,a) depending on the value of particle
Definition: ccpairfunction.cc:533
bool is_op_decomposed() const
Definition: ccpairfunction.h:574
friend std::vector< CCPairFunction > multiply(const std::vector< CCPairFunction > &other, const Function< T, LDIM > f, const std::array< int, LDIM > &v1)
Definition: ccpairfunction.h:547
friend CCPairFunction copy(const CCPairFunction &other)
deep copy
Definition: ccpairfunction.h:439
CCPairFunction swap_particles() const
Definition: ccpairfunction.h:741
friend CCPairFunction operator*(const double fac, const CCPairFunction &f)
scalar multiplication: fac*f
Definition: ccpairfunction.h:526
Function< T, LDIM > dirac_convolution(const CCFunction< T, LDIM > &x, const CCConvolutionOperator< T, LDIM > &op, const size_t particle) const
result is: <x|op12|f>_particle
Definition: ccpairfunction.cc:321
Function< T, LDIM > project_out_decomposed(const Function< T, LDIM > &f, const size_t particle) const
Definition: ccpairfunction.cc:490
CCPairFunction()=default
empty ctor
A multiresolution adaptive numerical function.
Definition: mra.h:122
Definition: projector.h:17
Convolutions in separated form (including Gaussian)
Definition: operator.h:136
TensorTypeData< T >::scalar_type scalar_type
C++ typename of the real type associated with a complex type.
Definition: tensor.h:409
Definition: ccpairfunction.h:136
virtual void print_size(const std::string name="") const =0
virtual hashT hash() const =0
virtual std::shared_ptr< TwoBodyFunctionComponentBase > clone()=0
virtual bool has_operator() const =0
virtual bool is_pure() const
Definition: ccpairfunction.h:139
virtual void swap_particles_inplace()=0
virtual ~TwoBodyFunctionComponentBase()
Definition: ccpairfunction.h:148
virtual World & world() const =0
virtual bool is_decomposed() const
Definition: ccpairfunction.h:140
virtual std::string name(const bool transpose=false) const =0
a two-body, explicitly 6-dimensional function
Definition: ccpairfunction.h:154
bool has_operator() const override
Definition: ccpairfunction.h:179
TwoBodyFunctionPureComponent(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op, const Function< T, NDIM > &f)
Definition: ccpairfunction.h:162
TwoBodyFunctionPureComponent & operator*=(const Q fac)
Definition: ccpairfunction.h:172
std::string name(const bool transpose) const override
Definition: ccpairfunction.h:187
Function< T, NDIM > & get_function()
Definition: ccpairfunction.h:212
const std::shared_ptr< CCConvolutionOperator< T, LDIM > > get_operator_ptr() const
Definition: ccpairfunction.h:208
std::shared_ptr< CCConvolutionOperator< T, LDIM > > op
Definition: ccpairfunction.h:225
TwoBodyFunctionPureComponent()=default
World & world() const override
Definition: ccpairfunction.h:181
Function< T, NDIM > u
pure 6D function
Definition: ccpairfunction.h:224
TwoBodyFunctionPureComponent(const Function< T, NDIM > &f)
Definition: ccpairfunction.h:161
void print_size(const std::string name1="") const override
Definition: ccpairfunction.h:183
void swap_particles_inplace() override
return f(2,1)
Definition: ccpairfunction.h:204
hashT hash() const override
Definition: ccpairfunction.h:216
TwoBodyFunctionPureComponent apply(const SeparatedConvolution< Q, MDIM > *op, const int particle=0)
Definition: ccpairfunction.h:201
std::shared_ptr< TwoBodyFunctionComponentBase > clone() override
deep copy
Definition: ccpairfunction.h:166
void set_operator(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op1)
Definition: ccpairfunction.h:210
bool is_pure() const override
Definition: ccpairfunction.h:177
static constexpr std::size_t LDIM
Definition: ccpairfunction.h:155
Definition: ccpairfunction.h:232
World & world() const override
Definition: ccpairfunction.h:263
long rank() const
Definition: ccpairfunction.h:308
void serialize()
Definition: ccpairfunction.h:285
std::shared_ptr< CCConvolutionOperator< T, LDIM > > op
Definition: ccpairfunction.h:332
std::vector< Function< T, LDIM > > get_vector(const int i) const
Definition: ccpairfunction.h:315
std::vector< Function< T, LDIM > > b
Definition: ccpairfunction.h:331
static constexpr std::size_t LDIM
Definition: ccpairfunction.h:233
TwoBodyFunctionSeparatedComponent(const TwoBodyFunctionSeparatedComponent &other)=default
hashT hash() const override
Definition: ccpairfunction.h:287
void set_operator(const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op1)
Definition: ccpairfunction.h:326
const std::shared_ptr< CCConvolutionOperator< T, LDIM > > get_operator_ptr() const
Definition: ccpairfunction.h:324
TwoBodyFunctionSeparatedComponent(const std::vector< Function< T, LDIM >> &a, const std::vector< Function< T, LDIM >> &b)
Definition: ccpairfunction.h:239
void print_size(const std::string name1="") const override
Definition: ccpairfunction.h:268
TwoBodyFunctionSeparatedComponent()=default
bool has_operator() const override
Definition: ccpairfunction.h:261
std::string name(const bool transpose) const override
Definition: ccpairfunction.h:276
TwoBodyFunctionSeparatedComponent(const std::vector< Function< T, LDIM >> &a, const std::vector< Function< T, LDIM >> &b, const std::shared_ptr< CCConvolutionOperator< T, LDIM >> op)
Definition: ccpairfunction.h:242
std::vector< Function< T, LDIM > > get_a() const
Definition: ccpairfunction.h:313
TwoBodyFunctionPureComponent< T, NDIM > apply(const SeparatedConvolution< Q, MDIM > *op, const int particle=0)
Definition: ccpairfunction.h:299
void swap_particles_inplace() override
return f(2,1)
Definition: ccpairfunction.h:304
std::vector< Function< T, LDIM > > a
Definition: ccpairfunction.h:330
bool is_decomposed() const override
Definition: ccpairfunction.h:260
std::vector< Function< T, LDIM > > get_b() const
Definition: ccpairfunction.h:314
TwoBodyFunctionSeparatedComponent & operator*=(const Q fac)
Definition: ccpairfunction.h:255
std::shared_ptr< TwoBodyFunctionComponentBase > clone() override
deep copy
Definition: ccpairfunction.h:249
A simple, fixed dimension vector.
Definition: vector.h:64
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
World * get_world() const
Returns a pointer to the world.
Definition: parallel_archive.h:130
An archive for storing local or parallel data wrapping a BinaryFstreamOutputArchive.
Definition: parallel_archive.h:321
Objects that implement their own parallel archive interface should derive from this class.
Definition: parallel_archive.h:58
double(* f1)(const coord_3d &)
Definition: derivatives.cc:55
double(* f2)(const coord_3d &)
Definition: derivatives.cc:56
const std::size_t bufsize
Definition: derivatives.cc:16
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition: derivatives.cc:72
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
Tensor< double > op(const Tensor< double > &x)
Definition: kain.cc:508
#define max(a, b)
Definition: lda.h:51
Declares the macrotaskq and MacroTaskBase classes.
#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_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
#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.
double norm(const T &t)
Definition: adquad.h:42
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
std::vector< CCPairFunction< T, NDIM > > operator+(const std::vector< CCPairFunction< T, NDIM >> c1, const std::vector< CCPairFunction< T, NDIM > > &c2)
Definition: ccpairfunction.h:1047
static std::string stringify(T arg)
Definition: funcplot.h:1034
static double cpu_time()
Returns the cpu time in seconds relative to an arbitrary origin.
Definition: timers.h:127
std::enable_if_t< NDIM%2==0, Function< T, NDIM > > swap_particles(const Function< T, NDIM > &f)
swap particles 1 and 2
Definition: mra.h:2302
response_space scale(response_space a, double b)
std::vector< CCPairFunction< T, NDIM > > operator-(const std::vector< CCPairFunction< T, NDIM >> c1, const std::vector< CCPairFunction< T, NDIM > > &c2)
Definition: ccpairfunction.h:1055
response_space apply(World &world, std::vector< std::vector< std::shared_ptr< real_convolution_3d >>> &op, response_space &f)
Definition: basic_operators.cc:39
FuncType
Definition: ccpairfunction.h:26
@ RESPONSE
Definition: ccpairfunction.h:26
@ HOLE
Definition: ccpairfunction.h:26
@ UNDEFINED
Definition: ccpairfunction.h:26
@ PARTICLE
Definition: ccpairfunction.h:26
@ MIXED
Definition: ccpairfunction.h:26
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
response_space transpose(response_space &f)
Definition: basic_operators.cc:10
void hash_combine(hashT &seed, const T &v)
Combine hash values.
Definition: worldhash.h:260
double norm2(World &world, const std::vector< Function< T, NDIM > > &v)
Computes the 2-norm of a vector of functions.
Definition: vmra.h:851
void plot_plane(World &world, const Function< double, NDIM > &function, const std::string name)
Definition: funcplot.h:621
OpType
operator types
Definition: operatorinfo.h:11
@ OT_UNDEFINED
Definition: operatorinfo.h:12
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
bool is_collected(const std::vector< CCPairFunction< T, NDIM >> &other)
Definition: ccpairfunction.h:1092
void print_size(World &world, const std::vector< Function< T, NDIM > > &v, const std::string &msg="vectorfunction")
Definition: vmra.h:1622
std::vector< CCPairFunction< T, NDIM > > & operator+=(std::vector< CCPairFunction< T, NDIM > > &lhs, const CCPairFunction< T, NDIM > &rhs)
Definition: ccpairfunction.h:1063
NDIM & f
Definition: mra.h:2416
std::vector< CCPairFunction< T, NDIM > > & operator-=(std::vector< CCPairFunction< T, NDIM > > &rhs, const std::vector< CCPairFunction< T, NDIM > > &lhs)
Definition: ccpairfunction.h:1077
std::vector< CCPairFunction< T, NDIM > > operator*(const double fac, const std::vector< CCPairFunction< T, NDIM > > &arg)
Definition: ccpairfunction.h:1084
std::size_t hashT
The hash value type.
Definition: worldhash.h:145
double wall_time()
Returns the wall time in seconds relative to an arbitrary origin.
Definition: timers.cc:48
double inner(response_space &a, response_space &b)
Definition: response_functions.h:442
double imag(double x)
Definition: complexfun.h:56
std::string type(const PairType &n)
Definition: PNOParameters.h:18
double real(double x)
Definition: complexfun.h:52
std::string name(const FuncType &type, const int ex=-1)
Definition: ccpairfunction.h:28
madness::hashT hash_value(const std::array< T, N > &a)
Hash std::array with madness hash.
Definition: array_addons.h:78
void swap(Vector< T, N > &l, Vector< T, N > &r)
Swap the contents of two Vectors.
Definition: vector.h:497
static long abs(long a)
Definition: tensor.h:218
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 c
Definition: relops.cc:10
static const double thresh
Definition: rk.cc:45
parameter class
Definition: CCStructures.h:747
Default load of an object via serialize(ar, t).
Definition: archive.h:666
static void store(const ParallelOutputArchive< archiveT > &ar, const CCPairFunction< T, NDIM > &f)
Definition: ccpairfunction.h:867
Default store of an object via serialize(ar, t).
Definition: archive.h:611
Definition: lowrankfunction.h:332
void push_back(const vector_real_function_3d &f)
Definition: response_functions.h:300
Definition: timing_utilities.h:9
double end(const std::string msg)
Definition: timing_utilities.h:56
pcomplex_operatorT G
Definition: tdse1d.cc:167
InputParameters param
Definition: tdse.cc:203
int P
Definition: test_binsorter.cc:9
double aa
Definition: testbsh.cc:68
static const std::size_t NDIM
Definition: testpdiff.cc:42
const double R2
Definition: vnucso.cc:84