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
18f1d07e
Unverified
Commit
18f1d07e
authored
Nov 12, 2021
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up code
parent
b5969761
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
54 deletions
+5
-54
src/Point.cpp
+0
-41
test/unit-test.cpp
+5
-13
No files found.
src/Point.cpp
View file @
18f1d07e
...
...
@@ -162,13 +162,6 @@ class Matrix : public MatrixBase<T>
return
m_data
[
i
*
m_n
+
j
];
}
template
<
typename
Func
>
void
each
(
Func
f
)
{
for
(
uint32_t
i
=
0
;
i
<
m_m
*
m_n
;
++
i
)
f
(
m_data
[
i
]);
}
template
<
typename
U
>
Matrix
&
operator
/=
(
U
v
)
{
...
...
@@ -219,18 +212,6 @@ class SymmetricMatrix : public MatrixBase<T>
T
operator
()(
uint32_t
i
,
uint32_t
j
)
const
;
virtual
T
&
operator
()(
uint32_t
i
,
uint32_t
j
);
// erase two rows, add one at the end (for neighbour joining)
void
erase_2
(
uint32_t
i
,
uint32_t
j
);
template
<
typename
Func
>
void
each
(
Func
f
)
{
uint32_t
N
=
(
m_n
*
(
m_n
+
1
))
/
2
;
for
(
uint32_t
i
=
0
;
i
<
N
;
++
i
)
f
(
m_data
[
i
]);
}
template
<
typename
U
>
SymmetricMatrix
&
operator
/=
(
U
v
)
{
...
...
@@ -266,28 +247,6 @@ inline T &SymmetricMatrix<T>::operator()(uint32_t i, uint32_t j)
}
template
<
typename
T
>
void
SymmetricMatrix
<
T
>::
erase_2
(
uint32_t
di
,
uint32_t
dj
)
{
uint32_t
s
=
0
,
d
=
0
;
for
(
uint32_t
i
=
0
;
i
<
m_n
;
++
i
)
{
for
(
uint32_t
j
=
0
;
j
<
i
;
++
j
)
{
if
(
i
!=
di
and
j
!=
dj
and
i
!=
dj
and
j
!=
di
)
{
if
(
s
!=
d
)
m_data
[
d
]
=
m_data
[
s
];
++
d
;
}
++
s
;
}
}
--
m_n
;
}
template
<
typename
T
>
class
IdentityMatrix
:
public
MatrixBase
<
T
>
{
public
:
...
...
test/unit-test.cpp
View file @
18f1d07e
...
...
@@ -35,6 +35,9 @@
#include "cif++/BondMap.hpp"
#include "cif++/CifValidator.hpp"
namespace
tt
=
boost
::
test_tools
;
std
::
filesystem
::
path
gTestDir
=
std
::
filesystem
::
current_path
();
// filled in first test
// --------------------------------------------------------------------
...
...
@@ -1718,8 +1721,7 @@ BOOST_AUTO_TEST_CASE(t1)
Quaternion
q
{
0.5
,
0.5
,
0.5
,
0.5
};
q
=
Normalize
(
q
);
// std::cout << "q: " << q << std::endl;
const
auto
&&
[
angle0
,
axis0
]
=
QuaternionToAngleAxis
(
q
);
std
::
vector
<
Point
>
p1
{
{
16.979
,
13.301
,
44.555
},
...
...
@@ -1735,26 +1737,16 @@ BOOST_AUTO_TEST_CASE(t1)
Point
c1
=
CenterPoints
(
p1
);
std
::
cout
<<
c1
<<
std
::
endl
;
for
(
auto
&
p
:
p2
)
p
.
rotate
(
q
);
Point
c2
=
CenterPoints
(
p2
);
// std::cout << c2 << std::endl;
// std::cout << "rmsd: " << RMSd(p1, p2) << std::endl;
auto
q2
=
AlignPoints
(
p1
,
p2
);
// std::cout << "q2: " << q2 << std::endl;
const
auto
&&
[
angle
,
axis
]
=
QuaternionToAngleAxis
(
q2
);
// std::cout << "rotated " << angle << " " << std::endl
;
BOOST_TEST
(
std
::
fmod
(
360
+
angle
,
360
)
==
std
::
fmod
(
360
-
angle0
,
360
),
tt
::
tolerance
(
0.01
))
;
for
(
auto
&
p
:
p1
)
p
.
rotate
(
q2
);
...
...
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