MPQC  3.0.0-alpha
tiledarray_fock.hpp
1 /*
2  * tiledarray_ints.hpp
3  *
4  * Created on: Aug 14, 2013
5  * Author: drewlewis
6  */
7 
8 #ifndef mpqc_interfaces_tiledarray_tests_tiled_array_fock_hpp
9 #define mpqc_interfaces_tiledarray_tests_tiled_array_fock_hpp
10 
11 #include "common.hpp"
12 #include <mpqc/interfaces/tiledarray/symmscmat.hpp>
13 #include <chemistry/qc/lcao/soad.h>
14 #include <Eigen/Dense>
15 
16 namespace mpqc {
17 namespace tests {
18 
19  TA::Array<double, 2>
20  get_overlap(madness::World &world,
21  const R<Molecule> &mol,
22  const R<Basis> &basis,
23  const R<Integral> &int_fac){
24  int_fac->set_basis(basis);
25  IntPool<R<sc::OneBodyInt> > overlap_pool(int_fac->overlap());
26  TA::Array<double, 2> S = Integrals(world, overlap_pool,
27  tiling::tile_by_atom);
28  world.gop.fence();
29  return S;
30  }
31 
32  TA::Array<double, 2>
33  get_hcore(madness::World &world,
34  const R<Molecule> &mol,
35  const R<Basis> &basis,
36  const R<Integral> &int_fac){
37  int_fac->set_basis(basis);
38  IntPool<R<sc::OneBodyInt> > hcore_pool(int_fac->hcore());
39  TA::Array<double, 2> H = Integrals(world, hcore_pool,
40  tiling::tile_by_atom);
41  world.gop.fence();
42  return H;
43  }
44 
45  TA::Array<double, 4>
46  get_eri(madness::World &world,
47  const R<Molecule> &mol,
48  const R<Basis> &basis,
49  const R<Integral> &int_fac){
50  int_fac->set_basis(basis);
51  IntPool<R<sc::TwoBodyInt> > eri_pool(int_fac->electron_repulsion());
52  TA::Array<double, 4> Eri = Integrals(world, eri_pool,
53  tiling::tile_by_atom);
54  world.gop.fence();
55  return Eri;
56  }
57 
58  TA::Array<double, 2>
59  get_eri2(madness::World &world,
60  const R<Molecule> &mol,
61  const R<Basis> &basis_df,
62  const R<Integral> &int_fac){
63  int_fac->set_basis(basis_df, basis_df);
64  using Eri2Int = sc::TwoBodyTwoCenterInt;
65  IntPool<R<Eri2Int> > eri2_pool(int_fac->electron_repulsion2());
66  TA::Array<double, 2> Eri2 = Integrals(world, eri2_pool,
67  tiling::tile_by_atom);
68  world.gop.fence();
69  return Eri2;
70  }
71 
72  TA::Array<double, 3>
73  get_eri3(madness::World &world,
74  const R<Molecule> &mol,
75  const R<Basis> &basis,
76  const R<Basis> &basis_df,
77  const R<Integral> &int_fac){
78  int_fac->set_basis(basis, basis, basis_df);
79  using Eri3Int = sc::TwoBodyThreeCenterInt;
80  IntPool<R<Eri3Int> > eri3_pool(int_fac->electron_repulsion3());
81  TA::Array<double, 3> Eri3 = Integrals(world, eri3_pool,
82  tiling::tile_by_atom);
83  world.gop.fence();
84  return Eri3;
85  }
86 
87  TA::Array<double, 2>
88  get_soad_guess(madness::World &world,
89  const R<Molecule> &mol,
90  const R<Basis> &basis){
92 
93  R<AKeyVal> akv = new AKeyVal;
94  akv->assign("molecule", mol.pointer());
95  akv->assign("basis", basis.pointer());
96 
97  R<Soad> s_guess = new Soad(R<KeyVal>(akv));
98  R<sc::SymmSCMatrix> P = s_guess->ao_density();
99 
100  TA::Array<double, 2> D = SymmScMat_To_TiledArray(world, P,
101  tiling::tile_by_atom(basis));
102 
103  D("i,j") = 0.5 * D("i,j");
104 
105  world.gop.fence();
106  return D;
107  }
108 
109  TA::Array<double, 2>
110  get_inverse(const TA::Array<double, 2> &array){
111  using namespace Eigen;
112  MatrixXd Mat = TA::array_to_eigen(array);
113  double a = 1.0/(Mat.lpNorm<1>() * Mat.lpNorm<Infinity>());
114 
115  TA::Array<double, 2> In = a * array("i,j");
116 
117  for(auto i = 0; i < 100; ++i){
118  In("i,j") = 2.0 * In("i,j") - In("i,c") * array("c,d") * In("d,j");
119  }
120 
121  array.world().gop.fence();
122  return In;
123  }
124 
125 } // namespace tests
126 } // namesapce mpqc
127 
128 
129 
130 
131 #endif /* mpqc_interfaces_tiledarray_tests_tiled_array_fock_hpp */
mpqc
Contains new MPQC code since version 3.
Definition: integralenginepool.hpp:37
sc::TwoBodyTwoCenterInt
This is an abstract base type for classes that compute integrals involving two electrons in two Gauss...
Definition: tbint.h:305
sc::TwoBodyThreeCenterInt
This is an abstract base type for classes that compute integrals involving two electrons in three Gau...
Definition: tbint.h:191
mpqc::SymmScMat_To_TiledArray
inline ::TiledArray::Array< double, 2 > SymmScMat_To_TiledArray(madness::World &world, const sc::Ref< sc::SymmSCMatrix > &matrix, const ::TiledArray::TiledRange1 trange1)
addtogroup TiledArrayInterface
Definition: symmscmat.hpp:115
sc::SuperpositionOfAtomicDensities
SuperpositionOfAtomicDensities is a OneBodyWavefunction useful as a guess for other OneBodyWavefuncti...
Definition: soad.h:46

Generated at Sun Jan 26 2020 23:24:01 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.