/** * finds a matching space group * @author Tobias Weber * @date jan-2020 * @license GPLv3, see 'LICENSE' file */ #include "../structfact/loadcif.h" #include "libs/_cxx20/math_algos.h" #include #include #include using t_real = double; using t_vec = std::vector; using t_mat = m::mat; constexpr t_real g_eps = 1e-6; constexpr int g_prec = 6; /** * find matching spacegroup */ std::vector>> find_sgs( const std::vector& vecInit, const std::vector& vecFinal) { return find_matching_sgs(vecInit, vecFinal); } /** * entry point */ int main(int argc, char** argv) { // TODO: read input data // test data std::vector vecInit {{ m::create({ 0.1, 0.1, 0.1}), m::create({ 0.4, -0.1, -0.4}), m::create({-0.1, -0.4, 0.4}), m::create({-0.4, 0.4, -0.1}), }}; std::vector vecFinal {{ m::create({ 0.1, 0.1, 0.1}), m::create({ 0.4, -0.1, -0.4}), m::create({-0.1, -0.4, 0.4}), m::create({-0.4, 0.4, -0.1}), }}; std::cout << "Full set of positions to match:\n"; std::size_t ctr = 1; for(const auto& pos : vecFinal) std::cout << "\t(" << ctr++ << ") " << pos << "\n"; std::cout << std::endl; while(1) { std::cout << "\n--------------------------------------------------------------------------------\n"; std::cout << "Base set of positions:\n"; ctr = 1; for(const auto& pos : vecInit) std::cout << "\t(" << ctr++ << ") " << pos << "\n"; std::cout << std::endl; auto matchingSGs = find_sgs(vecInit, vecFinal); std::cout << "Matching space groups:\n"; ctr = 1; for(const auto& sg : matchingSGs) std::cout << "\t(" << ctr++ << ") " << std::get<1>(sg) << "\n"; std::cout << "--------------------------------------------------------------------------------\n"; std::cout << std::endl; vecInit.pop_back(); if(vecInit.size() == 0) break; } return 0; }