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
243f05ef
Verified
Commit
243f05ef
authored
May 29, 2022
by
Tobias WEBER
Browse files
finished with bz polygons
parent
501415f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
tools/bz/bz.cpp
View file @
243f05ef
...
...
@@ -431,9 +431,11 @@ void BZDlg::CalcBZ()
std
::
ostringstream
ostr
;
ostr
.
precision
(
g_prec
);
#ifdef DEBUG
ostr
<<
"# centring symmetry operations"
<<
std
::
endl
;
for
(
const
t_mat
&
op
:
ops_centr
)
ostr
<<
op
<<
std
::
endl
;
#endif
std
::
vector
<
t_vec
>
Qs_invA
;
Qs_invA
.
reserve
((
2
*
maxBZ
+
1
)
*
(
2
*
maxBZ
+
1
)
*
(
2
*
maxBZ
+
1
));
...
...
@@ -466,7 +468,6 @@ void BZDlg::CalcBZ()
auto
[
voronoi
,
triags
,
neighbours
]
=
geo
::
calc_delaunay
(
3
,
Qs_invA
,
false
,
false
,
idx000
);
ostr
<<
"
\n
# Brillouin zone"
<<
std
::
endl
;
ClearPlot
();
#ifdef DEBUG
...
...
@@ -484,7 +485,7 @@ void BZDlg::CalcBZ()
PlotAddBraggPeak
(
Qs_invA
[
idx000
]);
// add voronoi vertices forming the vertices of the BZ
ostr
<<
"
\n
"
;
ostr
<<
"
\n
# Brillouin zone vertices"
<<
std
::
endl
;
for
(
std
::
size_t
idx
=
0
;
idx
<
voronoi
.
size
();
++
idx
)
{
t_vec
&
voro
=
voronoi
[
idx
];
...
...
@@ -493,8 +494,8 @@ void BZDlg::CalcBZ()
PlotAddVoronoiVertex
(
voro
);
ostr
<<
"vertex "
<<
idx
<<
": "
<<
voro
<<
std
::
endl
;
for
(
std
::
size_t
nidx
:
neighbours
[
idx
])
ostr
<<
"
\t
neighbour index: "
<<
nidx
<<
std
::
endl
;
//
for(std::size_t nidx : neighbours[idx])
//
ostr << "\tneighbour index: " << nidx << std::endl;
}
// calculate the faces of the BZ
...
...
@@ -502,10 +503,11 @@ void BZDlg::CalcBZ()
geo
::
calc_delaunay
(
3
,
voronoi
,
true
,
false
);
std
::
vector
<
t_vec
>
bz_all_triags
;
ostr
<<
"
\n
"
;
ostr
<<
"
\n
# Brillouin zone polygons"
<<
std
::
endl
;
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
)
{
...
...
@@ -514,7 +516,7 @@ void BZDlg::CalcBZ()
}
}
PlotAdd
Plane
(
bz_all_triags
);
PlotAdd
Triangles
(
bz_all_triags
);
// brillouin zone description
m_bz
->
setPlainText
(
ostr
.
str
().
c_str
());
...
...
tools/bz/bz.h
View file @
243f05ef
...
...
@@ -138,7 +138,7 @@ protected:
void
ClearPlot
();
void
PlotAddVoronoiVertex
(
const
t_vec
&
pos
);
void
PlotAddBraggPeak
(
const
t_vec
&
pos
);
void
PlotAdd
Plane
(
const
std
::
vector
<
t_vec
>&
vecs
);
void
PlotAdd
Triangles
(
const
std
::
vector
<
t_vec
>&
vecs
);
void
Set3DStatusMsg
(
const
std
::
string
&
msg
);
void
ShowBZPlot
();
...
...
tools/bz/bz_plot.cpp
View file @
243f05ef
...
...
@@ -144,9 +144,9 @@ void BZDlg::PlotAddBraggPeak(const t_vec& pos)
/**
* add
a plane
to the plot
* add
polygons
to the plot
*/
void
BZDlg
::
PlotAdd
Plane
(
const
std
::
vector
<
t_vec
>&
_vecs
)
void
BZDlg
::
PlotAdd
Triangles
(
const
std
::
vector
<
t_vec
>&
_vecs
)
{
if
(
!
m_plot
)
return
;
if
(
_vecs
.
size
()
<
3
)
return
;
...
...
@@ -156,20 +156,33 @@ void BZDlg::PlotAddPlane(const std::vector<t_vec>& _vecs)
vecs
.
reserve
(
_vecs
.
size
());
norms
.
reserve
(
_vecs
.
size
());
t_vec
_norm
=
tl2
::
cross
(
_vecs
[
2
]
-
_vecs
[
0
],
_vecs
[
1
]
-
_vecs
[
0
]);
t_vec3_gl
norm
=
tl2
::
convert
<
t_vec3_gl
>
(
_norm
);
for
(
std
::
size_t
idx
=
0
;
idx
<
_vecs
.
size
()
-
2
;
idx
+=
3
)
{
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
);
t_vec3_gl
norm
=
tl2
::
cross
<
t_vec3_gl
>
(
vec2
-
vec1
,
vec3
-
vec1
);
norm
/=
tl2
::
norm
(
norm
);
t_vec3_gl
mid
=
(
vec1
+
vec2
+
vec3
)
/
3.
;
mid
/=
tl2
::
norm
<
t_vec3_gl
>
(
mid
);
// change sign of norm / sense of veritices?
if
(
tl2
::
inner
<
t_vec3_gl
>
(
norm
,
mid
)
<
0.
)
{
vecs
.
emplace_back
(
std
::
move
(
vec3
));
vecs
.
emplace_back
(
std
::
move
(
vec2
));
vecs
.
emplace_back
(
std
::
move
(
vec1
));
norms
.
push_back
(
-
norm
);
}
else
{
vecs
.
emplace_back
(
std
::
move
(
vec1
));
vecs
.
emplace_back
(
std
::
move
(
vec2
));
vecs
.
emplace_back
(
std
::
move
(
vec3
));
norms
.
push_back
(
norm
);
}
}
auto
obj
=
m_plot
->
GetRenderer
()
->
AddTriangleObject
(
vecs
,
norms
,
r
,
g
,
b
,
1
);
...
...
@@ -270,4 +283,6 @@ void BZDlg::AfterGLInitialisation()
m_labelGlInfos
[
1
]
->
setText
(
QString
(
"GL Shader Version: "
)
+
strGlShaderVer
.
c_str
()
+
QString
(
"."
));
m_labelGlInfos
[
2
]
->
setText
(
QString
(
"GL Vendor: "
)
+
strGlVendor
.
c_str
()
+
QString
(
"."
));
m_labelGlInfos
[
3
]
->
setText
(
QString
(
"GL Device: "
)
+
strGlRenderer
.
c_str
()
+
QString
(
"."
));
CalcBZ
();
}
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