Commit 9845fb6b authored by Doak, Peter W.'s avatar Doak, Peter W.
Browse files

finish backport

parent abdbc16b
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -78,7 +78,13 @@ void general_interaction<parameters_type>::set_vertex(
  const int pos = rng() * correlated_orbitals.size();
  // This is instead of crashing on segv when module is unknown.
  // \todo catch earlier in release as well.
  assert( pos < correlated_orbitals.size() && "It is likely you have specified an unknown model" );
#ifndef NDEBUG
  if (pos >= correlated_orbitals.size()) {
    std::cerr << "pos: " << pos << " < correlated_orbitals.size(): " << correlated_orbitals.size()
              << '\n';
    throw std::runtime_error("It is likely you have specified an unknown model");
  }
#endif
  const int lin_ind = correlated_orbitals[pos];

  std::array<int, 6> sub_ind;  // [0]=b1, [1]=s1, [2]=b2, [3]=s2, [4]=r1, [5]=r2
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ template <typename Concurrency>
void EdSolverParameters::unpack(const Concurrency& concurrency, char* buffer, int buffer_size,
                                int& position) {
  concurrency.unpack(buffer, buffer_size, position, eigenvalue_cut_off_);
  concurrency.unpack(buffer, buffer_size, position, threads_);
}

template <typename ReaderOrWriter>
+6 −5
Original line number Diff line number Diff line
@@ -268,11 +268,6 @@ void MciParameters::readWrite(ReaderOrWriter& reader_or_writer) {
    reader_or_writer.execute("seed", seed_);
  }

  // Read error computation type.
  std::string error_type = toString(error_computation_type_);
  reader_or_writer.execute("error-computation-type", error_type);
  error_computation_type_ = stringToErrorComputationType(error_type);

  reader_or_writer.execute("warm-up-sweeps", warm_up_sweeps_);
  read_legacy_vector("sweeps-per-measurement", sweeps_per_measurement_);
  read_legacy_vector("measurements", measurements_);
@@ -291,6 +286,12 @@ void MciParameters::readWrite(ReaderOrWriter& reader_or_writer) {
                           shared_walk_and_accumulation_thread_);
  reader_or_writer.execute("fix-meas-per-walker", fix_meas_per_walker_);


  // Read error computation type.
  std::string error_type = toString(error_computation_type_);
  reader_or_writer.execute("error-computation-type", error_type);
  error_computation_type_ = stringToErrorComputationType(error_type);

  // Read distribution type.
  std::string g4_dist_name = toString(g4_distribution_);
  reader_or_writer.execute("g4-distribution", g4_dist_name);
+4 −4
Original line number Diff line number Diff line
@@ -49,10 +49,10 @@ bool JSONReader::open_group(const std::string& name) noexcept {
  if (open_groups_.top())
    new_group = open_groups_.top()->getGroup(name);

  // TODO maybe: process error here.
  //  if (!new_group)
  //    throw(std::logic_error("Group " + name + " does not exist"));
  if (new_group)
  {
    open_groups_.push(new_group);
  }
  return static_cast<bool>(new_group);
}

+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ FourPointType stringToFourPointType(const std::string& name) {
  else if (name == "PARTICLE_HOLE_LONGITUDINAL_UP_DOWN")
    return FourPointType::PARTICLE_HOLE_LONGITUDINAL_UP_DOWN;
  else
    throw std::logic_error("Invalid four point mode: " + name);
    return FourPointType::PARTICLE_HOLE_NONE;
}

std::string toString(const FourPointType type) {