Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
Takin
mag-core
Commits
266ae76c
Verified
Commit
266ae76c
authored
Jun 20, 2022
by
Tobias WEBER
Browse files
bz tool: added cutting plane properties
parent
50b23590
Changes
2
Hide whitespace changes
Inline
Side-by-side
tools/bz/bz.cpp
View file @
266ae76c
...
...
@@ -220,15 +220,15 @@ BZDlg::BZDlg(QWidget* pParent) : QDialog{pParent},
// cuts
grid
->
addWidget
(
m_bzview
,
0
,
0
,
1
,
4
);
grid
->
addWidget
(
new
QLabel
(
"In-Plane Vector:"
),
1
,
0
,
1
,
1
);
grid
->
addWidget
(
new
QLabel
(
"In-Plane Vector
[rlu]
:"
),
1
,
0
,
1
,
1
);
grid
->
addWidget
(
m_cutX
,
1
,
1
,
1
,
1
);
grid
->
addWidget
(
m_cutY
,
1
,
2
,
1
,
1
);
grid
->
addWidget
(
m_cutZ
,
1
,
3
,
1
,
1
);
grid
->
addWidget
(
new
QLabel
(
"Plane Normal:"
),
2
,
0
,
1
,
1
);
grid
->
addWidget
(
new
QLabel
(
"Plane Normal
[rlu]
:"
),
2
,
0
,
1
,
1
);
grid
->
addWidget
(
m_cutNX
,
2
,
1
,
1
,
1
);
grid
->
addWidget
(
m_cutNY
,
2
,
2
,
1
,
1
);
grid
->
addWidget
(
m_cutNZ
,
2
,
3
,
1
,
1
);
grid
->
addWidget
(
new
QLabel
(
"Plane Offset:"
),
3
,
0
,
1
,
1
);
grid
->
addWidget
(
new
QLabel
(
"Plane Offset
[rlu]
:"
),
3
,
0
,
1
,
1
);
grid
->
addWidget
(
m_cutD
,
3
,
1
,
1
,
1
);
grid
->
addWidget
(
new
QLabel
(
"Draw Order:"
),
3
,
2
,
1
,
1
);
grid
->
addWidget
(
m_BZDrawOrder
,
3
,
3
,
1
,
1
);
...
...
tools/bz/bz_calc.cpp
View file @
266ae76c
...
...
@@ -245,19 +245,29 @@ void BZDlg::CalcBZCut()
bool
calc_bzcut_hull
=
m_acCutHull
->
isChecked
();
// get plane coordinate system
t_vec
vec1
=
m_crystB
*
tl2
::
create
<
t_vec
>
({
x
,
y
,
z
});
t_vec
norm
=
tl2
::
create
<
t_vec
>
({
nx
,
ny
,
nz
});
norm
=
m_crystB
*
norm
/
tl2
::
norm
<
t_vec
>
(
norm
);
m_cut_norm_scale
=
tl2
::
norm
<
t_vec
>
(
norm
);
norm
/=
m_cut_norm_scale
;
t_real
d_invA
=
d_rlu
*
m_cut_norm_scale
;
t_vec
vec2
=
tl2
::
cross
<
t_vec
>
(
norm
,
vec1
);
vec1
=
tl2
::
cross
<
t_vec
>
(
vec2
,
norm
);
vec1
/=
tl2
::
norm
<
t_vec
>
(
vec1
);
vec2
/=
tl2
::
norm
<
t_vec
>
(
vec2
);
m_cut_plane
=
tl2
::
create
<
t_mat
,
t_vec
>
({
vec1
,
vec2
,
norm
},
false
);
t_vec
vec1_rlu
=
tl2
::
create
<
t_vec
>
({
x
,
y
,
z
});
t_vec
norm_rlu
=
tl2
::
create
<
t_vec
>
({
nx
,
ny
,
nz
});
vec1_rlu
/=
tl2
::
norm
<
t_vec
>
(
vec1_rlu
);
norm_rlu
/=
tl2
::
norm
<
t_vec
>
(
norm_rlu
);
t_vec
vec1_invA
=
m_crystB
*
vec1_rlu
;
t_vec
norm_invA
=
m_crystB
*
norm_rlu
;
m_cut_norm_scale
=
tl2
::
norm
<
t_vec
>
(
norm_invA
);
norm_invA
/=
m_cut_norm_scale
;
t_real
d_invA
=
d_rlu
*
m_cut_norm_scale
;
t_vec
vec2_invA
=
tl2
::
cross
<
t_vec
>
(
norm_invA
,
vec1_invA
);
vec1_invA
=
tl2
::
cross
<
t_vec
>
(
vec2_invA
,
norm_invA
);
vec1_invA
/=
tl2
::
norm
<
t_vec
>
(
vec1_invA
);
vec2_invA
/=
tl2
::
norm
<
t_vec
>
(
vec2_invA
);
t_mat
B_inv
=
m_crystA
/
(
t_real
(
2
)
*
tl2
::
pi
<
t_real
>
);
t_vec
vec2_rlu
=
B_inv
*
vec2_invA
;
vec2_rlu
/=
tl2
::
norm
<
t_vec
>
(
vec2_rlu
);
m_cut_plane
=
tl2
::
create
<
t_mat
,
t_vec
>
({
vec1_invA
,
vec2_invA
,
norm_invA
},
false
);
m_cut_plane_inv
=
tl2
::
trans
<
t_mat
>
(
m_cut_plane
);
// [x, y, Q]
...
...
@@ -294,7 +304,7 @@ void BZDlg::CalcBZCut()
vec
+=
Q_invA
;
auto
vecs
=
tl2
::
intersect_plane_poly
<
t_vec
>
(
norm
,
d_invA
,
bz_poly
,
g_eps
);
norm
_invA
,
d_invA
,
bz_poly
,
g_eps
);
vecs
=
tl2
::
remove_duplicates
(
vecs
,
g_eps
);
// calculate the hull of the bz cut
...
...
@@ -400,6 +410,26 @@ void BZDlg::CalcBZCut()
m_bzscene
->
AddCut
(
cut_lines
);
// get description of the cut plane
tl2
::
set_eps_0
(
norm_invA
,
g_eps
);
tl2
::
set_eps_0
(
norm_rlu
,
g_eps
);
tl2
::
set_eps_0
(
vec1_invA
,
g_eps
);
tl2
::
set_eps_0
(
vec1_rlu
,
g_eps
);
tl2
::
set_eps_0
(
vec2_invA
,
g_eps
);
tl2
::
set_eps_0
(
vec2_rlu
,
g_eps
);
ostr
<<
"# Cutting plane"
;
ostr
<<
"
\n
in relative lattice units:"
;
ostr
<<
"
\n\t
normal: "
<<
norm_rlu
<<
" rlu"
;
ostr
<<
"
\n\t
in-plane vector 1: "
<<
vec1_rlu
<<
" rlu"
;
ostr
<<
"
\n\t
in-plane vector 2: "
<<
vec2_rlu
<<
" rlu"
;
ostr
<<
"
\n\t
plane offset: "
<<
d_rlu
<<
" rlu"
;
ostr
<<
"
\n
in lab units:"
;
ostr
<<
"
\n\t
normal: "
<<
norm_invA
<<
" Å⁻¹"
;
ostr
<<
"
\n\t
in-plane vector 1: "
<<
vec1_invA
<<
" Å⁻¹"
;
ostr
<<
"
\n\t
in-plane vector 2: "
<<
vec2_invA
<<
" Å⁻¹"
;
ostr
<<
"
\n\t
plane offset: "
<<
d_invA
<<
" Å⁻¹"
;
ostr
<<
"
\n
"
<<
std
::
endl
;
// get description of bz cut
ostr
<<
"# Brillouin zone cut"
<<
std
::
endl
;
for
(
std
::
size_t
i
=
0
;
i
<
cut_lines000
.
size
();
++
i
)
...
...
@@ -413,7 +443,7 @@ void BZDlg::CalcBZCut()
// update calculation results
PlotSetPlane
(
norm
,
d_invA
);
PlotSetPlane
(
norm
_invA
,
d_invA
);
UpdateBZDescription
();
CalcFormulas
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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