From 918f255ac0cfc5af1b3280ade692ebcbe29723c4 Mon Sep 17 00:00:00 2001
From: juergen <juergen@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Mon, 29 Mar 2010 12:06:48 +0000
Subject: [PATCH] rule-based and heuristic build are now relying on the same
 implementation for backbone torsion angles -removed isp torsion completely
 -fixed omega torsion implementation +added check for res.IsPetideLinking()
 before adding backbone torsions

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1896 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 modules/conop/src/builder.cc                 | 43 ++++++++++
 modules/conop/src/builder.hh                 |  3 +
 modules/conop/src/heuristic_builder.cc       | 17 +---
 modules/conop/src/heuristic_connect_table.hh | 85 ++++++++++----------
 modules/conop/src/rule_based_builder.cc      | 33 +-------
 modules/mol/base/pymod/export_residue.cc     |  1 -
 modules/mol/base/src/impl/residue_impl.cc    | 35 ++------
 modules/mol/base/src/impl/residue_impl.hh    | 11 +--
 modules/mol/base/src/residue_base.cc         |  6 --
 modules/mol/base/src/residue_base.hh         |  6 --
 10 files changed, 103 insertions(+), 137 deletions(-)

diff --git a/modules/conop/src/builder.cc b/modules/conop/src/builder.cc
index 538bb8f52..f82eede9b 100644
--- a/modules/conop/src/builder.cc
+++ b/modules/conop/src/builder.cc
@@ -159,6 +159,49 @@ bool Builder::AreResiduesConsecutive(const mol::ResidueHandle& r1,
          r2.GetNumber().GetInsCode()==r1.GetNumber().NextInsertionCode().GetInsCode();
 }
 
+void Builder::AssignBackBoneTorsionsToResidue(const mol::ResidueHandle& res)
+{
+
+  mol::ResidueHandle prev=res.GetPrev();
+  mol::ResidueHandle next=res.GetNext();
+  mol::XCSEditor e=res.GetEntity().RequestXCSEditor(mol::BUFFERED_EDIT);
+  //psi
+  if (next.IsValid() && next.IsPeptideLinking()){
+    mol::AtomHandle ca_this=res.FindAtom("CA");
+    mol::AtomHandle n_this=res.FindAtom("N");
+    mol::AtomHandle c_this=res.FindAtom("C");
+    mol::AtomHandle n_next=next.FindAtom("N");
+    if ((ca_this && n_this && c_this && n_next &&  BondExists(c_this, n_next))
+        && !res.GetPsiTorsion()) {
+      e.AddTorsion("PSI", n_this, ca_this, c_this, n_next);
+    }
+  };
+  //phi
+  if (prev.IsValid() && prev.IsPeptideLinking()) {
+    mol::AtomHandle c_prev=prev.FindAtom("C");
+    mol::AtomHandle n_this=res.FindAtom("N");
+    mol::AtomHandle ca_this=res.FindAtom("CA");
+    mol::AtomHandle c_this=res.FindAtom("C");
+    if ((c_prev && n_this && ca_this && c_this && BondExists(c_prev, n_this))
+        && !res.GetPhiTorsion()) {
+      e.AddTorsion("PHI", c_prev, n_this, ca_this, c_this);
+    }
+  }
+  //omega
+  if (prev.IsValid() && prev.IsPeptideLinking()) {
+    mol::AtomHandle ca_prev=prev.FindAtom("CA");
+    mol::AtomHandle c_prev=prev.FindAtom("C");
+    mol::AtomHandle n=res.FindAtom("N");
+    mol::AtomHandle ca=res.FindAtom("CA");
+    if ((ca_prev && c_prev && n && ca && BondExists(c_prev, n))
+        && !res.GetOmegaTorsion()) {
+      e.AddTorsion("OMEGA",ca_prev , c_prev, n, ca);
+    }
+  }
+}
+
+
+
 void Builder::DistanceBasedConnect(const mol::AtomHandle& atom)
 {
   mol::EntityHandle ent=atom.GetEntity();
diff --git a/modules/conop/src/builder.hh b/modules/conop/src/builder.hh
index 47a9f29c0..b47e432ac 100644
--- a/modules/conop/src/builder.hh
+++ b/modules/conop/src/builder.hh
@@ -99,6 +99,9 @@ public:
   /// \brief assign named torsions to single residue
   virtual void AssignTorsionsToResidue(const mol::ResidueHandle& residue);
   
+  /// \brief assign Backbone torsions to single residue  
+  void AssignBackBoneTorsionsToResidue(const mol::ResidueHandle& res);
+  
   /// \brief  Check if peptide bond is formed between the two atoms.
   /// 
   /// This method is called by ConnectResidueWithNext() after making sure that
diff --git a/modules/conop/src/heuristic_builder.cc b/modules/conop/src/heuristic_builder.cc
index c154c0c11..00e7f251b 100644
--- a/modules/conop/src/heuristic_builder.cc
+++ b/modules/conop/src/heuristic_builder.cc
@@ -359,18 +359,6 @@ void HeuristicBuilder::AssignTorsionsToResidue(const mol::ResidueHandle& res)
               flag=true;
             }
           }
