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
6768a501
Unverified
Commit
6768a501
authored
Mar 21, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
access to atoms
parent
879e15c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
3 deletions
+56
-3
include/cif++/Structure.hpp
+5
-0
src/Point.cpp
+2
-1
src/Structure.cpp
+49
-2
No files found.
include/cif++/Structure.hpp
View file @
6768a501
...
...
@@ -551,6 +551,8 @@ class Structure
~
Structure
();
const
AtomView
&
atoms
()
const
{
return
mAtoms
;
}
AtomView
&
atoms
()
{
return
mAtoms
;
}
AtomView
waters
()
const
;
const
std
::
list
<
Polymer
>
&
polymers
()
const
{
return
mPolymers
;
}
...
...
@@ -580,6 +582,9 @@ class Structure
/// \brief Get a the single residue for an asym with id \a asymID
const
Residue
&
getResidue
(
const
std
::
string
&
asymID
)
const
;
/// \brief Get a the single residue for an asym with id \a asymID and seq id \a seqID
const
Residue
&
getResidue
(
const
std
::
string
&
asymID
,
int
seqID
)
const
;
/// \brief Get a the single residue for an asym with id \a asymID
Residue
&
getResidue
(
const
std
::
string
&
asymID
);
...
...
src/Point.cpp
View file @
6768a501
...
...
@@ -302,7 +302,8 @@ Quaternion ConstructFromAngleAxis(float angle, Point axis)
axis
.
normalize
();
return
Normalize
(
Quaternion
{
q
,
return
Normalize
(
Quaternion
{
static_cast
<
float
>
(
q
),
static_cast
<
float
>
(
s
*
axis
.
mX
),
static_cast
<
float
>
(
s
*
axis
.
mY
),
static_cast
<
float
>
(
s
*
axis
.
mZ
)});
...
...
src/Structure.cpp
View file @
6768a501
...
...
@@ -1429,10 +1429,21 @@ Atom Structure::getAtomByID(std::string id) const
// auto i = find_if(mAtoms.begin(), mAtoms.end(),
// [&id](auto& a) { return a.id() == id; });
Atom
result
;
if
(
i
==
mAtomIndex
.
end
()
or
mAtoms
[
*
i
].
id
()
!=
id
)
throw
std
::
out_of_range
(
"Could not find atom with id "
+
id
);
{
auto
j
=
std
::
find_if
(
mAtoms
.
begin
(),
mAtoms
.
end
(),
[
id
](
const
Atom
&
a
)
{
return
a
.
id
()
==
id
;
});
if
(
j
==
mAtoms
.
end
())
throw
std
::
out_of_range
(
"Could not find atom with id "
+
id
);
result
=
*
j
;
}
else
result
=
mAtoms
[
*
i
];
return
mAtoms
[
*
i
]
;
return
result
;
}
Atom
Structure
::
getAtomByLabel
(
const
std
::
string
&
atomID
,
const
std
::
string
&
asymID
,
const
std
::
string
&
compID
,
int
seqID
,
const
std
::
string
&
altID
)
...
...
@@ -1558,6 +1569,42 @@ const Residue &Structure::getResidue(const std::string &asymID) const
throw
std
::
out_of_range
(
"Could not find residue "
+
asymID
);
}
const
Residue
&
Structure
::
getResidue
(
const
std
::
string
&
asymID
,
int
seqID
)
const
{
if
(
seqID
==
0
)
{
for
(
auto
&
res
:
mNonPolymers
)
{
if
(
res
.
asymID
()
!=
asymID
)
continue
;
return
res
;
}
}
for
(
auto
&
poly
:
mPolymers
)
{
if
(
poly
.
asymID
()
!=
asymID
)
continue
;
for
(
auto
&
res
:
poly
)
{
if
(
res
.
seqID
()
==
seqID
)
return
res
;
}
}
for
(
auto
&
res
:
mBranchResidues
)
{
if
(
res
.
asymID
()
!=
asymID
or
res
.
seqID
()
!=
seqID
)
continue
;
return
res
;
}
throw
std
::
out_of_range
(
"Could not find residue "
+
asymID
+
'/'
+
std
::
to_string
(
seqID
));
}
Residue
&
Structure
::
getResidue
(
const
std
::
string
&
asymID
)
{
return
const_cast
<
Residue
&>
(
const_cast
<
Structure
const
&>
(
*
this
).
getResidue
(
asymID
));
...
...
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