Commit b6143f36 by Maarten L. Hekkelman

optimise load atom data

parent 348aa7af
...@@ -1376,23 +1376,16 @@ structure::structure(datablock &db, size_t modelNr, StructureOpenOptions options ...@@ -1376,23 +1376,16 @@ structure::structure(datablock &db, size_t modelNr, StructureOpenOptions options
void structure::load_atoms_for_model(StructureOpenOptions options) void structure::load_atoms_for_model(StructureOpenOptions options)
{ {
auto &atomCat = m_db["atom_site"]; using namespace literals;
for (const auto &a : atomCat)
{
std::string id, type_symbol;
std::optional<size_t> model_nr;
cif::tie(id, type_symbol, model_nr) = a.get("id", "type_symbol", "pdbx_PDB_model_num");
if (model_nr and *model_nr != m_model_nr) auto &atomCat = m_db["atom_site"];
continue;
if ((options bitand StructureOpenOptions::SkipHydrogen) and (type_symbol == "H" or type_symbol == "D")) condition c = "pdbx_PDB_model_num"_key == null or "pdbx_PDB_model_num"_key == m_model_nr;
continue; if (options bitand StructureOpenOptions::SkipHydrogen)
c = std::move(c) and ("type_symbol"_key != "H" and "type_symbol"_key != "D");
for (auto id : atomCat.find<std::string>(std::move(c), "id"))
emplace_atom(std::make_shared<atom::atom_impl>(m_db, id)); emplace_atom(std::make_shared<atom::atom_impl>(m_db, id));
}
} }
// structure::structure(const structure &s) // structure::structure(const structure &s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment