Verified Commit 75626e5f authored by Tobias WEBER's avatar Tobias WEBER
Browse files

adapted to tlibs2 changes

parent 50d83dbb
...@@ -53,6 +53,8 @@ tools/magstructfact/build/** ...@@ -53,6 +53,8 @@ tools/magstructfact/build/**
tools/magsgbrowser/build/** tools/magsgbrowser/build/**
tools/pol/build/** tools/pol/build/**
tools/moldyn/build/** tools/moldyn/build/**
tools/main/build/**
tools/setup/build/**
*.pyc *.pyc
.DS_Store .DS_Store
*.csv *.csv
......
...@@ -13,8 +13,8 @@ set(CMAKE_VERBOSE_MAKEFILE TRUE) ...@@ -13,8 +13,8 @@ set(CMAKE_VERBOSE_MAKEFILE TRUE)
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
add_definitions(-std=c++2a -fconcepts) add_definitions(-std=c++20)
add_definitions(${Boost_CXX_FLAGS}) add_definitions(${Boost_CXX_FLAGS})
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
#include "../structfact/loadcif.h" #include "../structfact/loadcif.h"
#include "libs/math_algos.h" #include "libs/math20.h"
#include <gemmi/version.hpp> #include <gemmi/version.hpp>
#include <iostream> #include <iostream>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
using t_real = double; using t_real = double;
using t_vec = std::vector<t_real>; using t_vec = std::vector<t_real>;
using t_mat = m::mat<t_real, std::vector>; using t_mat = tl2::mat<t_real, std::vector>;
constexpr t_real g_eps = 1e-6; constexpr t_real g_eps = 1e-6;
constexpr int g_prec = 6; constexpr int g_prec = 6;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
#include "../structfact/loadcif.h" #include "../structfact/loadcif.h"
#include "libs/math_algos.h" #include "libs/math20.h"
#include <gemmi/version.hpp> #include <gemmi/version.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
using t_real = double; using t_real = double;
using t_vec = std::vector<t_real>; using t_vec = std::vector<t_real>;
using t_mat = m::mat<t_real, std::vector>; using t_mat = tl2::mat<t_real, std::vector>;
constexpr t_real g_eps = 1e-6; constexpr t_real g_eps = 1e-6;
...@@ -30,10 +30,10 @@ int main(int argc, char** argv) ...@@ -30,10 +30,10 @@ int main(int argc, char** argv)
std::vector<t_vec> vecFinal; std::vector<t_vec> vecFinal;
/*{{ // test data /*{{ // test data
m::create<t_vec>({ 0.1, 0.1, 0.1}), tl2::create<t_vec>({ 0.1, 0.1, 0.1}),
m::create<t_vec>({ 0.4, -0.1, -0.4}), tl2::create<t_vec>({ 0.4, -0.1, -0.4}),
m::create<t_vec>({-0.1, -0.4, 0.4}), tl2::create<t_vec>({-0.1, -0.4, 0.4}),
m::create<t_vec>({-0.4, 0.4, -0.1}), tl2::create<t_vec>({-0.4, 0.4, -0.1}),
}}*/; }}*/;
std::size_t atomnr = 1; std::size_t atomnr = 1;
......
...@@ -12,8 +12,8 @@ find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets) ...@@ -12,8 +12,8 @@ find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
add_definitions(-std=c++17 -fconcepts) add_definitions(-std=c++20)
include_directories("${PROJECT_SOURCE_DIR}" "../.." include_directories("${PROJECT_SOURCE_DIR}" "../.."
"../../ext/gemmi/include" "../../ext/gemmi/third_party") "../../ext/gemmi/include" "../../ext/gemmi/third_party")
......
...@@ -17,15 +17,15 @@ ...@@ -17,15 +17,15 @@
#include <QtWidgets/QListWidgetItem> #include <QtWidgets/QListWidgetItem>
#include "libs/magsg.h" #include "libs/magsg.h"
#include "libs/math_algos.h" #include "libs/math20.h"
#include "ui_browser.h" #include "ui_browser.h"
using t_real_sg = double; using t_real_sg = double;
using t_vec_sg = m::qvec_adapter<int, 3, t_real_sg, QGenericMatrix>; using t_vec_sg = tl2::qvec_adapter<int, 3, t_real_sg, QGenericMatrix>;
using t_mat_sg = m::qmat_adapter<int, 3, 3, t_real_sg, QGenericMatrix>; using t_mat_sg = tl2::qmat_adapter<int, 3, 3, t_real_sg, QGenericMatrix>;
using t_mat44_sg = m::qmat_adapter<int, 4, 4, t_real_sg, QGenericMatrix>; using t_mat44_sg = tl2::qmat_adapter<int, 4, 4, t_real_sg, QGenericMatrix>;
class SgBrowserDlg : public QDialog, Ui::SgBrowserDlg class SgBrowserDlg : public QDialog, Ui::SgBrowserDlg
......
...@@ -16,8 +16,8 @@ find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets OpenGL) ...@@ -16,8 +16,8 @@ find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets OpenGL)
set(CMAKE_AUTOUIC TRUE) set(CMAKE_AUTOUIC TRUE)
set(CMAKE_AUTOMOC TRUE) set(CMAKE_AUTOMOC TRUE)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
add_definitions(-std=c++17 -fconcepts) add_definitions(-std=c++20)
add_definitions(${Boost_CXX_FLAGS}) add_definitions(${Boost_CXX_FLAGS})
include_directories( include_directories(
...@@ -32,11 +32,11 @@ if(BUILD_LIB) ...@@ -32,11 +32,11 @@ if(BUILD_LIB)
add_definitions(-DBUILD_LIB) add_definitions(-DBUILD_LIB)
add_library(magstructfact SHARED add_library(magstructfact SHARED
magstructfact.cpp magstructfact.h magstructfact.cpp magstructfact.h
../../libs/_cxx20/glplot.cpp ../../libs/_cxx20/glplot.h) ../../libs/glplot.cpp ../../libs/glplot.h)
else() else()
add_executable(magstructfact add_executable(magstructfact
magstructfact.cpp magstructfact.h magstructfact.cpp magstructfact.h
../../libs/_cxx20/glplot.cpp ../../libs/_cxx20/glplot.h) ../../libs/glplot.cpp ../../libs/glplot.h)
endif() endif()
target_link_libraries(magstructfact ${Boost_LIBRARIES}) target_link_libraries(magstructfact ${Boost_LIBRARIES})
......
...@@ -43,8 +43,8 @@ namespace consts = si::constants; ...@@ -43,8 +43,8 @@ namespace consts = si::constants;
#include "libs/helper.h" #include "libs/helper.h"
//using namespace m; //using namespace tl2;
using namespace m_ops; using namespace tl2_ops;
constexpr t_real g_eps = 1e-6; constexpr t_real g_eps = 1e-6;
...@@ -536,11 +536,11 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent}, ...@@ -536,11 +536,11 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
m_dlgPlot->setWindowTitle("Unit Cell"); m_dlgPlot->setWindowTitle("Unit Cell");
m_plot = std::make_shared<GlPlot>(this); m_plot = std::make_shared<GlPlot>(this);
m_plot->GetImpl()->SetLight(0, m::create<t_vec3_gl>({ 5, 5, 5 })); m_plot->GetImpl()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plot->GetImpl()->SetLight(1, m::create<t_vec3_gl>({ -5, -5, -5 })); m_plot->GetImpl()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plot->GetImpl()->SetCoordMax(1.); m_plot->GetImpl()->SetCoordMax(1.);
m_plot->GetImpl()->SetCamBase(m::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}), m_plot->GetImpl()->SetCamBase(tl2::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}),
m::create<t_vec_gl>({1,0,0,0}), m::create<t_vec_gl>({0,0,1,0})); tl2::create<t_vec_gl>({1,0,0,0}), tl2::create<t_vec_gl>({0,0,1,0}));
auto labCoordSys = new QLabel("Coordinate System:", /*m_dlgPlot*/ this); auto labCoordSys = new QLabel("Coordinate System:", /*m_dlgPlot*/ this);
...@@ -596,11 +596,11 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent}, ...@@ -596,11 +596,11 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
m_dlgPlotSC->setWindowTitle("Super Cell"); m_dlgPlotSC->setWindowTitle("Super Cell");
m_plotSC = std::make_shared<GlPlot>(this); m_plotSC = std::make_shared<GlPlot>(this);
m_plotSC->GetImpl()->SetLight(0, m::create<t_vec3_gl>({ 5, 5, 5 })); m_plotSC->GetImpl()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plotSC->GetImpl()->SetLight(1, m::create<t_vec3_gl>({ -5, -5, -5 })); m_plotSC->GetImpl()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plotSC->GetImpl()->SetCoordMax(1.); m_plotSC->GetImpl()->SetCoordMax(1.);
m_plotSC->GetImpl()->SetCamBase(m::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}), m_plotSC->GetImpl()->SetCamBase(tl2::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}),
m::create<t_vec_gl>({1,0,0,0}), m::create<t_vec_gl>({0,0,1,0})); tl2::create<t_vec_gl>({1,0,0,0}), tl2::create<t_vec_gl>({0,0,1,0}));
auto labCoordSys = new QLabel("Coordinate System:", /*m_dlgPlotSC*/ this); auto labCoordSys = new QLabel("Coordinate System:", /*m_dlgPlotSC*/ this);
...@@ -802,30 +802,30 @@ void MagStructFactDlg::Sync3DItem(int row) ...@@ -802,30 +802,30 @@ void MagStructFactDlg::Sync3DItem(int row)
QColor col{itemCol->text()}; QColor col{itemCol->text()};
col.getRgbF(&r, &g, &b); col.getRgbF(&r, &g, &b);
t_mat_gl matSphere = m::hom_translation<t_mat_gl>(posx, posy, posz) * t_mat_gl matSphere = tl2::hom_translation<t_mat_gl>(posx, posy, posz) *
m::hom_scaling<t_mat_gl>(M*scale, M*scale, M*scale); tl2::hom_scaling<t_mat_gl>(M*scale, M*scale, M*scale);
auto vecReM = m::create<t_vec_gl>({t_real_gl(ReMX), t_real_gl(ReMY), t_real_gl(ReMZ)}); auto vecReM = tl2::create<t_vec_gl>({t_real_gl(ReMX), t_real_gl(ReMY), t_real_gl(ReMZ)});
auto vecImM = m::create<t_vec_gl>({t_real_gl(ImMX), t_real_gl(ImMY), t_real_gl(ImMZ)}); auto vecImM = tl2::create<t_vec_gl>({t_real_gl(ImMX), t_real_gl(ImMY), t_real_gl(ImMZ)});
auto normReM = m::norm<t_vec_gl>(vecReM); auto normReM = tl2::norm<t_vec_gl>(vecReM);
auto normImM = m::norm<t_vec_gl>(vecImM); auto normImM = tl2::norm<t_vec_gl>(vecImM);
t_mat_gl matArrowRe = GlPlot_impl::GetArrowMatrix( t_mat_gl matArrowRe = GlPlot_impl::GetArrowMatrix(
vecReM, // to vecReM, // to
1, // post-scale 1, // post-scale
m::create<t_vec_gl>({0, 0, 0}), // post-translate tl2::create<t_vec_gl>({0, 0, 0}), // post-translate
m::create<t_vec_gl>({0, 0, 1}), // from tl2::create<t_vec_gl>({0, 0, 1}), // from
M*scale, // pre-scale M*scale, // pre-scale
m::create<t_vec_gl>({posx, posy, posz}) // pre-translate tl2::create<t_vec_gl>({posx, posy, posz}) // pre-translate
); );
t_mat_gl matArrowIm = GlPlot_impl::GetArrowMatrix( t_mat_gl matArrowIm = GlPlot_impl::GetArrowMatrix(
vecImM, // to vecImM, // to
1, // post-scale 1, // post-scale
m::create<t_vec_gl>({0, 0, 0}), // post-translate tl2::create<t_vec_gl>({0, 0, 0}), // post-translate
m::create<t_vec_gl>({0, 0, 1}), // from tl2::create<t_vec_gl>({0, 0, 1}), // from
M*scale, // pre-scale M*scale, // pre-scale
m::create<t_vec_gl>({posx, posy, posz}) // pre-translate tl2::create<t_vec_gl>({posx, posy, posz}) // pre-translate
); );
m_plot->GetImpl()->SetObjectMatrix(objSphere, matSphere); m_plot->GetImpl()->SetObjectMatrix(objSphere, matSphere);
...@@ -835,8 +835,8 @@ void MagStructFactDlg::Sync3DItem(int row) ...@@ -835,8 +835,8 @@ void MagStructFactDlg::Sync3DItem(int row)
m_plot->GetImpl()->SetObjectCol(objSphere, r, g, b, 1); m_plot->GetImpl()->SetObjectCol(objSphere, r, g, b, 1);
m_plot->GetImpl()->SetObjectCol(objArrowRe, r, g, b, 1); m_plot->GetImpl()->SetObjectCol(objArrowRe, r, g, b, 1);
m_plot->GetImpl()->SetObjectCol(objArrowIm, 1.-r, 1.-g, 1.-b, 1); m_plot->GetImpl()->SetObjectCol(objArrowIm, 1.-r, 1.-g, 1.-b, 1);
m_plot->GetImpl()->SetObjectVisible(objArrowRe, !m::equals<t_real_gl>(normReM, 0, g_eps)); m_plot->GetImpl()->SetObjectVisible(objArrowRe, !tl2::equals<t_real_gl>(normReM, 0, g_eps));
m_plot->GetImpl()->SetObjectVisible(objArrowIm, !m::equals<t_real_gl>(normImM, 0, g_eps)); m_plot->GetImpl()->SetObjectVisible(objArrowIm, !tl2::equals<t_real_gl>(normImM, 0, g_eps));
m_plot->update(); m_plot->update();
} }
...@@ -1509,8 +1509,8 @@ void MagStructFactDlg::GenerateFromSG() ...@@ -1509,8 +1509,8 @@ void MagStructFactDlg::GenerateFromSG()
std::string name = m_nuclei->item(row, COL_NAME)->text().toStdString(); std::string name = m_nuclei->item(row, COL_NAME)->text().toStdString();
std::string col = m_nuclei->item(row, COL_COL)->text().toStdString(); std::string col = m_nuclei->item(row, COL_COL)->text().toStdString();
t_vec nucl = m::create<t_vec>({x, y, z, 1}); t_vec nucl = tl2::create<t_vec>({x, y, z, 1});
auto newnuclei = m::apply_ops_hom<t_vec, t_mat, t_real>(nucl, ops, g_eps); auto newnuclei = tl2::apply_ops_hom<t_vec, t_mat, t_real>(nucl, ops, g_eps);
for(const auto& newnucl : newnuclei) for(const auto& newnucl : newnuclei)
{ {
...@@ -1606,19 +1606,19 @@ void MagStructFactDlg::CalcB(bool bFullRecalc) ...@@ -1606,19 +1606,19 @@ void MagStructFactDlg::CalcB(bool bFullRecalc)
std::istringstream{m_editBeta->text().toStdString()} >> beta; std::istringstream{m_editBeta->text().toStdString()} >> beta;
std::istringstream{m_editGamma->text().toStdString()} >> gamma; std::istringstream{m_editGamma->text().toStdString()} >> gamma;
m_crystB = m::B_matrix<t_mat>(a, b, c, m_crystB = tl2::B_matrix<t_mat>(a, b, c,
alpha/180.*m::pi<t_real>, beta/180.*m::pi<t_real>, gamma/180.*m::pi<t_real>); alpha/180.*tl2::pi<t_real>, beta/180.*tl2::pi<t_real>, gamma/180.*tl2::pi<t_real>);
bool ok = true; bool ok = true;
std::tie(m_crystA, ok) = m::inv(m_crystB); std::tie(m_crystA, ok) = tl2::inv(m_crystB);
if(!ok) if(!ok)
{ {
m_crystA = m::unit<t_mat>(); m_crystA = tl2::unit<t_mat>();
std::cerr << "Error: Cannot invert B matrix." << std::endl; std::cerr << "Error: Cannot invert B matrix." << std::endl;
} }
else else
{ {
m_crystA *= t_real_gl(2)*m::pi<t_real_gl>; m_crystA *= t_real_gl(2)*tl2::pi<t_real_gl>;
} }
if(m_plot) if(m_plot)
...@@ -1665,7 +1665,7 @@ void MagStructFactDlg::Calc() ...@@ -1665,7 +1665,7 @@ void MagStructFactDlg::Calc()
std::istringstream{m_propvecs->item(row, PROP_COL_Z)->text().toStdString()} >> z; std::istringstream{m_propvecs->item(row, PROP_COL_Z)->text().toStdString()} >> z;
std::istringstream{m_propvecs->item(row, PROP_COL_CONJ)->text().toStdString()} >> iConj; std::istringstream{m_propvecs->item(row, PROP_COL_CONJ)->text().toStdString()} >> iConj;
propvecs.emplace_back(m::create<t_vec>({x, y, z})); propvecs.emplace_back(tl2::create<t_vec>({x, y, z}));
conjFCs.push_back(iConj != 0); conjFCs.push_back(iConj != 0);
} }
...@@ -1682,7 +1682,7 @@ void MagStructFactDlg::Calc() ...@@ -1682,7 +1682,7 @@ void MagStructFactDlg::Calc()
bool foundQ = false; bool foundQ = false;
for(auto& line : powderlines) for(auto& line : powderlines)
{ {
if(m::equals<t_real>(line.Q, Q, g_eps)) if(tl2::equals<t_real>(line.Q, Q, g_eps))
{ {
line.I += I; line.I += I;
line.peaks += ostrPeak.str(); line.peaks += ostrPeak.str();
...@@ -1714,8 +1714,8 @@ void MagStructFactDlg::Calc() ...@@ -1714,8 +1714,8 @@ void MagStructFactDlg::Calc()
for(const auto& nucl : GetNuclei()) for(const auto& nucl : GetNuclei())
{ {
pos.emplace_back(m::create<t_vec>({ nucl.pos[0], nucl.pos[1], nucl.pos[2] })); pos.emplace_back(tl2::create<t_vec>({ nucl.pos[0], nucl.pos[1], nucl.pos[2] }));
Ms.emplace_back(nucl.MAbs * m::create<t_vec_cplx>({ Ms.emplace_back(nucl.MAbs * tl2::create<t_vec_cplx>({
t_cplx{nucl.ReM[0], nucl.ImM[0]}, t_cplx{nucl.ReM[0], nucl.ImM[0]},
t_cplx{nucl.ReM[1], nucl.ImM[1]}, t_cplx{nucl.ReM[1], nucl.ImM[1]},
t_cplx{nucl.ReM[2], nucl.ImM[2]} })); t_cplx{nucl.ReM[2], nucl.ImM[2]} }));
...@@ -1760,28 +1760,28 @@ void MagStructFactDlg::Calc() ...@@ -1760,28 +1760,28 @@ void MagStructFactDlg::Calc()
{ {
for(const auto& prop : propvecs) for(const auto& prop : propvecs)
{ {
auto Q = m::create<t_vec>({ h,k,l }) + prop; auto Q = tl2::create<t_vec>({ h,k,l }) + prop;
auto Q_invA = m_crystB * Q; auto Q_invA = m_crystB * Q;
auto Qabs_invA = m::norm(Q_invA); auto Qabs_invA = tl2::norm(Q_invA);
// magnetic structure factor // magnetic structure factor
auto Fm = p * m::structure_factor<t_vec, t_vec_cplx>(Ms, pos, Q, nullptr); auto Fm = p * tl2::structure_factor<t_vec, t_vec_cplx>(Ms, pos, Q, nullptr);
bool Fm_is_zero = 1; bool Fm_is_zero = 1;
for(auto &comp : Fm) for(auto &comp : Fm)
{ {
if(m::equals<t_real>(comp.real(), t_real(0), g_eps)) comp.real(0.); else Fm_is_zero = 0; if(tl2::equals<t_real>(comp.real(), t_real(0), g_eps)) comp.real(0.); else Fm_is_zero = 0;
if(m::equals<t_real>(comp.imag(), t_real(0), g_eps)) comp.imag(0.); else Fm_is_zero = 0; if(tl2::equals<t_real>(comp.imag(), t_real(0), g_eps)) comp.imag(0.); else Fm_is_zero = 0;
} }
if(Fm.size() == 0) if(Fm.size() == 0)
Fm = m::zero<t_vec_cplx>(3); Fm = tl2::zero<t_vec_cplx>(3);
// neutron scattering: orthogonal projection onto plane with normal Q. // neutron scattering: orthogonal projection onto plane with normal Q.
auto Fm_perp = m::ortho_project<t_vec_cplx>( auto Fm_perp = tl2::ortho_project<t_vec_cplx>(
Fm, m::create<t_vec_cplx>({Q[0], Q[1], Q[2]}), false); Fm, tl2::create<t_vec_cplx>({Q[0], Q[1], Q[2]}), false);
for(auto &comp : Fm_perp) for(auto &comp : Fm_perp)
{ {
if(m::equals<t_real>(comp.real(), t_real(0), g_eps)) comp.real(0.); if(tl2::equals<t_real>(comp.real(), t_real(0), g_eps)) comp.real(0.);
if(m::equals<t_real>(comp.imag(), t_real(0), g_eps)) comp.imag(0.); if(tl2::equals<t_real>(comp.imag(), t_real(0), g_eps)) comp.imag(0.);
} }
t_real I = (std::conj(Fm[0])*Fm[0] + t_real I = (std::conj(Fm[0])*Fm[0] +
...@@ -1877,7 +1877,7 @@ void MagStructFactDlg::Calc() ...@@ -1877,7 +1877,7 @@ void MagStructFactDlg::Calc()
<< std::setw(g_prec*1.2) << std::right << "sc_z" << "\n"; << std::setw(g_prec*1.2) << std::right << "sc_z" << "\n";
//std::vector<t_vec_cplx> moments; //std::vector<t_vec_cplx> moments;
auto vecCentring = m::create<t_vec>({0, 0, 0}); auto vecCentring = tl2::create<t_vec>({0, 0, 0});
for(t_real sc_x=-maxSCx; sc_x<=maxSCx; ++sc_x) for(t_real sc_x=-maxSCx; sc_x<=maxSCx; ++sc_x)
{ {
...@@ -1885,7 +1885,7 @@ void MagStructFactDlg::Calc() ...@@ -1885,7 +1885,7 @@ void MagStructFactDlg::Calc()
{ {
for(t_real sc_z=-maxSCz; sc_z<=maxSCz; ++sc_z) for(t_real sc_z=-maxSCz; sc_z<=maxSCz; ++sc_z)
{ {
auto vecCellCentre = m::create<t_vec>({ sc_x, sc_y, sc_z }) + vecCentring; auto vecCellCentre = tl2::create<t_vec>({ sc_x, sc_y, sc_z }) + vecCentring;
for(std::size_t nuclidx=0; nuclidx<Ms.size(); ++nuclidx) for(std::size_t nuclidx=0; nuclidx<Ms.size(); ++nuclidx)
{ {
...@@ -1895,9 +1895,9 @@ void MagStructFactDlg::Calc() ...@@ -1895,9 +1895,9 @@ void MagStructFactDlg::Calc()
auto thepos = pos[nuclidx] + vecCellCentre; auto thepos = pos[nuclidx] + vecCellCentre;
auto scale = scales[nuclidx]; auto scale = scales[nuclidx];
auto posGL = m::convert<t_vec_gl>(thepos); auto posGL = tl2::convert<t_vec_gl>(thepos);
auto moment = m::create<t_vec_cplx>({0, 0, 0}); auto moment = tl2::create<t_vec_cplx>({0, 0, 0});
auto fourier_conj = m::conj(fourier); auto fourier_conj = tl2::conj(fourier);
qreal r=1, g=1, b=1; qreal r=1, g=1, b=1;
QColor col{colstr.c_str()}; QColor col{colstr.c_str()};
...@@ -1907,13 +1907,13 @@ void MagStructFactDlg::Calc() ...@@ -1907,13 +1907,13 @@ void MagStructFactDlg::Calc()
{ {
const auto& propvec = propvecs[propidx]; const auto& propvec = propvecs[propidx];
auto *pfourier = conjFCs[propidx] ? &fourier_conj : &fourier; auto *pfourier = conjFCs[propidx] ? &fourier_conj : &fourier;
moment += *pfourier * std::exp(t_cplx{0,1}*m::pi<t_real>*t_real{2} * m::inner<t_vec>(propvec, vecCellCentre)); moment += *pfourier * std::exp(t_cplx{0,1}*tl2::pi<t_real>*t_real{2} * tl2::inner<t_vec>(propvec, vecCellCentre));
} }
for(auto &comp : moment) for(auto &comp : moment)
{ {
if(m::equals<t_real>(comp.real(), t_real(0), g_eps)) comp.real(0.); if(tl2::equals<t_real>(comp.real(), t_real(0), g_eps)) comp.real(0.);
if(m::equals<t_real>(comp.imag(), t_real(0), g_eps)) comp.imag(0.); if(tl2::equals<t_real>(comp.imag(), t_real(0), g_eps)) comp.imag(0.);
} }
...@@ -1923,18 +1923,18 @@ void MagStructFactDlg::Calc() ...@@ -1923,18 +1923,18 @@ void MagStructFactDlg::Calc()
auto objArrowRe = m_plotSC->GetImpl()->AddLinkedObject(m_arrowSC, 0,0,0, 1,1,1,1); auto objArrowRe = m_plotSC->GetImpl()->AddLinkedObject(m_arrowSC, 0,0,0, 1,1,1,1);
auto objArrowIm = m_plotSC->GetImpl()->AddLinkedObject(m_arrowSC, 0,0,0, 1,1,1,1); auto objArrowIm = m_plotSC->GetImpl()->AddLinkedObject(m_arrowSC, 0,0,0, 1,1,1,1);
auto [_vecReM, _vecImM] = m::split_cplx<t_cplx>(moment); auto [_vecReM, _vecImM] = tl2::split_cplx<t_cplx>(moment);
auto vecReM = m::convert<t_vec_gl>(_vecReM); auto vecReM = tl2::convert<t_vec_gl>(_vecReM);
auto vecImM = m::convert<t_vec_gl>(_vecImM); auto vecImM = tl2::convert<t_vec_gl>(_vecImM);
auto normReM = m::norm<t_vec_gl>(vecReM); auto normReM = tl2::norm<t_vec_gl>(vecReM);
auto normImM = m::norm<t_vec_gl>(vecImM); auto normImM = tl2::norm<t_vec_gl>(vecImM);
t_mat_gl matArrowRe = GlPlot_impl::GetArrowMatrix( t_mat_gl matArrowRe = GlPlot_impl::GetArrowMatrix(
vecReM, // to vecReM, // to
1, // post-scale 1, // post-scale
m::create<t_vec_gl>({0, 0, 0}), // post-translate tl2::create<t_vec_gl>({0, 0, 0}), // post-translate
m::create<t_vec_gl>({0, 0, 1}), // from tl2::create<t_vec_gl>({0, 0, 1}), // from
normReM*scale, // pre-scale normReM*scale, // pre-scale
posGL // pre-translate posGL // pre-translate
); );
...@@ -1942,8 +1942,8 @@ void MagStructFactDlg::Calc() ...@@ -1942,8 +1942,8 @@ void MagStructFactDlg::Calc()
t_mat_gl matArrowIm = GlPlot_impl::GetArrowMatrix( t_mat_gl matArrowIm = GlPlot_impl::GetArrowMatrix(
vecImM, // to vecImM, // to
1, // post-scale 1, // post-scale
m::create<t_vec_gl>({0, 0, 0}), // post-translate tl2::create<t_vec_gl>({0, 0, 0}), // post-translate
m::create<t_vec_gl>({0, 0, 1}), // from tl2::create<t_vec_gl>({0, 0, 1}), // from
normImM*scale, // pre-scale normImM*scale, // pre-scale
posGL // pre-translate posGL // pre-translate
); );
...@@ -1964,8 +1964,8 @@ void MagStructFactDlg::Calc() ...@@ -1964,8 +1964,8 @@ void MagStructFactDlg::Calc()
//m_plotSC->GetImpl()->SetObjectLabel(objArrowIm, name + " (imag)");