Commit 5ad308ec authored by gbalduzz's avatar gbalduzz
Browse files

Fix mci parameters check.

parent df2ba500
Loading
Loading
Loading
Loading
+69 −75
Original line number Diff line number Diff line
@@ -209,7 +209,6 @@ void MciParameters::readWrite(ReaderOrWriter& reader_or_writer) {
    }
  };

  try {
  reader_or_writer.open_group("Monte-Carlo-integration");

  if (reader_or_writer.is_reader()) {
@@ -218,11 +217,11 @@ void MciParameters::readWrite(ReaderOrWriter& reader_or_writer) {
      // Try to read a seeding option.
      std::string seed_string;
      reader_or_writer.execute("seed", seed_string);
        if (strcmp(seed_string.c_str(), "random") == 0)
      if (seed_string == "random")
        generateRandomSeed();
      else {
          std::cerr << "Warning: Invalid seeding option. Using default seed = " << default_seed
                    << "." << std::endl;
        std::cerr << "Warning: Invalid seeding option. Using default seed = " << default_seed << "."
                  << std::endl;
        seed_ = default_seed;
      }
    }
@@ -249,7 +248,6 @@ void MciParameters::readWrite(ReaderOrWriter& reader_or_writer) {
  try_to_read_write("store-configuration", store_configuration_);

  // Read arguments for threaded solver.
    try {
  reader_or_writer.open_group("threaded-solver");

  try_to_read_write("walkers", walkers_);
@@ -257,10 +255,20 @@ void MciParameters::readWrite(ReaderOrWriter& reader_or_writer) {
  try_to_read_write("shared-walk-and-accumulation-thread", shared_walk_and_accumulation_thread_);
  try_to_read_write("fix-meas-per-walker", fix_meas_per_walker_);

  // Read distribution type.
  std::string g4_dist_name = toString(g4_distribution_);
  try_to_read_write("g4-distribution", g4_dist_name);
  g4_distribution_ = stringToDistType(g4_dist_name);

  reader_or_writer.close_group();

  // TODO: adjust_self_energy_for_double_counting has no effect at the moment. Use default value
  // 'false'.
  // try_to_read_write("adjust-self-energy-for-double-counting", adjust_self_energy_for_double_counting_);

  reader_or_writer.close_group();

  // Check parameters consistency.
  if (g4_distribution_ == DistType::MPI) {
    // Check for number of accumulators and walkers consistency.
    if (!shared_walk_and_accumulation_thread_ || walkers_ != accumulators_) {
@@ -281,20 +289,6 @@ void MciParameters::readWrite(ReaderOrWriter& reader_or_writer) {
          "2) each accumulator should have same measurements\n");
    }
  }

      reader_or_writer.close_group();
    }
    catch (const std::exception& r_e) {
    }

    // TODO: adjust_self_energy_for_double_counting has no effect at the moment. Use default value
    // 'false'.
    // try_to_read_write("adjust-self-energy-for-double-counting", adjust_self_energy_for_double_counting_);

    reader_or_writer.close_group();
  }
  catch (const std::exception& r_e) {
  }
}

void MciParameters::solveDcaIterationConflict(int iterations) {