From 0e85f1fcbc22508c87a39f7e65bc23eeff24aa77 Mon Sep 17 00:00:00 2001 From: Xavier Andrade Date: Mon, 30 Sep 2024 01:10:05 -0700 Subject: [PATCH 1/3] Define a partition for kpin and spinor states. --- src/systems/electrons.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/systems/electrons.hpp b/src/systems/electrons.hpp index 454b01f2..c110faa0 100644 --- a/src/systems/electrons.hpp +++ b/src/systems/electrons.hpp @@ -78,6 +78,7 @@ class electrons { std::shared_ptr logger_; parallel::partition kpin_part_; parallel::arbitrary_partition kpin_states_part_; + parallel::arbitrary_partition kpin_spinor_states_part_; public: @@ -180,6 +181,7 @@ class electrons { } kpin_states_part_ = parallel::arbitrary_partition(kpin_part_.local_size()*max_local_set_size_, kpin_states_comm_); + kpin_spinor_states_part_ = parallel::arbitrary_partition(kpin_part_.local_size()*max_local_spinor_set_size_, kpin_states_comm_); assert(long(kpin_.size()) == kpin_part_.local_size()); assert(max_local_set_size_ > 0); @@ -406,6 +408,10 @@ class electrons { auto & kpin_states_part() const { return kpin_states_part_; } + + auto & kpin_spinor_states_part() const { + return kpin_spinor_states_part_; + } auto & max_local_set_size() const { return max_local_set_size_; From 122958e1d5d7701b580c7ed97f53e47581846e84 Mon Sep 17 00:00:00 2001 From: Xavier Andrade Date: Mon, 30 Sep 2024 01:14:21 -0700 Subject: [PATCH 2/3] Bugfix: use the correct partition object for gather information with spinors in eigenvalue output. --- src/ground_state/eigenvalue_output.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ground_state/eigenvalue_output.hpp b/src/ground_state/eigenvalue_output.hpp index 7e87e48e..086a23bf 100644 --- a/src/ground_state/eigenvalue_output.hpp +++ b/src/ground_state/eigenvalue_output.hpp @@ -61,13 +61,17 @@ class eigenvalues_output { } iphi++; } + + all_kpoint_index = parallel::gather(+kpoint_index.flatted(), el.kpin_spinor_states_part(), el.kpin_states_comm(), 0); + if(el.kpin_states_comm().root()){ + for(auto index : all_kpoint_index) assert(index >= 0 and index < electrons_.brillouin_zone().size()); + } - all_kpoint_index = parallel::gather(+kpoint_index.flatted(), el.kpin_states_part(), el.kpin_states_comm(), 0); - all_spin_index = parallel::gather(+spin_index.flatted(), el.kpin_states_part(), el.kpin_states_comm(), 0); - all_states_index = parallel::gather(+state_index.flatted(), el.kpin_states_part(), el.kpin_states_comm(), 0); - all_eigenvalues = parallel::gather(+el.eigenvalues().flatted(), el.kpin_states_part(), el.kpin_states_comm(), 0); - all_occupations = parallel::gather(+occs.flatted(), el.kpin_states_part(), el.kpin_states_comm(), 0); - all_normres = parallel::gather(+normres.flatted(), el.kpin_states_part(), el.kpin_states_comm(), 0); + all_spin_index = parallel::gather(+spin_index.flatted(), el.kpin_spinor_states_part(), el.kpin_states_comm(), 0); + all_states_index = parallel::gather(+state_index.flatted(), el.kpin_spinor_states_part(), el.kpin_states_comm(), 0); + all_eigenvalues = parallel::gather(+el.eigenvalues().flatted(), el.kpin_spinor_states_part(), el.kpin_states_comm(), 0); + all_occupations = parallel::gather(+occs.flatted(), el.kpin_spinor_states_part(), el.kpin_states_comm(), 0); + all_normres = parallel::gather(+normres.flatted(), el.kpin_spinor_states_part(), el.kpin_states_comm(), 0); } static std::string spin_string(int index){ From 428b49a73ae856cd1319a0de6e07ce29896a8e80 Mon Sep 17 00:00:00 2001 From: Xavier Andrade Date: Mon, 30 Sep 2024 07:13:10 -0700 Subject: [PATCH 3/3] Avoid unused variable warning. --- src/ground_state/eigenvalue_output.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ground_state/eigenvalue_output.hpp b/src/ground_state/eigenvalue_output.hpp index 086a23bf..2a37683a 100644 --- a/src/ground_state/eigenvalue_output.hpp +++ b/src/ground_state/eigenvalue_output.hpp @@ -64,7 +64,7 @@ class eigenvalues_output { all_kpoint_index = parallel::gather(+kpoint_index.flatted(), el.kpin_spinor_states_part(), el.kpin_states_comm(), 0); if(el.kpin_states_comm().root()){ - for(auto index : all_kpoint_index) assert(index >= 0 and index < electrons_.brillouin_zone().size()); + for([[maybe_unused]] auto index : all_kpoint_index) assert(index >= 0 and index < electrons_.brillouin_zone().size()); } all_spin_index = parallel::gather(+spin_index.flatted(), el.kpin_spinor_states_part(), el.kpin_states_comm(), 0);