Commit 055fa0bf authored by Doak, Peter W.'s avatar Doak, Peter W.
Browse files

fix for reading current hdf5

parent 2dcd1a26
Loading
Loading
Loading
Loading
+89 −87
Original line number Diff line number Diff line
@@ -649,30 +649,36 @@ void DcaData<Parameters, DT>::initializeSigma(const std::string& filename) {
    long step_count = reader.getStepCount();
    // Work around odd way hdf5 steps get written
    int completed_iteration = 0;
    std::cout << step_count << " steps found.\n";
    if (step_count >= 0) {
      for (long i = 0; i < step_count; ++i) {
    find_step:
      for (std::size_t i = 0; i < step_count; ++i) {
        reader.begin_step();
        std::cerr << "current step " << i << '\n';
        bool has_iteration =
            reader.execute("DCA-loop-functions/completed-iteration", completed_iteration);
        std::cerr << "completed_iteration " << completed_iteration << '\n';
        if (has_iteration && (i >= completed_iteration)) {
        if (has_iteration && (i > completed_iteration)) {
          std::cerr << "past complete iterations " << completed_iteration << "at step " << i << '\n';
          hdf5_last_iteration = completed_iteration;
          hdf5_last_iteration = i;
          reader.close_file();
          reader.open_file(filename);
          step_count = hdf5_last_iteration;
          goto find_step;
        }
        if (i < step_count - 1)
          reader.end_step();
      }
      reader.begin_step();
      readSigmaFile(reader);
      reader.close_file();
      reader.end_step();
    }
    else {
      readSigmaFile(reader);
    }
  }
  concurrency_.broadcast(parameters_.get_chemical_potential());
  concurrency_.broadcast(Sigma);
}
}

template <class Parameters, DistType DT>
void DcaData<Parameters, DT>::readSigmaFile(io::Reader<Concurrency>& reader) {
@@ -768,14 +774,13 @@ void DcaData<Parameters, DT>::compute_Sigma_bands() {
      }
      for (int k_ind = 0; k_ind < KCutDmn::dmn_size(); ++k_ind) {
        auto kcut_slice = kConvert(KCutDmn::get_elements()[k_ind]);
        auto k_vec = domains::cluster_operations::translate_inside_cluster(
            kcut_slice, ksuper_basis);
        auto k_vec = domains::cluster_operations::translate_inside_cluster(kcut_slice, ksuper_basis);

        for (int K_ind = 0; K_ind < KClusterDmn::dmn_size(); ++K_ind) {
          auto kdmn_slice = kConvert(KClusterDmn::get_elements()[K_ind]);
          length_and_distance[K_ind].second = K_ind;
          length_and_distance[K_ind].first = domains::cluster_operations::minimal_distance(
              k_vec, kdmn_slice, ksuper_basis);
          length_and_distance[K_ind].first =
              domains::cluster_operations::minimal_distance(k_vec, kdmn_slice, ksuper_basis);
        }
        std::sort(length_and_distance.begin(), length_and_distance.end());

@@ -862,11 +867,9 @@ void DcaData<Parameters, DT>::compute_Sigma_bands() {
  if (concurrency_.id() == concurrency_.first() /*and parameters_.do_dca_plus()*/) {
    if (DIMENSION == 2) {
      std::cout << "\n\n";
        std::cout
            << "        K-vectors             || Re[Sigma_QMC]   Im[Sigma_QMC]   Re[Sigma_cg]  "
      std::cout << "        K-vectors             || Re[Sigma_QMC]   Im[Sigma_QMC]   Re[Sigma_cg]  "
                   "  Im[Sigma_cg] \n";
        std::cout
            << "-------------------------------------------------------------------------------"
      std::cout << "-------------------------------------------------------------------------------"
                   "---------------\n";
    }

@@ -874,8 +877,7 @@ void DcaData<Parameters, DT>::compute_Sigma_bands() {
      std::cout << "\n\n";
      std::cout << "                K-vectors                       || Re[Sigma_QMC]   "
                   "Im[Sigma_QMC]   Re[Sigma_cg]    Im[Sigma_cg] \n";
        std::cout
            << "-------------------------------------------------------------------------------"
      std::cout << "-------------------------------------------------------------------------------"
                   "---------------------------------\n";
    }

@@ -891,6 +893,6 @@ void DcaData<Parameters, DT>::compute_Sigma_bands() {
}

}  // namespace phys
}  // namespace phys
}  // namespace dca

#endif  // DCA_PHYS_DCA_DATA_DCA_DATA_HPP
+2 −2
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ void HDF5Reader::begin_step() {
  if (is_legacy_)
    return;
  if (in_step_)
    throw std::runtime_error("HDF5Writer::begin_step() called while already in step!");
    throw std::runtime_error("HDF5Reader::begin_step() called while already in step!");
  in_step_ = true;
  std::string step_group{"step_" + std::to_string(++step_ - 1)};
  paths_.push_back(step_group);
@@ -92,7 +92,7 @@ void HDF5Reader::end_step() {
  if (is_legacy_)
    return;
  if (!in_step_)
    throw std::runtime_error("HDF5Writer::end_step() called while not in step!");
    throw std::runtime_error("HDF5Reader::end_step() called while not in step!");
  paths_.clear();
  in_step_ = false;
}