-        } else if (cur_name==":") {
-          mol::ResidueHandle next=res.GetNext();
-          if (Builder::AreResiduesConsecutive(res,next)) {
-            centry2=LookupResEntry(next.GetKey());
-            if (centry2.second) {
-            //force CA since only N can be accessed by using centry2.first.GetNext();
-            //TODO refactor using hardcoded torsions from heuristic and place in base class.
-              cur_name="CA";
-              search_in=next;
-              flag=true;
-            }
-          }
         } else {
           flag=true;
         }
@@ -404,10 +392,13 @@ void HeuristicBuilder::AssignTorsions(const mol::ChainHandle& chain)
   if (chain.GetResidueCount()==0)
     return;
   std::vector<mol::ResidueHandle> rlist = chain.GetResidueList();
-  mol::AtomHandleList atom_list = rlist[0].GetAtomList();
   for(unsigned int ri=0;ri<rlist.size();++ri) {
     mol::ResidueHandle res=rlist[ri];
     this->AssignTorsionsToResidue(res);
+    if (!res.IsPeptideLinking()) {
+      return;
+    }
+    Builder::AssignBackBoneTorsionsToResidue(res);
   }
 }
 
diff --git a/modules/conop/src/heuristic_connect_table.hh b/modules/conop/src/heuristic_connect_table.hh
index 8f22ebcd3..6251d1070 100644
--- a/modules/conop/src/heuristic_connect_table.hh
+++ b/modules/conop/src/heuristic_connect_table.hh
@@ -34,7 +34,7 @@ struct CONN_DEF_ENTRY {
   struct CONN_TORSION_TMP {
     int n1,n2,n3,n4;
     String name;
-  }tor_list[12];
+  }tor_list[8];
   int tor_count;
   int flag_list[128];
   int flag_count;
@@ -44,159 +44,158 @@ CONN_DEF_ENTRY def_entry_table[]={
   {"Alanine","ALA",'A', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","OXT"},6,
    {{-2,1}, {1,2}, {2,3}, {3,4}, {2,5}, {3,-3}, {6, 3}},7,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
-   },4,
+   {
+   },0,
    {0, 0, 0, 0, 0, 0},6
   },
   {"Cystein","CYS",'C', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","SG","OXT"},7,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{3,-3},{8, 3}},8,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
-    {1,2,5,6,"CHI1"}
-   },5,
+   {{1,2,5,6,"CHI1"}
+   },1,
    {0, 0, 0, 0, 0, 0, 0},7
   },
   {"Aspartate","ASP",'D', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","OD1","OD2","OXT"},9,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{6,8},{3,-3},{9, 3}},10,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"}
-   },6,
+   },2,
    {0, 0, 0, 0, 0, 0, 0, 0, 0},9
   },
   {"Glutamate","GLU",'E', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","CD","OE1","OE2","OXT"},10,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{7,8},{7,9},{3,-3},{10, 3}},11,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"},{5,6,7,8,"CHI3"}
-   },7,
+   },3,
    {0},1
   },
   {"Phenylalanine","PHE",'F', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","CD1","CD2","CE1","CE2","CZ","OXT"},12,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{6,8},{7,9},{8,10},{9,11},{10,11},{3,-3},{12, 3}},14,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"}
-   },6,
+   },2,
    {0},1
   },
   {"Glycin","GLY",'G', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","OXT"},5,
    {{-2,1},{1,2},{2,3},{3,4},{3,-3},{5, 3}},6,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
-   },4,
+   {
+   },0,
    {0},1
   },
   {"Histidine","HIS",'H', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","ND1","CD2","CE1","NE2","OXT"},11,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{6,8},{7,9},{8,10},{9,10},{3,-3},{11, 3}},13,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"}
-   },6,
+   },2,
    {0},1
   },
   {"Isoleucine","ILE",'I', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG1","CG2","CD1","OXT"},9,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{5,7},{6,8},{3,-3},{9, 3}},10,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,8,"CHI2"}
-   },6,
+   },2,
    {0},1
   },
   {"Lysin","LYS",'K', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","CD","CE","NZ","OXT"},10,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{7,8},{8,9},{3,-3},{10, 3}},11,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"},{5,6,7,8,"CHI3"},{6,7,8,9,"CHI4"}
-   },8,
+   },4,
    {0},1
   },
   {"Leucin","LEU",'L', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","CD1","CD2","OXT"},9,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{6,8},{3,-3},{9, 3}},10,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"}
-   },6,
+   },2,
    {0},1
   },
   {"Methionine","MET",'M', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","SD","CE","OXT"},9,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{7,8},{3,-3},{10, 3}},10,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"},{5,6,7,8,"CHI3"}
-   },7,
+   },3,
    {0},1
   },
   {"Asparagine","ASN",'N', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","OD1","ND2","OXT"},9,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{6,8},{3,-3},{9, 3}},10,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"}
-   },6,
+   },2,
    {0},1
   },
   {"Proline","PRO",'P', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","CD","OXT"},8,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{3,-3},{1,7},{8, 3}},10,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"}
-   },6,
+   },2,
    {0},1
   },
   {"Glutamine","GLN",'Q', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","CD","OE1","NE2","OXT"},10,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{7,8},{7,9},{3,-3},{10, 3}},11,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"},{5,6,7,8,"CHI3"}
-   },7,
+   },3,
    {0},1
   },
   {"Arginine","ARG",'R', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","CD","NE","CZ","NH1","NH2","OXT"},12,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{7,8},{8,9},{9,10},{9,11},{3,-3},{12, 3}},13,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
-    {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"},{5,6,7,8,"CHI3"},{6,7,8,9,"CHI4"},{7,8,9,10,"CHI5"}
-   },9,
+   {
+   {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"},{5,6,7,8,"CHI3"},{6,7,8,9,"CHI4"},{7,8,9,10,"CHI5"}
+   },5,
    {0},1
   },
   {"Serine","SER",'S', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","OG","OXT"},7,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{3,-3},{7, 3}},8,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"}
-   },5,
+   },1,
    {0},1
   },
   {"Threonine","THR",'T', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","OG1","CG2","OXT"},8,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{5,7},{3,-3},{8, 3}},9,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"}
-   },5,
+   },1,
    {0},1
   },
   {"Valine","VAL",'V', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG1","CG2","OXT"},8,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{5,7},{3,-3},{8, 3}},9,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"}
-   },5,
+   },1,
    {0},1
   },
   {"Tryptophan","TRP",'W', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","CD1","CD2","NE1","CE2","CE3","CZ2","CZ3","CH2","OXT"},15,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{6,8},{7,9},{8,10},{9,10},{8,11},{10,12},{11,13},{12,14},{13,14},{3,-3},{15, 3}},18,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"}
-   },6,
+   },2,
    {0},1
   },
   {"Tyrosin","TYR",'Y', mol::ChemClass(mol::ChemClass::LPeptideLinking),
    {"N","CA","C","O","CB","CG","CD1","CD2","CE1","CE2","CZ","OH","OXT"},13,
    {{-2,1},{1,2},{2,3},{3,4},{2,5},{5,6},{6,7},{6,8},{7,9},{8,10},{9,11},{10,11},{11,12},{3,-3},{13, 3}},15,
-   {{-2,1,2,3,"PHI"},{1,2,3,-3,"PSI"},{-3,3,2,1,"ISP"},{2,3,-3,-4,"OMEGA"},
+   {
     {1,2,5,6,"CHI1"},{2,5,6,7,"CHI2"}
-   },6,
+   },2,
    {0},1
   },
   /* NUCLEIC ACIDS */
diff --git a/modules/conop/src/rule_based_builder.cc b/modules/conop/src/rule_based_builder.cc
index a4ddb247e..0f12cbc63 100644
--- a/modules/conop/src/rule_based_builder.cc
+++ b/modules/conop/src/rule_based_builder.cc
@@ -203,34 +203,6 @@ void RuleBasedBuilder::ConnectResidueToNext(const mol::ResidueHandle& rh,
   }
 }
 
