Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
j-otsuki committed May 8, 2018
1 parent 70721e4 commit dee49fa
Showing 1 changed file with 1 addition and 117 deletions.
118 changes: 1 addition & 117 deletions c++/pomerol_ed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,76 +397,6 @@ namespace pomerol2triqs {
///////////////////////////////////
// Two-particle Green's function //
///////////////////////////////////
/*
auto pomerol_ed::G2_iw(g2_iw_inu_inup_params_t const &p) -> g2_t {
if (!matrix_h) TRIQS_RUNTIME_ERROR << "G2_iw: no Hamiltonian has been diagonalized";
compute_rho(p.beta);
compute_field_operators(p.gf_struct);
if (verbose && !comm.rank()) { std::cout << "\nPomerol: computing TwoParticleGF" << std::endl; }
Pomerol::ParticleIndex pom_i1 = lookup_pomerol_index(p.index1);
Pomerol::ParticleIndex pom_i2 = lookup_pomerol_index(p.index2);
Pomerol::ParticleIndex pom_i3 = lookup_pomerol_index(p.index3);
Pomerol::ParticleIndex pom_i4 = lookup_pomerol_index(p.index4);
Pomerol::TwoParticleGF pom_g2(*states_class, *matrix_h,
ops_container->getAnnihilationOperator(pom_i2),
ops_container->getAnnihilationOperator(pom_i4),
ops_container->getCreationOperator(pom_i1),
ops_container->getCreationOperator(pom_i3),
*rho);
pom_g2.prepare();
pom_g2.compute(false, {}, comm);
// indices of fermionic Matsubara frequencies [-n_f:n_f)
std::vector<int> index_wf(2*p.n_f);
std::iota(index_wf.begin(), index_wf.end(), -p.n_f);
// for( auto i : iw_f ) std::cout << i << std::endl;
// indices of bosonic Matsubara frequencies [0:n_b)
std::vector<int> index_wb(p.n_b);
std::iota(index_wb.begin(), index_wb.end(), 0);
// for( auto i : iw_b ) std::cout << i << std::endl;
// std::cout << "Start freq loop: rank" << comm.rank() << std::endl;
// g2_t g2(p.n_b, 2*p.n_f, 2*p.n_f);
// // std::cout << typeid(g2).name() << std::endl;
// for(int ib=0; ib<index_wb.size(); ib++)
// for(int if1=0; if1<index_wf.size(); if1++)
// for(int if2=0; if2<index_wf.size(); if2++)
// g2(ib, if1, if2) = -pom_g2(index_wb[ib]+index_wf[if1], index_wf[if2], index_wf[if1]);
// create a list of three frequency-indices
std::vector< std::tuple<int, int, int> > three_freqs;
for(int ib=0; ib<index_wb.size(); ib++)
for(int if1=0; if1<index_wf.size(); if1++)
for(int if2=0; if2<index_wf.size(); if2++)
three_freqs.push_back( std::make_tuple(ib, if1, if2) );
// std::cout << three_freqs.size() << std::endl;
// compute g2 value using MPI
g2_t g2(p.n_b, 2*p.n_f, 2*p.n_f);
for(int i=comm.rank(); i<three_freqs.size(); i+=comm.size()){
int ib = std::get<0>(three_freqs[i]);
int if1 = std::get<1>(three_freqs[i]);
int if2 = std::get<2>(three_freqs[i]);
g2(ib, if1, if2) = -pom_g2(index_wb[ib]+index_wf[if1], index_wf[if2], index_wf[if1]);
}
// broadcast results
for(int i=0; i<three_freqs.size(); i++){
int ib = std::get<0>(three_freqs[i]);
int if1 = std::get<1>(three_freqs[i]);
int if2 = std::get<2>(three_freqs[i]);
int sender = i % comm.size();
boost::mpi::broadcast(comm, g2(ib, if1, if2), sender);
}
// std::cout << "End freq loop: rank" << comm.rank() << std::endl;
return g2;
}
*/

// core function for computing G2
triqs::arrays::array<std::complex<double>, 1> pomerol_ed::compute_g2_core(gf_struct_t const &gf_struct, double beta, channel_t channel, indices_t index1, indices_t index2, indices_t index3, indices_t index4, std::vector<three_freqs_t> const &three_freqs){
Expand Down Expand Up @@ -540,6 +470,7 @@ namespace pomerol2triqs {
return vec_g2[0];
}


auto pomerol_ed::G2_iw_freq_box(g2_iw_freq_box_params_t const &p) -> std::vector<g2_iw_freq_box_t> {

// create a list of three frequencies, (wb, wf1, wf2)
Expand All @@ -559,15 +490,13 @@ namespace pomerol2triqs {
for(int ib=0; ib<index_wb.size(); ib++)
for(int if1=0; if1<index_wf.size(); if1++)
for(int if2=0; if2<index_wf.size(); if2++){
// three_freqs.push_back( std::make_tuple(ib, if1, if2) );
three_freqs.push_back( std::make_tuple(index_wb[ib], index_wf[if1], index_wf[if2]) );
three_indices.push_back( std::make_tuple(ib, if1, if2) );
}
// std::cout << three_freqs.size() << std::endl;
}

// compute g2 values
// g2_iw_freq_fix_t g2_three_freqs = compute_g2(p.gf_struct, p.beta, p.channel, p.index1, p.index2, p.index3, p.index4, three_freqs);
std::vector<g2_iw_freq_fix_t> vec_g2_freq_vec = compute_g2(p.gf_struct, p.beta, p.channel, p.four_indices, three_freqs);

// reshape G2 (from freq_vec to freq_box)
Expand All @@ -590,51 +519,6 @@ namespace pomerol2triqs {
auto pomerol_ed::G2_iw_freq_fix(g2_iw_freq_fix_params_t const &p) -> std::vector<g2_iw_freq_fix_t> {
return compute_g2(p.gf_struct, p.beta, p.channel, p.four_indices, p.three_freqs);
}
/*
auto pomerol_ed::G2_iw_three_freqs(g2_three_freqs_params_t const &p) -> g2_three_freqs_t {
if (!matrix_h) TRIQS_RUNTIME_ERROR << "G2_iw: no Hamiltonian has been diagonalized";
compute_rho(p.beta);
compute_field_operators(p.gf_struct);
if (verbose && !comm.rank()) { std::cout << "\nPomerol: computing TwoParticleGF" << std::endl; }
Pomerol::ParticleIndex pom_i1 = lookup_pomerol_index(p.index1);
Pomerol::ParticleIndex pom_i2 = lookup_pomerol_index(p.index2);
Pomerol::ParticleIndex pom_i3 = lookup_pomerol_index(p.index3);
Pomerol::ParticleIndex pom_i4 = lookup_pomerol_index(p.index4);
Pomerol::TwoParticleGF pom_g2(*states_class, *matrix_h,
ops_container->getAnnihilationOperator(pom_i2),
ops_container->getAnnihilationOperator(pom_i4),
ops_container->getCreationOperator(pom_i1),
ops_container->getCreationOperator(pom_i3),
*rho);
pom_g2.prepare();
pom_g2.compute(false, {}, comm);
// compute g2 value using MPI
g2_three_freqs_t g2( p.three_freqs.size() );
for(int i=comm.rank(); i<p.three_freqs.size(); i+=comm.size()){
// int ib = std::get<0>(three_freqs[i]);
// int if1 = std::get<1>(three_freqs[i]);
// int if2 = std::get<2>(three_freqs[i]);
// g2(ib, if1, if2) = -pom_g2(index_wb[ib]+index_wf[if1], index_wf[if2], index_wf[if1]);
int wb = std::get<0>(p.three_freqs[i]);
int wf1 = std::get<1>(p.three_freqs[i]);
int wf2 = std::get<2>(p.three_freqs[i]);
g2[i] = -pom_g2(wb+wf1, wf2, wf1);
}
// broadcast results
for(int i=0; i<p.three_freqs.size(); i++){
int sender = i % comm.size();
boost::mpi::broadcast(comm, g2[i], sender);
}
// std::cout << "End freq loop: rank" << comm.rank() << std::endl;
return g2;
}
*/

/*
template <typename Mesh, typename Filler>
Expand Down

0 comments on commit dee49fa

Please sign in to comment.