Commit 7e3fe0d3 authored by gbalduzz's avatar gbalduzz
Browse files

Fixed ctint configuration reading.

parent 60552670
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -17,18 +17,33 @@ namespace solver {
namespace ctint {
// dca::phys::solver::ctint::

io::Buffer& operator<<(io::Buffer& buff, const Vertex& v) {
  return buff << v.aux_spin << v.interaction_id << v.tau;
}

io::Buffer& operator>>(io::Buffer& buff, Vertex& v) {
  return buff >> v.aux_spin >> v.interaction_id >> v.tau;
}

io::Buffer& operator<<(io::Buffer& buff, const SolverConfiguration& config) {
  buff << config.vertices_;
  buff << config.vertices_.size();

  for (const auto& v : config.vertices_)
    buff << v;

  return buff;
}

io::Buffer& operator>>(io::Buffer& buff, SolverConfiguration& config) {
  std::vector<Vertex> vertices;
  buff >> vertices;
  std::size_t n;
  buff >> n;

  for (auto& v : vertices) {
  for (int i = 0; i < n; ++i) {
    Vertex v;
    buff >> v;
    v.tag = config.current_tag_++;
    config.push_back(v);
    config.commitInsertion(config.size() - 1);
  }

  return buff;
+10 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ void SolverConfiguration::moveAndShrink(std::array<HostVector<int>, 2>& sector_f

  for (int left_index = 0; left_index <= right_index; ++left_index) {
    const int dead_index = remove[left_index];
    assert(vertices_[dead_index].annihilatable == false);
    while (right_index >= left_index &&
           living_index == remove[right_index]) {  // Living not found: remove from back.
      vertices_.pop_back();
@@ -198,6 +199,15 @@ bool SolverConfiguration::checkConsistency() const {
    }
  }

  // Count annihilatable.
  unsigned n_annihilatable = 0;
  for (const auto& v : vertices_)
    n_annihilatable += v.annihilatable;
  if (n_annihilatable != n_annihilatable_) {
    std::cerr << "Non consistant annihilatable count." << std::endl;
    return false;
  }

  if (double_insertion_prob_) {
    for (const auto& v : vertices_) {
      const auto& list = existing_[v.interaction_id];
+1 −1

File changed.

Contains only whitespace changes.