8 #ifndef mpqc_interfaces_tiledarray_tests_tiled_array_fock_hpp
9 #define mpqc_interfaces_tiledarray_tests_tiled_array_fock_hpp
12 #include <mpqc/interfaces/tiledarray/symmscmat.hpp>
13 #include <chemistry/qc/lcao/soad.h>
14 #include <Eigen/Dense>
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);
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);
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);
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);
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);
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);
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);
88 get_soad_guess(madness::World &world,
89 const R<Molecule> &mol,
90 const R<Basis> &basis){
93 R<AKeyVal> akv =
new AKeyVal;
94 akv->assign(
"molecule", mol.pointer());
95 akv->assign(
"basis", basis.pointer());
97 R<Soad> s_guess =
new Soad(R<KeyVal>(akv));
98 R<sc::SymmSCMatrix> P = s_guess->ao_density();
101 tiling::tile_by_atom(basis));
103 D(
"i,j") = 0.5 * D(
"i,j");
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>());
115 TA::Array<double, 2> In = a * array(
"i,j");
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");
121 array.world().gop.fence();