From 7f0829b606251136a416c385d1904a5043567540 Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Tue, 15 Feb 2011 11:17:38 +0100
Subject: [PATCH] added NO_PEPTIDE_BONDS flag to ConnectAll.

If set, no peptide bonds will be added. Defaults to off, of course.
---
 modules/conop/src/conop.cc | 12 +++++++-----
 modules/conop/src/conop.hh |  9 ++++++++-
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/modules/conop/src/conop.cc b/modules/conop/src/conop.cc
index 76b45d7bf..b1448aa8f 100644
--- a/modules/conop/src/conop.cc
+++ b/modules/conop/src/conop.cc
@@ -229,9 +229,10 @@ private:
 class Connector: public mol::EntityVisitor
 {
 public:
-  Connector(const BuilderP& b):
+  Connector(const BuilderP& b, bool peptide_bonds):
     builder_(b),
-    prev_()
+    prev_(),
+    peptide_bonds_(peptide_bonds)
   {}
 
   virtual bool VisitChain(const mol::ChainHandle& chain) {
@@ -241,7 +242,7 @@ public:
 
   virtual bool VisitResidue(const mol::ResidueHandle& res) {
     builder_->ConnectAtomsOfResidue(res);
-    if (prev_) {
+    if (peptide_bonds_ && prev_) {
       builder_->ConnectResidueToPrev(res,prev_);
     }
     prev_=res;
@@ -251,6 +252,7 @@ public:
 private:
   BuilderP builder_;
   mol::ResidueHandle prev_;
+  bool peptide_bonds_;
 };
 
 class TorsionMaker: public mol::EntityVisitor
@@ -270,7 +272,7 @@ private:
 };
 } // ns
 
-void Conopology::ConnectAll(const BuilderP& b, mol::EntityHandle eh, int flag)
+void Conopology::ConnectAll(const BuilderP& b, mol::EntityHandle eh, int flags)
 {
   Profile profile_connect("ConnectAll");
   LOG_DEBUG("Conopology: ConnectAll: building internal coordinate system");
@@ -280,7 +282,7 @@ void Conopology::ConnectAll(const BuilderP& b, mol::EntityHandle eh, int flag)
   ChemClassAssigner cca(b);
   eh.Apply(cca);
   LOG_DEBUG("Conopology: ConnectAll: connecting all bonds");
-  Connector connector(b);
+  Connector connector(b, !(flags & NO_PEPTIDE_BONDS));
   eh.Apply(connector);
 
   LOG_DEBUG("Conopology: ConnectAll: assigning all torsions");
diff --git a/modules/conop/src/conop.hh b/modules/conop/src/conop.hh
index 7109c83aa..0d9fccf7b 100644
--- a/modules/conop/src/conop.hh
+++ b/modules/conop/src/conop.hh
@@ -26,6 +26,12 @@
 
 namespace ost { namespace conop {
 
+
+typedef enum {
+  NO_PEPTIDE_BONDS=1,
+} ConopFlag;
+
+  
 class DLLEXPORT_OST_CONOP Conopology {
   typedef std::map<String,BuilderP> BuilderMap;
 
@@ -42,7 +48,8 @@ public:
 
     does this need to live within Conopology ?
   */
-  void ConnectAll(const BuilderP& b, mol::EntityHandle eh, int flag=0);
+  void ConnectAll(const BuilderP& b, mol::EntityHandle eh, 
+                  int flags=0);
 
   void RegisterBuilder(const BuilderP& b, const String& name);
   void SetDefaultBuilder(const String& default_name);
-- 
GitLab