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
e78ad703
Verified
Commit
e78ad703
authored
Jun 02, 2022
by
Tobias WEBER
Browse files
bz tool: added symop properties
parent
7f963ae1
Changes
4
Hide whitespace changes
Inline
Side-by-side
tools/bz/bz.cpp
View file @
e78ad703
...
...
@@ -72,8 +72,11 @@ BZDlg::BZDlg(QWidget* pParent) : QDialog{pParent},
m_symops
->
setAlternatingRowColors
(
true
);
m_symops
->
setColumnCount
(
NUM_COLS
);
m_symops
->
setHorizontalHeaderItem
(
COL_OP
,
new
QTableWidgetItem
{
"Symmetry Operations"
});
m_symops
->
setColumnWidth
(
COL_OP
,
500
);
new
QTableWidgetItem
{
"Symmetry Operation"
});
m_symops
->
setHorizontalHeaderItem
(
COL_PROP
,
new
QTableWidgetItem
{
"Properties"
});
m_symops
->
setColumnWidth
(
COL_OP
,
400
);
m_symops
->
setColumnWidth
(
COL_PROP
,
100
);
QToolButton
*
btnAdd
=
new
QToolButton
(
symopspanel
);
QToolButton
*
btnDel
=
new
QToolButton
(
symopspanel
);
...
...
tools/bz/bz.h
View file @
e78ad703
...
...
@@ -54,6 +54,7 @@
enum
:
int
{
COL_OP
=
0
,
COL_PROP
,
NUM_COLS
};
...
...
@@ -175,6 +176,8 @@ protected:
static
std
::
string
OpToStr
(
const
t_mat
&
rot
);
static
t_mat
StrToOp
(
const
std
::
string
&
str
);
static
std
::
string
GetOpProperties
(
const
t_mat
&
op
);
private:
int
m_iCursorRow
=
-
1
;
...
...
tools/bz/bz_ops.cpp
View file @
e78ad703
...
...
@@ -85,6 +85,28 @@ t_mat BZDlg::StrToOp(const std::string& str)
}
/**
* get the properties of a symmetry operation
*/
std
::
string
BZDlg
::
GetOpProperties
(
const
t_mat
&
op
)
{
std
::
string
prop
;
if
(
tl2
::
is_unit
<
t_mat
>
(
op
,
g_eps
))
{
if
(
prop
.
size
())
prop
+=
", "
;
prop
+=
"identity"
;
}
if
(
tl2
::
hom_is_centring
<
t_mat
>
(
op
,
g_eps
))
{
if
(
prop
.
size
())
prop
+=
", "
;
prop
+=
"centring"
;
}
return
prop
;
}
void
BZDlg
::
AddTabItem
(
int
row
,
const
t_mat
&
op
)
{
bool
bclone
=
0
;
...
...
@@ -114,8 +136,11 @@ void BZDlg::AddTabItem(int row, const t_mat& op)
}
else
{
std
::
string
prop
=
GetOpProperties
(
op
);
m_symops
->
setItem
(
row
,
COL_OP
,
new
QTableWidgetItem
(
OpToStr
(
op
).
c_str
()));
m_symops
->
setItem
(
row
,
COL_PROP
,
new
QTableWidgetItem
(
prop
.
c_str
()));
}
m_symops
->
scrollToItem
(
m_symops
->
item
(
row
,
0
));
...
...
@@ -251,10 +276,8 @@ std::vector<int> BZDlg::GetSelectedRows(bool sort_reversed) const
* selected a new row
*/
void
BZDlg
::
TableCurCellChanged
(
[[
maybe_unused
]]
int
rowNew
,
[[
maybe_unused
]]
int
colNew
,
[[
maybe_unused
]]
int
rowOld
,
[[
maybe_unused
]]
int
colOld
)
[[
maybe_unused
]]
int
rowNew
,
[[
maybe_unused
]]
int
colNew
,
[[
maybe_unused
]]
int
rowOld
,
[[
maybe_unused
]]
int
colOld
)
{
}
...
...
@@ -272,17 +295,15 @@ void BZDlg::TableCellEntered(const QModelIndex&)
*/
void
BZDlg
::
TableItemChanged
(
QTableWidgetItem
*
item
)
{
// update
associated 3d object
if
(
item
)
// update
properties
if
(
item
->
column
()
==
COL_OP
)
{
int
row
=
item
->
row
();
if
(
std
::
size_t
obj
=
m_symops
->
item
(
row
,
COL_OP
)
->
data
(
Qt
::
UserRole
).
toUInt
();
obj
)
{
auto
*
itemOp
=
m_symops
->
item
(
row
,
COL_OP
);
// TODO
}
t_mat
op
=
StrToOp
(
item
->
text
().
toStdString
());
std
::
string
prop
=
GetOpProperties
(
op
);
if
(
QTableWidgetItem
*
itemProp
=
m_symops
->
item
(
item
->
row
(),
COL_PROP
);
itemProp
)
itemProp
->
setText
(
prop
.
c_str
());
else
m_symops
->
setItem
(
item
->
row
(),
COL_PROP
,
new
QTableWidgetItem
(
prop
.
c_str
()));
}
if
(
!
m_ignoreChanges
)
...
...
@@ -368,7 +389,7 @@ std::vector<t_mat> BZDlg::GetSymOps(bool only_centring) const
bool
add_op
=
true
;
if
(
only_centring
)
add_op
=
tl2
::
hom_is_cent
e
ring
<
t_mat
>
(
op
,
g_eps
);
add_op
=
tl2
::
hom_is_centring
<
t_mat
>
(
op
,
g_eps
);
if
(
add_op
)
ops
.
emplace_back
(
std
::
move
(
op
));
...
...
tools/structfact/structfact.cpp
View file @
e78ad703
...
...
@@ -139,7 +139,7 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
std
::
vector
<
t_mat
>
ops_centr
;
for
(
const
t_mat
&
op
:
ops
)
{
if
(
tl2
::
hom_is_cent
e
ring
<
t_mat
>
(
op
,
g_eps
))
if
(
tl2
::
hom_is_centring
<
t_mat
>
(
op
,
g_eps
))
ops_centr
.
push_back
(
op
);
}
m_SGops_centr
.
emplace_back
(
std
::
move
(
ops_centr
));
...
...
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