Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
c0dd41ce
Commit
c0dd41ce
authored
Apr 13, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added inverse symmetry operation
parent
4cff92bb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
include/cif++/symmetry.hpp
+2
-0
src/symmetry.cpp
+33
-2
No files found.
include/cif++/symmetry.hpp
View file @
c0dd41ce
...
...
@@ -314,6 +314,8 @@ class spacegroup : public std::vector<transformation>
point
operator
()(
const
point
&
pt
,
const
cell
&
c
,
sym_op
symop
)
const
;
point
inverse
(
const
point
&
pt
,
const
cell
&
c
,
sym_op
symop
)
const
;
private
:
int
m_nr
;
size_t
m_index
;
...
...
src/symmetry.cpp
View file @
c0dd41ce
...
...
@@ -111,7 +111,7 @@ std::string sym_op::string() const
*
r
.
ptr
++
=
'0'
+
m_tc
;
*
r
.
ptr
=
0
;
return
{
b
,
r
.
ptr
-
b
};
return
{
b
,
static_cast
<
size_t
>
(
r
.
ptr
-
b
)
};
}
// --------------------------------------------------------------------
...
...
@@ -232,7 +232,31 @@ point spacegroup::operator()(const point &pt, const cell &c, sym_op symop) const
auto
o
=
offsetToOrigin
(
c
,
pt
);
transformation
tlo
(
identity_matrix
<
float
>
(
3
),
o
);
auto
itlo
=
inverse
(
tlo
);
auto
itlo
=
cif
::
inverse
(
tlo
);
point
result
=
pt
+
o
;
result
=
t_orth
(
result
);
result
=
itlo
(
result
);
return
result
;
}
point
spacegroup
::
inverse
(
const
point
&
pt
,
const
cell
&
c
,
sym_op
symop
)
const
{
if
(
symop
.
m_nr
<
1
or
symop
.
m_nr
>
size
())
throw
std
::
out_of_range
(
"symmetry operator number out of range"
);
transformation
t
=
at
(
symop
.
m_nr
-
1
);
t
.
m_translation
.
m_x
+=
symop
.
m_ta
-
5
;
t
.
m_translation
.
m_y
+=
symop
.
m_tb
-
5
;
t
.
m_translation
.
m_z
+=
symop
.
m_tc
-
5
;
auto
t_orth
=
cif
::
inverse
(
orthogonal
(
t
,
c
));
auto
o
=
offsetToOrigin
(
c
,
pt
);
transformation
tlo
(
identity_matrix
<
float
>
(
3
),
o
);
auto
itlo
=
cif
::
inverse
(
tlo
);
point
result
=
pt
+
o
;
result
=
t_orth
(
result
);
...
...
@@ -379,6 +403,13 @@ std::tuple<float,point,sym_op> closest_symmetry_copy(const spacegroup &sg, const
float
result_d
=
std
::
numeric_limits
<
float
>::
max
();
sym_op
result_s
;
auto
o
=
offsetToOrigin
(
c
,
a
);
transformation
tlo
(
identity_matrix
<
float
>
(
3
),
o
);
auto
itlo
=
cif
::
inverse
(
tlo
);
a
+=
o
;
b
+=
o
;
auto
fa
=
fractional
(
a
,
c
);
auto
fb
=
fractional
(
b
,
c
);
...
...
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