Пример #1
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);
  g0tilde_tau()[spin] = triqs::gfs::inverse_fourier(g0tilde_iw[spin]);
 }

 // 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<double> CTQMC(n_cycles, length_cycle,
                                           n_warmup_cycles, random_name,
                                           random_seed, verbosity);

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

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

 // Run and collect results
 CTQMC.start(1.0, 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_);
}
Пример #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));
}