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
a978edb0
Commit
a978edb0
authored
13 years ago
by
Marco Biasini
Browse files
Options
Downloads
Patches
Plain Diff
sort before superposing
parent
88c1c0a9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/io/src/mol/dcd_io.cc
+6
-4
6 additions, 4 deletions
modules/io/src/mol/dcd_io.cc
modules/mol/alg/src/superpose_frames.cc
+14
-3
14 additions, 3 deletions
modules/mol/alg/src/superpose_frames.cc
with
20 additions
and
7 deletions
modules/io/src/mol/dcd_io.cc
+
6
−
4
View file @
a978edb0
...
...
@@ -144,14 +144,16 @@ size_t calc_frame_size(bool skip_flag, bool gap_flag, size_t num_atoms)
bool
read_frame
(
std
::
istream
&
istream
,
const
DCDHeader
&
header
,
size_t
frame_size
,
bool
skip_flag
,
bool
gap_flag
,
bool
swap_flag
,
std
::
vector
<
float
>&
xlist
,
std
::
vector
<
geom
::
Vec3
>&
frame
)
std
::
vector
<
geom
::
Vec3
>&
frame
,
uint
frame_num
)
{
char
dummy
[
4
];
if
(
skip_flag
)
istream
.
seekg
(
14
*
4
,
std
::
ios_base
::
cur
);
// read each frame
if
(
!
istream
)
{
/* premature EOF */
LOG_ERROR
(
"LoadCHARMMTraj: premature end of file, frames read"
);
LOG_ERROR
(
"LoadCHARMMTraj: premature end of file while trying to read frame "
<<
frame_num
);
return
false
;
}
// x coord
...
...
@@ -217,7 +219,7 @@ mol::CoordGroupHandle load_dcd(const mol::AtomHandleList& alist, // this atom li
int
i
=
0
;
for
(;
i
<
header
.
num
;
i
+=
stride
)
{
if
(
!
read_frame
(
istream
,
header
,
frame_size
,
skip_flag
,
gap_flag
,
swap_flag
,
xlist
,
clist
))
{
swap_flag
,
xlist
,
clist
,
i
))
{
break
;
}
cg
.
AddFrame
(
clist
);
...
...
@@ -296,7 +298,7 @@ void DCDCoordSource::FetchFrame(uint frame)
stream_
.
seekg
(
pos
,
std
::
ios_base
::
beg
);
std
::
vector
<
float
>
xlist
(
header_
.
t_atom_count
);
if
(
!
read_frame
(
stream_
,
header_
,
frame_size
,
skip_flag_
,
gap_flag_
,
swap_flag_
,
xlist
,
*
frame_
.
get
()))
{
swap_flag_
,
xlist
,
*
frame_
.
get
()
,
frame
))
{
}
}
...
...
This diff is collapsed.
Click to expand it.
modules/mol/alg/src/superpose_frames.cc
+
14
−
3
View file @
a978edb0
...
...
@@ -26,6 +26,13 @@
namespace
ost
{
namespace
mol
{
namespace
alg
{
namespace
{
bool
less_index
(
const
mol
::
AtomHandle
&
a1
,
const
mol
::
AtomHandle
&
a2
)
{
return
a1
.
GetIndex
()
<
a2
.
GetIndex
();
}
}
typedef
Eigen
::
Matrix
<
Real
,
3
,
3
>
EMat3
;
typedef
Eigen
::
Matrix
<
Real
,
1
,
3
>
ECVec3
;
...
...
@@ -76,7 +83,7 @@ inline EMatX3 col_sub(const EMatX3& m, const ECVec3& s)
}
void
AddSuperposedFrame
(
CoordGroupHandle
&
superposed
,
EMatX3
&
ref_mat
,
EMatX3
&
ref_centered
,
ECVec3
&
ref_center
,
CoordFramePtr
frame
,
std
::
vector
<
unsigned
long
>&
indices
)
void
AddSuperposedFrame
(
CoordGroupHandle
&
superposed
,
EMatX3
&
ref_mat
,
EMatX3
&
ref_centered
,
ECVec3
&
ref_center
,
CoordFramePtr
frame
,
std
::
vector
<
unsigned
long
>&
indices
)
{
// This function superposes and then adds a CoordFrame (frame) to a CoordGroup (superposed).
// ref_mat, ref_centered and ref_center contain respectively the positions, centered positions and
...
...
@@ -144,7 +151,9 @@ CoordGroupHandle SuperposeFrames(CoordGroupHandle& cg, EntityView& sel,
indices
.
push_back
(
i
->
GetIndex
());
}
}
CoordGroupHandle
superposed
=
CreateCoordGroup
(
cg
.
GetEntity
().
GetAtomList
());
mol
::
AtomHandleList
alist
(
cg
.
GetEntity
().
GetAtomList
());
std
::
sort
(
alist
.
begin
(),
alist
.
end
(),
less_index
);
CoordGroupHandle
superposed
=
CreateCoordGroup
(
alist
);
EMatX3
ref_mat
=
EMatX3
::
Zero
(
indices
.
size
(),
3
);
EMatX3
ref_centered
=
EMatX3
::
Zero
(
indices
.
size
(),
3
);
ECVec3
ref_center
;
...
...
@@ -208,7 +217,9 @@ CoordGroupHandle SuperposeFrames(CoordGroupHandle& cg, EntityView& sel,
if
(
int
(
indices
.
size
())
!=
ref_view
.
GetAtomCount
()){
throw
std
::
runtime_error
(
"atom counts of the two views are not equal"
);
}
CoordGroupHandle
superposed
=
CreateCoordGroup
(
cg
.
GetEntity
().
GetAtomList
());
mol
::
AtomHandleList
alist
(
cg
.
GetEntity
().
GetAtomList
());
std
::
sort
(
alist
.
begin
(),
alist
.
end
(),
less_index
);
CoordGroupHandle
superposed
=
CreateCoordGroup
(
alist
);
EMatX3
ref_mat
=
EMatX3
::
Zero
(
indices
.
size
(),
3
);
EMatX3
ref_centered
=
EMatX3
::
Zero
(
indices
.
size
(),
3
);
ECVec3
ref_center
;
...
...
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