10#ifndef CCSTRUCTURES_H_
11#define CCSTRUCTURES_H_
92 output(
const std::string& msg)
const;
95 section(
const std::string& msg)
const;
101 warning(
const std::string& msg)
const;
109 using madness::operators::operator<<;
147 info(
const bool debug =
true,
const double norm = 12345.6789);
188 void print(
const std::pair<double, double>& times)
const {
190 std::cout << std::setfill(
' ') << std::scientific << std::setprecision(2)
191 <<
"Timer: " << times.first <<
" (Wall), " << times.second <<
" (CPU)" <<
", (" +
operation +
")"
218 double thresh_operators=1.e-6;
219 initialize < std::string > (
"calc_type",
"mp2",
"the calculation type", {
"mp2",
"mp3",
"cc2",
"cis",
"lrcc2",
"cispd",
"adc2",
"test"});
220 initialize < double > (
"lo", 1.e-7,
"the finest length scale to be resolved by 6D operators");
221 initialize < double > (
"dmin", 1.0,
"defines the depth of the special level");
222 initialize < double > (
"thresh_6d",
thresh,
"threshold for the 6D wave function");
223 initialize < double > (
"tight_thresh_6d", 0.1*
thresh,
"tight threshold for the 6D wave function");
224 initialize < double > (
"thresh_3d", 0.01*
thresh,
"threshold for the 3D reference wave function");
225 initialize < double > (
"tight_thresh_3d", 0.001*
thresh,
"tight threshold for the 3D reference wave function");
226 initialize < double > (
"thresh_bsh_3d", thresh_operators,
"threshold for BSH operators");
227 initialize < double > (
"thresh_bsh_6d", thresh_operators,
"threshold for BSH operators");
228 initialize < double > (
"thresh_poisson", thresh_operators,
"threshold for Poisson operators");
229 initialize < double > (
"thresh_f12", thresh_operators,
"threshold for Poisson operators");
230 initialize < double > (
"thresh_Ue", thresh_operators,
"ue threshold");
231 initialize < double > (
"econv",
thresh,
"overal convergence threshold ");
232 initialize < double > (
"econv_pairs", 0.1*
thresh,
"convergence threshold for pairs");
233 initialize < double > (
"dconv_3d", 0.3*
thresh,
"convergence for cc singles");
234 initialize < double > (
"dconv_6d", 3.0*
thresh,
"convergence for cc doubles");
235 initialize < std::size_t > (
"iter_max", 10,
"max iterations");
236 initialize < std::size_t > (
"iter_max_3d", 10,
"max iterations for singles");
237 initialize < std::size_t > (
"iter_max_6d", 10,
"max iterations for doubles");
238 initialize < std::pair<int, int>> (
"only_pair", {-1, -1},
"compute only a single pair");
239 initialize < bool > (
"restart",
false,
"restart");
240 initialize < bool > (
"no_compute",
false,
"no compute");
241 initialize < bool > (
"no_compute_gs",
false,
"no compute");
242 initialize < bool > (
"no_compute_mp2_constantpart",
false,
"no compute");
243 initialize < bool > (
"no_compute_response",
false,
"no compute");
244 initialize < bool > (
"no_compute_mp2",
false,
"no compute");
245 initialize < bool > (
"no_compute_cc2",
false,
"no compute");
246 initialize < bool > (
"no_compute_cispd",
false,
"no compute");
247 initialize < bool > (
"no_compute_lrcc2",
false,
"no compute");
248 initialize < double > (
"corrfac_gamma", 1.0,
"exponent for the correlation factor");
249 initialize < std::size_t > (
"output_prec", 8,
"for formatted output");
250 initialize < bool > (
"debug",
false,
"");
251 initialize < bool > (
"plot",
false,
"");
252 initialize < bool > (
"kain",
true,
"");
253 initialize < std::size_t > (
"kain_subspace", 3,
"");
254 initialize < long > (
"freeze", -1,
"number of frozen orbitals: -1: automatic");
255 initialize < bool > (
"test",
false,
"");
257 initialize < bool > (
"decompose_Q",
true,
"always true",{
true});
261 initialize < bool > (
"QtAnsatz",
true,
"always true",{
true});
263 initialize < std::vector<size_t>>
264 (
"excitations", {},
"vector containing the excitations");
270 std::string value = get<std::string>(
"calc_type");
271 if (value ==
"mp2")
return CT_MP2;
272 if (value ==
"mp3")
return CT_MP3;
273 if (value ==
"cc2")
return CT_CC2;
274 if (value ==
"cis")
return CT_LRCCS;
275 if (value ==
"lrcc2")
return CT_LRCC2;
276 if (value ==
"cispd")
return CT_CISPD;
277 if (value ==
"adc2")
return CT_ADC2;
278 if (value ==
"test")
return CT_TEST;
283 double lo()
const {
return get<double>(
"lo"); }
285 double dmin()
const {
return get<double>(
"dmin"); }
287 double thresh_3D()
const {
return get<double>(
"thresh_3d"); }
291 double thresh_6D()
const {
return get<double>(
"thresh_6d"); }
301 double thresh_f12()
const {
return get<double>(
"thresh_f12"); }
303 double thresh_Ue()
const {
return get<double>(
"thresh_ue"); }
305 double econv()
const {
return get<double>(
"econv"); }
309 double dconv_3D()
const {
return get<double>(
"dconv_3d"); }
311 double dconv_6D()
const {
return get<double>(
"dconv_6d"); }
313 std::size_t
iter_max()
const {
return get<std::size_t>(
"iter_max"); }
315 std::size_t
iter_max_3D()
const {
return get<std::size_t>(
"iter_max_3d"); }
317 std::size_t
iter_max_6D()
const {
return get<std::size_t>(
"iter_max_6d"); }
319 std::pair<int, int>
only_pair()
const {
return get<std::pair<int, int>>(
"only_pair"); }
321 bool restart()
const {
return get<bool>(
"restart"); }
339 bool debug()
const {
return get<bool>(
"debug"); }
341 bool plot()
const {
return get<bool>(
"plot"); }
343 bool kain()
const {
return get<bool>(
"kain"); }
345 bool test()
const {
return get<bool>(
"test"); }
349 bool QtAnsatz()
const {
return get<bool>(
"qtansatz"); }
351 std::size_t
output_prec()
const {
return get<std::size_t>(
"output_prec"); }
353 std::size_t
kain_subspace()
const {
return get<std::size_t>(
"kain_subspace"); }
355 long freeze()
const {
return get<long>(
"freeze"); }
357 std::vector<std::size_t>
excitations()
const {
return get<std::vector<std::size_t>>(
"excitations"); }
359 double gamma()
const {
return get<double>(
"corrfac_gamma");}
368 if (world.
rank() == 0)
369 std::cout <<
"\n\n\n\n\n!!!!!!!!!\n\nERROR IN CC_PARAMETERS:\n ERROR MESSAGE IS: " << msg
370 <<
"\n\n\n!!!!!!!!" << std::endl;
375 if (world.
rank() == 0) std::cout <<
"WARNING IN CC_PARAMETERS!: " << msg << std::endl;
383 std::vector<std::pair<int, int>>
map;
388 std::vector<std::pair<int, int>>
map;
389 for (
int i=nfreeze; i<nocc; ++i) {
390 for (
int j=i; j<nocc; ++j) {
391 map.push_back(std::make_pair(i,j));
398 std::vector<std::pair<int, int>>
map;
399 for (
int i=nfreeze; i<nocc; ++i) {
400 for (
int j=nfreeze; j<nocc; ++j) {
401 map.push_back(std::make_pair(i,j));
407 void print(
const std::string msg=
"PairVectorMap")
const {
410 for (
size_t i=0; i<
map.size(); ++i) {
429 template<
typename R,
typename opT>
432 for (
auto&
p :
arg.allpairs) {
434 int j=
p.first.second;
442 for (
int i=0; i<argument.size(); ++i) {
443 pairs.
insert(map.
map[i].first,map.
map[i].second,argument[i]);
449 std::vector<T> vector;
450 for (
size_t i=0; i<argument.
allpairs.size(); ++i) {
451 vector.push_back(argument(map.
map[i].first,map.
map[i].second));
458 return allpairs.at(std::make_pair(i, j));
466 return allpairs[std::make_pair(i, j)];
472 std::pair<int, int> key = std::make_pair(i, j);
473 allpairs.insert(std::make_pair(key, pair));
482 if (
allpairs.size() == 0)
return true;
488template <
typename T, std::
size_t NDIM>
495template<
typename T, std::
size_t NDIM>
499 for (
const auto& tmp : im.allpairs) {
500 size += get_size<T, NDIM>(tmp.second);
516 for (
size_t i = 0; i <
v.size(); i++) {
518 functions.insert(std::make_pair(i, tmp));
523 for (
size_t i = 0; i <
v.size(); i++) {
530 for (
size_t i = 0; i <
v.size(); i++) {
532 functions.insert(std::make_pair(i, tmp));
540 for (
size_t i = 0; i <
v.size(); i++) {
542 functions.insert(std::make_pair(freeze + i, tmp));
548 for (
auto x:
v)
functions.insert(std::make_pair(x.i, x));
561 if (
this == &other)
return *
this;
578 tmp.
functions.insert(std::make_pair(x.first,
copy(x.second)));
609 template<
typename Archive>
611 typedef std::vector<std::pair<std::size_t, CCFunction<double,3>>> CC_functionvec;
614 return CC_functionvec(map.begin(), map.end());
616 auto vector2map = [] (
const CC_functionvec&
vec) {
621 if (ar.is_input_archive) {
624 CC_functionvec tmp(
size);
626 for (
auto& t : tmp) ar & t.first & t.second;
628 }
else if (ar.is_output_archive) {
631 for (
auto& t : tmp) ar & t.first & t.second;
636 hashT hashval = std::hash<FuncType>{}(
type);
688 for (
size_t i = 0; i <
v.size(); i++) {
690 functions.insert(std::make_pair(freeze + i, tmp));
697 for (
auto x:
functions) tmp.push_back(x.second.function);
708 print_size(
const std::string& msg =
"!?not assigned!?")
const;
713 const size_t freeze =
functions.cbegin()->first;
720 ktmp.second.function.scale(factor);
728 void plot(
const std::string& msg =
"")
const {
730 ktmp.second.plot(msg);
742template<
typename T=
double, std::
size_t NDIM=3>
765 template<
typename archiveT>
794 param.freeze=
a.parameters.freeze;
798 friend std::shared_ptr<CCConvolutionOperator>
combine(
const std::shared_ptr<CCConvolutionOperator>&
a,
799 const std::shared_ptr<CCConvolutionOperator>&
b) {
800 if (
a and (not
b))
return a;
801 if ((not
a) and
b)
return b;
802 if ((not
a) and (not
b))
return nullptr;
810 if (
op)
return ((*
op)(
f)).truncate();
819 std::vector<Function<T, NDIM>> result;
820 if constexpr (
NDIM == 3) {
825 result.push_back(tmpi);
843 return apply<T,T,NDIM,NDIM>(
world, (*
op),
f);
870 std::stringstream ss;
898 for (
const auto& tmp:
imH.allpairs)
899 tmp.second.print_size(
"<H" + std::to_string(tmp.first.first) +
"|" +
name() +
"|H" +
900 std::to_string(tmp.first.second) +
"> intermediate");
902 for (
const auto& tmp:
imP.allpairs)
903 tmp.second.print_size(
"<H" + std::to_string(tmp.first.first) +
"|" +
name() +
"|P" +
904 std::to_string(tmp.first.second) +
"> intermediate");
906 for (
const auto& tmp:
imR.allpairs)
907 tmp.second.print_size(
"<H" + std::to_string(tmp.first.first) +
"|" +
name() +
"|R" +
908 std::to_string(tmp.first.second) +
"> intermediate");
914 factory.set_info(
op->info);
922 std::shared_ptr<SeparatedConvolution<T,NDIM>>
get_op()
const {
return op;};
933 std::shared_ptr<SeparatedConvolution<T,NDIM>>
op;
940 void error(
const std::string& msg)
const {
942 std::cout <<
"\n\n!!!!ERROR in CCConvolutionOperator " <<
name() <<
": " << msg
943 <<
"!!!!!\n\n" << std::endl;
949template<
typename T, std::
size_t NDIM>
980 std::vector<unsigned char>
v;
986 records+=cloud.
store(world,
v);
987 if (function_is_assigned) records+=cloud.
store(world,
functions[0]);
998 std::vector<unsigned char>
v=cloud.
forward_load<std::vector<unsigned char>>(world,recordlist);
1000 bool function_is_assigned =
false, constant_part_is_initialized=
false;
1001 arin &
type &
ctype &
i &
j &
bsh_eps & function_is_assigned & constant_part_is_initialized;
1024 template<
typename Archive>
1027 bool fexist = (f_size > 0) && (
functions[0].get_function().is_initialized());
1030 if constexpr (Archive::is_input_archive) {
1038 if (fexist) ar &
functions[0].get_function();
1047 if (world.
rank() == 0) printf(
"loading matrix elements %s\n",
name.c_str());
1054 if (world.
rank() == 0)
print(
"could not find pair ",
i,
j,
" on disk");
1061 if (world.
rank() == 0) printf(
"storing matrix elements %s\n",
name.c_str());
1067 hashT hash_i = std::hash<std::size_t>{}(
i);
1087 std::string
name =
"???";
1162 for (
const auto&
f :
v) {
1200 std::cout <<
"Intermediate Potential Manager: " << msg <<
"\n";
1216 std::vector<Function<double,3>>
U1;
1243 records+=cloud.
store(world,
U2);
1244 records+=cloud.
store(world,
U1);
1263 U1=cloud.
forward_load<std::vector<Function<double,3>>>(world,recordlist);
1275 const std::string
policy)
const override {
1277 for (
size_t i = 0; i < vsize1; i++) {
1279 p.push_back(std::make_pair(
batch,1.0));
1296 std::size_t n = std::get<0>(argtuple).size();
1297 resultT result = zero_functions_compressed<double, 6>(world, n);
1305 resultT operator() (
const std::vector<CCPair>& pair,
const Info& info,
const std::vector<std::string>& argument)
const;
1321 const std::string
policy)
const override {
1323 for (
size_t i = 0; i < vsize1; i++) {
1325 p.push_back(std::make_pair(
batch,1.0));
1334 name=
"ConstantPart";
1340 typedef std::tuple<const std::vector<CCPair>&,
1341 const std::vector<Function<double,3>>&,
const std::vector<Function<double,3>>&,
1347 std::size_t n = std::get<0>(argtuple).size();
1348 resultT result = zero_functions_compressed<double, 6>(world, n);
1354 const Info& info)
const;
1366 const std::string
policy)
const override {
1368 for (
size_t i = 0; i < vsize1; i++) {
1370 p.push_back(std::make_pair(
batch, 1.0));
1378 name=
"MP2UpdatePair";
1385 typedef std::tuple<const std::vector<CCPair>&,
const std::vector<real_function_6d>&,
1391 std::size_t n = std::get<0>(argtuple).size();
1392 resultT result = zero_functions_compressed<double, 6>(world, n);
1400 resultT operator() (
const std::vector<CCPair>& pair,
const std::vector<real_function_6d>& mp2_coupling,
1412 const std::string
policy)
const override {
1414 for (
size_t i = 0; i < vsize1; i++) {
1416 p.push_back(std::make_pair(
batch,1.0));
1428 const std::vector<CCPair>&,
1429 const std::vector<real_function_6d>&,
1439 std::size_t n = std::get<0>(argtuple).size();
1440 resultT result = zero_functions_compressed<double, 6>(world, n);
1456 const std::vector<real_function_6d>& local_coupling,
1460 const std::size_t&
maxiter)
const;
double potential(const coord_3d &r)
Definition 3dharmonic.cc:132
Definition macrotaskpartitioner.h:63
a batch consists of a 2D-input batch and a 1D-output batch: K-batch <- (I-batch, J-batch)
Definition macrotaskpartitioner.h:132
Definition CCStructures.h:743
intermediateT< T, NDIM > imH
Definition CCStructures.h:934
CCConvolutionOperator(const CCConvolutionOperator &other)=default
friend hashT hash_value(CCConvolutionOperator< T, NDIM > &op)
Definition CCStructures.h:882
static std::shared_ptr< CCConvolutionOperator > CCConvolutionOperatorPtr(World &world, const OpType type, Parameters param)
Definition CCStructures.h:782
Function< T, NDIM > operator()(const Function< T, NDIM > &f) const
Definition CCStructures.h:809
SeparatedConvolution< T, NDIM > * init_op(const OpType &type, const Parameters ¶meters) const
Definition CCStructures.cc:374
size_t info() const
prints out information (operatorname, number of stored intermediates ...)
Definition CCStructures.cc:356
std::shared_ptr< SeparatedConvolution< T, NDIM > > op
Definition CCStructures.h:933
std::vector< Function< T, NDIM > > operator()(const std::vector< Function< T, NDIM > > &f) const
Definition CCStructures.h:841
OpType type() const
Definition CCStructures.h:918
void clear_intermediates(const FuncType &type)
Definition CCStructures.cc:334
World & world
the world
Definition CCStructures.h:926
void sanity() const
sanity check .. doens not do so much
Definition CCStructures.h:893
std::string name() const
Definition CCStructures.h:869
friend std::shared_ptr< CCConvolutionOperator > combine(const std::shared_ptr< CCConvolutionOperator > &a, const std::shared_ptr< CCConvolutionOperator > &b)
Definition CCStructures.h:798
void update_elements(const CC_vecfunction &bra, const CC_vecfunction &ket)
Definition CCStructures.cc:302
intermediateT< T, NDIM > imP
Definition CCStructures.h:935
void error(const std::string &msg) const
Definition CCStructures.h:940
const Parameters parameters
Definition CCStructures.h:920
CCConvolutionOperator(World &world, const OpType type, Parameters param)
Definition CCStructures.h:775
std::vector< Function< T, NDIM > > operator()(const CC_vecfunction &bra, const CCFunction< T, NDIM > &ket) const
Definition CCStructures.h:817
std::shared_ptr< SeparatedConvolution< T, NDIM > > get_op() const
Definition CCStructures.h:922
void print_intermediate(const FuncType type) const
Definition CCStructures.h:896
intermediateT< T, NDIM > imR
Definition CCStructures.h:936
TwoElectronFactory< T, 2 *NDIM > get_kernel() const
create a TwoElectronFactory with the operatorkernel
Definition CCStructures.h:912
friend CCConvolutionOperator combine(const CCConvolutionOperator &a, const CCConvolutionOperator &b)
Definition CCStructures.h:788
structure for a CC Function 3D which holds an index and a type
Definition ccpairfunction.h:45
Function< T, NDIM > function
Definition ccpairfunction.h:70
size_t i
Definition ccpairfunction.h:78
a 6D function, either in full or low rank form, possibly including an 2-particle function
Definition ccpairfunction.h:373
Definition CCStructures.h:956
hashT hash() const
Definition CCStructures.h:1066
void info() const
Definition CCStructures.cc:84
void store_pair(World &world)
Definition CCStructures.h:1059
CCPair(const CCPair &other)
Definition CCStructures.h:966
Recordlist< Cloud::keyT > cloud_store(World &world, Cloud &cloud) const
customized function to store this to the cloud
Definition CCStructures.h:978
std::string name() const
Definition CCStructures.h:1086
CCPair(const size_t ii, const size_t jj, const CCState t, const CalcType c, const std::vector< CCPairFunction< double, 6 > > &f)
Definition CCStructures.h:963
size_t i
Definition CCStructures.h:972
CCPair()
Definition CCStructures.h:958
real_function_6d function() const
gives back the pure 6D part of the pair function
Definition CCStructures.h:1010
real_function_6d constant_part
the constant part
Definition CCStructures.h:1079
std::vector< CCPairFunction< double, 6 > > functions
the functions which belong to the pair
Definition CCStructures.h:1076
CCPair(const size_t ii, const size_t jj, const CCState t, const CalcType c)
Definition CCStructures.h:960
void update_u(const real_function_6d &u)
updates the pure 6D part of the pair function
Definition CCStructures.h:1017
size_t j
Definition CCStructures.h:973
CCState type
Definition CCStructures.h:970
bool load_pair(World &world)
Definition CCStructures.h:1043
double bsh_eps
Definition CCStructures.h:1084
void serialize(const Archive &ar)
Definition CCStructures.h:1025
CalcType ctype
Definition CCStructures.h:971
void cloud_load(World &world, const Cloud &cloud, Recordlist< Cloud::keyT > &recordlist)
customized function to load this from the cloud
Definition CCStructures.h:996
cloud class
Definition cloud.h:147
recordlistT store(madness::World &world, const T &source)
Definition cloud.h:302
T forward_load(madness::World &world, recordlistT &recordlist) const
load a single object from the cloud, recordlist is consumed while loading elements
Definition cloud.h:284
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:204
static const double & get_thresh()
Returns the default threshold.
Definition funcdefaults.h:279
A multiresolution adaptive numerical function.
Definition mra.h:122
void set_thresh(double value, bool fence=true)
Sets the value of the truncation threshold. Optional global fence.
Definition mra.h:577
const std::shared_ptr< FunctionImpl< T, NDIM > > & get_impl() const
Returns a shared-pointer to the implementation.
Definition mra.h:614
void clear(bool fence=true)
Clears the function as if constructed uninitialized. Optional fence.
Definition mra.h:847
bool is_initialized() const
Returns true if the function is initialized.
Definition mra.h:147
Definition CCStructures.h:1316
partitionT do_partitioning(const std::size_t &vsize1, const std::size_t &vsize2, const std::string policy) const override
override this if you want your own partitioning
Definition CCStructures.h:1320
ConstantPartPartitioner()
Definition CCStructures.h:1318
Definition CCStructures.h:1314
std::vector< real_function_6d > resultT
Definition CCStructures.h:1344
MacroTaskConstantPart()
Definition CCStructures.h:1332
std::tuple< const std::vector< CCPair > &, const std::vector< Function< double, 3 > > &, const std::vector< Function< double, 3 > > &, const madness::Info & > argtupleT
Definition CCStructures.h:1342
resultT allocator(World &world, const argtupleT &argtuple) const
Definition CCStructures.h:1346
resultT operator()(const std::vector< CCPair > &pair, const std::vector< Function< double, 3 > > &gs_singles, const std::vector< Function< double, 3 > > &ex_singles, const Info &info) const
Definition CCStructures.cc:527
Definition CCStructures.h:1407
IteratePairPartitioner()=default
partitionT do_partitioning(const std::size_t &vsize1, const std::size_t &vsize2, const std::string policy) const override
override this if you want your own partitioning
Definition CCStructures.h:1411
Definition CCStructures.h:1405
std::tuple< const std::vector< CCPair > &, const std::vector< real_function_6d > &, const CC_vecfunction &, const CC_vecfunction &, const Info &, const std::size_t & > argtupleT
Definition CCStructures.h:1434
resultT operator()(const std::vector< CCPair > &pair, const std::vector< real_function_6d > &local_coupling, const CC_vecfunction &gs_singles, const CC_vecfunction &ex_singles, const Info &info, const std::size_t &maxiter) const
iterate a given pair of the MP2, CC2 or LRCC2 calculation
Definition CCStructures.cc:569
MacroTaskIteratePair()
Definition CCStructures.h:1422
resultT allocator(World &world, const argtupleT &argtuple) const
Definition CCStructures.h:1438
std::vector< real_function_6d > resultT
Definition CCStructures.h:1436
Definition CCStructures.h:1270
ConstantPartPartitioner()
Definition CCStructures.h:1272
partitionT do_partitioning(const std::size_t &vsize1, const std::size_t &vsize2, const std::string policy) const override
override this if you want your own partitioning
Definition CCStructures.h:1274
Definition CCStructures.h:1268
resultT operator()(const std::vector< CCPair > &pair, const Info &info, const std::vector< std::string > &argument) const
Definition CCStructures.cc:515
MacroTaskMp2ConstantPart()
Definition CCStructures.h:1286
std::tuple< const std::vector< CCPair > &, const madness::Info &, const std::vector< std::string > & > argtupleT
Definition CCStructures.h:1291
std::vector< real_function_6d > resultT
Definition CCStructures.h:1293
resultT allocator(World &world, const argtupleT &argtuple) const
Definition CCStructures.h:1295
Definition CCStructures.h:1359
UpdatePairPartitioner()
Definition CCStructures.h:1361
partitionT do_partitioning(const std::size_t &vsize1, const std::size_t &vsize2, const std::string policy) const override
override this if you want your own partitioning
Definition CCStructures.h:1365
Definition CCStructures.h:1357
MacroTaskMp2UpdatePair()
Definition CCStructures.h:1376
resultT allocator(World &world, const argtupleT &argtuple) const
Definition CCStructures.h:1390
std::vector< real_function_6d > resultT
Definition CCStructures.h:1388
std::tuple< const std::vector< CCPair > &, const std::vector< real_function_6d > &, const std::vector< madness::Vector< double, 3 > > &, const Info & > argtupleT
Definition CCStructures.h:1386
resultT operator()(const std::vector< CCPair > &pair, const std::vector< real_function_6d > &mp2_coupling, const std::vector< madness::Vector< double, 3 > > &all_coords_vec, const Info &info) const
Definition CCStructures.cc:553
Definition macrotaskq.h:716
Batch batch
Definition macrotaskq.h:718
std::shared_ptr< MacroTaskPartitioner > partitioner
Definition macrotaskq.h:720
std::string name
Definition macrotaskq.h:719
partition one (two) vectors into 1D (2D) batches.
Definition macrotaskpartitioner.h:190
std::string policy
how to partition the batches
Definition macrotaskpartitioner.h:198
std::list< std::pair< Batch, double > > partitionT
Definition macrotaskpartitioner.h:194
MacroTaskPartitioner & set_dimension(const std::size_t &n)
Definition macrotaskpartitioner.h:213
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
Convolutions in separated form (including Gaussian)
Definition operator.h:136
static OperatorInfo combine_OT(const SeparatedConvolution< Q, NDIM > &left, const SeparatedConvolution< Q, NDIM > &right)
return operator type and other info of the combined operator (e.g. fg = f(1,2)* g(1,...
Definition operator.h:1653
A tensor is a multidimension array.
Definition tensor.h:317
factory for generating TwoElectronInterfaces
Definition function_factory.h:436
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
static std::enable_if_t< std::is_same< X, BinaryFstreamInputArchive >::value||std::is_same< X, BinaryFstreamOutputArchive >::value, bool > exists(World &world, const char *filename)
Returns true if the named, unopened archive exists on disk with read access.
Definition parallel_archive.h:224
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
Wraps an archive around an STL vector for output.
Definition vector_archive.h:55
double(* f1)(const coord_3d &)
Definition derivatives.cc:55
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
static bool debug
Definition dirac-hatom.cc:16
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
const int maxiter
Definition gygi_soltion.cc:68
static const double v
Definition hatom_sf_dirac.cc:20
static double u(double r, double c)
Definition he.cc:20
Tensor< double > op(const Tensor< double > &x)
Definition kain.cc:508
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:182
#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
Main include file for MADNESS and defines Function interface.
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
static const char * filename
Definition legendre.cc:96
CalcType
Calculation Types used by CC2.
Definition CCStructures.h:27
@ CT_CC2
Definition CCStructures.h:28
@ CT_LRCC2
Definition CCStructures.h:28
@ CT_MP3
Definition CCStructures.h:28
@ CT_UNDEFINED
Definition CCStructures.h:28
@ CT_LRCCS
Definition CCStructures.h:28
@ CT_CISPD
Definition CCStructures.h:28
@ CT_TEST
Definition CCStructures.h:28
@ CT_MP2
Definition CCStructures.h:28
@ CT_ADC2
Definition CCStructures.h:28
@ CT_TDHF
Definition CCStructures.h:28
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
Function< TENSOR_RESULT_TYPE(Q, T), NDIM > mul(const Q alpha, const Function< T, NDIM > &f, bool fence=true)
Returns new function equal to alpha*f(x) with optional fence.
Definition mra.h:1701
void truncate(World &world, response_space &v, double tol, bool fence)
Definition basic_operators.cc:30
CCState
Type of Pairs used by CC_Pair2 class.
Definition CCStructures.h:31
@ CCSTATE_UNDEFINED
Definition CCStructures.h:32
@ GROUND_STATE
Definition CCStructures.h:32
@ EXCITED_STATE
Definition CCStructures.h:32
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
CalcType assign_calctype(const std::string name)
Assigns enum to string.
Definition CCStructures.cc:400
std::shared_ptr< CCConvolutionOperator< T, NDIM > > CCConvolutionOperatorPtr(World &world, const OpType type, typename CCConvolutionOperator< T, NDIM >::Parameters param)
Definition CCStructures.h:950
void hash_combine(hashT &seed, const T &v)
Combine hash values.
Definition worldhash.h:260
Pairs< Function< T, NDIM > > intermediateT
f12 and g12 intermediates of the form <f1|op|f2> (with op=f12 or op=g12) will be saved using the pair...
Definition CCStructures.h:489
double size_of(const intermediateT< T, NDIM > &im)
Returns the size of an intermediate.
Definition CCStructures.h:497
std::vector< real_function_3d > vector_real_function_3d
Definition functypedefs.h:79
std::shared_ptr< FunctionFunctorInterface< double, 3 > > func(new opT(g))
OpType
operator types
Definition operatorinfo.h:11
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
response_space apply(World &world, std::vector< std::vector< std::shared_ptr< real_convolution_3d > > > &op, response_space &f)
Definition basic_operators.cc:39
NDIM & f
Definition mra.h:2416
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
std::string type(const PairType &n)
Definition PNOParameters.h:18
PotentialType
CC2 Singles Potentials.
Definition CCStructures.h:35
@ POT_singles_
Definition CCStructures.h:52
@ POT_s2b_
Definition CCStructures.h:44
@ POT_F3D_
Definition CCStructures.h:37
@ POT_s5b_
Definition CCStructures.h:42
@ POT_s4c_
Definition CCStructures.h:48
@ POT_s5c_
Definition CCStructures.h:43
@ POT_s6_
Definition CCStructures.h:49
@ POT_s4b_
Definition CCStructures.h:47
@ POT_ccs_
Definition CCStructures.h:50
@ POT_s3c_
Definition CCStructures.h:40
@ POT_s4a_
Definition CCStructures.h:46
@ POT_s5a_
Definition CCStructures.h:41
@ POT_s3b_
Definition CCStructures.h:39
@ POT_s2c_
Definition CCStructures.h:45
@ POT_cis_
Definition CCStructures.h:51
@ POT_UNDEFINED
Definition CCStructures.h:36
@ POT_s3a_
Definition CCStructures.h:38
std::string assign_name(const CCState &input)
Assigns strings to enums for formated output.
Definition CCStructures.cc:383
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
Vector< T, sizeof...(Ts)+1 > vec(T t, Ts... ts)
Factory function for creating a madness::Vector.
Definition vector.h:711
static const double b
Definition nonlinschro.cc:119
static const double a
Definition nonlinschro.cc:118
static const double c
Definition relops.cc:10
static const double thresh
Definition rk.cc:45
parameter class
Definition CCStructures.h:747
int freeze
Definition CCStructures.h:762
Parameters()
Definition CCStructures.h:748
void serialize(archiveT &ar)
f12 exponent
Definition CCStructures.h:766
double lo
Definition CCStructures.h:761
double gamma
Definition CCStructures.h:763
Parameters(const CCParameters ¶m)
Definition CCStructures.h:757
double thresh_op
Definition CCStructures.h:760
Parameters(const Parameters &other)
Definition CCStructures.h:750
Definition CCStructures.h:77
void print_warnings() const
Definition CCStructures.h:103
void warning(const std::string &msg) const
Definition CCStructures.cc:45
void debug_output(const std::string &msg) const
Definition CCStructures.h:87
bool debug
Definition CCStructures.h:83
void subsection(const std::string &msg) const
Definition CCStructures.cc:34
CCMessenger operator<<(const T &t) const
Definition CCStructures.h:108
World & world
Definition CCStructures.h:80
bool scientific
Definition CCStructures.h:82
std::vector< std::string > warnings
collect all warnings that occur to print out at the end of the job
Definition CCStructures.h:115
std::ostream & os
output stream
Definition CCStructures.h:117
void section(const std::string &msg) const
Definition CCStructures.cc:23
void output(const std::string &msg) const
Definition CCStructures.cc:14
CCMessenger(World &world)
Definition CCStructures.h:78
size_t output_prec
Definition CCStructures.h:81
void operator()(const std::string &msg) const
Definition CCStructures.h:85
Definition CCStructures.h:199
double thresh_Ue() const
Definition CCStructures.h:303
double thresh_f12() const
Definition CCStructures.h:301
std::size_t kain_subspace() const
Definition CCStructures.h:353
double tight_thresh_6D() const
Definition CCStructures.h:293
std::size_t iter_max_3D() const
Definition CCStructures.h:315
bool no_compute_cispd() const
Definition CCStructures.h:335
CCParameters(World &world, const commandlineparser &parser)
ctor reading out the input file
Definition CCStructures.h:209
bool no_compute_mp2_constantpart() const
Definition CCStructures.h:327
std::pair< int, int > only_pair() const
Definition CCStructures.h:319
bool kain() const
Definition CCStructures.h:343
bool plot() const
Definition CCStructures.h:341
bool no_compute_response() const
Definition CCStructures.h:329
double thresh_poisson() const
Definition CCStructures.h:299
CCParameters()
Definition CCStructures.h:201
double thresh_bsh_3D() const
Definition CCStructures.h:295
bool no_compute_mp2() const
Definition CCStructures.h:331
double dconv_6D() const
Definition CCStructures.h:311
double econv_pairs() const
Definition CCStructures.h:307
void initialize_parameters()
Definition CCStructures.h:216
bool response() const
Definition CCStructures.h:282
bool decompose_Q() const
Definition CCStructures.h:347
double thresh_bsh_6D() const
Definition CCStructures.h:297
void error(World &world, const std::string &msg) const
Definition CCStructures.h:367
CCParameters(const CCParameters &other)=default
copy constructor
double gamma() const
Definition CCStructures.h:359
double thresh_3D() const
Definition CCStructures.h:287
double tight_thresh_3D() const
Definition CCStructures.h:289
bool no_compute() const
Definition CCStructures.h:323
double dconv_3D() const
Definition CCStructures.h:309
std::size_t iter_max() const
Definition CCStructures.h:313
double lo() const
Definition CCStructures.h:283
long freeze() const
Definition CCStructures.h:355
double thresh_6D() const
Definition CCStructures.h:291
bool no_compute_cc2() const
Definition CCStructures.h:333
std::vector< std::size_t > excitations() const
Definition CCStructures.h:357
void set_derived_values()
Definition CCStructures.cc:163
bool QtAnsatz() const
Definition CCStructures.h:349
bool test() const
Definition CCStructures.h:345
double dmin() const
Definition CCStructures.h:285
std::size_t output_prec() const
Definition CCStructures.h:351
bool restart() const
Definition CCStructures.h:321
double econv() const
Definition CCStructures.h:305
std::size_t iter_max_6D() const
Definition CCStructures.h:317
CalcType calc_type() const
Definition CCStructures.h:269
bool no_compute_gs() const
Definition CCStructures.h:325
bool debug() const
Definition CCStructures.h:339
void information(World &world) const
print out the parameters
Definition CCStructures.cc:195
bool no_compute_lrcc2() const
Definition CCStructures.h:337
size_t warning(World &world, const std::string &msg) const
Definition CCStructures.h:374
void sanity_check(World &world) const
check if parameters are set correct
Definition CCStructures.cc:206
Timer Structure.
Definition CCStructures.h:122
std::pair< double, double > current_time(bool printout=false)
Definition CCStructures.h:175
CCTimer(World &world, std::string msg)
Definition CCStructures.h:126
void print() const
Definition CCStructures.h:184
std::string operation
Definition CCStructures.h:133
double start_cpu
Definition CCStructures.h:132
double time_wall
Definition CCStructures.h:136
double get_wall_time_diff() const
Definition CCStructures.h:171
void update_time()
Definition CCStructures.h:139
CCTimer stop()
Definition CCStructures.h:155
CCTimer start()
Definition CCStructures.h:149
void print()
Definition CCStructures.h:180
double time_cpu
Definition CCStructures.h:137
double start_wall
Definition CCStructures.h:131
double get_cpu_time_diff() const
Definition CCStructures.h:173
void print(const std::pair< double, double > ×) const
Definition CCStructures.h:188
double reset()
Definition CCStructures.h:163
World & world
Definition CCStructures.h:130
double end_wall
Definition CCStructures.h:134
double end_cpu
Definition CCStructures.h:135
A helper structure which holds a map of functions.
Definition CCStructures.h:509
std::string irrep
Definition CCStructures.h:649
hashT hash() const
Definition CCStructures.h:635
CC_vecfunction(const vector_real_function_3d &v, const FuncType &type, const size_t &freeze)
Definition CCStructures.h:536
std::map< std::size_t, CCFunction< double, 3 > > CC_functionmap
Definition CCStructures.h:642
CC_vecfunction(const CC_vecfunction &other)
copy ctor (shallow)
Definition CCStructures.h:552
const CCFunction< double, 3 > & operator()(const CCFunction< double, 3 > &i) const
getter
Definition CCStructures.h:661
void insert(const size_t &i, const CCFunction< double, 3 > &f)
setter
Definition CCStructures.h:681
CC_vecfunction(const vector_real_function_3d &v, const FuncType &type)
Definition CCStructures.h:528
static CC_vecfunction load_restartdata(World &world, std::string filename)
Definition CCStructures.h:597
const CCFunction< double, 3 > & operator()(const size_t &i) const
getter
Definition CCStructures.h:666
CC_vecfunction operator*(const double &fac) const
scalar multiplication
Definition CCStructures.h:711
double delta
Definition CCStructures.h:648
CCFunction< double, 3 > & operator()(const size_t &i)
getter
Definition CCStructures.h:676
void print_size(const std::string &msg="!?not assigned!?") const
Print the memory of which is used by all the functions in the map.
Definition CCStructures.cc:69
CC_vecfunction(const std::vector< CCFunction< double, 3 > > &v)
Definition CCStructures.h:522
bool operator<(const CC_vecfunction &b) const
operator needed for sort operation (sorted by omega values)
Definition CCStructures.h:725
CC_vecfunction(const FuncType type_)
Definition CCStructures.h:513
void serialize(const Archive &ar)
Definition CCStructures.h:610
CC_vecfunction(const std::vector< CCFunction< double, 3 > > &v, const FuncType type_)
Definition CCStructures.h:546
CC_vecfunction(const vector_real_function_3d &v)
Definition CCStructures.h:515
CC_vecfunction()
Definition CCStructures.h:511
void set_functions(const vector_real_function_3d &v, const FuncType &type, const size_t &freeze)
setter
Definition CCStructures.h:686
CCFunction< double, 3 > & operator()(const CCFunction< double, 3 > &i)
getter
Definition CCStructures.h:671
void scale(const double &factor)
scaling (inplace)
Definition CCStructures.h:718
void plot(const std::string &msg="") const
Definition CCStructures.h:728
FuncType type
Definition CCStructures.h:645
double current_error
excitation energy
Definition CCStructures.h:647
friend CC_vecfunction copy(const CC_vecfunction &other)
returns a deep copy (void shallow copy errors)
Definition CCStructures.h:574
size_t size() const
Get the size vector (number of functions in the map)
Definition CCStructures.h:702
CC_vecfunction & operator=(const CC_vecfunction &other)
assignment operator, shallow wrt the functions
Definition CCStructures.h:560
double omega
Definition CCStructures.h:646
bool is_converged(const double econv, const double dconv) const
Definition CCStructures.h:656
vector_real_function_3d get_vecfunction() const
Returns all the functions of the map as vector.
Definition CCStructures.h:695
void save_restartdata(World &world, std::string filename) const
Definition CCStructures.h:604
CC_functionmap functions
Definition CCStructures.h:643
std::string name(const int ex) const
excitation irrep (direct product of x function and corresponding orbital)
Definition CCStructures.h:652
POD holding some basic functions and some intermediates for the CC2 calculation.
Definition CCStructures.h:1207
std::vector< Function< double, 3 > > mo_ket
Definition CCStructures.h:1208
Recordlist< Cloud::keyT > cloud_store(World &world, Cloud &cloud) const
customized function to store this to the cloud
Definition CCStructures.h:1233
Tensor< double > fock
Definition CCStructures.h:1213
Function< double, 3 > R
Definition CCStructures.h:1215
std::vector< Function< double, 3 > > U1
Definition CCStructures.h:1216
CCIntermediatePotentials intermediate_potentials
Definition CCStructures.h:1214
Function< double, 3 > U2
Definition CCStructures.h:1215
std::vector< madness::Vector< double, 3 > > molecular_coordinates
Definition CCStructures.h:1210
std::vector< double > orbital_energies
Definition CCStructures.h:1212
std::vector< Function< double, 3 > > mo_bra
Definition CCStructures.h:1209
CCParameters parameters
Definition CCStructures.h:1211
vector_real_function_3d get_active_mo_bra() const
Definition CCStructures.h:1224
void cloud_load(World &world, const Cloud &cloud, Recordlist< Cloud::keyT > &recordlist)
customized function to load this from the cloud
Definition CCStructures.h:1252
Function< double, 3 > R_square
Definition CCStructures.h:1215
vector_real_function_3d get_active_mo_ket() const
Definition CCStructures.h:1218
Definition CCStructures.h:381
static PairVectorMap triangular_map(const int nfreeze, const int nocc)
Definition CCStructures.h:387
void print(const std::string msg="PairVectorMap") const
Definition CCStructures.h:407
std::vector< std::pair< int, int > > map
maps pair index (i,j) to vector index k
Definition CCStructures.h:383
static PairVectorMap quadratic_map(const int nfreeze, const int nocc)
Definition CCStructures.h:397
PairVectorMap(const std::vector< std::pair< int, int > > map1)
Definition CCStructures.h:385
Definition CCStructures.h:421
void swap(Pairs< T > &other)
swap the contant of the pairmap
Definition CCStructures.h:477
pairmapT allpairs
Definition CCStructures.h:424
static Pairs vector2pairs(const std::vector< T > &argument, const PairVectorMap map)
Definition CCStructures.h:440
Pairs< R > convert(const Pairs< T > arg, const opT op) const
convert Pairs<T> to another type
Definition CCStructures.h:430
std::map< std::pair< int, int >, T > pairmapT
Definition CCStructures.h:423
bool empty() const
Definition CCStructures.h:481
T & operator()(int i, int j)
getter
Definition CCStructures.h:464
void insert(int i, int j, const T &pair)
Definition CCStructures.h:471
const T & operator()(int i, int j) const
getter
Definition CCStructures.h:457
static std::vector< T > pairs2vector(const Pairs< T > &argument, const PairVectorMap map)
Definition CCStructures.h:448
very simple command line parser
Definition commandlineparser.h:15
Definition lowrankfunction.h:332
static double current_time
Definition tdse1d.cc:160
InputParameters param
Definition tdse.cc:203
double norm(const T i1)
Definition test_cloud.cc:72
double h(const coord_1d &r)
Definition testgconv.cc:68
static const std::size_t NDIM
Definition testpdiff.cc:42