Gemmi C++ API
Loading...
Searching...
No Matches
gemmi
include
gemmi
mmcif.hpp
Go to the documentation of this file.
1
// Copyright 2017 Global Phasing Ltd.
2
//
3
// Read mmcif (PDBx/mmCIF) file into a Structure from model.hpp.
4
5
#ifndef GEMMI_MMCIF_HPP_
6
#define GEMMI_MMCIF_HPP_
7
8
#include <string>
9
#include "
cifdoc.hpp
"
10
#include "
fail.hpp
"
// for fail
11
#include "
model.hpp
"
// for Structure
12
13
namespace
gemmi
{
14
15
GEMMI_DLL
Structure
make_structure_from_block
(
const
cif::Block
& block);
16
17
inline
Structure
make_structure
(
cif::Document
&&
doc
,
cif::Document
*
save_doc
=
nullptr
) {
18
// mmCIF files for deposition may have more than one block:
19
// coordinates in the first block and restraints in the others.
20
for
(
size_t
i
= 1;
i
<
doc
.blocks.size(); ++
i
)
21
if
(
doc
.blocks[
i
].has_tag(
"_atom_site.id"
))
22
fail
(
"2+ blocks are ok if only the first one has coordinates;\n"
23
"_atom_site in block #"
+ std::to_string(
i
+1) +
": "
+
doc
.source);
24
Structure
st
=
make_structure_from_block
(
doc
.blocks.at(0));
25
if
(
save_doc
)
26
*
save_doc
= std::move(
doc
);
27
return
st
;
28
}
29
30
}
// namespace gemmi
31
#endif
cifdoc.hpp
fail.hpp
GEMMI_DLL
#define GEMMI_DLL
Definition
fail.hpp:53
model.hpp
gemmi
Definition
addends.hpp:12
gemmi::make_structure
Structure make_structure(cif::Document &&doc, cif::Document *save_doc=nullptr)
Definition
mmcif.hpp:17
gemmi::make_structure_from_block
GEMMI_DLL Structure make_structure_from_block(const cif::Block &block)
gemmi::fail
void fail(const std::string &msg)
Definition
fail.hpp:59
gemmi::HklValue
Definition
asudata.hpp:97
gemmi::Structure
Definition
model.hpp:921
gemmi::cif::Block
Definition
cifdoc.hpp:443
gemmi::cif::Document
Definition
cifdoc.hpp:1056
Generated by
1.9.8