Commit 7a6f9afb authored by Doak, Peter W.'s avatar Doak, Peter W.
Browse files

debugging full application rashba failures

parent 32ef4984
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -186,7 +186,6 @@ void TpAccumulatorGpuBase<Parameters, DT>::initializeG0() {
  const int sp_index_offset = (WDmn::dmn_size() - WTpExtDmn::dmn_size()) / 2;
  static func::dmn_variadic<BDmn, KDmn, WTpExtDmn> bkw_dmn;
  std::array<MatrixHost, 2> G0_host;

  for (int s = 0; s < 2; ++s) {
    auto& G0 = get_G0();

@@ -194,9 +193,10 @@ void TpAccumulatorGpuBase<Parameters, DT>::initializeG0() {
    for (int w = 0; w < WTpExtDmn::dmn_size(); ++w)
      for (int k = 0; k < KDmn::dmn_size(); ++k)
        for (int b2 = 0; b2 < n_bands_; ++b2)
          for (int b1 = 0; b1 < n_bands_; ++b1)
          for (int b1 = 0; b1 < n_bands_; ++b1) {
	    assert(std::abs(WTpExtDmn::get_elements()[w] - WDmn::get_elements()[w + sp_index_offset]) < 1e-3);
            G0_host[s](bkw_dmn(b1, k, w),b2) = (*G0_ptr_)(b1, s, b2, s, k, w + sp_index_offset);

	  }
    dca::linalg::util::GpuStream reset_stream(cudaStreamLegacy);
    G0[s].set(G0_host[s], reset_stream);
  }
+4 −1
Original line number Diff line number Diff line
@@ -636,6 +636,9 @@ void StdThreadQmciClusterSolver<QmciSolver>::startWalkerAndAccumulator(int id,
    if (parameters_.fix_meas_per_walker() || walk_finished_ == parameters_.get_walkers() - 1)
      current_exception = std::make_unique<std::bad_alloc>(err);
  }
  catch (...) {
    throw std::runtime_error("something mysterious  went wrong in walker thread!");
  }
			     
  ++walk_finished_;
  if (BaseClass::writer_ && BaseClass::writer_->isADIOS2())
+18 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public:

  static std::vector<e_spin_states_type>& get_elements() {
    static std::vector<e_spin_states_type> v = initialize_elements();
    return v;
    return elements_;
  }

  template <typename Writer>
@@ -45,8 +45,13 @@ public:

  static int to_coordinate(element_type spin);

  template <typename Parameters>
  static void initialize(const Parameters& parameters);

private:
  static std::vector<e_spin_states_type> initialize_elements();
  static void initialize_elements(std::vector<e_spin_states_type>& elements);
  static inline std::vector<element_type> elements_;
};

template <typename Writer>
@@ -56,6 +61,18 @@ void electron_spin_domain::write(Writer& writer) {
  writer.close_group();
}

template <typename Parameters>
void electron_spin_domain::initialize(const Parameters& /*parameters*/) {
  using Lattice = typename Parameters::lattice_type;
  int spins = 2;
  if constexpr(Parameters::template HasCustomSpin<Parameters::Model::lattice_type::SPINS>::value) {
    spins = Parameters::Model::lattice_type::SPINS;
  }
  elements_.resize(spins);
  initialize_elements(elements_);
}

  
}  // domains
}  // phys
}  // dca
+17 −4
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ public:

  const static int DIMENSION = 2;

  const static int SPINS = 2;
  // The model is singleband, but up and down spins are stored in the same sector.
  const static int BANDS = 2;

@@ -58,6 +59,8 @@ public:
  // }

  static std::vector<int> flavors();
  static std::vector<int> spins();

  static std::vector<std::vector<double>> aVectors();

  static std::vector<std::pair<std::pair<int, int>, std::pair<int, int>>> orbitalPermutations();
@@ -100,6 +103,16 @@ const double* RashbaHubbard<PointGroup>::initializeRLDABasis() {
  return r_base.data();
}

template <typename PointGroup>
std::vector<int> RashbaHubbard<PointGroup>::spins() {
  static std::vector<int> spins(spins);

  for (int i = 0; i < SPINS; i++)
    spins[i] = i;

  return spins;
}
  
template <typename PointGroup>
std::vector<int> RashbaHubbard<PointGroup>::flavors() {
  static std::vector<int> flavors(BANDS);
@@ -129,8 +142,8 @@ void RashbaHubbard<PointGroup>::initializeHInteraction(
    const parameters_type& parameters) {
  if (BandDmn::dmn_size() != BANDS)
    throw std::logic_error("Rashba lattice has 2 bands.");
  if (SpinDmn::dmn_size() != 2)
    throw std::logic_error("Spin domain size must be 2.");
  // if (SpinDmn::dmn_size() != 2)
  //   throw std::logic_error("Spin domain size must be 2.");

  // Get the index of the origin (0,0).
  const int origin = RDmn::parameter_type::origin_index();
@@ -163,8 +176,8 @@ void RashbaHubbard<PointGroup>::initializeH0(
                                                  func::dmn_variadic<BandDmn, SpinDmn>, KDmn>>& H_0) {
  if (BandDmn::dmn_size() != BANDS)
    throw std::logic_error("Square lattice has one band.");
  if (SpinDmn::dmn_size() != 2)
    throw std::logic_error("Spin domain size must be 2.");
  // if (SpinDmn::dmn_size() != 2)
  //   throw std::logic_error("Spin domain size must be 2.");

  const auto& k_vecs = KDmn::get_elements();

+7 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <iostream>
#include <stdexcept>
#include <string>
#include <type_traits>

#include "dca/phys/models/analytic_hamiltonians/bilayer_lattice.hpp"
#include "dca/phys/models/analytic_hamiltonians/fe_as_lattice.hpp"
@@ -44,6 +45,12 @@ namespace params {
template <typename Model>
class ModelParameters {};

template <typename T, typename = void>
struct HasCustomSpin : std::false_type {};

template <typename T>
struct HasCustomSpin<T, decltype(std::declval<T>().SPIN, void())> : std::true_type{};

// Specialization for 2D 2-band model
// #include "model_parameters_2d_2band.inc"

Loading