From 73db0650f372b00f7ee68f72376597bfc20090bc Mon Sep 17 00:00:00 2001
From: B13nch3n <stefan.bienert@me.com>
Date: Wed, 22 Jul 2020 14:16:30 +0200
Subject: [PATCH] Use pdbx_entity_branch connectivity data in DNG

---
 modules/io/src/mol/entity_io_mmcif_handler.cc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/io/src/mol/entity_io_mmcif_handler.cc b/modules/io/src/mol/entity_io_mmcif_handler.cc
index 68955f3fd..fa12d5a5a 100644
--- a/modules/io/src/mol/entity_io_mmcif_handler.cc
+++ b/modules/io/src/mol/entity_io_mmcif_handler.cc
@@ -55,6 +55,13 @@ void EntityIOMMCIFHandler::Import(mol::EntityHandle& ent,
   MMCifReader reader(stream,ent,  
                      IOProfileRegistry::Instance().GetDefault());
   reader.Parse();
+  // This is a hack: the reader is not available in
+  // file_loader.cc/ FileLoader::TryLoadEntity, but this is where the Conop
+  // processor is called to establish covalent bonds. Since RequiresProcessor()
+  // always returns true, the mechanism always tries to establish bonds, so we
+  // do that here.
+  MMCifInfo info = reader.GetInfo();
+  info.ConnectBranchLinks();
 }
 
 void EntityIOMMCIFHandler::Export(const mol::EntityView& ent,
@@ -69,6 +76,13 @@ void EntityIOMMCIFHandler::Import(mol::EntityHandle& ent,
   MMCifReader reader(filename, ent,  
                      IOProfileRegistry::Instance().GetDefault());
   reader.Parse();
+  // This is a hack: the reader is not available in
+  // file_loader.cc/ FileLoader::TryLoadEntity, but this is where the Conop
+  // processor is called to establish covalent bonds. Since RequiresProcessor()
+  // always returns true, the mechanism always tries to establish bonds, so we
+  // do that here.
+  MMCifInfo info = reader.GetInfo();
+  info.ConnectBranchLinks();
 }
 
 bool EntityIOMMCIFHandler::ProvidesImport(const boost::filesystem::path& loc,
-- 
GitLab