Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
Takin
mag-core
Commits
501415f7
Verified
Commit
501415f7
authored
May 29, 2022
by
Tobias WEBER
Browse files
bz tool: started with faces
parent
93a31bc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
tools/bz/bz.cpp
View file @
501415f7
...
...
@@ -463,7 +463,8 @@ void BZDlg::CalcBZ()
// calculate voronoi diagram
auto
[
voronoi
,
triags
,
neighbours
]
=
geo
::
calc_delaunay
(
3
,
Qs_invA
,
false
,
false
,
idx000
);
auto
[
voronoi
,
triags
,
neighbours
]
=
geo
::
calc_delaunay
(
3
,
Qs_invA
,
false
,
false
,
idx000
);
ostr
<<
"
\n
# Brillouin zone"
<<
std
::
endl
;
ClearPlot
();
...
...
@@ -479,11 +480,14 @@ void BZDlg::CalcBZ()
}
#endif
// add gamma point
PlotAddBraggPeak
(
Qs_invA
[
idx000
]);
// add voronoi vertices forming the vertices of the BZ
ostr
<<
"
\n
"
;
for
(
std
::
size_t
idx
=
0
;
idx
<
voronoi
.
size
();
++
idx
)
{
t_vec
voro
=
voronoi
[
idx
];
t_vec
&
voro
=
voronoi
[
idx
];
tl2
::
set_eps_0
(
voro
,
g_eps
);
PlotAddVoronoiVertex
(
voro
);
...
...
@@ -493,6 +497,25 @@ void BZDlg::CalcBZ()
ostr
<<
"
\t
neighbour index: "
<<
nidx
<<
std
::
endl
;
}
// calculate the faces of the BZ
auto
[
bz_verts
,
bz_triags
,
bz_neighbours
]
=
geo
::
calc_delaunay
(
3
,
voronoi
,
true
,
false
);
std
::
vector
<
t_vec
>
bz_all_triags
;
ostr
<<
"
\n
"
;
for
(
std
::
size_t
idx_triag
=
0
;
idx_triag
<
bz_triags
.
size
();
++
idx_triag
)
{
const
auto
&
triag
=
bz_triags
[
idx_triag
];
ostr
<<
"polygon "
<<
idx_triag
<<
": "
<<
std
::
endl
;
for
(
std
::
size_t
idx_vert
=
0
;
idx_vert
<
triag
.
size
();
++
idx_vert
)
{
bz_all_triags
.
push_back
(
triag
[
idx_vert
]);
ostr
<<
"
\t
vertex: "
<<
triag
[
idx_vert
]
<<
std
::
endl
;
}
}
PlotAddPlane
(
bz_all_triags
);
// brillouin zone description
m_bz
->
setPlainText
(
ostr
.
str
().
c_str
());
}
...
...
tools/bz/bz_plot.cpp
View file @
501415f7
...
...
@@ -159,15 +159,17 @@ void BZDlg::PlotAddPlane(const std::vector<t_vec>& _vecs)
t_vec
_norm
=
tl2
::
cross
(
_vecs
[
2
]
-
_vecs
[
0
],
_vecs
[
1
]
-
_vecs
[
0
]);
t_vec3_gl
norm
=
tl2
::
convert
<
t_vec3_gl
>
(
_norm
);
t_vec3_gl
vec1
=
tl2
::
convert
<
t_vec3_gl
>
(
_vecs
[
0
]);
for
(
std
::
size_t
idx
=
1
;
idx
<
_vecs
.
size
()
-
2
;
++
idx
)
for
(
std
::
size_t
idx
=
0
;
idx
<
_vecs
.
size
()
-
2
;
idx
+=
3
)
{
t_vec3_gl
vec2
=
tl2
::
convert
<
t_vec3_gl
>
(
_vecs
[
idx
]);
t_vec3_gl
vec3
=
tl2
::
convert
<
t_vec3_gl
>
(
_vecs
[
idx
+
1
]);
vecs
.
push_back
(
vec1
);
t_vec3_gl
vec1
=
tl2
::
convert
<
t_vec3_gl
>
(
_vecs
[
idx
]);
t_vec3_gl
vec2
=
tl2
::
convert
<
t_vec3_gl
>
(
_vecs
[
idx
+
1
]);
t_vec3_gl
vec3
=
tl2
::
convert
<
t_vec3_gl
>
(
_vecs
[
idx
+
2
]);
vecs
.
emplace_back
(
std
::
move
(
vec1
));
vecs
.
emplace_back
(
std
::
move
(
vec2
));
vecs
.
emplace_back
(
std
::
move
(
vec3
));
norms
.
push_back
(
norm
);
norms
.
push_back
(
norm
);
norms
.
push_back
(
norm
);
}
auto
obj
=
m_plot
->
GetRenderer
()
->
AddTriangleObject
(
vecs
,
norms
,
r
,
g
,
b
,
1
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment