14#ifndef MMTF_EXPORT_HELPERS_H
15#define MMTF_EXPORT_HELPERS_H
35 std::vector<int32_t> m_atom2groupType;
36 std::vector<int32_t> m_atomOffsets;
45 : m_data(&data), m_atomOffsets(data.groupTypeList.size(), -1)
47 m_atom2groupType.reserve(data.
numAtoms);
53 if (m_atomOffsets[groupType] != -1) {
57 size_t atomOffset = m_atom2groupType.size();
58 size_t groupSize = data.
groupList[groupType].atomNameList.size();
60 m_atomOffsets[groupType] = atomOffset;
61 m_atom2groupType.resize(atomOffset + groupSize, groupType);
74 bool operator()(int32_t atom1, int32_t atom2, int8_t order)
76 if (atom1 >= m_atom2groupType.size() ||
77 atom2 >= m_atom2groupType.size())
80 if (m_atom2groupType[atom1] == m_atom2groupType[atom2]) {
81 int32_t groupType = m_atom2groupType[atom1];
82 GroupType& group = m_data->groupList[groupType];
83 group.
bondAtomList.push_back(atom1 - m_atomOffsets[groupType]);
84 group.
bondAtomList.push_back(atom2 - m_atomOffsets[groupType]);
87 m_data->bondAtomList.push_back(atom1);
88 m_data->bondAtomList.push_back(atom2);
89 m_data->bondOrderList.push_back(order);
108 std::vector<size_t> idremap(n_old, 0);
110 for (
size_t i = 1; i < n_old; ++i) {
123 }
else if (i_free == 0) {
127 idremap[i] = i_found;
BondAdder(StructureData &data)
Definition export_helpers.hpp:44
bool operator()(int32_t atom1, int32_t atom2, int8_t order)
Add one bond.
Definition export_helpers.hpp:74
Exception thrown when failing during encoding.
Definition errors.hpp:31
Definition binary_decoder.hpp:25
void compressGroupList(StructureData &data)
Eliminate redundant groups from groupList.
Definition export_helpers.hpp:104
Group (residue) level data store.
Definition structure_data.hpp:53
std::vector< int8_t > bondOrderList
Definition structure_data.hpp:58
std::vector< int32_t > bondAtomList
Definition structure_data.hpp:57
Top level MMTF data container.
Definition structure_data.hpp:157
std::vector< GroupType > groupList
Definition structure_data.hpp:178
std::vector< int32_t > groupTypeList
Definition structure_data.hpp:190
int32_t numAtoms
Definition structure_data.hpp:174