-void RuleBasedBuilder::AssignBackBoneTorsionsToResidue(const mol::ResidueHandle& res)
-{
-
-  mol::ResidueHandle prev=res.GetPrev();
-  mol::ResidueHandle next=res.GetNext();
-  mol::XCSEditor e=res.GetEntity().RequestXCSEditor(mol::BUFFERED_EDIT);
-  if (next.IsValid() && next.IsPeptideLinking()){
-    mol::AtomHandle ca_this=res.FindAtom("CA");
-    mol::AtomHandle n_this=res.FindAtom("N");
-    mol::AtomHandle c_this=res.FindAtom("C");
-    mol::AtomHandle n_next=next.FindAtom("N");
-    if ((ca_this && n_this && c_this && n_next &&  BondExists(c_this, n_next))
-        && !res.GetPsiTorsion()) {
-      e.AddTorsion("PSI", n_this, ca_this, c_this, n_next);
-    }
-  };
-  if (prev.IsValid() && prev.IsPeptideLinking()) {
-    mol::AtomHandle c_prev=prev.FindAtom("C");
-    mol::AtomHandle n_this=res.FindAtom("N");
-    mol::AtomHandle ca_this=res.FindAtom("CA");
-    mol::AtomHandle c_this=res.FindAtom("C");
-    if ((c_prev && n_this && ca_this && c_this && BondExists(c_prev, n_this))
-        && !res.GetPhiTorsion()) {
-      e.AddTorsion("PHI", c_prev, n_this, ca_this, c_this);
-    }
-  }
-}
-
 
 void RuleBasedBuilder::AssignTorsions(const mol::ChainHandle& chain) {
   if (chain.GetResidueCount()==0)
@@ -247,15 +219,14 @@ void RuleBasedBuilder::AssignTorsionsToResidue(const mol::ResidueHandle& residue
   /// The only components having named torsions are the standard set of amino
   /// acids, plus some of compounds derived from them such as selenium
   /// methionine. Things are simplified a lot by only storing the torsions
-  /// of the side chains in the database. PHI and PSI torsions are checked
-  /// without a lookup in the database.
+  /// of the side chains in the database. PHI, PSI and OMEGA torsions are    checked without a lookup in the database.
   LookupCompound(residue);
   if (!last_compound_)
     return;  
   if (!last_compound_->IsPeptideLinking()) {
     return;
   }
-  AssignBackBoneTorsionsToResidue(residue);
+  Builder::AssignBackBoneTorsionsToResidue(residue);
 }
 
 bool RuleBasedBuilder::IsResidueComplete(const mol::ResidueHandle& residue)
diff --git a/modules/mol/base/pymod/export_residue.cc b/modules/mol/base/pymod/export_residue.cc
index 42498a4e1..615c6bc3d 100644
--- a/modules/mol/base/pymod/export_residue.cc
+++ b/modules/mol/base/pymod/export_residue.cc
@@ -85,7 +85,6 @@ void export_Residue()
     .def("SetSecStructure", &ResidueBase::SetSecStructure)
     .def("GetPhiTorsion", &ResidueBase::GetPhiTorsion)
     .def("GetPsiTorsion", &ResidueBase::GetPsiTorsion)
-    .def("GetIspTorsion", &ResidueBase::GetIspTorsion)
     .def("GetOmegaTorsion", &ResidueBase::GetOmegaTorsion)
     .def("IsValid", &ResidueBase::IsValid)
     .def(self_ns::str(self))
diff --git a/modules/mol/base/src/impl/residue_impl.cc b/modules/mol/base/src/impl/residue_impl.cc
index 2fd41b0ba..b45dae810 100644
--- a/modules/mol/base/src/impl/residue_impl.cc
+++ b/modules/mol/base/src/impl/residue_impl.cc
@@ -246,29 +246,6 @@ const AtomImplList& ResidueImpl::GetAtomList() const
   return atom_list_;
 }
 
