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
a38f31ce
Unverified
Commit
a38f31ce
authored
Apr 14, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix closest_symmetry_copy
parent
d25cbeb1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
50 deletions
+30
-50
include/cif++/matrix.hpp
+1
-1
src/symmetry.cpp
+4
-1
test/unit-3d-test.cpp
+25
-48
No files found.
include/cif++/matrix.hpp
View file @
a38f31ce
...
...
@@ -626,7 +626,7 @@ class matrix_cofactors : public matrix_expression<matrix_cofactors<M>>
m_m
(
ix
[
0
],
iy
[
1
])
*
m_m
(
ix
[
1
],
iy
[
0
])
*
m_m
(
ix
[
2
],
iy
[
2
])
-
m_m
(
ix
[
0
],
iy
[
0
])
*
m_m
(
ix
[
1
],
iy
[
2
])
*
m_m
(
ix
[
2
],
iy
[
1
]);
return
i
+
j
%
2
==
1
?
-
result
:
result
;
return
(
i
+
j
)
%
2
==
1
?
-
result
:
result
;
}
private
:
...
...
src/symmetry.cpp
View file @
a38f31ce
...
...
@@ -464,7 +464,10 @@ std::tuple<float,point,sym_op> closest_symmetry_copy(const spacegroup &sg, const
}
}
return
{
std
::
sqrt
(
result_d
),
result_p
,
result_s
};
transformation
tlo
(
identity_matrix
<
float
>
(
3
),
o
);
auto
itlo
=
cif
::
inverse
(
tlo
);
return
{
std
::
sqrt
(
result_d
),
itlo
(
result_p
),
result_s
};
}
}
// namespace cif
test/unit-3d-test.cpp
View file @
a38f31ce
...
...
@@ -361,6 +361,31 @@ BOOST_AUTO_TEST_CASE(symm_2bi3_1, *utf::tolerance(0.1f))
}
}
BOOST_AUTO_TEST_CASE
(
symm_3bwh_1
,
*
utf
::
tolerance
(
0.1
f
))
{
cif
::
file
f
(
gTestDir
/
"3bwh.cif.gz"
);
auto
&
db
=
f
.
front
();
cif
::
spacegroup
sg
(
db
);
cif
::
cell
c
(
db
);
cif
::
mm
::
structure
s
(
db
);
for
(
auto
a1
:
s
.
atoms
())
{
for
(
auto
a2
:
s
.
atoms
())
{
if
(
a1
==
a2
)
continue
;
const
auto
&
[
d
,
p
,
so
]
=
cif
::
closest_symmetry_copy
(
sg
,
c
,
a1
.
get_location
(),
a2
.
get_location
());
BOOST_TEST
(
d
==
distance
(
a1
.
get_location
(),
p
));
}
}
}
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE
(
eigen_1
,
*
utf
::
tolerance
(
0.1
f
))
...
...
@@ -387,51 +412,4 @@ BOOST_AUTO_TEST_CASE(eigen_1, *utf::tolerance(0.1f))
BOOST_TEST
(
ev
[
1
]
==
1.4780548447781369
f
);
BOOST_TEST
(
ev
[
2
]
==
37.1014913651276582
f
);
BOOST_TEST
(
ev
[
3
]
==
2585.25381092892231
f
);
// === Example ===
// Let
// <math>
// S = \begin{pmatrix} 4 & -30 & 60 & -35 \\ -30 & 300 & -675 & 420 \\ 60 & -675 & 1620 & -1050 \\ -35 & 420 & -1050 & 700 \end{pmatrix}
// </math>
// Then ''jacobi'' produces the following eigenvalues and eigenvectors after 3 sweeps (19 iterations) :
// <math>
// e_1 = 2585.25381092892231
// </math>
// <math>
// E_1 = \begin{pmatrix}0.0291933231647860588\\ -0.328712055763188997\\ 0.791411145833126331\\ -0.514552749997152907\end{pmatrix}
// </math>
// <math>
// e_2 = 37.1014913651276582
// </math>
// <math>
// E_2 = \begin{pmatrix}-0.179186290535454826\\ 0.741917790628453435\\ -0.100228136947192199\\ -0.638282528193614892\end{pmatrix}
// </math>
// <math>
// e_3 = 1.4780548447781369
// </math>
// <math>
// E_3 = \begin{pmatrix}-0.582075699497237650\\ 0.370502185067093058\\ 0.509578634501799626\\ 0.514048272222164294\end{pmatrix}
// </math>
// <math>
// e_4 = 0.1666428611718905
// </math>
// <math>
// E_4 = \begin{pmatrix}0.792608291163763585\\ 0.451923120901599794\\ 0.322416398581824992\\ 0.252161169688241933\end{pmatrix}
// </math>
}
\ No newline at end of file
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