From 78c3ca0492cd63669243844c684db5e030bfb5f0 Mon Sep 17 00:00:00 2001
From: Rafal Gumienny <guma44@gmail.com>
Date: Fri, 23 Feb 2018 14:02:46 +0100
Subject: [PATCH] fix: SCHWED-3126 Make MapNonStandardResidues in-place

---
 modules/mol/alg/src/molck.cc | 7 ++++---
 modules/mol/alg/src/molck.hh | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/mol/alg/src/molck.cc b/modules/mol/alg/src/molck.cc
index 0667275af..e1c35083f 100644
--- a/modules/mol/alg/src/molck.cc
+++ b/modules/mol/alg/src/molck.cc
@@ -8,7 +8,8 @@ using namespace ost::conop;
 using namespace ost::mol;
 
 
-EntityHandle ost::mol::alg::MapNonStandardResidues(EntityHandle& ent, CompoundLibPtr lib) {
+void ost::mol::alg::MapNonStandardResidues(EntityHandle& ent, CompoundLibPtr lib) {
+  // TODO: Maybe it is possible to make it in-place operation
   EntityHandle new_ent=CreateEntity();  
   ChainHandleList chains=ent.GetChainList();
   XCSEditor new_edi=new_ent.EditXCS();
@@ -40,7 +41,7 @@ EntityHandle ost::mol::alg::MapNonStandardResidues(EntityHandle& ent, CompoundLi
       }   
     }        
   }
-  return new_ent;
+  ent = new_ent;
 }
 
 void ost::mol::alg::RemoveAtoms(
@@ -147,7 +148,7 @@ void ost::mol::alg::Molck(
            ost::conop::CompoundLibPtr lib,
            const ost::mol::alg::MolckSettings& settings=ost::mol::alg::MolckSettings()){
   if (settings.map_nonstd_res)  {
-    ent = ost::mol::alg::MapNonStandardResidues(ent, lib);
+    ost::mol::alg::MapNonStandardResidues(ent, lib);
   }
   ost::mol::alg::RemoveAtoms(ent, 
               lib, 
diff --git a/modules/mol/alg/src/molck.hh b/modules/mol/alg/src/molck.hh
index 566261d76..fea0ef177 100644
--- a/modules/mol/alg/src/molck.hh
+++ b/modules/mol/alg/src/molck.hh
@@ -69,7 +69,7 @@ struct MolckSettings{
 
 };
 
-ost::mol::EntityHandle MapNonStandardResidues(ost::mol::EntityHandle& ent,
+void MapNonStandardResidues(ost::mol::EntityHandle& ent,
                                               ost::conop::CompoundLibPtr lib);
 
 void RemoveAtoms(ost::mol::EntityHandle& ent,
-- 
GitLab