Merge branch 'lipid' of mmka.chem.univ.gda.pl:unres into lipid
[unres.git] / source / unres / src_Eshel / rescode.f
diff --git a/source/unres/src_Eshel/rescode.f b/source/unres/src_Eshel/rescode.f
new file mode 100644 (file)
index 0000000..2973ef9
--- /dev/null
@@ -0,0 +1,32 @@
+      integer function rescode(iseq,nam,itype)
+      implicit real*8 (a-h,o-z)
+      include 'DIMENSIONS'
+      include 'COMMON.NAMES'
+      include 'COMMON.IOUNITS'
+      character*3 nam,ucase
+
+      if (itype.eq.0) then
+
+      do i=1,ntyp1
+        if (ucase(nam).eq.restyp(i)) then
+          rescode=i
+          return
+        endif
+      enddo
+
+      else
+
+      do i=1,ntyp1
+        if (nam(1:1).eq.onelet(i)) then
+          rescode=i
+          return  
+        endif  
+      enddo
+
+      endif
+
+      write (iout,10) iseq,nam
+      stop
+   10 format ('**** Error - residue',i4,' has an unresolved name ',a3)
+      end
+