code: def fix_residue_numbering(self):
          
  
          resid_list = self.aa_resids()
          resid_set  = set(resid_list)
          resid_lst1 = list(resid_set)
          resid_lst1.sort()
          map_res_id = {}
  
          x = 1
          old_chain = resid_lst1[0][0]
          for resid in resid_lst1:
              map_res_id[resid] = resid[0] + '%4.i' % x
              if resid[0] == old_chain:
                  x+=1
              else:
                  x = 1
                  old_chain = resid[0]
  
          atomlines = []
          for line in self.lines:
              if line[0:4] == "ATOM" and line[21:26] in resid_set and line[26] == ' ':
                  lst = [char for char in line]
                  #lst.remove('\n')
                  lst[21:26] = map_res_id[line[21:26]]
                  atomlines.append( string.join(lst,'') )
                  #print string.join(lst,'')
              else:
                  atomlines.append(line)
  
          self.lines = atomlines
          return map_res_id
docs: this function renumbers the res ids in order to avoid strange behaviour of Rosetta