-TorsionImplP ResidueImpl::GetIspTorsion() const {
-  ChainImplPtr chain=this->GetChain();
-  ResidueImplPtr self=const_cast<ResidueImpl*>(this)->shared_from_this();
-  ResidueImplPtr next=chain->GetNext(self);
-  if (!next || !InSequence(self, next))
-    return TorsionImplP();
-  AtomImplPtr calpha=this->FindAtom("CA");
-  AtomImplPtr c=this->FindAtom("C");
-  AtomImplPtr n=next->FindAtom("N");
-  AtomImplPtr ca_po=next->FindAtom("CA");
-  TorsionImplList::const_iterator i=torsion_list_.begin();
-  for (;i!=torsion_list_.end(); ++i) {
-    TorsionImplP t=*i;
-    if (t->Matches(calpha, c, n, ca_po))
-      return t;
-  }
-
-  LOGN_DUMP("Can't find torsion ISP for " <<
-            this->GetKey() << this->GetNumber());
-  return TorsionImplP();
-
-}
-
 TorsionImplP ResidueImpl::GetPsiTorsion() const {
   ChainImplPtr chain=this->GetChain();
   ResidueImplPtr self=const_cast<ResidueImpl*>(this)->shared_from_this();
@@ -310,19 +287,19 @@ TorsionImplP ResidueImpl::FindTorsion(const String& torsion_name) const {
 TorsionImplP ResidueImpl::GetOmegaTorsion() const {
   ChainImplPtr chain=this->GetChain();
   ResidueImplPtr self=const_cast<ResidueImpl*>(this)->shared_from_this();
-  ResidueImplPtr next=chain->GetNext(self);
-  if (!next || !InSequence(self, next))
+  ResidueImplPtr prev=chain->GetPrev(self);
+  if (!prev || !InSequence(prev, self))
     return TorsionImplP();
 
+  AtomImplPtr calpha_prev=prev->FindAtom("CA");
+  AtomImplPtr c_prev=prev->FindAtom("C");
+  AtomImplPtr n=this->FindAtom("N");
   AtomImplPtr calpha=this->FindAtom("CA");
-  AtomImplPtr c=this->FindAtom("C");
-  AtomImplPtr nne=next->FindAtom("N");
-  AtomImplPtr calphane=next->FindAtom("CA");
   TorsionImplList::const_iterator i=torsion_list_.begin();
 
   for (;i!=torsion_list_.end(); ++i) {
     TorsionImplP t=*i;
-    if (t->Matches(calpha, c, nne,  calphane))
+    if (t->Matches(calpha_prev, c_prev, n,  calpha))
       return t;
   }
 
diff --git a/modules/mol/base/src/impl/residue_impl.hh b/modules/mol/base/src/impl/residue_impl.hh
index ee47bdbb2..6a36a75bc 100644
--- a/modules/mol/base/src/impl/residue_impl.hh
+++ b/modules/mol/base/src/impl/residue_impl.hh
@@ -103,17 +103,12 @@ public:
   /// TorsionImplP will be returned.
   TorsionImplP GetPhiTorsion() const;
 
-  /// \brief Get isp torsion between this and the prev residue
+  /// \brief Retrieve omega torsion between this and the previous residue
   ///
-  /// If no isp torsion has been assigned to this residue an invalid
-  /// TorsionImplP will be returned.
-  TorsionImplP GetIspTorsion() const;
-
-  /// \brief Get omega torsion between this and the prev residue
-  ///
-  /// If no isp torsion has been assigned to this residue an invalid
+  /// If no omega torsion has been assigned to this residue an invalid
   /// TorsionImplP will be returned.
   TorsionImplP GetOmegaTorsion() const;
+  
   /// \brief Get psi torsion
   ///
   /// If no psi torsion has been assigned to this residue an invalid
diff --git a/modules/mol/base/src/residue_base.cc b/modules/mol/base/src/residue_base.cc
index dfd4b16fb..e53801668 100644
--- a/modules/mol/base/src/residue_base.cc
+++ b/modules/mol/base/src/residue_base.cc
@@ -119,12 +119,6 @@ TorsionHandle ResidueBase::GetPsiTorsion() const
   return impl_->GetPsiTorsion();
 }
 
-TorsionHandle ResidueBase::GetIspTorsion() const 
-{
-  this->CheckValidity();
-  return impl_->GetIspTorsion();
-}
-
 TorsionHandle ResidueBase::GetOmegaTorsion() const
 {
   this->CheckValidity();
diff --git a/modules/mol/base/src/residue_base.hh b/modules/mol/base/src/residue_base.hh
index 024812ab6..da5cd0525 100644
--- a/modules/mol/base/src/residue_base.hh
+++ b/modules/mol/base/src/residue_base.hh
@@ -122,12 +122,6 @@ public:
   /// will be returned.
   TorsionHandle GetPsiTorsion() const;
 
-   /// \brief Get isp torsion
-  ///
-  /// If no isp torsion has been assigned to this residue an invalid TorsionHandle
-  /// will be returned.
-  TorsionHandle GetIspTorsion() const;
-
   /// \brief Get omega torsion
   ///
   /// If no omega torsion has been assigned to this residue an invalid TorsionHandle
-- 
GitLab