From fec24bae52428155cf8cf31f96114227f4e25698 Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Mon, 26 Sep 2011 13:24:42 +0200
Subject: [PATCH] fix MatchResiduesByNum

the method was doing the "wrong thing" when structure a
had, for example residues with numbers 1 and 3 and
structure two had residues with numbers 2 and 4.
---
 modules/mol/alg/pymod/superpose.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/mol/alg/pymod/superpose.py b/modules/mol/alg/pymod/superpose.py
index 96ad881b0..76d4afe98 100644
--- a/modules/mol/alg/pymod/superpose.py
+++ b/modules/mol/alg/pymod/superpose.py
@@ -112,10 +112,11 @@ def MatchResidueByNum(ent_a, ent_b, atoms='all'):
         while True:
           r_a=residues_a.next()
           r_b=residues_b.next()
-          while r_a.number<r_b.number:
-            r_a=residues_a.next()
-          while r_b.number<r_a.number:
-            r_b=residues_b.next()
+          while r_a.number!=r_b.number:
+            while r_a.number<r_b.number:
+              r_a=residues_a.next()
+            while r_b.number<r_a.number:
+              r_b=residues_b.next()
           assert r_a.number==r_b.number
           result_a,result_b=_fetch_atoms(r_a, r_b, result_a, result_b, atmset)
       except StopIteration:
-- 
GitLab