Loading test/unit/phys/domains/cluster/CMakeLists.txt +4 −3 Original line number Diff line number Diff line Loading @@ -4,9 +4,10 @@ dca_add_gtest(cluster_operations_test GTEST_MAIN LIBS ${LAPACK_LIBRARIES} ${DCA_CUDA_LIBS}) #dca_add_gtest(momentum_exchage_domain_test # GTEST_MAIN # LIBS cluster_domains) dca_add_gtest(momentum_exchage_domain_test GTEST_MAIN LIBS ${DCA_LIBS} INCLUDE_DIRS ${DCA_INCLUDE_DIRS};${PROJECT_SOURCE_DIR}) # deprecated (requires NFFT) # add_subdirectory(interpolation/wannier_interpolation) test/unit/phys/domains/cluster/input.json 0 → 100644 +14 −0 Original line number Diff line number Diff line { "domains": { "real-space-grids": { "cluster": [[4, 0], [0, 4]] } }, "four-point": { "type": "PARTICLE_PARTICLE_UP_DOWN", "momentum-transfer": [0., 3.1415], "compute-all-transfers" : true } } test/unit/phys/domains/cluster/momentum_exchage_domain_test.cpp +17 −38 Original line number Diff line number Diff line Loading @@ -15,50 +15,29 @@ #include <gtest/gtest.h> #include "dca/math/util/vector_operations.hpp" constexpr int cluster_size = 6; struct MockParameters { struct KClusterDmn { static int dmn_size() { return cluster_size; } }; bool compute_all_transfers() const { return compute_all_transfers_; } int get_four_point_momentum_transfer_index() const { return transfer_index_; } bool compute_all_transfers_ = false; int transfer_index_ = -1; }; #include "test/unit/phys/dca_step/cluster_solver/test_setup.hpp" using dca::phys::domains::MomentumExchangeDomain; using dca::math::util::isSameVector; TEST(MomentumExchangeDomainTest, SingleExchange) { const int exchange_id = -2; MockParameters parameters{false, exchange_id}; MomentumExchangeDomain::initialize(parameters); EXPECT_TRUE(MomentumExchangeDomain::isInitialized()); EXPECT_EQ(1, MomentumExchangeDomain::get_size()); EXPECT_TRUE(isSameVector(std::vector<int>{-2}, MomentumExchangeDomain::get_elements())); } constexpr char input_file[] = DCA_SOURCE_DIR "/test/unit/phys/domains/cluster/input.json"; using MomentumExchangeDomainTest = dca::testing::G0Setup<dca::testing::LatticeSquare, dca::phys::solver::CT_AUX, input_file>; TEST(MomentumExchangeDomainTest, MultipleExchanges) { MockParameters parameters{true}; MomentumExchangeDomain::initialize(parameters); TEST_F(MomentumExchangeDomainTest, MultipleExchanges) { MomentumExchangeDomain::initialize(parameters_); EXPECT_TRUE(MomentumExchangeDomain::isInitialized()); EXPECT_EQ(cluster_size, MomentumExchangeDomain::get_size()); // Cluster sites with their id: // 12 13 14 15 // 08 09 10 11 // 04 05 06 07 // 00 01 02 03 // // Independent sites due to rotations and reflections: 00, 01, 02, 05, 06, 10. std::vector<int> expected_elements(cluster_size); std::iota(expected_elements.begin(), expected_elements.end(), 0); EXPECT_TRUE(isSameVector(expected_elements, MomentumExchangeDomain::get_elements())); EXPECT_EQ(6, MomentumExchangeDomain::get_size()); const std::vector<int> expected_elements{00, 01, 02, 05, 06, 10}; EXPECT_TRUE(expected_elements == MomentumExchangeDomain::get_elements()); } Loading
test/unit/phys/domains/cluster/CMakeLists.txt +4 −3 Original line number Diff line number Diff line Loading @@ -4,9 +4,10 @@ dca_add_gtest(cluster_operations_test GTEST_MAIN LIBS ${LAPACK_LIBRARIES} ${DCA_CUDA_LIBS}) #dca_add_gtest(momentum_exchage_domain_test # GTEST_MAIN # LIBS cluster_domains) dca_add_gtest(momentum_exchage_domain_test GTEST_MAIN LIBS ${DCA_LIBS} INCLUDE_DIRS ${DCA_INCLUDE_DIRS};${PROJECT_SOURCE_DIR}) # deprecated (requires NFFT) # add_subdirectory(interpolation/wannier_interpolation)
test/unit/phys/domains/cluster/input.json 0 → 100644 +14 −0 Original line number Diff line number Diff line { "domains": { "real-space-grids": { "cluster": [[4, 0], [0, 4]] } }, "four-point": { "type": "PARTICLE_PARTICLE_UP_DOWN", "momentum-transfer": [0., 3.1415], "compute-all-transfers" : true } }
test/unit/phys/domains/cluster/momentum_exchage_domain_test.cpp +17 −38 Original line number Diff line number Diff line Loading @@ -15,50 +15,29 @@ #include <gtest/gtest.h> #include "dca/math/util/vector_operations.hpp" constexpr int cluster_size = 6; struct MockParameters { struct KClusterDmn { static int dmn_size() { return cluster_size; } }; bool compute_all_transfers() const { return compute_all_transfers_; } int get_four_point_momentum_transfer_index() const { return transfer_index_; } bool compute_all_transfers_ = false; int transfer_index_ = -1; }; #include "test/unit/phys/dca_step/cluster_solver/test_setup.hpp" using dca::phys::domains::MomentumExchangeDomain; using dca::math::util::isSameVector; TEST(MomentumExchangeDomainTest, SingleExchange) { const int exchange_id = -2; MockParameters parameters{false, exchange_id}; MomentumExchangeDomain::initialize(parameters); EXPECT_TRUE(MomentumExchangeDomain::isInitialized()); EXPECT_EQ(1, MomentumExchangeDomain::get_size()); EXPECT_TRUE(isSameVector(std::vector<int>{-2}, MomentumExchangeDomain::get_elements())); } constexpr char input_file[] = DCA_SOURCE_DIR "/test/unit/phys/domains/cluster/input.json"; using MomentumExchangeDomainTest = dca::testing::G0Setup<dca::testing::LatticeSquare, dca::phys::solver::CT_AUX, input_file>; TEST(MomentumExchangeDomainTest, MultipleExchanges) { MockParameters parameters{true}; MomentumExchangeDomain::initialize(parameters); TEST_F(MomentumExchangeDomainTest, MultipleExchanges) { MomentumExchangeDomain::initialize(parameters_); EXPECT_TRUE(MomentumExchangeDomain::isInitialized()); EXPECT_EQ(cluster_size, MomentumExchangeDomain::get_size()); // Cluster sites with their id: // 12 13 14 15 // 08 09 10 11 // 04 05 06 07 // 00 01 02 03 // // Independent sites due to rotations and reflections: 00, 01, 02, 05, 06, 10. std::vector<int> expected_elements(cluster_size); std::iota(expected_elements.begin(), expected_elements.end(), 0); EXPECT_TRUE(isSameVector(expected_elements, MomentumExchangeDomain::get_elements())); EXPECT_EQ(6, MomentumExchangeDomain::get_size()); const std::vector<int> expected_elements{00, 01, 02, 05, 06, 10}; EXPECT_TRUE(expected_elements == MomentumExchangeDomain::get_elements()); }