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];
83 group.
bondAtomList.push_back(atom1 - m_atomOffsets[groupType]);
84 group.
bondAtomList.push_back(atom2 - m_atomOffsets[groupType]);
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;
Helper class for adding bonds to a group-redundant system.
Definition: export_helpers.hpp:33
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
int32_t numBonds
Definition: structure_data.hpp:173
std::vector< int8_t > bondOrderList
Definition: structure_data.hpp:180
std::vector< int32_t > bondAtomList
Definition: structure_data.hpp:179
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