diff --git a/modules/io/src/mol/mmcif_info.cc b/modules/io/src/mol/mmcif_info.cc index af1e725881c823ed4cf4ffad23c30f627ee55c0c..c797a14f8ede547fef96a1f427beb8d6c71fc63a 100644 --- a/modules/io/src/mol/mmcif_info.cc +++ b/modules/io/src/mol/mmcif_info.cc @@ -225,16 +225,19 @@ const std::vector<MMCifInfoEntityBranch> MMCifInfo::GetEntityBranchLinks() const return all_links; } -void MMCifInfo::ConnectBranchLinks(mol::XCSEditor editor) +void MMCifInfo::ConnectBranchLinks() { MMCifInfoEntityBranchMap::iterator blm_it; for (blm_it = entity_branches_.begin(); blm_it != entity_branches_.end(); ++blm_it) { - for (std::vector<MMCifInfoEntityBranch>::iterator blv_it = - blm_it->second.begin(); - blv_it != blm_it->second.end(); - ++blv_it) { - blv_it->ConnectBranchLink(editor); + // We assume that one chain only comes from one entity, so we go with one + // editor per chain + std::vector<MMCifInfoEntityBranch>::iterator blv_it = blm_it->second.begin(); + if (blv_it != blm_it->second.end()) { + mol::XCSEditor editor = blv_it->GetAtom1().GetEntity().EditXCS(); + for (; blv_it != blm_it->second.end(); ++blv_it) { + blv_it->ConnectBranchLink(editor); + } } } } diff --git a/modules/io/src/mol/mmcif_info.hh b/modules/io/src/mol/mmcif_info.hh index 5dfffb2013ec2d530cd7f9218ef9b155bf78d166..4e5e62a9df730981b7760b6247501b08ab428d4f 100644 --- a/modules/io/src/mol/mmcif_info.hh +++ b/modules/io/src/mol/mmcif_info.hh @@ -1179,7 +1179,7 @@ public: /// \brief Connect all atoms listed as links for branched entities. /// - void ConnectBranchLinks(mol::XCSEditor editor); + void ConnectBranchLinks(); //protected: diff --git a/modules/io/tests/test_io_mmcif.py b/modules/io/tests/test_io_mmcif.py index 72d84658db7248215bce5f56e283e95a788133c8..8f850f55eef11d668729513c8ecdd9fc1b5ee6dd 100644 --- a/modules/io/tests/test_io_mmcif.py +++ b/modules/io/tests/test_io_mmcif.py @@ -294,7 +294,7 @@ class TestMMCifInfo(unittest.TestCase): self.assertEqual(blinks[1].atom1.qualified_name, "B.NAG2.C1") self.assertEqual(blinks[1].GetAtom2().qualified_name, "B.NAG1.O4") - info.ConnectBranchLinks(editor) + info.ConnectBranchLinks() self.assertEqual(atom4.GetBondPartners()[0].qualified_name, "B.NAG2.C1") if __name__== '__main__': diff --git a/modules/io/tests/test_mmcif_info.cc b/modules/io/tests/test_mmcif_info.cc index 25fccecea2f033714d51253ae3cfbed453173b69..6265eba1db4486dffef8ac04eeea2030d6af4f9d 100644 --- a/modules/io/tests/test_mmcif_info.cc +++ b/modules/io/tests/test_mmcif_info.cc @@ -359,7 +359,7 @@ BOOST_AUTO_TEST_CASE(mmcif_info) BOOST_CHECK(blinks[1].GetAtom2().GetQualifiedName() == "B.BMA1.O3"); // check that branch links get bonds - info.ConnectBranchLinks(editor); + info.ConnectBranchLinks(); BOOST_CHECK(atom11.GetBondPartners()[0] == atom12); BOOST_CHECK(atom22.GetBondPartners()[0] == atom21);