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
5e0b197a
Unverified
Commit
5e0b197a
authored
May 04, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmcif::Atom::compound() revision
parent
af721eb1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
25 deletions
+28
-25
.gitignore
+1
-0
CMakeLists.txt
+1
-1
changelog
+3
-0
include/cif++/Structure.hpp
+2
-2
src/Structure.cpp
+21
-22
No files found.
.gitignore
View file @
5e0b197a
...
@@ -13,3 +13,4 @@ msvc/
...
@@ -13,3 +13,4 @@ msvc/
Testing/
Testing/
rsrc/feature-request.txt
rsrc/feature-request.txt
test/1cbs.cif
test/1cbs.cif
test/test-create_sugar_2.cif
CMakeLists.txt
View file @
5e0b197a
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
cmake_minimum_required
(
VERSION 3.16
)
cmake_minimum_required
(
VERSION 3.16
)
# set the project name
# set the project name
project
(
cifpp VERSION 4.
0
.0 LANGUAGES CXX
)
project
(
cifpp VERSION 4.
1
.0 LANGUAGES CXX
)
list
(
PREPEND CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
list
(
PREPEND CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
...
...
changelog
View file @
5e0b197a
Version
4.1.0
-
Some
interface
changes
for
mmcif
::
Atom
Version
4.0.0
Version
4.0.0
-
getResidue
in
mmcif
::
Structure
now
requires
both
a
-
getResidue
in
mmcif
::
Structure
now
requires
both
a
sequence
ID
and
an
auth
sequence
ID
.
As
a
result
the
code
was
cleaned
sequence
ID
and
an
auth
sequence
ID
.
As
a
result
the
code
was
cleaned
...
...
include/cif++/Structure.hpp
View file @
5e0b197a
...
@@ -80,7 +80,7 @@ class Atom
...
@@ -80,7 +80,7 @@ class Atom
void
moveTo
(
const
Point
&
p
);
void
moveTo
(
const
Point
&
p
);
const
Compound
&
comp
()
const
;
const
Compound
*
compound
()
const
;
const
std
::
string
get_property
(
const
std
::
string_view
name
)
const
;
const
std
::
string
get_property
(
const
std
::
string_view
name
)
const
;
void
set_property
(
const
std
::
string_view
name
,
const
std
::
string
&
value
);
void
set_property
(
const
std
::
string_view
name
,
const
std
::
string
&
value
);
...
@@ -186,7 +186,7 @@ class Atom
...
@@ -186,7 +186,7 @@ class Atom
bool
isSymmetryCopy
()
const
{
return
impl
().
mSymmetryCopy
;
}
bool
isSymmetryCopy
()
const
{
return
impl
().
mSymmetryCopy
;
}
std
::
string
symmetry
()
const
{
return
impl
().
mSymmetryOperator
;
}
std
::
string
symmetry
()
const
{
return
impl
().
mSymmetryOperator
;
}
const
Compound
&
comp
()
const
{
return
impl
().
comp
();
}
const
Compound
&
comp
ound
()
const
;
bool
isWater
()
const
{
return
impl
().
mCompID
==
"HOH"
or
impl
().
mCompID
==
"H2O"
or
impl
().
mCompID
==
"WAT"
;
}
bool
isWater
()
const
{
return
impl
().
mCompID
==
"HOH"
or
impl
().
mCompID
==
"H2O"
or
impl
().
mCompID
==
"WAT"
;
}
int
charge
()
const
;
int
charge
()
const
;
...
...
src/Structure.cpp
View file @
5e0b197a
...
@@ -148,19 +148,10 @@ int Atom::AtomImpl::charge() const
...
@@ -148,19 +148,10 @@ int Atom::AtomImpl::charge() const
if
(
not
formalCharge
.
has_value
())
if
(
not
formalCharge
.
has_value
())
{
{
try
auto
c
=
compound
();
{
auto
&
compound
=
comp
();
if
(
compound
.
atoms
().
size
()
==
1
)
if
(
c
!=
nullptr
and
c
->
atoms
().
size
()
==
1
)
formalCharge
=
compound
.
atoms
().
front
().
charge
;
formalCharge
=
c
->
atoms
().
front
().
charge
;
}
catch
(
const
std
::
exception
&
ex
)
{
if
(
cif
::
VERBOSE
>
0
)
std
::
cerr
<<
"Error when trying to get charge of atom: "
<<
ex
.
what
()
<<
std
::
endl
;
formalCharge
=
0
;
}
}
}
return
formalCharge
.
value_or
(
0
);
return
formalCharge
.
value_or
(
0
);
...
@@ -188,23 +179,16 @@ void Atom::AtomImpl::moveTo(const Point &p)
...
@@ -188,23 +179,16 @@ void Atom::AtomImpl::moveTo(const Point &p)
mLocation
=
p
;
mLocation
=
p
;
}
}
const
Compound
&
Atom
::
AtomImpl
::
comp
()
const
const
Compound
*
Atom
::
AtomImpl
::
compound
()
const
{
{
if
(
mCompound
==
nullptr
)
if
(
mCompound
==
nullptr
)
{
{
std
::
string
compID
;
std
::
string
compID
=
get_property
(
"label_comp_id"
);
cif
::
tie
(
compID
)
=
mRow
.
get
(
"label_comp_id"
);
mCompound
=
CompoundFactory
::
instance
().
create
(
compID
);
mCompound
=
CompoundFactory
::
instance
().
create
(
compID
);
if
(
cif
::
VERBOSE
>
0
and
mCompound
==
nullptr
)
std
::
cerr
<<
"Compound not found: '"
<<
compID
<<
'\''
<<
std
::
endl
;
}
}
if
(
mCompound
==
nullptr
)
return
mCompound
;
throw
std
::
runtime_error
(
"no compound"
);
return
*
mCompound
;
}
}
const
std
::
string
Atom
::
AtomImpl
::
get_property
(
const
std
::
string_view
name
)
const
const
std
::
string
Atom
::
AtomImpl
::
get_property
(
const
std
::
string_view
name
)
const
...
@@ -281,6 +265,21 @@ std::string Atom::pdbID() const
...
@@ -281,6 +265,21 @@ std::string Atom::pdbID() const
get_property
<
std
::
string
>
(
"pdbx_PDB_ins_code"
);
get_property
<
std
::
string
>
(
"pdbx_PDB_ins_code"
);
}
}
const
Compound
&
Atom
::
compound
()
const
{
auto
result
=
impl
().
compound
();
if
(
result
==
nullptr
)
{
if
(
cif
::
VERBOSE
>
0
)
std
::
cerr
<<
"Compound not found: '"
<<
get_property
<
std
::
string
>
(
"label_comp_id"
)
<<
'\''
<<
std
::
endl
;
throw
std
::
runtime_error
(
"no compound"
);
}
return
*
result
;
}
int
Atom
::
charge
()
const
int
Atom
::
charge
()
const
{
{
return
impl
().
charge
();
return
impl
().
charge
();
...
...
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