Gemmi C++ API
Loading...
Searching...
No Matches
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
13namespace gemmi {
14
16
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);
25 if (save_doc)
26 *save_doc = std::move(doc);
27 return st;
28}
29
30} // namespace gemmi
31#endif
#define GEMMI_DLL
Definition fail.hpp:53
Structure make_structure(cif::Document &&doc, cif::Document *save_doc=nullptr)
Definition mmcif.hpp:17
GEMMI_DLL Structure make_structure_from_block(const cif::Block &block)
void fail(const std::string &msg)
Definition fail.hpp:59