Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
d6491c83
Commit
d6491c83
authored
12 years ago
by
Gabriel Studer
Browse files
Options
Downloads
Patches
Plain Diff
unit tests for iterative superposition
parent
446fa417
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/mol/alg/tests/test_superposition.cc
+44
-41
44 additions, 41 deletions
modules/mol/alg/tests/test_superposition.cc
with
44 additions
and
41 deletions
modules/mol/alg/tests/test_superposition.cc
+
44
−
41
View file @
d6491c83
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include
<boost/test/unit_test.hpp>
#include
<boost/test/unit_test.hpp>
#include
<boost/test/auto_unit_test.hpp>
#include
<boost/test/auto_unit_test.hpp>
#include
<ost/mol/mol.hh>
#include
<ost/mol/mol.hh>
#include
<ost/mol/builder.hh>
using
namespace
ost
;
using
namespace
ost
;
using
namespace
ost
::
mol
;
using
namespace
ost
::
mol
;
...
@@ -33,48 +34,20 @@ using namespace ost::mol::alg;
...
@@ -33,48 +34,20 @@ using namespace ost::mol::alg;
struct
Fixture
{
struct
Fixture
{
Fixture
()
{
Fixture
()
{
e
=
CreateEntity
();
e
=
Builder
()
XCSEditor
ed
=
e
.
EditXCS
();
.
Chain
(
"A"
)
c
=
ed
.
InsertChain
(
"A"
);
.
Residue
(
"DUM"
)
r
=
ed
.
AppendResidue
(
c
,
"XXX"
);
.
Atom
(
"A"
,
geom
::
Vec3
(
-
5
,
-
5
,
-
5
))
ab
=
ed
.
InsertAtom
(
r
,
"A"
,
geom
::
Vec3
(
-
5
,
-
5
,
-
5
),
"C"
);
.
Atom
(
"B"
,
geom
::
Vec3
(
-
5
,
5
,
-
5
))
ac
=
ed
.
InsertAtom
(
r
,
"B"
,
geom
::
Vec3
(
-
5
,
5
,
-
5
),
"C"
);
.
Atom
(
"C"
,
geom
::
Vec3
(
-
5
,
5
,
5
))
ad
=
ed
.
InsertAtom
(
r
,
"C"
,
geom
::
Vec3
(
-
5
,
5
,
5
),
"C"
);
.
Atom
(
"D"
,
geom
::
Vec3
(
-
5
,
-
5
,
5
))
ae
=
ed
.
InsertAtom
(
r
,
"D"
,
geom
::
Vec3
(
-
5
,
-
5
,
5
),
"C"
);
.
Atom
(
"E"
,
geom
::
Vec3
(
5
,
-
5
,
5
))
af
=
ed
.
InsertAtom
(
r
,
"E"
,
geom
::
Vec3
(
5
,
-
5
,
5
),
"C"
);
.
Atom
(
"F"
,
geom
::
Vec3
(
5
,
-
5
,
-
5
))
ag
=
ed
.
InsertAtom
(
r
,
"F"
,
geom
::
Vec3
(
5
,
-
5
,
-
5
),
"C"
);
.
Atom
(
"G"
,
geom
::
Vec3
(
5
,
5
,
-
5
))
ah
=
ed
.
InsertAtom
(
r
,
"G"
,
geom
::
Vec3
(
5
,
5
,
-
5
),
"C"
);
.
Atom
(
"H"
,
geom
::
Vec3
(
5
,
5
,
5
));
ai
=
ed
.
InsertAtom
(
r
,
"H"
,
geom
::
Vec3
(
5
,
5
,
5
),
"C"
);
BondHandle
b1
=
ed
.
Connect
(
ab
,
ad
);
BondHandle
b2
=
ed
.
Connect
(
ad
,
ah
);
BondHandle
b3
=
ed
.
Connect
(
ah
,
ae
);
BondHandle
b4
=
ed
.
Connect
(
ae
,
ab
);
BondHandle
b5
=
ed
.
Connect
(
ac
,
ag
);
BondHandle
b6
=
ed
.
Connect
(
ag
,
ai
);
BondHandle
b7
=
ed
.
Connect
(
ai
,
af
);
BondHandle
b8
=
ed
.
Connect
(
af
,
ac
);
BondHandle
b9
=
ed
.
Connect
(
ab
,
ac
);
BondHandle
b10
=
ed
.
Connect
(
ah
,
ai
);
BondHandle
b11
=
ed
.
Connect
(
ae
,
ag
);
BondHandle
b12
=
ed
.
Connect
(
ad
,
af
);
}
}
EntityHandle
e
;
EntityHandle
e
;
ChainHandle
c
;
ResidueHandle
r
;
AtomHandle
ab
;
AtomHandle
ac
;
AtomHandle
ad
;
AtomHandle
ae
;
AtomHandle
af
;
AtomHandle
ag
;
AtomHandle
ah
;
AtomHandle
ai
;
};
};
...
@@ -86,7 +59,6 @@ BOOST_AUTO_TEST_CASE(superposition_svd)
...
@@ -86,7 +59,6 @@ BOOST_AUTO_TEST_CASE(superposition_svd)
EntityView
ev1
=
f1
.
e
.
CreateFullView
();
EntityView
ev1
=
f1
.
e
.
CreateFullView
();
XCSEditor
ed
=
f1
.
e
.
EditXCS
();
XCSEditor
ed
=
f1
.
e
.
EditXCS
();
EntityView
ev2
=
f2
.
e
.
CreateFullView
();
EntityView
ev2
=
f2
.
e
.
CreateFullView
();
ChainHandle
ch1
=
f1
.
e
.
GetChainList
()[
0
];
AtomHandleList
atoms
=
f1
.
e
.
GetAtomList
();
AtomHandleList
atoms
=
f1
.
e
.
GetAtomList
();
for
(
AtomHandleList
::
const_iterator
i
=
atoms
.
begin
(),
e
=
atoms
.
end
();
i
!=
e
;
++
i
)
{
for
(
AtomHandleList
::
const_iterator
i
=
atoms
.
begin
(),
e
=
atoms
.
end
();
i
!=
e
;
++
i
)
{
AtomHandle
atom
=*
i
;
AtomHandle
atom
=*
i
;
...
@@ -95,7 +67,38 @@ BOOST_AUTO_TEST_CASE(superposition_svd)
...
@@ -95,7 +67,38 @@ BOOST_AUTO_TEST_CASE(superposition_svd)
}
}
SuperpositionResult
res
;
SuperpositionResult
res
;
res
=
SuperposeSVD
(
ev1
,
ev2
,
true
);
res
=
SuperposeSVD
(
ev1
,
ev2
,
true
);
BOOST_CHECK
(
abs
(
res
.
rmsd
)
<
0.0001
);
BOOST_CHECK
(
res
.
rmsd
<
0.0001
);
}
}
BOOST_AUTO_TEST_CASE
(
iterative_superposition_svd
)
{
Fixture
f1
,
f2
;
EntityView
ev1
=
f1
.
e
.
CreateFullView
();
EntityView
ev2
=
f2
.
e
.
CreateFullView
();
XCSEditor
ed
=
f1
.
e
.
EditXCS
();
AtomHandleList
atoms
=
f1
.
e
.
GetAtomList
();
ed
.
SetAtomPos
(
atoms
[
0
],
geom
::
Vec3
(
-
10
,
-
10
,
-
10
));
for
(
AtomHandleList
::
const_iterator
i
=
atoms
.
begin
(),
e
=
atoms
.
end
();
i
!=
e
;
++
i
)
{
AtomHandle
atom
=*
i
;
ed
.
SetAtomPos
(
atom
,
geom
::
EulerTransformation
(
0.1
,
0
,
0
)
*
atom
.
GetPos
()
+
geom
::
Vec3
(
0
,
5
,
0
));
}
SuperpositionResult
res_classic
,
res_1
,
res_2
,
res_3
;
res_1
=
IterativeSuperposeSVD
(
ev1
,
ev2
,
1
,
5.0
,
false
);
res_2
=
IterativeSuperposeSVD
(
ev1
,
ev2
,
2
,
5.0
,
false
);
res_3
=
IterativeSuperposeSVD
(
ev1
,
ev2
,
10
,
5.0
,
false
);
res_classic
=
SuperposeSVD
(
ev1
,
ev2
,
false
);
BOOST_CHECK
(
res_2
.
rmsd_superposed_atoms
<
0.0001
);
BOOST_CHECK
(
res_2
.
rmsd
>
1.0
);
BOOST_CHECK
(
res_1
.
rmsd
==
res_classic
.
rmsd
);
BOOST_CHECK
(
res_1
.
ncycles
==
1
);
BOOST_CHECK
(
res_2
.
ncycles
==
2
);
BOOST_CHECK
(
res_1
.
fraction_superposed
==
1.0
);
BOOST_CHECK
(
res_2
.
fraction_superposed
==
7.0
/
8.0
);
BOOST_CHECK
(
res_3
.
ncycles
==
3
);
}
BOOST_AUTO_TEST_SUITE_END
();
BOOST_AUTO_TEST_SUITE_END
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment