Index: rmsdfun.f
===================================================================
--- rmsdfun.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ rmsdfun.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,35 +1,31 @@
-! **************************************************************
-!
-! This file contains the subroutines: rmsdfun,rmsdopt,fitmol,
-!                                     jacobi,rmsinit
-!
-! Copyright 2003-2005  Frank Eisenmenger, U.H.E. Hansmann,
-!                      Shura Hayryan, Chin-Ku
-! Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-!                      Jan H. Meinke, Sandipan Mohanty
-!
-! **************************************************************
+c **************************************************************
+c
+c This file contains the subroutines: rmsdfun,rmsdopt,fitmol,
+c                                     jacobi,rmsinit
+c
+c Copyright 2003-2005  Frank Eisenmenger, U.H.E. Hansmann,
+c                      Shura Hayryan, Chin-Ku 
+c Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+c                      Jan H. Meinke, Sandipan Mohanty
+c
+c **************************************************************
 
       real*8 function rmsdfun(nml,ir1,ir2,ixat,xrf,yrf,zrf,isl)
-!
-! --------------------------------------------------------------
-! Wrapping function for calculating rmsd
-!
-! LIMITATION: requires call of rmsinit BEFORE calling this function
-!
-! CALLS: rmsdopt
-!
-! ---------------------------------------------------------------
-!
+C
+C --------------------------------------------------------------
+c Wrapping function for calculating rmsd
+c
+c LIMITATION: requires call of rmsinit BEFORE calling this function
+c
+c CALLS: rmsdopt
+c
+c ---------------------------------------------------------------
+c
       include 'INCL.H'
       include 'INCP.H'
-!
-! Input
-      double precision xrf, yrf, zrf, rm, av1, av2, rssd
-
-      integer nml, ir1, ir2, ixat, isl
-
+c
+c Input
       dimension ixat(mxat),xrf(mxatp),yrf(mxatp),zrf(mxatp)
-! Local
+c Local
       dimension rm(3,3),av1(3),av2(3)
       call rmsdopt(nml,ir1,ir2,ixat,xrf,yrf,zrf,isl,rm,av1,av2,rssd)
@@ -41,40 +37,35 @@
       end
 
-!*******************************************************************
+c*******************************************************************
       subroutine rmsdopt(nml,ir1,ir2,ixat,xrf,yrf,zrf,isl,
-     &                   rm,av1,av2,rmsd)
-
-! ---------------------------------------------------------------
-! PURPOSE: root mean square deviation (rmsd) between current SMMP
-!          structure and reference atom coordinates 'x,y,zrf()'
-!          for range of SMMP residues [ir1,ir2] in molecule 'nml'
-!
-!          ixat(i) - points to the atom in ref. coords., which is
-!                    equivalent to atom i of SMMP structure
-!                    (=0 if no equivalent in ref. structure exists)
-!
-!          isl = 0  : select all heavy atoms
-!          isl = 1  : backbone atoms n,ca,c
-!          isl = 2  : only ca atoms
-!
-! CALLS:   fitmol [S.K.Kearsley, Acta Cryst. 1989, A45, 208-210]
-!
-!      NB  uncomment last lines in 'fitmol' to return coordinates
-!          in 'x2' after fitting the ref. str. onto SMMP structure
-! ----------------------------------------------------------------
+     #                   rm,av1,av2,rmsd)
+
+c ---------------------------------------------------------------
+c PURPOSE: root mean square deviation (rmsd) between current SMMP
+c          structure and reference atom coordinates 'x,y,zrf()'
+c          for range of SMMP residues [ir1,ir2] in molecule 'nml'
+c
+c          ixat(i) - points to the atom in ref. coords., which is
+c                    equivalent to atom i of SMMP structure
+c                    (=0 if no equivalent in ref. structure exists)
+c
+c          isl = 0  : select all heavy atoms
+c          isl = 1  : backbone atoms n,ca,c
+c          isl = 2  : only ca atoms
+c
+c CALLS:   fitmol [S.K.Kearsley, Acta Cryst. 1989, A45, 208-210]
+c
+c      NB  uncomment last lines in 'fitmol' to return coordinates
+c          in 'x2' after fitting the ref. str. onto SMMP structure 
+c ----------------------------------------------------------------
 
       include 'INCL.H'
       include 'INCP.H'
-      
-      double precision x1, x2, xrf, yrf, zrf, rm, av1, av2, rmsd
-
-      integer nml, nr, na, n, im, ir, ia, ir1, ir2, ix, ixat, isl
-
-
-!-------------------------------------------------------- input
+
+c-------------------------------------------------------- input
       dimension ixat(mxat),xrf(mxatp),yrf(mxatp),zrf(mxatp)
-!-------------------------------------------------------- output
+c-------------------------------------------------------- output
       dimension rm(3,3),av1(3),av2(3)
-!-------------------------------------------------------- local
+c-------------------------------------------------------- local
       dimension x1(3,mxat),x2(3,mxat)
       character*4 atnm
@@ -82,6 +73,5 @@
 
       if (nml.lt.1.or.nml.gt.ntlml) then
-        write (logString, *) ' rmsdopt>  Sorry, there is no molecule #',
-     &     nml
+        write(*,*) ' rmsdopt>  Sorry, there is no molecule #',nml
         stop
       endif
@@ -109,14 +99,14 @@
                 if ( isl.eq.0
 
-     &               .or.
-
-     &              (isl.eq.1.and.(index(atnm,'n   ').gt.0 .or.
-     &                             index(atnm,'ca  ').gt.0 .or.
-     &                             index(atnm,'c   ').gt.0 ))
-     &               .or.
-
-     &              (isl.eq.2.and.index(atnm,'ca  ').gt.0)
-
-     &          ) then
+     #               .or.
+
+     #              (isl.eq.1.and.(index(atnm,'n   ').gt.0 .or.
+     #                             index(atnm,'ca  ').gt.0 .or.
+     #                             index(atnm,'c   ').gt.0 ))
+     #               .or.
+
+     #              (isl.eq.2.and.index(atnm,'ca  ').gt.0)
+
+     #          ) then
 
                   n=n+1
@@ -138,5 +128,5 @@
 
       if (n.lt.3) then
-        write (logString, *) ' rmsdopt>  <3 atoms selected !'
+        write(*,*) ' rmsdopt>  <3 atoms selected !'
         stop
       endif
@@ -146,32 +136,27 @@
       return
       end
-! *********************************************
+c *********************************************
       subroutine fitmol(n,x1,x2, rm,a1,a2,rmsd)
-!      real*8 function fitmol(n,x1,x2)
-
-! .......................................................
-! PURPOSE: compute RMSD of n positions in x1(3,) & x2(3,)
-!          [S.K.Kearsley Acta Cryst. 1989,A45,208-210]
-!
-! CALLS: jacobi
-! .......................................................
-!f2py intent(out) rmsd
-
+c      real*8 function fitmol(n,x1,x2)
+
+c .......................................................
+c PURPOSE: compute RMSD of n positions in x1(3,) & x2(3,)
+c          [S.K.Kearsley Acta Cryst. 1989,A45,208-210]
+c
+c CALLS: jacobi
+c .......................................................
+cf2py intent(out) rmsd
+                    
       include 'INCL.H'
-!      implicit real*8 (a-h,o-z)
-!      implicit integer*4 (i-n)
-
-! ------------------------------------------- input/output
-      double precision dn, a1, a2, x1, x2, q, dm, dp, dxm, dym, dzm, dxp
-      double precision dyp, dzp, e, v, em, rmsd, rm
-
-      integer n, i, j, ndim4, im
-
+c      implicit real*8 (a-h,o-z)
+c      implicit integer*4 (i-n)
+ 
+c ------------------------------------------- input/output
       dimension x1(3,mxat),x2(3,mxat)
-! -------------------------------------------------- local
+c -------------------------------------------------- local
       dimension e(4),q(4,4),v(4,4),dm(3),dp(3),a1(3),a2(3),rm(3,3)
 
       dn=dble(n)
-! ------------------- average of coordinates
+c ------------------- average of coordinates
       do i=1,3
         a1(i) = 0.d0
@@ -184,5 +169,5 @@
         a2(i) = a2(i)/dn
       enddo
-! ------------------------- compile quaternion
+c ------------------------- compile quaternion
       do i=1,4
         do j=1,4
@@ -223,8 +208,8 @@
         enddo
       enddo
-! ------------------------------ eigenvalues & -vectors
+c ------------------------------ eigenvalues & -vectors
       ndim4=4
       call jacobi(q,ndim4,e,v)
-! --------------------------- lowest eigenvalue
+c --------------------------- lowest eigenvalue
       im=1
       em=e(1)
@@ -238,7 +223,7 @@
       rmsd = sqrt(em/dn)
 
-! ================= uncomment following lines to fit molecule 2 onto 1
-
-! ---------------------------------------------------rotation matrix
+c ================= uncomment following lines to fit molecule 2 onto 1
+
+c ---------------------------------------------------rotation matrix
       rm(1,1) = v(1,im)**2+v(2,im)**2-v(3,im)**2-v(4,im)**2
       rm(1,2) = 2.d0*( v(2,im)*v(3,im)-v(1,im)*v(4,im) )
@@ -251,47 +236,45 @@
       rm(3,3) = v(1,im)**2+v(4,im)**2-v(2,im)**2-v(3,im)**2
 
