Verified Commit ba2fa41e authored by Tobias WEBER's avatar Tobias WEBER
Browse files

bz tools: highlighted (000) brillouin zone

parent e78ad703
......@@ -75,7 +75,7 @@ BZDlg::BZDlg(QWidget* pParent) : QDialog{pParent},
new QTableWidgetItem{"Symmetry Operation"});
m_symops->setHorizontalHeaderItem(COL_PROP,
new QTableWidgetItem{"Properties"});
m_symops->setColumnWidth(COL_OP, 400);
m_symops->setColumnWidth(COL_OP, 300);
m_symops->setColumnWidth(COL_PROP, 100);
QToolButton *btnAdd = new QToolButton(symopspanel);
......
......@@ -259,7 +259,9 @@ void BZDlg::CalcBZCut()
m_cut_plane = tl2::create<t_mat, t_vec>({ vec1, vec2, norm }, false);
m_cut_plane_inv = tl2::trans<t_mat>(m_cut_plane);
std::vector<std::pair<t_vec, t_vec>> cut_lines, cut_lines000;
// [x, y, Q]
std::vector<std::tuple<t_vec, t_vec, std::array<t_real, 3>>>
cut_lines, cut_lines000;
const auto order = m_BZOrder->value();
const auto ops = GetSymOps(true);
......@@ -320,9 +322,13 @@ void BZDlg::CalcBZCut()
tl2::set_eps_0(pt1, g_eps);
tl2::set_eps_0(pt2, g_eps);
cut_lines.emplace_back(std::make_pair(pt1, pt2));
cut_lines.emplace_back(std::make_tuple(
pt1, pt2,
std::array<t_real,3>{h, k, l}));
if(is_000)
cut_lines000.emplace_back(std::make_pair(pt1, pt2));
cut_lines000.emplace_back(std::make_tuple(
pt1, pt2,
std::array<t_real,3>{h, k, l}));
}
}
......@@ -351,9 +357,13 @@ void BZDlg::CalcBZCut()
tl2::set_eps_0(pt1, g_eps);
tl2::set_eps_0(pt2, g_eps);
cut_lines.emplace_back(std::make_pair(pt1, pt2));
cut_lines.emplace_back(std::make_tuple(
pt1, pt2,
std::array<t_real,3>{h, k, l}));
if(is_000)
cut_lines000.emplace_back(std::make_pair(pt1, pt2));
cut_lines000.emplace_back(std::make_tuple(
pt1, pt2,
std::array<t_real,3>{h, k, l}));
}
}
}
......@@ -369,8 +379,8 @@ void BZDlg::CalcBZCut()
{
const auto& line = cut_lines000[i];
ostr << "line " << i << ":\n\tvertex 0: " << line.first
<< "\n\tvertex 1: " << line.second << std::endl;
ostr << "line " << i << ":\n\tvertex 0: " << std::get<0>(line)
<< "\n\tvertex 1: " << std::get<1>(line) << std::endl;
}
m_descrBZCut = ostr.str();
......
......@@ -40,18 +40,47 @@ BZCutScene::~BZCutScene()
}
void BZCutScene::AddCut(const std::vector<std::pair<t_vec, t_vec>>& lines)
void BZCutScene::AddCut(
const std::vector<std::tuple<t_vec, t_vec, std::array<t_real, 3>>>& lines)
{
// (000) brillouin zone
std::vector<const std::tuple<t_vec, t_vec, std::array<t_real, 3>>*> lines000;
QPen pen;
pen.setCosmetic(true);
pen.setColor(qApp->palette().color(QPalette::WindowText));
pen.setWidthF(2.);
// draw brillouin zones
for(const auto& line : lines)
{
QPen pen;
pen.setCosmetic(true);
pen.setColor(qApp->palette().color(QPalette::WindowText));
pen.setWidthF(2.);
const auto& Q = std::get<2>(line);
// (000) BZ?
if(tl2::equals_0(Q[0], g_eps) &&
tl2::equals_0(Q[1], g_eps) &&
tl2::equals_0(Q[2], g_eps))
{
lines000.push_back(&line);
continue;
}
addLine(QLineF(
std::get<0>(line)[0]*m_scale, std::get<0>(line)[1]*m_scale,
std::get<1>(line)[0]*m_scale, std::get<1>(line)[1]*m_scale),
pen);
}
// draw (000) brillouin zone
pen.setColor(QColor(0x00, 0x00, 0xff));
pen.setWidthF(4.);
for(const auto* line : lines000)
{
addLine(QLineF(
line.first[0]*m_scale, line.first[1]*m_scale,
line.second[0]*m_scale, line.second[1]*m_scale),
std::get<0>(*line)[0]*m_scale, std::get<0>(*line)[1]*m_scale,
std::get<1>(*line)[0]*m_scale, std::get<1>(*line)[1]*m_scale),
pen);
}
}
......
......@@ -34,6 +34,9 @@
#include <QtGui/QMouseEvent>
#include <QtGui/QWheelEvent>
#include <tuple>
#include <array>
#include "globals.h"
......@@ -43,7 +46,9 @@ public:
BZCutScene(QWidget *parent = nullptr);
virtual ~BZCutScene();
void AddCut(const std::vector<std::pair<t_vec, t_vec>>& lines);
void AddCut(const std::vector<
// [x, y, Q]
std::tuple<t_vec, t_vec, std::array<t_real, 3>>>& lines);
t_real GetScale() const { return m_scale; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment