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
f19a1d38
Verified
Commit
f19a1d38
authored
Jun 01, 2022
by
Tobias WEBER
Browse files
finished with bz cuts
parent
290cd478
Changes
6
Hide whitespace changes
Inline
Side-by-side
tools/bz/bz.cpp
View file @
f19a1d38
...
...
@@ -184,7 +184,9 @@ BZDlg::BZDlg(QWidget* pParent) : QDialog{pParent},
m_bzscene
=
new
BZCutScene
(
cutspanel
);
m_bzview
=
new
BZCutView
(
m_bzscene
);
for
(
QDoubleSpinBox
**
const
cut
:
{
&
m_cutX
,
&
m_cutY
,
&
m_cutZ
,
&
m_cutD
})
for
(
QDoubleSpinBox
**
const
cut
:
{
&
m_cutX
,
&
m_cutY
,
&
m_cutZ
,
&
m_cutNX
,
&
m_cutNY
,
&
m_cutNZ
,
&
m_cutD
})
{
*
cut
=
new
QDoubleSpinBox
(
cutspanel
);
(
*
cut
)
->
setMinimum
(
-
99
);
...
...
@@ -197,15 +199,20 @@ BZDlg::BZDlg(QWidget* pParent) : QDialog{pParent},
(
&
QDoubleSpinBox
::
valueChanged
),
this
,
&
BZDlg
::
CalcBZCut
);
}
m_cutZ
->
setValue
(
1
);
m_cutX
->
setValue
(
1
);
m_cutNZ
->
setValue
(
1
);
pGrid
->
addWidget
(
m_bzview
,
0
,
0
,
1
,
4
);
pGrid
->
addWidget
(
new
QLabel
(
"Plane
Normal
:"
),
1
,
0
,
1
,
1
);
pGrid
->
addWidget
(
new
QLabel
(
"
In-
Plane
Vector
:"
),
1
,
0
,
1
,
1
);
pGrid
->
addWidget
(
m_cutX
,
1
,
1
,
1
,
1
);
pGrid
->
addWidget
(
m_cutY
,
1
,
2
,
1
,
1
);
pGrid
->
addWidget
(
m_cutZ
,
1
,
3
,
1
,
1
);
pGrid
->
addWidget
(
new
QLabel
(
"Plane Offset:"
),
2
,
0
,
1
,
1
);
pGrid
->
addWidget
(
m_cutD
,
2
,
1
,
1
,
1
);
pGrid
->
addWidget
(
new
QLabel
(
"Plane Normal:"
),
2
,
0
,
1
,
1
);
pGrid
->
addWidget
(
m_cutNX
,
2
,
1
,
1
,
1
);
pGrid
->
addWidget
(
m_cutNY
,
2
,
2
,
1
,
1
);
pGrid
->
addWidget
(
m_cutNZ
,
2
,
3
,
1
,
1
);
pGrid
->
addWidget
(
new
QLabel
(
"Plane Offset:"
),
3
,
0
,
1
,
1
);
pGrid
->
addWidget
(
m_cutD
,
3
,
1
,
1
,
1
);
tabs
->
addTab
(
cutspanel
,
"Cut"
);
}
...
...
tools/bz/bz.h
View file @
f19a1d38
...
...
@@ -97,11 +97,15 @@ protected:
QDoubleSpinBox
*
m_cutX
=
nullptr
;
QDoubleSpinBox
*
m_cutY
=
nullptr
;
QDoubleSpinBox
*
m_cutZ
=
nullptr
;
QDoubleSpinBox
*
m_cutNX
=
nullptr
;
QDoubleSpinBox
*
m_cutNY
=
nullptr
;
QDoubleSpinBox
*
m_cutNZ
=
nullptr
;
QDoubleSpinBox
*
m_cutD
=
nullptr
;
// brillouin zone panel
QPlainTextEdit
*
m_bz
=
nullptr
;
QSpinBox
*
m_maxBZ
=
nullptr
;
std
::
vector
<
std
::
vector
<
t_vec
>>
m_bz_polys
;
QMenu
*
m_pTabContextMenu
=
nullptr
;
// menu in case a symop is selected
QMenu
*
m_pTabContextMenuNoItem
=
nullptr
;
// menu if nothing is selected
...
...
@@ -130,8 +134,8 @@ protected:
void
GetSymOpsFromSG
();
std
::
vector
<
t_mat
>
GetSymOps
(
bool
only_centring
=
false
)
const
;
void
CalcB
(
bool
bF
ull
R
ecalc
=
true
);
void
CalcBZ
();
void
CalcB
(
bool
f
ull
_r
ecalc
=
true
);
void
CalcBZ
(
bool
full_recalc
=
true
);
void
CalcBZCut
();
void
ClearPlot
();
...
...
tools/bz/bz_calc.cpp
View file @
f19a1d38
...
...
@@ -44,7 +44,7 @@ using namespace tl2_ops;
/**
* calculate crystal B matrix
*/
void
BZDlg
::
CalcB
(
bool
bF
ull
R
ecalc
)
void
BZDlg
::
CalcB
(
bool
f
ull
_r
ecalc
)
{
if
(
m_ignoreCalc
)
return
;
...
...
@@ -93,7 +93,7 @@ void BZDlg::CalcB(bool bFullRecalc)
m_plot
->
GetRenderer
()
->
SetBTrafo
(
m_crystB
,
&
matA
);
}
if
(
bF
ull
R
ecalc
)
if
(
f
ull
_r
ecalc
)
CalcBZ
();
}
...
...
@@ -101,7 +101,7 @@ void BZDlg::CalcB(bool bFullRecalc)
/**
* calculate brillouin zone
*/
void
BZDlg
::
CalcBZ
()
void
BZDlg
::
CalcBZ
(
bool
full_recalc
)
{
if
(
m_ignoreCalc
)
return
;
...
...
@@ -151,6 +151,7 @@ void BZDlg::CalcBZ()
voronoi
=
tl2
::
remove_duplicates
(
voronoi
,
g_eps
);
ClearPlot
();
m_bz_polys
.
clear
();
#ifdef DEBUG
std
::
ofstream
ofstrSites
(
"sites.dat"
);
...
...
@@ -211,10 +212,14 @@ void BZDlg::CalcBZ()
}
}
m_bz_polys
=
std
::
move
(
bz_triags
);
PlotAddTriangles
(
bz_all_triags
);
// brillouin zone description
m_bz
->
setPlainText
(
ostr
.
str
().
c_str
());
if
(
full_recalc
)
CalcBZCut
();
}
...
...
@@ -223,12 +228,47 @@ void BZDlg::CalcBZ()
*/
void
BZDlg
::
CalcBZCut
()
{
t_real
nx
=
m_cutX
->
value
();
t_real
ny
=
m_cutY
->
value
();
t_real
nz
=
m_cutZ
->
value
();
if
(
m_ignoreCalc
||
!
m_bz_polys
.
size
())
return
;
t_real
x
=
m_cutX
->
value
();
t_real
y
=
m_cutY
->
value
();
t_real
z
=
m_cutZ
->
value
();
t_real
nx
=
m_cutNX
->
value
();
t_real
ny
=
m_cutNY
->
value
();
t_real
nz
=
m_cutNZ
->
value
();
t_real
d
=
m_cutD
->
value
();
// get plane coordinate system
t_vec
vec1
=
tl2
::
create
<
t_vec
>
({
x
,
y
,
z
});
t_vec
norm
=
tl2
::
create
<
t_vec
>
({
nx
,
ny
,
nz
});
norm
/=
tl2
::
norm
<
t_vec
>
(
norm
);
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
);
t_mat
matPlane
=
tl2
::
create
<
t_mat
,
t_vec
>
({
vec1
,
vec2
,
norm
},
true
);
std
::
vector
<
std
::
pair
<
t_vec
,
t_vec
>>
lines
;
for
(
const
auto
&
bz_poly
:
m_bz_polys
)
{
auto
vecs
=
tl2
::
intersect_plane_poly
<
t_vec
>
(
norm
,
d
,
bz_poly
,
g_eps
);
vecs
=
tl2
::
remove_duplicates
(
vecs
,
g_eps
);
if
(
vecs
.
size
()
>=
2
)
{
t_vec
pt1
=
matPlane
*
vecs
[
0
];
t_vec
pt2
=
matPlane
*
vecs
[
1
];
lines
.
emplace_back
(
std
::
make_pair
(
pt1
,
pt2
));
}
}
m_bzscene
->
clear
();
m_bzscene
->
AddCut
(
lines
);
PlotSetPlane
(
norm
,
d
);
}
tools/bz/bz_plot.cpp
View file @
f19a1d38
...
...
@@ -360,5 +360,5 @@ void BZDlg::AfterGLInitialisation()
m_labelGlInfos
[
2
]
->
setText
(
QString
(
"GL Vendor: "
)
+
strGlVendor
.
c_str
()
+
QString
(
"."
));
m_labelGlInfos
[
3
]
->
setText
(
QString
(
"GL Device: "
)
+
strGlRenderer
.
c_str
()
+
QString
(
"."
));
CalcB
Z
();
CalcB
(
true
);
}
tools/bz/plot_cut.cpp
View file @
f19a1d38
...
...
@@ -31,13 +31,23 @@
// --------------------------------------------------------------------------------
BZCutScene
::
BZCutScene
(
QWidget
*
parent
)
:
QGraphicsScene
(
parent
)
{
//addLine(QLineF(0,0, 10,10));
}
BZCutScene
::~
BZCutScene
()
{
}
void
BZCutScene
::
AddCut
(
const
std
::
vector
<
std
::
pair
<
t_vec
,
t_vec
>>&
lines
)
{
for
(
const
auto
&
line
:
lines
)
{
addLine
(
QLineF
(
line
.
first
[
0
]
*
m_scale
,
line
.
first
[
1
]
*
m_scale
,
line
.
second
[
0
]
*
m_scale
,
line
.
second
[
1
]
*
m_scale
));
}
}
// --------------------------------------------------------------------------------
...
...
tools/bz/plot_cut.h
View file @
f19a1d38
...
...
@@ -42,8 +42,11 @@ public:
BZCutScene
(
QWidget
*
parent
=
nullptr
);
virtual
~
BZCutScene
();
void
AddCut
(
const
std
::
vector
<
std
::
pair
<
t_vec
,
t_vec
>>&
lines
);
protected:
t_real
m_scale
=
100.
;
};
...
...
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