-!      do i=1,n
-!        do j=1,3
-!          dm(j) = x2(j,i) - a2(j)
-!        enddo
-!        do j=1,3
-!          dp(j) = a1(j)
-!          do k=1,3
-!            dp(j) = dp(j) + rm(j,k) * dm(k)
-!          enddo
-!          x2(j,i) = dp(j)
-!        enddo
-!      enddo
-
-!      fitmol=rmsd
+c      do i=1,n
+c        do j=1,3
+c          dm(j) = x2(j,i) - a2(j)
+c        enddo
+c        do j=1,3
+c          dp(j) = a1(j)
+c          do k=1,3
+c            dp(j) = dp(j) + rm(j,k) * dm(k)
+c          enddo
+c          x2(j,i) = dp(j)
+c        enddo
+c      enddo
+
+c      fitmol=rmsd
 
       return
       end
-! ******************************
+c ******************************
       subroutine jacobi(a,n,d,v)
 
-! ......................................................
-! PURPOSE: for given symmetric matrix 'a(n,n)
-!          compute eigenvalues 'd' & eigenvectors 'v(,)'
-!
-!  [W.H.Press,S.A.Teukolsky,W.T.Vetterling,
-!   B.P.Flannery, Numerical Recipes in FORTRAN,
-!   Cambridge Univ. Press, 2nd Ed. 1992, 456-462]
-!
-! CALLS: none
-!
-! ......................................................
-
-!f2py intent(out) d
-!f2py intent(out) v
-      integer nmax
-
+c ......................................................
+c PURPOSE: for given symmetric matrix 'a(n,n)
+c          compute eigenvalues 'd' & eigenvectors 'v(,)'
+c
+c  [W.H.Press,S.A.Teukolsky,W.T.Vetterling,
+c   B.P.Flannery, Numerical Recipes in FORTRAN,
+c   Cambridge Univ. Press, 2nd Ed. 1992, 456-462]
+c
+c CALLS: none
+c
+c ......................................................
+
+cf2py intent(out) d
+cf2py intent(out) v
       parameter (NMAX=500)
-
+      
       integer n,nrot,i,ip,iq,j
 
-      character(255) logString
+
       real*8 a(n,n),d(n),v(n,n),
-     &       c,g,h,s,sm,t,tau,theta,tresh,b(NMAX),z(NMAX),smeps
+     #       c,g,h,s,sm,t,tau,theta,tresh,b(NMAX),z(NMAX),smeps
 
       smeps=1.0d-6
@@ -335,5 +318,5 @@
             if((i.gt.4).and.(abs(d(ip))+
 
-     &g.eq.abs(d(ip))).and.(abs(d(iq))+g.eq.abs(d(iq))))then
+     #g.eq.abs(d(ip))).and.(abs(d(iq))+g.eq.abs(d(iq))))then
               a(ip,iq)=0.d0
 
@@ -404,5 +387,5 @@
       enddo
 
-      write (logString, *) ' jacobi> too many iterations'
+      write(*,*) ' jacobi> too many iterations'
       stop
 
@@ -410,28 +393,26 @@
       end
 
-! ***********************************************************
+c ***********************************************************
 
       subroutine rmsinit(nml,string)
-!
-!------------------------------------------------------------------------------
-! Reads in pdb-file 'string' into INCP.H and initalizes
-! the files that 'rmdsopt' needs to calculate the rmsd
-! of a configuration with the pdb-configuration
-!
-! CALLS: pdbread,atixpdb
-!
-! ----------------------------------------------------------------------------
-!
+c
+c------------------------------------------------------------------------------
+c Reads in pdb-file 'string' into INCP.H and initalizes 
+c the files that 'rmdsopt' needs to calculate the rmsd
+c of a configuration with the pdb-configuration
+C
+c CALLS: pdbread,atixpdb
+c
+c ----------------------------------------------------------------------------
+c
       include 'INCL.H'
       include 'INCP.H'
 
-      integer i, nml, ier
-
       character string*(*)
-
+ 
       if(string.eq.'smmp') then
-!
-! Compare with a smmp-structure
-!
+c
+c Compare with a smmp-structure
+c
         do i=iatrs1(irsml1(nml)),iatrs2(irsml2(nml))
          if(nmat(i)(1:1).ne.'h') then
@@ -441,13 +422,13 @@
          end if
         enddo
-!
+c
        else
-!
-! Reference structure is read in from pdb-file
-!
+c
+c Reference structure is read in from pdb-file
+c
          call pdbread(string,ier)
-         if(ier.ne.0) stop
+         if(ier.ne.0) stop 
          call atixpdb(nml)
-!
+c
       end if
       print *,'RMSD initialized with ',string
