Beispiel #1
0
// Legendre coefficients
som_core::som_core(gf_const_view<legendre> g_l, gf_const_view<legendre> S_l,
                   observable_kind kind, vector<double> const& norms) :
 mesh(g_l.mesh()), kind(kind), norms(make_default_norms(norms,get_target_shape(g_l)[0])),
 rhs(input_data_r_t()), error_bars(input_data_r_t()) {

 if(is_stat_relevant(kind)) check_gf_stat(g_l, observable_statistics(kind));

 check_input_gf(g_l,S_l);
 if(!is_gf_real(g_l) || !is_gf_real(S_l))
  fatal_error("Legendre " + observable_name(kind) + " must be real");
 gf<legendre, matrix_real_valued> g_l_real = real(g_l), S_l_real = real(S_l);
 set_input_data(make_const_view(g_l_real), make_const_view(S_l_real));
}
Beispiel #2
0
// The method that runs the qmc
void ctint_solver::solve(double U, double delta, int n_cycles, int length_cycle, int n_warmup_cycles, std::string random_name, int max_time) {

  mpi::communicator world;
  triqs::clef::placeholder<0> spin_;
  triqs::clef::placeholder<1> om_;

  for (auto spin : {up, down}) { // Apply shift to g0_iw and Fourier transform
    g0tilde_iw[spin](om_) << 1.0 / (1.0 / g0_iw[spin](om_) - U / 2);
    array<dcomplex, 3> mom{{{0}}, {{1}}}; // Fix the moments: 0 + 1/omega
    g0tilde_tau()[spin] = triqs::gfs::fourier(g0tilde_iw[spin], make_const_view(mom));
  }

  // Rank-specific variables
  int verbosity   = (world.rank() == 0 ? 3 : 0);
  int random_seed = 34788 + 928374 * world.rank();

  // Construct a Monte Carlo loop
  triqs::mc_tools::mc_generic<dcomplex> CTQMC(random_name, random_seed, 1.0, verbosity);

  // Prepare the configuration
  auto config = configuration{g0tilde_tau, beta, delta};

  // Register moves and measurements
  CTQMC.add_move(move_insert{&config, CTQMC.get_rng(), beta, U}, "insertion");
  CTQMC.add_move(move_remove{&config, CTQMC.get_rng(), beta, U}, "removal");
  CTQMC.add_measure(measure_M{&config, M_iw, beta}, "M measurement");

  // Run and collect results
  CTQMC.warmup_and_accumulate(n_warmup_cycles, n_cycles, length_cycle, triqs::utility::clock_callback(max_time));
  CTQMC.collect_results(world);

  // Compute the Green function from Mw
  g_iw[spin_](om_) << g0tilde_iw[spin_](om_)  + g0tilde_iw[spin_](om_) * M_iw[spin_](om_) * g0tilde_iw[spin_](om_);

  // Set the tail of g_iw to 1/w
  triqs::arrays::array<dcomplex, 3> mom{{{0}}, {{1}}}; // 0 + 1/omega
  for (auto &g : g_iw) replace_by_tail_in_fit_window(g(), make_const_view(mom));
}
Beispiel #3
0
template<typename MeshType> void check_gf_stat(gf_view<MeshType> g,
                                               triqs::gfs::statistic_enum expected_stat) {
 return check_gf_stat(make_const_view(g), expected_stat);
}
Beispiel #4
0
template<typename MeshType> void check_gf_dim(gf_view<MeshType> g, int expected_dim) {
 check_gf_dim(make_const_view(g), expected_dim);
}
Beispiel #5
0
void fill_data(gf_view<imfreq> g_iw, int i, vector<dcomplex> const& data) {
 auto g_positive_freq = positive_freq_view(g_iw);
 g_positive_freq.data()(range(),i,i) = data;
 g_iw = make_gf_from_real_gf(make_const_view(g_positive_freq));
}
Beispiel #6
0
 template <typename G> inline gf_keeper<tags::legendre, imtime, typename G::target_t> imtime_to_legendre(G const &gt) {
   static_assert(is_gf_v<G, imtime>, "imtime_to_legendre takes an imaginary time Green function");
   return {make_const_view(gt)};
 }
Beispiel #7
0
 template <typename G> inline gf_keeper<tags::legendre, imfreq, typename G::target_t> imfreq_to_legendre(G const &gw) {
   static_assert(is_gf_v<G, imfreq>, "imfreq_to_legendre takes a Matsubara Green function");
   return {make_const_view(gw)};
 }
Beispiel #8
0
 template <typename G> inline gf_keeper<tags::legendre, legendre, typename G::target_t> legendre_to_imtime(G const &gl) {
   static_assert(is_gf_v<G, legendre>, "legendre_to_imtime takes a Legendre Green function");
   return {make_const_view(gl)};
 }