Index: itignore
===================================================================
--- .gitignore	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,8 +1,0 @@
-# Ignore objects and archives.
-*.[oa]
-# Ignore compiled python files
-*.pyc
-# Ignore backup files
-*~
-# Ignore library files
-*.so
Index: EXAMPLES/1bdd.seq
===================================================================
--- EXAMPLES/1bdd.seq	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ EXAMPLES/1bdd.seq	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -5,3 +5,2 @@
   SER GLN SER ALA ASN LEU LEU ALA GLU ALA 
   LYS LYS LEU ASN ASP ALA
-
Index: EXAMPLES/Makefile
===================================================================
--- EXAMPLES/Makefile	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ EXAMPLES/Makefile	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -38,5 +38,5 @@
 # F_FLAGS=-c -fPIC -O3 -funroll-loops -mmmx -msse2 -msse -march=i686 -malign-double -fomit-frame-pointer
 # Select your compiler
-# F90=gfortran
+#F90=gfortran
 F90=ifort
 #F90=pgf90
Index: EXAMPLES/multicanonical.f
===================================================================
--- EXAMPLES/multicanonical.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ EXAMPLES/multicanonical.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -31,5 +31,5 @@
 !     Change the following directory path to where you want to put SMMP
 !     libraries of residues. 
-      libdir='../../SMMP/'
+      libdir='../SMMP/'
 
 !!     Choose energy type with the following switch
@@ -58,5 +58,5 @@
       iabin = 1  ! =0: read from PDB-file
                  ! =1: ab Initio from sequence (& variables)
-      seqfile='1vp.seq'
+      seqfile='enkefa.seq'
 !      varfile='EXAMPLES/enkefa.var'
       varfile = ' '
@@ -77,10 +77,10 @@
       temp=1000.0
 
-!      call mulcan_par(nsweeps, nup, temp, kmin, kmax, binWidth, l_iter)
+      call mulcan_par(nsweeps, nup, temp, kmin, kmax, binWidth, l_iter)
 ! Uncomment the following three lines to perform a multi canonical simulation with
 ! the parameters stored in muca.d
-       nmes = 1000
-       call mulcan_sim(nmes, nsweeps, nmes, nup, kmin, kmax, binWidth, 
-     &                l_iter)
+!       nmes = 1000
+!       call mulcan_sim(nmes, nsweeps, nmes, nup, kmin, kmax, binWidth, 
+!      &                l_iter)
       end program multicanonical_main
 
Index: AMPLES/multicanonical.mod
===================================================================
--- EXAMPLES/multicanonical.mod	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../multicanonical.mod
Index: EXAMPLES/parallel_tempering_p.f
===================================================================
--- EXAMPLES/parallel_tempering_p.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ EXAMPLES/parallel_tempering_p.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -125,4 +125,6 @@
       upchswitch=1
       rndord=.true.
+      
+      if (ientyp.eq.2) call init_lundff
 !     =================================================================
 !     Distribute nodes to parallel tempering tasks
@@ -196,8 +198,5 @@
      &        fileNameMP(filebase, 6, 9, rep_id + 1))
       endif
-      call init_lund
-      if (ientyp.eq.2) call init_lundff
       if (ientyp.eq.3) call init_abgn
-
 
 !     ========================================  start of parallel tempering run
Index: EXAMPLES/parallel_tempering_s.f
===================================================================
--- EXAMPLES/parallel_tempering_s.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ EXAMPLES/parallel_tempering_s.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -20,21 +20,21 @@
       integer switch
 
-! =================================================== Energy setup
+c =================================================== Energy setup
 
-!            Directory for SMMP libraries
-!     Change the following directory path to where you want to put SMMP
-!     libraries of residues. 
+c            Directory for SMMP libraries
+c     Change the following directory path to where you want to put SMMP
+c     libraries of residues. 
       libdir='../SMMP/'
 
-!      The switch in the following line is now not used.
+c      The switch in the following line is now not used.
       flex=.false.        ! .true. for Flex  / .false. for ECEPP
 
-!     Choose energy type with the following switch instead ...
+c     Choose energy type with the following switch instead ...
       ientyp = 0
-!        0  => ECEPP2 or ECEPP3 depending on the value of sh2
-!        1  => FLEX 
-!        2  => Lund force field
-!        3  => ECEPP with Abagyan corrections
-!
+c        0  => ECEPP2 or ECEPP3 depending on the value of sh2
+c        1  => FLEX 
+c        2  => Lund force field
+c        3  => ECEPP with Abagyan corrections
+c
 
       sh2=.false.         ! .true. for ECEPP/2; .false. for ECEPP3
@@ -48,5 +48,5 @@
       call init_energy(libdir)
 
-! ================================================= Structure setup
+c ================================================= Structure setup
 
       grpn = 'nh2' ! N-terminal group
@@ -59,5 +59,5 @@
       ntlml = 0
       write (*,*) 'Solvent: ', itysol
-!     Initialize random number generator.
+c     Initialize random number generator.
       call sgrnd(31433)
       
@@ -69,8 +69,8 @@
 
       call init_molecule(iabin,grpn,grpc,seqfile,varfile)
-! Decide if and when to use BGS, and initialize Lund data structures 
+c Decide if and when to use BGS, and initialize Lund data structures 
       bgsprob=0.75   ! Prob for BGS, given that it is possible
-! upchswitch= 0 => No BGS 1 => BGS with probability bgsprob 
-! 2 => temperature dependent choice 
+c upchswitch= 0 => No BGS 1 => BGS with probability bgsprob 
+c 2 => temperature dependent choice 
       upchswitch=1
       rndord=.true.
@@ -80,5 +80,5 @@
       
 
-! ========================================  Add your task down here
+c ========================================  Add your task down here
       num_rep = 5
       nequi = 100
@@ -87,5 +87,5 @@
       newsta = .true.
       switch = 1
-!     parallel tempering on a single CPU
+c     parallel tempering on a single CPU
       eol = energy()
       write (*,*) "Energy before randomization:", eol
@@ -94,4 +94,4 @@
       write (*,*) "Final energy:", eol
 
-! ========================================  End of main      
+c ========================================  End of main      
        end
Index: EXAMPLES/partem_p.f
===================================================================
--- EXAMPLES/partem_p.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ EXAMPLES/partem_p.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,30 +1,30 @@
-!**************************************************************
-!     
-! This file contains the subroutines: partem_p 
-! Compared to the version in the main distribution, this
-! routine doesn't write the rmsd nor native contacts to the time
-! series.
-!     
-! Copyright 2003-2005  Frank Eisenmenger, U.H.E. Hansmann,
-!                      Shura Hayryan, Chin-Ku Hu
-! Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-!                      Jan H. Meinke, Sandipan Mohanty
-!     
-!     **************************************************************
+c**************************************************************
+c     
+c This file contains the subroutines: partem_p 
+C Compared to the version in the main distribution, this
+C routine doesn't write the rmsd nor native contacts to the time
+C series.
+c     
+c Copyright 2003-2005  Frank Eisenmenger, U.H.E. Hansmann,
+c                      Shura Hayryan, Chin-Ku Hu
+c Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+c                      Jan H. Meinke, Sandipan Mohanty
+c     
+c     **************************************************************
 
       subroutine  partem_p(num_rep, nequi, nswp, nmes, nsave, newsta,
      &                     switch, rep_id, partem_comm)
-!     
-!     PURPOSE: SIMULATION OF PROTEINS BY PARALLEL TEMPERING ALGORITHM 
-!     ON PARALLEL COMPUTERS USING MPI
-!     
-!     switch: Choses the starting configuration:
-!     -1 - stretched configuration
-!     0 - don't change anything
-!     1 - random start configuration
-!     
-!     CALLS:  addang,contacts,energy,hbond,helix,iendst,metropolis,
-!     outvar,(rand),rgyr
-!     
+C     
+C     PURPOSE: SIMULATION OF PROTEINS BY PARALLEL TEMPERING ALGORITHM 
+C     ON PARALLEL COMPUTERS USING MPI
+C     
+C     switch: Choses the starting configuration:
+C     -1 - stretched configuration
+C     0 - don't change anything
+C     1 - random start configuration
+C     
+c     CALLS:  addang,contacts,energy,hbond,helix,iendst,metropolis,
+c     outvar,(rand),rgyr
+C     
       include '../INCL.H'
       include '../INCP.H'
@@ -37,8 +37,8 @@
       external can_weight
 
-!     nequi:  number of Monte Carlo sweeps for thermalization
-!     nswp:   number of Monte Carlo sweeps
-!     nmes:   number of Monte Carlo sweeps between measurments
-!     newsta: .true. for new simulations, .false. for re-start
+C     nequi:  number of Monte Carlo sweeps for thermalization
+C     nswp:   number of Monte Carlo sweeps
+C     nmes:   number of Monte Carlo sweeps between measurments
+C     newsta: .true. for new simulations, .false. for re-start
 
       dimension  eavm(MAX_PROC),sph(MAX_PROC),intem(MAX_PROC),
@@ -50,23 +50,23 @@
       double precision    e_min, e_minp(MAX_PROC), e_minpt(MAX_PROC)
       integer   h_max, h_maxp(MAX_PROC)
-!     Order of replica exchange
+c     Order of replica exchange
       integer   odd
 !     Counter to keep random number generators in sync
       integer randomCount
       
-!     Collect partial energies. Only the root writes to disk. We have to
-!     collect the information from the different replicas and provide 
-!     arrays to store them.
-!     eyslr    storage array for solvent energy
-!     eyelp     -      "        - coulomb energy
-!     eyvwp     -      "        - van-der-Waals energy
-!     eyhbp     -      "        - hydrogen bonding energy
-!     eysmi    -      "        - intermolecular interaction energy
+c     Collect partial energies. Only the root writes to disk. We have to
+c     collect the information from the different replicas and provide 
+c     arrays to store them.
+c     eyslr    storage array for solvent energy
+c     eyelp     -      "        - coulomb energy
+c     eyvwp     -      "        - van-der-Waals energy
+c     eyhbp     -      "        - hydrogen bonding energy
+c     eysmi    -      "        - intermolecular interaction energy
       double precision eyslr(MAX_PROC)
       double precision eyelp(MAX_PROC),eyvwp(MAX_PROC),eyhbp(MAX_PROC), 
      &     eyvrp(MAX_PROC),eysmip(MAX_PROC)
-!     Collect information about accessible surface and van-der-Waals volume
-!     asap      storage array for solvent accessible surface
-!     vdvolp     storage array for van-der-Waals volume
+c     Collect information about accessible surface and van-der-Waals volume
+c     asap      storage array for solvent accessible surface
+c     vdvolp     storage array for van-der-Waals volume
       double precision asap(MAX_PROC), vdvolp(MAX_PROC)
 
@@ -75,11 +75,11 @@
       integer imhbp(MAX_PROC)
       character*80 filebase, fileNameMP, tbase0,tbase1
-!     frame     frame number for writing configurations
-!     trackID   configuration that should be tracked and written out
-!     dir          direction in random walk
-!     -1 - visited highest temperature last
-!     1 - visited lowest temperature last
-!     0 - haven't visited the boundaries yet.
-!     dirp      storage array for directions.
+c     frame     frame number for writing configurations
+c     trackID   configuration that should be tracked and written out
+c     dir          direction in random walk
+c     -1 - visited highest temperature last
+c     1 - visited lowest temperature last
+c     0 - haven't visited the boundaries yet.
+c     dirp      storage array for directions.
       integer frame, trackID, dir
       integer dirp(MAX_PROC)
@@ -92,7 +92,7 @@
      &            rep_id, num_rep, partem_comm, myrank
       call flush(6)
-!     
-!     
-!     File with temperatures 
+C     
+c     
+C     File with temperatures 
       open(11,file='temperatures_abeta',status='old')
       
@@ -100,9 +100,9 @@
       open(18,file=fileNameMP(tbase0,5,9,rep_id),status='unknown')
       if (rep_id.eq.0.and.myrank.eq.0) then
-!     File with time series of simulation
+c     File with time series of simulation
          open(14,file='ts.d',status='unknown')
       endif
       
-!     READ IN TEMPERATURES
+C     READ IN TEMPERATURES
       do i=1,num_rep
          read(11,*) j,temp
@@ -111,8 +111,8 @@
       close(11)
 
-!     nresi:  number of residues
+c     nresi:  number of residues
       nresi=irsml2(1)-irsml1(1)+1
-!     
-!     Initialize variables
+C     
+C     Initialize variables
       do i=1,num_rep      
          acx1(i) = 0.0d0
@@ -132,5 +132,5 @@
       dir = dirp(rep_id + 1)
 
-!     _________________________________ Initialize Variables
+c     _________________________________ Initialize Variables
       if(newsta) then
          iold=0
@@ -139,5 +139,5 @@
             intem(i) = i
          end do
-!     _________________________________ initialize starting configuration
+c     _________________________________ initialize starting configuration
          if (switch.ne.0) then
             do i=1,nvr
@@ -173,9 +173,9 @@
          CALL MPI_BCAST(INODE,num_rep,MPI_INTEGER,0,MPI_COMM_WORLD,IERR)
          CALL MPI_BCAST(YOL,num_rep,MPI_DOUBLE_PRECISION,0,
-     &        MPI_COMM_WORLD,IERR)
+     #        MPI_COMM_WORLD,IERR)
          CALL MPI_BCAST(E_MINP, num_rep, MPI_DOUBLE_PRECISION, 0, 
-     &        MPI_COMM_WORLD, IERR)
+     #        MPI_COMM_WORLD, IERR)
          CALL MPI_BCAST(h_maxp,num_rep,MPI_INTEGER,0,MPI_COMM_WORLD,
-     &        IERR)
+     $        IERR)
       end if
       
@@ -189,8 +189,8 @@
          write(*,*) rep_id, yol(rep_id + 1), eol
       endif
-!     Start of simulation
+C     Start of simulation
       write (*,*) '[',rep_id, myrank, beta, partem_comm,
      &            '] Energy before equilibration:', eol
-!     =====================Equilibration by canonical Metropolis
+c     =====================Equilibration by canonical Metropolis
       do nsw=1,nequi
          call metropolis(eol,acz,can_weight)
@@ -199,9 +199,9 @@
       write (*,*) '[',rep_id,'] Energy after equilibration:', eol
       call flush(6)
-!     
-!======================Multiple Markov Chains
+C     
+C======================Multiple Markov Chains
       acz = 0
       do nsw=1,nswp
-!------------First ordinary Metropolis 
+c------------First ordinary Metropolis 
          call metropolis(eol,acz,can_weight)
          iold = iold + 1	
@@ -214,10 +214,10 @@
             endif
             acz0 = acz
-!     Measure global radius of gyration
+C     Measure global radius of gyration
             call rgyr(0,rgy,ee)  
             rgyp = rgy
-!     Measure Helicity and Sheetness
+C     Measure Helicity and Sheetness
             call helix(nhel,mhel,nbet,mbet)
-!     Measure Number of hydrogen bonds
+C     Measure Number of hydrogen bonds
             mhb = 0
             do i = 1, ntlml
@@ -226,10 +226,10 @@
             enddo
             call interhbond(imhb) 
-!     Measure total number of contacts (NCTOT) and number of
-!     native contacts (NCNAT)
+C     Measure total number of contacts (NCTOT) and number of
+C     native contacts (NCNAT)
             call contacts(nctot,ncnat,dham)
-!     Add tracking of lowest energy configuration
+c     Add tracking of lowest energy configuration
             if (eol.lt.e_min) then
-!     Write out configuration
+c     Write out configuration
                i=rep_id+1
                j=inode(i)
@@ -248,7 +248,7 @@
                close(15)
             endif
-!     Add tracking of configuration with larges hydrogen contents.
+c     Add tracking of configuration with larges hydrogen contents.
             if ((mhb + imhb).gt.h_max) then
-!     Write out configuration
+c     Write out configuration
                i = rep_id + 1
                j = inode(i)
@@ -268,6 +268,6 @@
             endif
 
-!     
-!--------------------Gather measurement data
+C     
+C--------------------Gather measurement data
 ! I only use the master node of each replica for data collection. The
 ! variable partem_comm provides the appropriate communicator.
@@ -310,10 +310,10 @@
      &              MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
 
-!     Write trajectory
+c     Write trajectory
                write (18,*) '@@@',iold,inode(rep_id+1)
                call outvbs(0,18)
                write (18,*) '###'
 !                call flush(18)
-!     Write current configuration
+c     Write current configuration
                if ((mod(iold, nsave).eq.0)) then
                   filebase = "conf_0000.var"
@@ -324,15 +324,15 @@
             if(rep_id.eq.0.and.myrank.eq.0) then
                randomCount = 0
-!  Update acceptance, temperature wise average of E and E^2 used to calculate
-!  specific heat. 
+c  Update acceptance, temperature wise average of E and E^2 used to calculate
+c  specific heat. 
                do i=1,num_rep
                   j=intem(i)
                   acy(i)=0.0
-!  Above: contents of acy1 are added to acy(i) a few lines down. 
-!  acy1(intem(i)) contains information received from the node at temperature
-!  i, on how many updates have been accepted in node intem(i). Since acz
-!  is not reset to 0 every cycle, acy(i) must be set to 0 here. Else, there 
-!  will be serious double counting and the values of acceptance printed 
-!  will be simply wrong.
+c  Above: contents of acy1 are added to acy(i) a few lines down. 
+c  acy1(intem(i)) contains information received from the node at temperature
+c  i, on how many updates have been accepted in node intem(i). Since acz
+c  is not reset to 0 every cycle, acy(i) must be set to 0 here. Else, there 
+c  will be serious double counting and the values of acceptance printed 
+c  will be simply wrong.
                   e_minpt(i)=e_minp(intem(i))
                end do
@@ -346,5 +346,5 @@
 
 
-!     Write measurements to the time series file ts.d
+C     Write measurements to the time series file ts.d
                do i=1,num_rep
                   j=intem(i)
@@ -354,5 +354,5 @@
                       
                end do
-!     Write the current parallel tempering information into par_R.in
+c     Write the current parallel tempering information into par_R.in
                if ((mod(iold, nsave).eq.0))
      &         then
@@ -363,6 +363,6 @@
      &                    h_maxp(i)
                   end do
-!     -------------------------- Various statistics of current run
-!               swp=nswp-nequi
+C     -------------------------- Various statistics of current run
+c               swp=nswp-nequi
                   swp=nsw
                   write(13,*) 'Acceptance rate for change of chains:'
@@ -370,7 +370,7 @@
                      temp=1.0d0/pbe(k1)/0.00198773
                      write(13,*) temp, acx1(k1)*2.0d0*nmes/swp 
-!  Above: it's the acceptance rate of exchange of replicas. Since a 
-!  replica exchange is attempted only once every nmes sweeps, the 
-!  rate should be normalized with (nmes/swp).
+c  Above: it's the acceptance rate of exchange of replicas. Since a 
+c  replica exchange is attempted only once every nmes sweeps, the 
+c  rate should be normalized with (nmes/swp).
                   end do 
                   write(13,*)
@@ -381,12 +381,12 @@
                      geavm(k1) = nmes*eavm(k1)/swp
                      gsph(k1)  = (nmes*sph(k1)/swp-geavm(k1)**2)
-     &                    *beta*beta/nresi
+     #                    *beta*beta/nresi
                      write(13,'(a,2f9.2,i4,f12.3)') 
      &                    'Temperature, Node,local acceptance rate:',
      &                    beta,temp,k,acy(k1)/dble(nsw*nvr)
-!  Above: Changed (nswp-nequi) in the denominator of acceptance as 
-!  acceptance values are initialized to 0 after equilibration cycles are
-!  finished. Note also that since this is being written in the middle of
-!  the simulation, it is normalized to nsw instead of nswp.
+c  Above: Changed (nswp-nequi) in the denominator of acceptance as 
+c  acceptance values are initialized to 0 after equilibration cycles are
+c  finished. Note also that since this is being written in the middle of
+c  the simulation, it is normalized to nsw instead of nswp.
                      write(13,'(a,3f12.2)') 
      &                    'Last Energy, Average Energy, Spec. Heat:', 
@@ -401,10 +401,10 @@
                end if   
 
-!--------------------Parallel Tempering  update
-!     Swap with right neighbor (odd, even)            
+C--------------------Parallel Tempering  update
+c     Swap with right neighbor (odd, even)            
                if(odd.eq.1) then
                   nu=1
                   no1 = num_rep-1
-!     Swap with left neighbor (even, odd)
+c     Swap with left neighbor (even, odd)
                else
                   nu = 2
@@ -413,5 +413,5 @@
                do i=nu,no1,2
                   j=i+1
-!     Periodic bc for swaps
+c     Periodic bc for swaps
                   if(i.eq.num_rep) j=1
                   iidx=intem(i)
@@ -429,13 +429,13 @@
                   end if
                end do
-!     ---------------- End Loop over nodes which creates a new temperature
-!     map for all nodes, at the node with rank 0. 
-!     
+c     ---------------- End Loop over nodes which creates a new temperature
+c     map for all nodes, at the node with rank 0. 
+c     
                odd = 1 - odd
             end if
-!     End of "if (myrank.eq.0) ...". The block above includes PT update and 
-!     writing of observables into the time series file etc. 
+c     End of "if (myrank.eq.0) ...". The block above includes PT update and 
+c     writing of observables into the time series file etc. 
            
-!     Below: Communicate new temperature-node map to all nodes
+c     Below: Communicate new temperature-node map to all nodes
             CALL MPI_BCAST(INTEM,num_rep,MPI_INTEGER,0,MPI_COMM_WORLD,
      &           IERR)
@@ -446,5 +446,5 @@
             CALL MPI_BCAST(H_MAXP,num_rep,MPI_INTEGER,0,MPI_COMM_WORLD,
      &           IERR)
-! Synchronize random number generators for replica 0
+c Synchronize random number generators for replica 0
             if (rep_id.eq.0) then
                CALL MPI_BCAST(randomCount,1,MPI_INTEGER,0,my_mpi_comm,
@@ -467,10 +467,10 @@
 
          endif
-!        End of "if (mod(iold,nmes).eq.0) ..."
+c        End of "if (mod(iold,nmes).eq.0) ..."
       end do
-!-----------End Loop over sweeps
-!     
-!     OUTPUT:
-!--------------------For Re-starts:
+c-----------End Loop over sweeps
+c     
+C     OUTPUT:
+C--------------------For Re-starts:
       nu = rep_id + 1
       filebase = "conf_0000.var"
@@ -484,7 +484,7 @@
       if (partem_comm.ne.MPI_COMM_NULL) then
          CALL MPI_GATHER(EOL0,1,MPI_DOUBLE_PRECISION,YOL,1,
-     &        MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
+     #        MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
          CALL MPI_GATHER(acz0,1,MPI_DOUBLE_PRECISION,acy1,1,
-     &     MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
+     #     MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
       endif
       
@@ -496,5 +496,5 @@
             write(13,*) i,inode(i),intem(i),yol(i),e_minp(i),h_maxp(i)
          end do
-!     -------------------------- Various statistics of current run
+C     -------------------------- Various statistics of current run
          swp=nswp
          write(13,*) 'Acceptance rate for change of chains:'
@@ -519,9 +519,9 @@
          end do
          close(13)
-!         close(16)
+c         close(16)
       end if
       close(18)
 
-!     =====================
+c     =====================
       CALL MPI_BARRIER(MPI_COMM_WORLD,IERR)
 
Index: INCL.H
===================================================================
--- INCL.H	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ INCL.H	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,16 +1,9 @@
-      implicit none
-      
+      implicit integer*4 (i-n)
+      implicit real*8 (a-h,o-z)	
       character*255 version
-      character*255 logString
-
-      integer MAX_REPLICA, MAX_PROC, mxml, mxrs, mxat, mxbd, mxath
-      integer mxvr, mxms, mxvw, mx14, mxvrh, mxtyat, mxhbdo
-      integer mxhbac, mxtybl, mxtyba, mxtyto, mxrt, mxvrrt, mxrtsu
-      integer nrsty
-      integer MAXLOGLEVEL, LOGFILEUNIT
-      double precision pi, pi2, pi4, crd, cdr, zero, one
-      integer izero, ione
-
-      parameter(MAX_PROC=2048)
+
+      integer MAX_REPLICA, MAX_PROC
+
+      PARAMETER(MAX_PROC=2048)
       parameter (MAX_REPLICA = 2048)                                       ! max. number of replicas
       parameter (mxml=10)                                                ! max. number of molecules
@@ -51,6 +44,4 @@
       integer seed
       integer enysolct
-      double precision boxsize
-      common /logging/MAXLOGLEVEL,LOGFILEUNIT
       common /counter/enysolct
       common /commonrandom/ seed
@@ -60,9 +51,6 @@
       integer workPerProcessor(0:mxml, 0:MAX_PROC)
       common/paral/myrank,no,my_mpi_comm,workPerProcessor
-      double precision beta
       common /bet/beta
 !==   For solvent============================
-      integer mxpoint, mxbox, mxinbox, mxtysol
-      double precision rwater
       parameter (mxpoint=2000)                                          !
       parameter(mxbox=80000)                                          !
@@ -72,9 +60,6 @@
 
 !==   Solvent types 
-      integer itysol
       logical isolscl
       common /isolty/ itysol, isolscl
-      double precision spoint, coef_sl, rad_vdw, surfres, rsstrg
-      integer npnt
       common /tes/ spoint(mxpoint,3)
       common /pnt/ npnt
@@ -85,19 +70,15 @@
 
 !----  The vdW radii of the atoms and solvation coefficients
-       double precision rvdw, sigma
        common /solvent/ rvdw(mxat),sigma(mxat)
 
 !     vdvol - van der Waals volume of the molecule
 !     asa   - Surface of molecule
-      double precision vdvol, asa, asap, asah
       common /v_sol/ vdvol,asa,asap,asah
 
 !     gradan - analytical gradients of solv. energy against atomic coordinates
-      double precision gradan
       common /deriv/ gradan(mxat,3)
 
 
 !-----For calculation of hydrogen bonds
-      integer mxtyhb, ntyhb, ixtyhb, nutyhb, mmhb, nvr
       parameter(mxtyhb=100) !  Maximum number of hydrogen bond types
       common /h_bond/ ntyhb,ixtyhb(mxtyhb),nutyhb(mxtyhb),              &
@@ -105,7 +86,6 @@
 !-----For molecule parameter
       common/mol_par/ nvr
-      
+
 !-----Hydrophobic/polar radius of gyration
-      double precision rgyh, rgyp
       common /rgy/ rgyh, rgyp
 !=======================================  
@@ -121,10 +101,9 @@
 ! simple pivot update and BGS
       logical rndord
-      integer upchswitch, idloa, idloz, idupa, idupz
+      integer upchswitch
       double precision bgsprob
       common /updchois/rndord,upchswitch,bgsprob
       common /con_i/ idloa,idloz,idupa,idupz      
 !---- The contact matrix and the indices of C_alpha atoms
-      integer ijcont, ind_alf, iref, nci
       common/cont_i_j/ ijcont(mxrs,mxrs),ind_alf(mxrs)
       common /jref/ iref(mxrs,mxrs),nci
@@ -144,5 +123,5 @@
 !  varfil - name of file with commands to set variables
 !  rstfil - name of file with variable restraints
-      integer lunlib, lunseq, lunchg, lunvar, lunrst
+
       common /fil_i/ lunlib,lunseq,lunchg,lunvar,lunrst
       character reslib*80,seqfil*80,chgfil*80,varfil*80,rstfil*80
@@ -167,6 +146,5 @@
 !  gbpr - 6 global parameters per molecule (3 shifts, 3 angles)
 ! --------------------------------------------------------------------
-      integer ntlml, irsml1, irsml2, ivrml1, nvrml, imsml1, nmsml
-      integer iadml1, nadml, ixrfpt, ixatp, ireg
+
       common /mol_i/ ntlml,irsml1(mxml),irsml2(mxml),ivrml1(mxml),      &
      &nvrml(mxml),imsml1(mxml),nmsml(mxml),iadml1(mxml),nadml(mxml)     &
@@ -182,6 +160,5 @@
       common /mol_c/ nmml
 
-! ----------------------------------------- 
-      double precision rfpt, gbpr, xrfax, yrfax, zrfax
+! ----------------------------------------- new
       common /mol_r/ rfpt(3,mxml),gbpr(6,mxml),                         &
      &xrfax(3,mxml),yrfax(3,mxml),zrfax(3,mxml)
@@ -192,5 +169,5 @@
 !  ivrrs1,nvrrs  - index of 1st/number of local variable for residue
 !  seq    - names of residues
-      integer iatrs1, iatrs2, ixatrs, ivrrs1, nvrrs
+
       common /res_i/ iatrs1(mxrs),iatrs2(mxrs),ixatrs(mxrs),ivrrs1(mxrs)&
      &              ,nvrrs(mxrs)
@@ -224,8 +201,5 @@
 !  zat    - |
 !  nmat   - atom name
-      integer ityat, iowat, iyowat, nbdat, ibdat, iybdat, ixmsat
-      double precision xbaat, ybaat, zbaat, baat, snbaat, csbaat, xtoat
-      double precision ytoat, ztoat, toat, sntoat, cstoat, blat, xat
-      double precision yat, zat, cgat
+
       common /atm_i/ ityat(mxat),iowat(mxat),iyowat(mxat),nbdat(mxat),  &
      &               ibdat(mxbd,mxat),iybdat(mxbd,mxat),ixmsat(mxat)    
@@ -257,7 +231,4 @@
 !  fxvr - .true. if variable will be fixed throughout calculations
 
-      double precision olvlvr, vlvr, axvr
-      integer iatvr, ityvr, iclvr, iorvr, imsvr1, imsvr2, latms1
-      integer latms2, iadvr1, iadvr2, ladvr, idvr
       common /var_r/ olvlvr(mxvr),vlvr(mxvr),axvr(mxvr)
       common /var_i/ iatvr(mxvr),ityvr(mxvr),iclvr(mxvr),iorvr(mxvr),   &
@@ -280,6 +251,5 @@
 !  eps_s - distance-INdependent diel. constant
 !  do_s,ac_s - flag to define atom-types serving as donors/acceptors in HB
-      double precision ehm, atpl, efel, emin, rmin, chb_s, ahb_s, e0to_s
-      double precision sgto_s, rnto_s, eps_s
+
       common /sche_r/ ehm,atpl(mxtyat),efel(mxtyat),emin(mxtyat),       &
      &    rmin(mxtyat),chb_s(mxhbdo,mxhbac),ahb_s(mxhbdo,mxhbac),       &
@@ -298,6 +268,4 @@
 !  do_f,ac_f - flags atom-types serving as donors/acceptors in HB
 
-      double precision c_f, a_f, chb_f, ahb_f, e0to_f, sgto_f, rnto_f
-      double precision plt_f, slp_f, cohb_f
       common /flex_r/ c_f(mxtyat,mxtyat),a_f(mxtyat,mxtyat),            &
      &            chb_f(mxhbdo,mxhbac),ahb_f(mxhbdo,mxhbac),            &
@@ -322,7 +290,5 @@
 !  ientyp : 0 => ECEPP, 1 => FLEX, 2 => Lund, 3 => ECEPP+Abagyan
 !  tesgrd - .true. if GRADTEST to be included
-      integer ihbty, ientyp
-      double precision cij, aij, a14, chb, ahb, e0to, sgto, rnto, esnto
-      double precision conv, plt, slp, cohb
+
       common /epar_i/ ihbty(mxtyat,mxtyat)
       common /epar_r/ cij(mxtyat,mxtyat),aij(mxtyat,mxtyat),            &
@@ -352,9 +318,4 @@
 !  wtey - weight to energy & energy gradient
 !  wtrg - weight to reg. target & its gradient
-      integer nvwml, ivwml1, n14ml, i14ml1, ivwat1, ivwat2, i14at1
-      integer i14at2, lvwat1, lvwat2, l14at, ixatvw, ixat14
-      double precision eyel, eyvw, eyhb, eyvr, eysm, eysl, eyrg, eyslh
-      double precision eyslp, eyab, eysmi, eyhbi, eyeli, eyvwi, gdeyvr
-      double precision gdeyrg, gdeysl, gdeygb, wtey, wtrg
       common /eny_i/ nvwml(mxml),ivwml1(mxml),n14ml(mxml),i14ml1(mxml), &
      &               ivwat1(mxat),ivwat2(mxat),i14at1(mxat),i14at2(mxat)&
@@ -379,7 +340,4 @@
 !  i1vrsu,i2vrsu - 1st,last pointer in 'ipvrsu' per var. subset
 !  ipvrsu - pointers var. subset -> variables
-      integer ntlrt, ntlsu, i1vrrt, i2vrrt, i1rtsu, nrtsu
-      integer iprtsu, i1vrsu, i2vrsu, ipvrsu
-      double precision pbrt, vuvrrt, dvvrrt
 
       common /rstr_i/ ntlrt,ntlsu,i1vrrt(mxrt),i2vrrt(mxrt),            &
@@ -396,7 +354,5 @@
 
 !   arrays for help
-      integer ityath, iowath, iyowath, nbdath, ibdath, iybdath, ityvrh
-      integer iclvrh, iatvrh
-      double precision blath, baath, toath, cgath
+
       common /help_i/ ityath(mxath),iowath(mxath),iyowath(mxath),       &
      &                nbdath(mxath),ibdath(mxbd,mxath),                 &
Index: INCP.H
===================================================================
--- INCP.H	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ INCP.H	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,56 +1,52 @@
-! ......................
-! contents of a PDB file
-! ......................
-      integer MXCHP, MXRSP, MXATP, nchp, nchrsp, nrsp, irsatp, nrsatp
-      integer natp, noatp
-      
-      double precision xatp, yatp, zatp
+c ......................
+c contents of a PDB file
+c ......................
 
       parameter (MXCHP =100,    ! max. no. of polypeptide chains
-     &           MXRSP =1000,   ! max. no. of residues
-     &           MXATP =10000)  ! max. no. of atoms
+     #           MXRSP =1000,   ! max. no. of residues
+     #           MXATP =10000)  ! max. no. of atoms
 
-!   nchp      - no. of polypeptide chains
-!   nchrsp()  - no. of residues / chain
-!   nrsp      - total no. of residues
-!   irsatp()  - index of 1st atom / res.
-!   nrsatp()  - no. of atoms / res.
-!   natp      - total no. of selected atoms
-!   noatp()   - atom numbers
+c   nchp      - no. of polypeptide chains
+c   nchrsp()  - no. of residues / chain
+c   nrsp      - total no. of residues
+c   irsatp()  - index of 1st atom / res.
+c   nrsatp()  - no. of atoms / res.
+c   natp      - total no. of selected atoms
+c   noatp()   - atom numbers
 
       common /pdb_i/ nchp,nchrsp(MXCHP),
-     &               nrsp,irsatp(MXRSP),nrsatp(MXRSP),
-     &               natp,noatp(MXATP)
+     #               nrsp,irsatp(MXRSP),nrsatp(MXRSP),
+     #               natp,noatp(MXATP)
       save /pdb_i/
 
-!   chnp()  - chain identifiers
-!   rsidp() - residue identifiers (number + insertion code)
-!   rsnmp() - residues (sequence, 3-letter code)
-!   atnmp() - atom names
+c   chnp()  - chain identifiers
+c   rsidp() - residue identifiers (number + insertion code)
+c   rsnmp() - residues (sequence, 3-letter code)
+c   atnmp() - atom names
 
       character chnp(MXCHP),
-     &          rsidp(MXRSP)*5,rsnmp(MXRSP)*3,
-     &          atnmp(MXATP)*4
+     #          rsidp(MXRSP)*5,rsnmp(MXRSP)*3,
+     #          atnmp(MXATP)*4
 
       common /pdb_c/ chnp,rsnmp,rsidp,atnmp
       save /pdb_c/
 
-!     xatp,yatp,zatp - atom coordinates
+c     xatp,yatp,zatp - atom coordinates
 
       common /pdb_r/ xatp(MXATP),yatp(MXATP),zatp(MXATP)
       save /pdb_r/
 
-! ------------------- code to list all PDB information
-!      ir=0
-!      do i=1,nchp
-!        write (logString, *) ' ===== chain |',chnp(i),'|'
-!        do j=1,nchrsp(i)
-!          ir=ir+1
-!          write (logString, *) ' ----- ',rsidp(ir),' ',rsnmp(ir),' ',nrsatp(ir)
-!          k1=irsatp(ir)
-!          k2=k1+nrsatp(ir)-1
-!          do k=k1,k2
-!            write (logString, *) ' ',noatp(k),' ',atnmp(k),' ',(xyzp(l,k),l=1,3)
-!          enddo
-!        enddo
-!      enddo
+c ------------------- code to list all PDB information
+c      ir=0
+c      do i=1,nchp
+c        write(*,*) ' ===== chain |',chnp(i),'|'
+c        do j=1,nchrsp(i)
+c          ir=ir+1
+c          write(*,*) ' ----- ',rsidp(ir),' ',rsnmp(ir),' ',nrsatp(ir)
+c          k1=irsatp(ir)
+c          k2=k1+nrsatp(ir)-1
+c          do k=k1,k2
+c            write(*,*) ' ',noatp(k),' ',atnmp(k),' ',(xyzp(l,k),l=1,3)
+c          enddo
+c        enddo
+c      enddo
Index: Makefile
===================================================================
--- Makefile	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ Makefile	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -4,7 +4,4 @@
 
 %_p.o : %_p.f
-	$(MPIF90) $(F_FLAGS) $<
-	
-%_p.o : %_p.F
 	$(MPIF90) $(F_FLAGS) $<
 	
@@ -17,9 +14,6 @@
 	$(F90) $(F_FLAGS) $<
 
-.SUFFIXES:	.o .F90
-.F90.o:
-	$(F90) $(F_FLAGS) $<
 # ==================================== Variables for compiling and linking
-L_FLAGS=-g
+# L_FLAGS=-g
 # Linker flags
 # Default flags, e.g., for gfortran, g77
@@ -27,8 +21,8 @@
 
 # Flags for Intel's ifort
-#L_FLAGS=-O3 -axT -g
-#L_FLAGS=-fast -parallel
+# L_FLAGS=-O3 -axW -g
+
 # FLAGS for Cray
-# L_FLAGS=-fast -Mipa
+# L_FLAGS=-fastsse -Mipa
 
 # Flags for xlf
@@ -42,10 +36,9 @@
 F_FLAGS=-c -O2 -g
 # Flags for Intel's ifort
-#F_FLAGS=-c -O3 -axT -g
-#F_FLAGS=-c -fast -parallel
+# F_FLAGS=-c -O3 -axW -g
 # Flags for debugging build
 # F_FLAGS=-c -O0 -g
 # FLAGS for Cray
-#F_FLAGS=-c -fast -Mipa -Minfo
+# F_FLAGS=-c -fastsse -Mipa
 # Flags for xlf
 #F_FLAGS=-c -O3 -qhot -q64 -qipa -qextname=flush
@@ -55,8 +48,8 @@
 
 # Select your compiler
+F90=gfortran
 #F90=ifort
 #F90=pgf90
 #F90=xlf
-F90=gfortran
 MPIF90=mpif90
 
@@ -72,5 +65,5 @@
 init_energy.o init_molecule.o gradient.o energy.o \
 regul.o nursvr.o twister.o eninteract.o bgs.o eyabgn.o enylun.o utilities.o\
-partem_s.o esolan.o opesol.o init_lund.o enyshe_simple.o timer.o
+partem_s.o esolan.o opesol.o
 #_________Serial implementation of ECEPP/3 and solvent
 SOBJ=enyshe.o enysol.o
@@ -84,15 +77,13 @@
 pdbread.f  rmsdfun.f opereg.f mincjg.f cnteny.f  init_energy.f init_molecule.f \
 gradient.f regul.f nursvr.f twister.f eninteract.f bgs.f eyabgn.f enylun.f \
-mulcan_par_mod.f90 esolan.f opesol.f init_lund.f90
+mulcan_par_mod.f90 esolan.f opesol.f
 # partem_s.f
 
 
-pyInterface=init_molecule init_energy \
+pyInterface=init_molecule init_energy mulcan_par mulcan_sim \
 init_lund sgrnd energy helix zimmer rgyr rmsdfun \
-anneal  outpdb  minim  regul contacts interhbond hbond setvar\
-enysol 
-#canon mulcan_par mulcan_sim metropolis
+anneal canon  outpdb  minim  regul contacts interhbond hbond
+# metropolis
 # ============================================== Linking
-all: $(PROG)
 
 $(PROG):	$(OBJ) $(SOBJ) main.o
@@ -103,5 +94,5 @@
 	$(MPIF90) -o $(PROG) $(L_FLAGS) main_p.o $(OBJ) $(POBJ)
 
-# Cross compile for BlueGene/L 
+# Cross compile for BlueGene/P 
 bgl: BGL_L_FLAGS = -L$(BGLSYS)/lib -lmpich.rts -lfmpich.rts -lmsglayer.rts -lrts.rts -ldevices.rts -qextname=flush
 bgl: F_FLAGS = -c -O5 -qhot -g -I$(BGLSYS)/include -L$(BGLSYS)/lib -qarch=440 -qtune=440 -qextname=flush
@@ -115,42 +106,14 @@
 	$(BGL_F90) -o $(PROG).rts $(BGL_L_FLAGS) main_bgl_p.o $(OBJ) $(POBJ) $(LIBSF_MPI)
 
-# Cross compile for BlueGene/P 
-bgp: BGP_SYS = /bgsys/drivers/ppcfloor/comm
-bgp: DIRCOMP = /opt/ibmcmp/xlf/bg/11.1/bin
-bgp: BGP_L_FLAGS = -O3 -qhot -g -I$(BGP_SYS)/include -qarch=440 -qtune=440 -qextname=flush
-bgp: F_FLAGS = -c -O3 -qhot -g -I$(BGP_SYS)/include -qarch=440 -qtune=440 -qextname=flush
-bgp: BGP_F90 = bgxlf
-bgp: F90 = $(BGP_F90)
-bgp: MPIF90 = $(BGP_F90)
-bgp: LIBS=-Wl,-allow-multiple-definition $(MASS) $(ESSL) -L$(BGP_SYS)/lib -lmpich.cnk -ldcmfcoll.cnk -ldcmf.cnk -L/bgsys/drivers/ppcfloor/runtime/SPI -lSPI.cna -lrt -lpthread
-
-bgp: $(OBJ) $(POBJ) main_p.o
-	$(BGP_F90) -o $(PROG).rts $(BGP_L_FLAGS) main_p.o $(OBJ) $(POBJ) $(LIBS)
-
 # Build the python bindings
-# 
-# The following line creates a minimal interface
-#
-# f2py --overwrite-signature -h basic_smmp.pyf -m smmp init_molecule.f init_energy.f energy.f utilities.f
-#
-# The following line includes the minimum set of files needed to fullfill all dependencies.
-#
-# f2py -c -m smmp_p basic_smmp.pyf init_molecule.f init_energy.f bldmol.f nursvr.f pdbread.f redvar.f redseq.f outvar.f redstr.f enysol.f setmvs.f mklist.f getmol.f helix.f contacts.f dihedr.f setvar.f init_lund.f90 rmsdfun.f addend.f difang.f
 pybind: $(FILES)
 	#./rmexclpoint.py $(FILES)
-	f2py -c -m smmp smmp.pyf $(FILES) --fcompiler=gnu95
+	f2py -c -m smmp smmp.pyf $(FILES) --f90exec=$(F90) --f77exec=$(F90)
 	#./restoreexclpoint.py $(FILES)
-
-# Compile bindings that include enyshe_p
-ppybind: basic_smmp.pyf init_molecule.f init_energy.f bldmol.f nursvr.f pdbread.f redvar.f redseq.f outvar.f redstr.f enysol.f setmvs.f mklist.f getmol.f helix.f contacts.f dihedr.f setvar.f init_lund.f90 rmsdfun.f addend.f difang.f energy.f enyshe_p.f enyflx.f enylun.f eninteract.f enyreg.f eyabgn.f esolan.f gradient.f twister.f opesol.f opeflx.f opereg.f opeshe.f utilities.f
-	f2py -c -m smmp_p basic_smmp.pyf init_molecule.f init_energy.f bldmol.f nursvr.f pdbread.f redvar.f redseq.f outvar.f redstr.f enysol_p.f setmvs.f mklist.f getmol.f helix.f contacts.f dihedr.f setvar.f init_lund.f90 rmsdfun.f addend.f difang.f energy.f enyshe_p.f enyflx.f enylun.f eninteract.f enyreg.f eyabgn.f esolan.f gradient.f twister.f opesol.f opeflx.f opereg.f opeshe.f utilities.f -I/usr/lib/mpi/gcc/openmpi/include -I/usr/lib/mpi/gcc/openmpi/lib -L/usr/lib/mpi/gcc/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl  -lutil -lm -ldl
-
-newbasicpybind: init_molecule.f init_energy.f energy.f utilities.f
-	f2py --overwrite-signature -h basic_smmp.pyf -m smmp_p init_molecule.f init_energy.f energy.f utilities.f
 
 newpybind: $(FILES)
 	./rmexclpoint.py $(FILES)
-#	mv smmp.pyf smmp.pyf.bak
-	f2py -h min_smmp.pyf -m smmp only: ${pyInterface} : $(FILES)
+	mv smmp.pyf smmp.pyf.bak
+	f2py -h smmp.pyf -m smmp only: ${pyInterface} : $(FILES)
 	./restoreexclpoint.py $(FILES)
 
Index: SMMP.kdevelop
===================================================================
--- SMMP.kdevelop	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ SMMP.kdevelop	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -132,5 +132,5 @@
       <filetype>*.h</filetype>
       <filetype>*.H</filetype>
-      <filetype>*.f90</filetype>
+      <filetype>*.hh</filetype>
       <filetype>*.hxx</filetype>
       <filetype>*.hpp</filetype>
@@ -143,6 +143,4 @@
       <filetype>Makefile</filetype>
       <filetype>CMakeLists.txt</filetype>
-      <filetype>*.py</filetype>
-      <filetype>*.f</filetype>
     </filetypes>
     <blacklist/>
Index: MP.kdevelop.filelist
===================================================================
--- SMMP.kdevelop.filelist	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,87 +1,0 @@
-# KDevelop Custom Project File List
-EXAMPLES
-EXAMPLES/Makefile
-EXAMPLES/Python
-EXAMPLES/Python/annealing.py
-EXAMPLES/Python/gui_example.py
-EXAMPLES/Python/minimization.py
-EXAMPLES/Python/muca.py
-EXAMPLES/Python/regularization.py
-EXAMPLES/annealing.f
-EXAMPLES/minimization.f
-EXAMPLES/multicanonical.f
-EXAMPLES/parallel_tempering_p.f
-EXAMPLES/parallel_tempering_s.f
-EXAMPLES/partem_p.f
-EXAMPLES/regularization.f
-INCL.H
-INCP.H
-Makefile
-addend.f
-algorithms.py
-anneal.f
-bgs.f
-bldmol.f
-callbacktest.f
-canon.f
-cnteny.f
-contacts.f
-difang.f
-dihedr.f
-doc
-doc/Makefile
-energy.f
-eninteract.f
-enyflx.f
-enylun.f
-enyreg.f
-enyshe.f
-enyshe_p.f
-enysol.f
-enysol_p.f
-esolan.f
-eyabgn.f
-getmol.f
-gradient.f
-hbond.f
-helix.f
-incl_lund.h
-init_energy.f
-init_molecule.f
-main.f
-main.py
-main_bgl_p.f
-main_p.f
-metropolis.f
-mincjg.f
-minim.f
-minqsn.f
-mklist.f
-mulcan_par.f
-mulcan_par_mod.f90
-mulcan_sim.f
-nursvr.f
-opeflx.f
-opereg.f
-opeshe.f
-opesol.f
-outpdb.f
-outvar.f
-partem_p.f
-partem_s.f
-pdbread.f
-protein.py
-redseq.f
-redstr.f
-redvar.f
-regul.f
-restoreexclpoint.py
-rgyr.f
-rmexclpoint.py
-rmsdfun.f
-setmvs.f
-setvar.f
-twister.f
-universe.py
-utilities.f
-zimmer.f
Index: MP/lib.lun
===================================================================
--- SMMP/lib.lun	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,390 +1,0 @@
-#ala   10   9
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5   9
-ha             1.080         109.000         -61.698  .02     1   3   0   0   0
-cb             1.53          110.000          56.472 -.09     7   3   6   7   8
-hb1            1.0           109.47   4*x1   180.     .04     1   5   0   0   0
-hb2            1.0           109.47          -60.     .04     1   5   0   0   0
-hb3            1.0           109.47           60.     .04     1   5   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -10   0   0
-o              1.230         121.700         180.    -.384   11  -9   0   0   0
-#arg   24  23
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  23
-ha             1.080         109.000         -60.35   .02     1   3   0   0   0
-cb             1.53          110.000          58.763 -.03     7   3   6   7   8
-hb1            1.0           108.1           -58.624  .015    1   5   0   0   0
-hb2            1.0           108.1            58.624  .015    1   5   0   0   0
-cg             1.52          113.7    4*x1   180.    -.03     7   5   9  10  11
-hg1            1.0           108.8           -58.624  .03     1   8   0   0   0
-hg2            1.0           108.8            58.624  .03     1   8   0   0   0
-cd             1.52          111.5    4*x2   180.     .12     7   8  12  13  14
-hd1            1.0           108.8           -58.778  .01     1  11   0   0   0
-hd2            1.0           108.8            58.778  .01     1  11   0   0   0
-ne             1.46          111.5    4*x3   180.    -.3     13  11  15  16   0
-he             1.            115.6             0.     .23     4  14   0   0   0
-cz             1.33          124.4    8*x4   180.     .58     9  14 -17 -20   0
-nh1            1.33          120.    17*x5     0.    -.39    13 -16  18  19   0
-hh11           1.            120.    18*x61  180.     .28     4  17   0   0   0
-hh12           1.            120.              0.     .28     4  17   0   0   0
-nh2            1.33          120.            180.    -.39    13 -16  21  22   0
-hh21           1.            120.    18*x62  180.     .28     4  20   0   0   0
-hh22           1.            120.              0.     .28     4  20   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -24   0   0
-o              1.230         121.700         180.    -.384   11 -23   0   0   0
-#asn   14  13
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  13
-ha             1.080         109.000         -58.981  .02     1   3   0   0   0
-cb             1.53          110.000          60.978 -.12     7   3   6   7   8
-hb1            1.0           108.4           -58.624  .055    1   5   0   0   0
-hb2            1.0           108.4            58.624  .055    1   5   0   0   0
-cg             1.52          112.6    4*x1   180.     .46     8   5  -9  10   0
-od1            1.23          120.9   11*x2   180.    -.375   11  -8   0   0   0
-nd2            1.33          117.              0.    -.445   14   8  11  12   0
-hd21           1.            120.    19*x3     0.     .2      4  10   0   0   0
-hd22           1.            120.            180.     .2      4  10   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -14   0   0
-o              1.230         121.700         180.    -.384   11 -13   0   0   0
-#asp   12  11
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.    -.06     7   1   4   5  11
-ha             1.080         109.000         -58.978  .024    1   3   0   0   0
-cb             1.53          110.000          60.917 -.17     7   3   6   7   8
-hb1            1.0           108.2           -58.622 -.02     1   5   0   0   0
-hb2            1.0           108.2            58.624 -.02     1   5   0   0   0
-cg             1.52          113.2    4*x1   180.     .5      8   5  -9 -10   0
-od1            1.25          118.6   10*x2   180.    -.57    12  -8   0   0   0
-od2            1.25          118.6             0.    -.57    12  -8   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -12   0   0
-o              1.230         121.700         180.    -.384   11 -11   0   0   0
-#cys   11  10
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  10
-ha             1.080         109.000         -60.68   .02     1   3   0   0   0
-cb             1.53          110.000          56.329 -.105    7   3   6   7   8
-hb1            1.0           108.1           -58.778  .055    1   5   0   0   0
-hb2            1.0           108.1            58.778  .055    1   5   0   0   0
-sg             1.81          113.4    4*x1   180.     .015   16   5   9   0   0
-hg             1.0           108.0   14*x2   180.     .01     6   8   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -11   0   0
-o              1.230         121.700         180.    -.384   11 -10   0   0   0
-#gln   17  16
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  16
-ha             1.080         109.000         -61.482  .02     1   3   0   0   0
-cb             1.53          110.000          56.545 -.03     7   3   6   7   8
-hb1            1.0           108.1          -58.624  .02     1   5   0   0   0
-hb2            1.0           108.1            58.624  .02     1   5   0   0   0
-cg             1.52          113.7    4*x1   180.    -.11     7   5   9  10  11
-hg1            1.0           108.4           -58.624  .05     1   8   0   0   0
-hg2            1.0           108.4            58.624  .05     1   8   0   0   0
-cd             1.52          112.6    4*x2   180.     .47     8   8 -12  13   0
-oe1            1.23          121.0   11*x3   180.    -.38    11 -11   0   0   0
-ne2            1.33          116.9             0.    -.43    14  11  14  15   0
-he21           1.            120.    19*x4     0.     .185    4  13   0   0   0
-he22           1.            120.            180.     .185    4  13   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -17   0   0
-o              1.230         121.700         180.    -.384   11 -16   0   0   0
-#glu   15  14
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  14
-ha             1.080         109.000         -61.482  .02     1   3   0   0   0
-cb             1.53          110.000          56.545 -.12     7   3   6   7   8
-hb1            1.0           108.1           -58.624  .02     1   5   0   0   0
-hb2            1.0           108.1            58.624  .02     1   5   0   0   0
-cg             1.52          114.1    4*x1   180.    -.17     7   5   9  10  11
-hg1            1.0           108.2           -58.624 -.04     1   8   0   0   0
-hg2            1.0           108.2            58.624 -.04     1   8   0   0   0
-cd             1.52          113.2    4*x2   180.     .5      8   8 -12 -13   0
-oe1            1.25          118.5   10*x3   180.    -.57    12 -11   0   0   0
-oe2            1.25          118.5             0.    -.57    12 -11   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -15   0   0
-o              1.230         121.700         180.    -.384   11 -14   0   0   0
-#gly    7   6
-n              1.330         116.600  3*psi  180.    -.344   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.    -.008    7   1   4   5   6
-ha1            1.08          109.000         -58.624  .055    1   3   0   0   0
-ha2            1.08          109.000          58.624  .055    1   3   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3  -7   0   0
-o              1.230         121.700         180.    -.384   11  -6   0   0   0
-#his   17  16
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  16
-ha             1.080         109.000         -62.135  .02     1   3   0   0   0
-cb             1.53          110.000          54.88  -.04     7   3   6   7   8
-hb1            1.0           108.2           -58.177  .015    1   5   0   0   0
-hb2            1.0           108.2            58.177  .015    1   5   0   0   0
-cg             1.52          113.2    4*x1   180.     .055    9   5   9 -14   0
-nd1            1.35          126.0   12*x2   180.    -.25    13   8  10  11   0
-hd1            1.            126.0             0.     .15     4   9   0   0   0
-ce1            1.35          108.            180.     .19     9   9  12 -13   0
-he1            1.0           126.            180.     .02     2  11   0   0   0
-ne2            1.35          108.              0.    -.24    15 -11  14   0   0
-cd2            1.35          108.              0.     .08     9  13  -8  15   0
-hd2            1.0           126.            180.     .035    2  14   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -17   0   0
-o              1.230         121.700         180.    -.384   11 -16   0   0   0
-#ile   19  18
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  18
-ha             1.080         109.000         -62.498  .02     1   3   0   0   0
-cb             1.53          110.000          54.154 -.005    7   3   6   7  11
-hb             1.0           109.2           -62.625  .025    1   5   0   0   0
-cg2            1.53          110.4            54.749 -.075    7   5   8   9  10
-hg21           1.0           109.47   4*x22  -60.     .025    1   7   0   0   0
-hg22           1.0           109.47           60.     .025    1   7   0   0   0
-hg23           1.0           109.47          180.     .025    1   7   0   0   0
-cg1            1.53          110.4    4*x1   180.    -.02     7   5  12  13  14
-hg11           1.0           108.1           -58.624  .015    1  11   0   0   0
-hg12           1.0           108.1            58.624  .015    1  11   0   0   0
-cd1            1.53          113.6    4*x21  180.    -.075    7  11  15  16  17
-hd11           1.0           109.47   4*x31  -60.     .025    1  14   0   0   0
-hd12           1.0           109.47           60.     .025    1  14   0   0   0
-hd13           1.0           109.47          180.     .025    1  14   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -19   0   0
-o              1.230         121.700         180.    -.384   11 -18   0   0   0
-#leu   19  18
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  18
-ha             1.080         109.000         -62.498  .02     1   3   0   0   0
-cb             1.53          110.000          54.154 -.03     7   3   6   7   8
-hb1            1.0           107.            -57.891  .022    1   5   0   0   0
-hb2            1.0           107.             57.891  .022    1   5   0   0   0
-cg             1.53          117.1    4*x1   180.    -.011    7   5   9  10  14
-hg             1.0           109.3            62.625  .025    1   8   0   0   0
-cd1            1.52          110.1    4*x2   180.    -.074    7   8  11  12  13
-hd11           1.0           109.47   4*x31  -60.     .025    1  10   0   0   0
-hd12           1.0           109.47           60.     .025    1  10   0   0   0
-hd13           1.0           109.47          180.     .025    1  10   0   0   0
-cd2            1.52          110.1           -54.749 -.074    7   8  15  16  17
-hd21           1.0           109.47   4*x32  -60.     .025    1  14   0   0   0
-hd22           1.0           109.47           60.     .025    1  14   0   0   0
-hd23           1.0           109.47          180.     .025    1  14   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -19   0   0
-o              1.230         121.700         180.    -.384   11 -18   0   0   0
-#lys   22  21
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  21
-ha             1.080         109.000         -62.498  .02     1   3   0   0   0
-cb             1.53          110.000          54.154 -.03     7   3   6   7   8
-hb1            1.0           108.1           -58.624  .015    1   5   0   0   0
-hb2            1.0           108.1            58.624  .015    1   5   0   0   0
-cg             1.52          113.8    4*x1   180.    -.025    7   5   9  10  11
-hg1            1.0           108.8           -58.624  .02     1   8   0   0   0
-hg2            1.0           108.8            58.624  .02     1   8   0   0   0
-cd             1.52          111.6    4*x2   180.    -.115    7   8  12  13  14
-hd1            1.0           108.8           -58.624  .1      1  11   0   0   0
-hd2            1.0           108.8            58.624  .1      1  11   0   0   0
-ce             1.52          111.6    4*x3   180.     .05     7  11  15  16  17
-he1            1.0           108.8           -58.701  .12     1  14   0   0   0
-he2            1.0           108.8          58.701  .12     1  14   0   0   0
-nz             1.49          111.6    4*x4   180.    -.32    13  14  18  19  20
-hz1            1.0           109.47   7*x5   180.     .32     3  17   0   0   0
-hz2            1.0           109.47          -60.     .32     3  17   0   0   0
-hz3            1.0           109.47           60.     .32     3  17   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -22   0   0
-o              1.230         121.700         180.    -.384   11 -21   0   0   0
-#met   17  16
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  16
-ha             1.080         109.000         -60.996  .02     1   3   0   0   0
-cb             1.53          110.000          58.986 -.01     7   3   6   7   8
-hb1            1.0           108.1           -58.624  .03     1   5   0   0   0
-hb2            1.0           108.1            58.624  .03     1   5   0   0   0
-cg             1.52          113.5    4*x1   180.    -.12     7   5   9  10  11
-hg1            1.0           108.7           -58.778  .045    1   8   0   0   0
-hg2            1.0           108.7            58.778  .045    1   8   0   0   0
-sd             1.810         111.9    4*x2   180.     .035   16   8  12   0   0
-ce             1.79          100.5   13*x3   180.    -.19     7  11  13  14  15
-he1            1.0           109.47  13*x4   -60.     .055    1  12   0   0   0
-he2            1.0           109.47           60.     .055    1  12   0   0   0
-he3            1.0           109.47          180.     .055    1  12   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -17   0   0
-o              1.230         121.700         180.    -.384   11 -16   0   0   0
-#phe   20  19
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  19
-ha             1.080         109.000         -60.574  .02     1   3   0   0   0
-cb             1.53          110.000          61.182 -.04     7   3   6   7   8
-hb1            1.0           108.1           -58.177  .025    1   5   0   0   0
-hb2            1.0           108.1            58.177  .025    1   5   0   0   0
-cg             1.52          113.7    4*x1   180.     .02     9   5  -9  17   0
-cd1            1.39          120.    12*x2   180.    -.015    9  -8  10  11   0
-hd1            1.0           120.              0.     .01     2   9   0   0   0
-ce1            1.39          120.            180.    -.015    9   9  12 -13   0
-he1            1.0           120.            180.     .01     2  11   0   0   0
-cz             1.39          120.              0.     .015    9 -11  14  15   0
-hz             1.0           120.            180.     .005    2  13   0   0   0
-ce2            1.39          120.              0.    -.015    9  13  16 -17   0
-he2            1.0           120.            180.     .01     2  15   0   0   0
-cd2            1.39          120.              0.    -.015    9 -15  18   8   0
-hd2            1.0           120.            180.     .01     2  17   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -20   0   0
-o              1.230         121.700         180.    -.384   11 -19   0   0   0
-#pro   14  13
-n              1.330         116.600  3*psi  180.    -.297   13   0   2  10   0
-ca             1.460         121.700  1*omg  180.     .057    7   1   3   4  13
-ha             1.080         109.000          53.7    .021    1   2   0   0   0
-cb             1.53          110.000         174.1   -.026    7   2   5   6   7
-hb1            1.0           111.6           120.     .023    1   4   0   0   0
-hb2            1.0           111.6          -120.     .023    1   4   0   0   0
-cg             1.51          103.3             0.0   -.034    7   4   8   9  10
-hg1            1.0           109.            120.     .025    1   7   0   0   0
-hg2            1.0           109.           -120.     .025    1   7   0   0   0
-cd             1.51          110.8             0.0    .095   18   7  11  12   1
-hd1            1.0           110.7           120.     .005   17  10   0   0   0
-hd2            1.0           110.7          -120.     .005   17  10   0   0   0
-c              1.520         111.000         -65.0    .456    8   2 -14   0   0
-o              1.230         121.700         180.    -.38    11 -13   0   0   0
-#ser   11  10
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  10
-ha             1.080         109.000         -60.837  .02     1   3   0   0   0
-cb             1.53          110.000          57.576  .13     7   3   6   7   8
-hb1            1.0           109.1           -58.473  .02     1   5   0   0   0
-hb2            1.0           109.1            58.473  .02     1   5   0   0   0
-og             1.42          110.6    4*x1   180.    -.31    10   5   9   0   0
-hg             1.            108.     5*x2   180.     .17     5   8   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -11   0   0
-o              1.230         121.700         180.    -.384   11 -10   0   0   0
-#thr   14  13
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  13
-ha             1.080         109.000         -63.043  .02     1   3   0   0   0
-cb             1.53          110.000          55.503  .16     7   3   6   7   9
-hb             1.0           109.3           -56.998  .015    1   5   0   0   0
-og1            1.43          108.6    4*x1   180.    -.31    10   5   8   0   0
-hg1            1.            108.     5*x21  180.     .17     5   7   0   0   0
-cg2            1.52          111.5            67.919 -.095    7   5  10  11  12
-hg21           1.0           109.47   4*x22   60.     .03     1   9   0   0   0
-hg22           1.0           109.47          -60.     .03     1   9   0   0   0
-hg23           1.0           109.47          180.     .03     1   9   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -14   0   0
-o              1.230         121.700         180.    -.384   11 -13   0   0   0
-#trp   24  23
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  23
-ha             1.080         109.000         -61.187  .02     1   3   0   0   0
-cb             1.53          110.000          55.612 -.03     7   3   6   7   8
-hb1            1.0           108.1           -58.177  .015    1   5   0   0   0
-hb2            1.0           108.1            58.177  .015    1   5   0   0   0
-cg             1.5           113.8    4*x1   180.    -.025    9   5  -9  22   0
-cd1            1.39          126.    12*x2   180.     .085    9  -8  10  11   0
-hd1            1.0           126.              0.     .0      2   9   0   0   0
-ne1            1.39          108.            180.    -.28    13   9  12  13   0
-he1            1.            126.            180.     .13     4  11   0   0   0
-ce2            1.39          108.              0.     .15     9  11  14 -22   0
-cz2            1.39          132.0           180.    -.06     9  13  15 -16   0
-hz2            1.0           120.              0.     .03     2  14   0   0   0
-ch2            1.39          120.            180.    -.005    9 -14  17  18   0
-hh2            1.0           120.            180.     .01     2  16   0   0   0
-cz3            1.39          120.              0.    -.02     9  16  19 -20   0
-hz3            1.0           120.            180.     .01     2  18   0   0   0
-ce3            1.39          120.              0.    -.08     9 -18  21  22   0
-he3            1.0           120.            180.     .08     2  20   0   0   0
-cd2            1.39          120.              0.     .005    9  20   8 -13   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -24   0   0
-o              1.230         121.700         180.    -.384   11 -23   0   0   0
-#tyr   21  20
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  20
-ha             1.080         109.000         -60.509  .02     1   3   0   0   0
-cb             1.53          110.000          61.78  -.04     7   3   6   7   8
-hb1            1.0           108.1           -58.177  .025    1   5   0   0   0
-hb2            1.0           108.1            58.177  .025    1   5   0   0   0
-cg             1.51          113.6    4*x1   180.     .02     9   5  -9  18   0
-cd1            1.39          120.    12*x2   180.    -.01     9  -8  10  11   0
-hd1            1.0           120.              0.     .01     2   9   0   0   0
-ce1            1.39          120.            180.    -.06     9   9  12 -13   0
-he1            1.0           120.            180.     .03     2  11   0   0   0
-cz             1.39          120.              0.     .225    9 -11  14  16   0
-oh             1.38          120.0           180.    -.33    10  13  15   0   0
-hh             1.            108.    15*x6   180.     .165    5  14   0   0   0
-ce2            1.39          120.              0.    -.06     9  13  17 -18   0
-he2            1.0           120.            180.     .03     2  16   0   0   0
-cd2            1.39          120.              0.    -.01     9 -16  19   8   0
-hd2            1.0           120.            180.     .01     2  18   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -21   0   0
-o              1.230         121.700         180.    -.384   11 -20   0   0   0
-#val   16  15
-n              1.330         116.600  3*psi  180.    -.356   13   0   2   3   0
-h              1.            120.000           0.     .176    4   1   0   0   0
-ca             1.460         121.700  1*omg  180.     .064    7   1   4   5  15
-ha             1.080         109.000         -62.068  .02     1   3   0   0   0
-cb             1.53          110.000          55.387  .008    7   3   6   7  11
-hb             1.0           109.1            61.977  .016    1   5   0   0   0
-cg1            1.52          110.7    4*x1   180.    -.072    7   5   8   9  10
-hg11           1.0           109.47   4*x21  -60.     .025    1   7   0   0   0
-hg12           1.0           109.47           60.     .025    1   7   0   0   0
-hg13           1.0           109.47          180.     .025    1   7   0   0   0
-cg2            1.52          110.7           -56.046 -.072    7   5  12  13  14
-hg21           1.0           109.47   4*x22  -60.     .025    1  11   0   0   0
-hg22           1.0           109.47           60.     .025    1  11   0   0   0
-hg23           1.0           109.47          180.     .025    1  11   0   0   0
-c              1.520         111.000  2*phi  180.     .45     8   3 -16   0   0
-o              1.230         121.700         180.    -.384   11 -15   0   0   0
-#ace    6   5
-ch3            1.46          121.7           180.    -.129    7   2   3   4   5
-h1             1.0           109.471           0.     .020    1   1   0   0   0
-h2             1.0           109.471         -60.001  .020    1   1   0   0   0
-h3             1.0           109.471          60.001  .020    1   1   0   0   0
-c              1.520         111.000         180.     .455    8   1  -6   0   0
-o              1.230         121.700         180.    -.386   11  -5   0   0   0
-#nme    6   3
-n              1.330         116.600  3*psi  180.    -.345   13   0   2   3   0
-h              1.            120.000           0.     .163    4   1   0   0   0
-c              1.520         111.000  1*omg  180.     .05     7   1   4   5   6
-h1             1.0           109.47   2*pht  180.     .044    1   3   0   0   0
-h2             1.0           109.47          -60.     .044    1   3   0   0   0
-h3             1.0           109.47           60.     .044    1   3   0   0   0
-#nh2    4   1
-n              1.330         116.600  3*psi  180.    -.242   13   0   2   3   4
-h1             1.            109.47   7*phi  180.     .354    3   1   0   0   0
-h2             1.            109.47           60.     .354    3   1   0   0   0
-h3             1.            109.47          -60.     .354    3   1   0   0   0
-#nh3+   4   1
-n              1.330         116.600  3*psi  180.    -.242   13   0   2   3   4
-h1             1.            109.47   7*phi  180.     .354    3   1   0   0   0
-h2             1.            109.47           60.     .354    3   1   0   0   0
-h3             1.            109.47          -60.     .354    3   1   0   0   0
-#nh2g   4   1
-n              1.330         116.600  3*psi  180.    -.242   13   0   2   3   4
-h1             1.            109.47   7*phi  180.     .354    3   1   0   0   0
-h2             1.            109.47           60.     .354    3   1   0   0   0
-h3             1.            109.47          -60.     .354    3   1   0   0   0
-#nh3g   4   1
-n              1.330         116.600  3*psi  180.    -.242   13   0   2   3   4
-h1             1.            109.47   7*phi  180.     .354    3   1   0   0   0
-h2             1.            109.47           60.     .354    3   1   0   0   0
-h3             1.            109.47          -60.     .354    3   1   0   0   0
-#cooh   3   1
-c              1.520         111.000  2*phi  180.     .395    8   0  -2  -3   0
-o              1.230         121.700           0.    -.664   12  -1   0   0   0
-oxt            1.230         121.700 10*pst  180.    -.664   12  -1   0   0   0
-#coo-   3   1
-c              1.520         111.000  2*phi  180.     .395    8   0  -2  -3   0
-o              1.230         121.700           0.    -.664   12  -1   0   0   0
-oxt            1.230         121.700 10*pst  180.    -.664   12  -1   0   0   0
-#goo-   3   1     # only for gly
-c              1.520         111.000  2*phi  180.     .396    8   0  -2  -3   0
-o              1.230         121.700           0.    -.665   12  -1   0   0   0
-oxt            1.230         121.700 10*pst  180.    -.665   12  -1   0   0   0
Index: addend.f
===================================================================
--- addend.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ addend.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,24 +1,24 @@
-! **************************************************************
-!
-!
-! This file contains the subroutines:  addend, redchg, rplgrp
-!
-! 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
-!
-! $Id: addend.f 334 2007-08-07 09:23:59Z meinke $
-! **************************************************************
+c **************************************************************
+c
+c
+c This file contains the subroutines:  addend, redchg, rplgrp
+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 $Id: addend.f 334 2007-08-07 09:23:59Z meinke $
+c **************************************************************
       subroutine addend(nml,grpn,grpc)
 
-! ..............................................................
-!  PURPOSE:  modify terminal residues to complete bonding scheme
-!            with residue 'grpn' at N- and residue 'grpc' at C-terminus
-!            ! need initial co-ordinates for residues to modify
-!            ! for N-terminus: may add only simple groups
-!
-!  CALLS:  rplgrp,tolost,redchg
-! ..............................................................
+c ..............................................................
+c  PURPOSE:  modify terminal residues to complete bonding scheme
+c            with residue 'grpn' at N- and residue 'grpc' at C-terminus
+c            ! need initial co-ordinates for residues to modify
+c            ! for N-terminus: may add only simple groups
+c
+c  CALLS:  rplgrp,tolost,redchg
+c ..............................................................
  
       include 'INCL.H'
@@ -28,9 +28,4 @@
       character res*4,rpat*4,sbrs*4,grn*4,grc*4
 
-      integer nml
-      
-      integer i, ifirs, ilars
-      
-      double precision cg
 
       grn = grpn
@@ -40,14 +35,13 @@
 
       if (grn(:3).eq.'ace'.or.grc(:3).eq.'ace'
-     &.or.grn(:3).eq.'nme'.or.grc(:3).eq.'nme') then
-
-        write (logString, '(2a)') 
-     &   ' addend> N-Acetyl (ace) or N-Methylamide (nme)',
-     &   ' should be put in SEQUENCE file, not added as end groups'
+     #.or.grn(:3).eq.'nme'.or.grc(:3).eq.'nme') then
+
+        write(*,'(2a)') ' addend> N-Acetyl (ace) or N-Methylamide (nme)'
+     #   ,' should be put in SEQUENCE file, not added as end groups'
 
         stop
       endif
 
-! __________________________________________ N-terminus
+c __________________________________________ N-terminus
       ifirs=irsml1(nml)
       rpat='n   '
@@ -60,6 +54,6 @@
               sbrs='nh2+'
             else
-              write (logString, '(2a)') ' addend> ',
-     &         ' No N-terminal Hyp possible with ECEPP/3 dataset'
+              write (*,'(2a)') ' addend> ',
+     #         ' No N-terminal Hyp possible with ECEPP/3 dataset'
               stop
             endif
@@ -88,6 +82,6 @@
         else
 
-          write (logString, '(2a)') ' addend> Can add only ',
-     &     'nh2 or nh3+ to N-terminus'
+          write(*,'(2a)') ' addend> Can add only ',
+     *     'nh2 or nh3+ to N-terminus'
           stop
 
@@ -99,9 +93,9 @@
       else ! ace
 
-        write (logString, '(2a)') ' addend> Acetyl group',
-     &     ' at N-terminus not modified'
-      endif
-
-! __________________________________________ C-terminus
+        write(*,'(2a)') ' addend> Acetyl group',
+     #     ' at N-terminus not modified'
+      endif
+
+c __________________________________________ C-terminus
       ilars=irsml2(nml)
       rpat='c   '
@@ -129,6 +123,6 @@
         else
 
-          write (logString, '(2a)') ' addend> Can add only ',
-     &     'cooh or coo- to C-terminus'
+          write(*,'(2a)') ' addend> Can add only ',
+     #     'cooh or coo- to C-terminus'
           stop
 
@@ -140,37 +134,35 @@
       else  ! N'-methylamide
 
-        write (logString, '(2a)') ' addend> N-Methylamide',
-     &     ' at C-terminus not modified'
-
-      endif
-
-! ----------------------------- net charge of molecule
+        write(*,'(2a)') ' addend> N-Methylamide',
+     #     ' at C-terminus not modified'
+
+      endif
+
+c ----------------------------- net charge of molecule
       cg = 0.d0
       do i=iatrs1(irsml1(nml)),iatrs2(irsml2(nml))
         cg = cg + cgat(i)
       enddo
-      if (abs(cg).gt.1.d-5) then
-         write (logString, '(a,i2,a,f7.3)') 
-     &      ' addend> Net charge of molecule #'
-     &        ,nml,': ',cg
-      endif
+      if (abs(cg).gt.1.d-5) write(*,'(a,i2,a,f7.3,/)')
+     #        ' addend> Net charge of molecule #'
+     #        ,nml,': ',cg
 
       return
       end
-! ****************************************
+c ****************************************
       subroutine rplgrp(nml,nrs,rpat,sbrs)
 
-! ...............................................................
-! PURPOSE: replace atom(s) rooted at atom 'rpat' in residue
-!          'nrs' of molecule 'nml' by atom(s) rooted at 
-!          'rpat' of residue 'sbrs' (same name of root
-!          atom 'rpat' maintains bonding geometry for
-!          preceeding atoms in 'nrs')
-!
-!          is NOT performed if 'rpat' is within mainchain,
-!          except it is first/last mainchain atom of 'nml'
-!
-! CALLS: dihedr,iopfil,iendst,eyring,fndbrn,redres,setsys,valang
-! ...............................................................
+c ...............................................................
+c PURPOSE: replace atom(s) rooted at atom 'rpat' in residue
+c          'nrs' of molecule 'nml' by atom(s) rooted at 
+c          'rpat' of residue 'sbrs' (same name of root
+c          atom 'rpat' maintains bonding geometry for
+c          preceeding atoms in 'nrs')
+c
+c          is NOT performed if 'rpat' is within mainchain,
+c          except it is first/last mainchain atom of 'nml'
+c
+c CALLS: dihedr,iopfil,iendst,eyring,fndbrn,redres,setsys,valang
+c ...............................................................
 
       include 'INCL.H'
@@ -178,20 +170,8 @@
       character rpat*4,sbrs*4
       logical ntbb,bb
-      integer nml, nrs, ibd, iybd
 
       dimension ibd(mxbd+1),iybd(mxbd+1)
-      
-      integer iopfil, iendst
-      
-      double precision valang, dihedr
-
-      integer ish, i, i1, irng1, irng2, ilavr, ilaat, i2, i3, ibdrg,
-     &        ib, iat, ifirs, ifivr, ii, iow, isgbb1, ity, nfi, ilars,
-     &        ivrrp, ivrsb, jsh, j, iybdrg, k, lvrrp, nb, natsb, nla, 
-     &        nfirp, nxt, nsb, nlarp, nfisb, nlasb, nrp, nsh,
-     &        nvrsb, nxtbb1, nxtbb2, nxtsb
-      double precision ba, ca, ct, dx, dz, h3, h2, sa, st,to, x1, x2,
-     &        x3, y1, y2, y3, z1, z2, z3
-      
+
+
       ifirs=irsml1(nml)
       ilars=irsml2(nml)
@@ -200,5 +180,5 @@
       nfi=iatrs1(nrs)
       nla=iatrs2(nrs)
-! __________________________ indices of atoms to be replaced
+c __________________________ indices of atoms to be replaced
       do i=nfi,nla
         if (rpat.eq.nmat(i)) then
@@ -207,7 +187,6 @@
         endif
       enddo
-      write (logString, '(4a,i4,a,i4)') ' rplgrp> cannot find atom >',
-     &   rpat,
-     &   '< to be replaced in residue ',seq(nrs),nrs,' of molecule ',nml
+      write (*,'(4a,i4,a,i4)') ' rplgrp> cannot find atom >',rpat,
+     #'< to be replaced in residue ',seq(nrs),nrs,' of molecule ',nml
       stop
 
@@ -238,7 +217,7 @@
             if (iowat(ibd(i)).ne.nfirp) then
               if (ibdrg.ne.0) then
-                write (logString, '(2a,i3)') 
-     &             ' rplgrp> Can handle only simple ring at 1st',
-     &             ' atom of molecule #',nml
+                write (*,'(2a,i3)') 
+     #             ' rplgrp> Can handle only simple ring at 1st',
+     #             ' atom of molecule #',nml
                 stop
               endif
@@ -265,26 +244,26 @@
           goto 11
         else
-          write (logString, '(4a,i4,a,i4)') 
-     &      ' rplgrp> Cannot replace BACKBONE atom ',rpat,
-     &      ' of residue ',seq(nrs),nrs,' in molecule #',nml
+          write (*,'(4a,i4,a,i4)') 
+     #      ' rplgrp> Cannot replace BACKBONE atom ',rpat,
+     #      ' of residue ',seq(nrs),nrs,' in molecule #',nml
           stop
         endif
 
       endif  ! N-terminus
-! _________________________________ previous atoms
+c _________________________________ previous atoms
     2 if (nfirp.eq.nfi.and.nrs.eq.ifirs) goto 11
       nxtbb1=iowat(nfirp)
       if (nxtbb1.eq.nfi.and.nrs.eq.ifirs) goto 11
       nxtbb2=iowat(nxtbb1)
-! _______________________________ get data for substituent atoms
+c _______________________________ get data for substituent atoms
     3 if (iopfil(lunlib,reslib,'old','formatted').le.izero) then
-        write (logString, '(a,/,a,i3,2a)') 
-     &    ' rplgrp> ERROR opening library of residues:',
-     &    ' LUN=',lunlib,' FILE=',reslib(1:iendst(reslib))
+        write (*,'(a,/,a,i3,2a)') 
+     #    ' rplgrp> ERROR opening library of residues:',
+     #    ' LUN=',lunlib,' FILE=',reslib(1:iendst(reslib))
         stop
       endif
       call redres(sbrs,natsb,nxtsb,nvrsb)
       close (lunlib)
-! __________________________ indices of substituent atoms
+c __________________________ indices of substituent atoms
       do i=1,natsb
         if (rpat.eq.nmath(i)) then
@@ -293,6 +272,6 @@
         endif
       enddo
-      write (logString, '(4a)') ' rplgrp> Cannot find atom >',rpat,
-     &'< in substituent residue ',sbrs
+      write (*,'(4a)') ' rplgrp> Cannot find atom >',rpat,
+     #'< in substituent residue ',sbrs
       stop
 
@@ -309,5 +288,5 @@
         enddo  ! ... branch atoms
     5 enddo  ! ... branches
-! _________________________________________________ local axes at 'nfirp'
+c _________________________________________________ local axes at 'nfirp'
       call setsys(nxtbb1,nfirp,nxtbb2,x1,x2,x3,y1,y2,y3,z1,z2,z3)
 
@@ -319,5 +298,5 @@
       zbaat(nfirp)=z3
 
-! _____________________ add virtual atoms
+c _____________________ add virtual atoms
       if (ntbb) then
 
@@ -327,5 +306,5 @@
         sa=snbaat(nxtbb1)
 
-! ------------------- Eyring
+c ------------------- Eyring
         h2=-sa*ct
         h3=-sa*st
@@ -352,5 +331,5 @@
         st=sntoat(nxtbb1)
 
-! -------------------- Eyring with b.angle = 90 deg.
+c -------------------- Eyring with b.angle = 90 deg.
         xat(-ione)=xat(izero)-ct*(z2*x3-z3*x2)-st*z1
         yat(-ione)=yat(izero)-ct*(z3*x1-z1*x3)-st*z2
@@ -358,5 +337,5 @@
 
       endif
-! _____________________________________________ Shift atom data
+c _____________________________________________ Shift atom data
       nrp=nlarp-nfirp
       nsb=nlasb-nfisb
@@ -376,6 +355,5 @@
         else  ! more atoms
           if ((ilaat+nsh).gt.mxat) then
-            write (logString, '(a,i5)') ' rplgrp> number of atoms > ',
-     &         mxat
+            write (*,'(a,i5)') ' rplgrp> number of atoms > ',mxat
             stop
           endif
@@ -429,5 +407,5 @@
 
         enddo
-! ____________________________________________ Shift residue data
+c ____________________________________________ Shift residue data
         do i=nrs+1,irsml2(ntlml)
           iatrs1(i)=iatrs1(i)+nsh
@@ -440,5 +418,5 @@
         nsh=0
       endif
-! _________________________________________ Correct data of 'nfirp'
+c _________________________________________ Correct data of 'nfirp'
       ish=nfirp-nfisb
       ityat(nfirp)=ityath(nfisb)
@@ -471,9 +449,9 @@
           nb=nb+1
           if (nb.gt.mxbd) then
-            write (logString, '(6a,/,2a,3(i4,a))')
-     &      ' rplgrp> Cannot add atoms following ',rpat,
-     &      ' from group ',sbrs,' to atom ',rpat,
-     &      ' of residue ',seq(nrs),nrs,' in molecule #',nml,
-     &      ' because need >',(mxbd+1),' bonds'
+            write (*,'(6a,/,2a,3(i4,a))')
+     #      ' rplgrp> Cannot add atoms following ',rpat,
+     #      ' from group ',sbrs,' to atom ',rpat,
+     #      ' of residue ',seq(nrs),nrs,' in molecule #',nml,
+     #      ' because need >',(mxbd+1),' bonds'
             stop
           endif
@@ -496,5 +474,5 @@
       endif
       nbdat(nfirp)=nb
-! _________________________________________ Add data for substituent
+c _________________________________________ Add data for substituent
       ii=nfirp
       do i=nfisb+1,nlasb
@@ -549,6 +527,6 @@
 
       enddo  ! substituent atoms
-! ___________________________________________________ Take care of Variables
-! (assume variables of replaced group/substituent to be stored CONSECUTIVELY)
+c ___________________________________________________ Take care of Variables
+c (assume variables of replaced group/substituent to be stored CONSECUTIVELY)
 
       ilavr=ivrml1(ntlml)+nvrml(ntlml)-1
@@ -598,6 +576,5 @@
         else
           if ((ilavr+jsh).gt.mxvr) then
-            write (logString, '(a,i5)') 
-     &         ' rplgrp> number of variables > ',mxvr
+            write (*,'(a,i5)') ' rplgrp> number of variables > ',mxvr
             stop
           endif
@@ -633,37 +610,32 @@
 
       return
-! __________________________________________ Errors
-   10 write (logString, '(3a,/,2a,i4,a,i4,/,2a)') 
-     &   ' rplgrp> Cannot replace atom(s) following ',rpat,
-     &   ' from INSIDE a ring','    in residue: ',seq(nrs),nrs,
-     &   ' in molecule #',nml,' or in substitute: ',sbrs
+c __________________________________________ Errors
+   10 write (*,'(3a,/,2a,i4,a,i4,/,2a)') 
+     #   ' rplgrp> Cannot replace atom(s) following ',rpat,
+     #   ' from INSIDE a ring','    in residue: ',seq(nrs),nrs,
+     #   ' in molecule #',nml,' or in substitute: ',sbrs
       stop
-   11 write (logString, '(4a,i4,a,i4,/,a)') 
-     &   ' rplgrp> Cannot replace atom(s) following ',rpat,
-     &   ' of residue ',seq(nrs),nrs,' in molecule #',nml,
-     &   ' since necessary 2 previous atoms are not available' 
+   11 write (*,'(4a,i4,a,i4,/,a)') 
+     #   ' rplgrp> Cannot replace atom(s) following ',rpat,
+     #   ' of residue ',seq(nrs),nrs,' in molecule #',nml,
+     #   ' since necessary 2 previous atoms are not available' 
       stop
 
       end
-! ****************************************
+c ****************************************
       subroutine redchg(nml,nrs,rpat,sbrs)
 
-! .........................................................
-! PURPOSE: read and place atomic point charges from residue
-!          'sbrs' to residue 'nrs' of molecule 'nml'
-!          from library 'chglib' with LUN=lunchg, if ilib=1
-!                       'reslib' with LUN=lunlib, if ilib=2
-!
-! CALLS: iopfil,iendst,tolost
-! ........................................................
+c .........................................................
+c PURPOSE: read and place atomic point charges from residue
+c          'sbrs' to residue 'nrs' of molecule 'nml'
+c          from library 'chglib' with LUN=lunchg, if ilib=1
+c                       'reslib' with LUN=lunlib, if ilib=2
+c
+c CALLS: iopfil,iendst,tolost
+c ........................................................
 
       include 'INCL.H'
 
       character rpat*4,sbrs*4,atnm*4,res*4,cgty*5,line*100
-      integer nml, nrs
-
-      integer iopfil, iendst
-
-      integer ifirs, ilars, ifvr, ilib, i, l, j, nchg
 
       ifirs=irsml1(nml)
@@ -692,6 +664,5 @@
           endif
         else
-          write(logString,*)
-     &                  ' redchg> dont know which end goup is present'
+          write (*,*) ' redchg> dont know which end goup is present'
           stop
         endif
@@ -705,7 +676,7 @@
 
         if (iopfil(lunchg,chgfil,'old','formatted').le.izero) then
-          write (logString, '(a,/,a,i3,2a)') 
-     &      ' redchg> ERROR opening library of charges:',
-     &      ' LUN=',lunchg,' FILE=',chgfil(1:iendst(chgfil))
+          write (*,'(a,/,a,i3,2a)') 
+     #      ' redchg> ERROR opening library of charges:',
+     #      ' LUN=',lunchg,' FILE=',chgfil(1:iendst(chgfil))
           stop
         endif
@@ -729,15 +700,14 @@
                 endif
               enddo
-              write (logString, '(6a)') ' redchg> Cannot find atom: ',
-     &                        atnm,
-     &                        ' for entry: ',cgty,' in library: ',
-     &                        chgfil(1:iendst(chgfil))
+              write (*,'(6a)') ' redchg> Cannot find atom: ',atnm,
+     #                        ' for entry: ',cgty,' in library: ',
+     #                        chgfil(1:iendst(chgfil))
               stop
     2       enddo
             return
           else
-            write (logString, '(4a)')
-     &       ' redchg> must increase MXATH to read data for entry: ',
-     &        cgty,' in library: ',chgfil(1:iendst(chgfil))
+            write (*,'(4a)')
+     #       ' redchg> must increase MXATH to read data for entry: ',
+     #        cgty,' in library: ',chgfil(1:iendst(chgfil))
             close(lunchg)
             stop
@@ -745,7 +715,7 @@
         endif
         goto 1
-    3   write (logString, '(4a)')
-     &   ' redchg> Cannot find entry: ',cgty,' in library: ',
-     &      chgfil(1:iendst(chgfil))
+    3   write (*,'(4a)')
+     #   ' redchg> Cannot find entry: ',cgty,' in library: ',
+     #      chgfil(1:iendst(chgfil))
         close(lunchg)
         stop
@@ -754,7 +724,7 @@
 
         if (iopfil(lunlib,reslib,'old','formatted').le.izero) then
-          write (logString, '(a,/,a,i3,2a)') 
-     &      ' redchg> ERROR opening library of residues:',
-     &      ' LUN=',lunlib,' FILE=',reslib(1:iendst(reslib))
+          write (*,'(a,/,a,i3,2a)') 
+     #      ' redchg> ERROR opening library of residues:',
+     #      ' LUN=',lunlib,' FILE=',reslib(1:iendst(reslib))
           stop
         endif
@@ -777,15 +747,14 @@
                 endif
               enddo
-              write (logString, '(6a)') ' redchg> Cannot find atom: ',
-     &                        atnm,
-     &                        ' for entry: ',cgty,' in library: ',
-     &                        reslib(1:iendst(reslib))
+              write (*,'(6a)') ' redchg> Cannot find atom: ',atnm,
+     #                        ' for entry: ',cgty,' in library: ',
+     #                        reslib(1:iendst(reslib))
               stop
     5       enddo
             return
           else
-            write (logString, '(4a)')
-     &       ' redchg> must increase MXATH to read data for entry: ',
-     &        cgty,' in library: ',reslib(1:iendst(reslib))
+            write (*,'(4a)')
+     #       ' redchg> must increase MXATH to read data for entry: ',
+     #        cgty,' in library: ',reslib(1:iendst(reslib))
             close(lunchg)
             stop
@@ -793,7 +762,7 @@
         endif
         goto 4
-    6   write (logString, '(4a)')
-     &   ' redchg> Cannot find entry: ',cgty,' in library: ',
-     &      reslib(1:iendst(reslib))
+    6   write (*,'(4a)')
+     #   ' redchg> Cannot find entry: ',cgty,' in library: ',
+     #      reslib(1:iendst(reslib))
         close(lunchg)
         stop
@@ -801,7 +770,7 @@
       endif
 
-   10 write (logString, '(4a)')
-     &    ' redchg> Do not have charges for N/C-terminal residue ',
-     &    res,' modified with group :',sbrs
+   10 write (*,'(4a)')
+     #    ' redchg> Do not have charges for N/C-terminal residue ',
+     #    res,' modified with group :',sbrs
       stop
 
Index: algorithms.py
===================================================================
--- algorithms.py	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
+++ algorithms.py	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -0,0 +1,91 @@
+# algorithms.py
+#
+# Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+#                      Jan H. Meinke, Sandipan Mohanty
+#
+import copy
+import random
+import smmp
+from math import *
+from universe import *
+from protein import *
+
+class CanonicalMonteCarlo:
+    """An implementation of a canonical Monte Carlo run using Metropolis weights.
+    After a Monte-Carlo sweep over all internal variables, this implementation 
+    calculates the interactions between all Protein s in the Universe
+    """
+    
+    def __init__(self, myUniverse, nequi, sweeps, weight =  lambda x : x * smmp.bet.beta):
+        self.__defSweeps = sweeps
+        self.__defEqui = nequi
+        self.__univ = myUniverse
+        self.__acc = 0
+        self.__performedSweeps = 0
+        self.__minEnergy = myUniverse.energy()
+        self.__l = 0.1
+        self.__minCounter = 0
+        self.__weight = weight
+        
+    ## Fraction of accepted Monte Carlo moves of the total number of attempted moves.
+    #  @pre At least one move must have been performed before this function can be
+    #       called
+    #  @return fraction of accepted moves as a number between 0 and 1.
+    def acceptanceRate(self):
+        return float(self.__acc) / (self.__performedSweeps * smmp.mol_par.nvr)
+    ## The lowest energy ever seen at the end of a Monte Carlo move.
+    #  @return lowest energy seen at the end of a sweep, sweep
+    def minimumEnergy(self):
+        return self.__minEnergy, self.__minCounter
+    ## Number of sweeps performed so far
+    def performedSweeps(self):
+        return self.__performedSweeps
+        
+    def run(self):
+        """A complete Monte Carlo run including initial equilibration."""
+        self.sweeps(self.__defSweeps)
+        
+    def equilibrate(self):
+        """Do nequi sweeps to eqilibrate the system."""
+        self.sweeps(self.__defEqui)
+        
+    def sweeps(self, n):
+        """Perform n sweeps."""
+        for i in range(0, n):
+            self.sweep()
+        
+    def sweep(self):
+        """Performs a single Monte Carlo sweep."""
+        eol = self.__univ.energy()
+        eol, self.__acc = smmp.metropolis(eol, self.__acc, self.__weight)
+        #eol = self.metropolis()
+        self.__performedSweeps += 1
+        if eol < self.__minEnergy:
+            self.__minEnergy = eol
+            self.__minCounter = self.__performedSweeps
+            smmp.outpdb(0, "best.pdb")
+
+    def metropolis(self):
+        """Implementation of the Metropolis algorithm."""
+        eol = self.__univ.energy()
+        # Update the internal degrees of freedom first
+        for i in range(0, smmp.mol_par.nvr):
+            jv = smmp.var_i.idvr[i] - 1
+            vrol = smmp.var_r.vlvr[jv]
+            dv=smmp.var_r.axvr[jv] * (random.random() - 0.5)
+            smmp.var_r.vlvr[jv] = (vrol + dv + pi) % (2 * pi) - pi
+            etrial = self.__univ.energy()
+            dW = self.__weight(etrial) - self.__weight(eol)
+            if dW < 0:
+                eol = etrial
+                self.__acc += 1
+            else:
+                rd =random.random()
+                dW = min(dW, 100)
+                if  exp(-dW) > rd:
+                    eol = etrial
+                    self.__acc +=1
+                else:
+                    smmp.var_r.vlvr[jv] = vrol
+        # Update the global degrees of freedom
+        return eol
Index: anneal.f
===================================================================
--- anneal.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ anneal.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,65 +1,59 @@
-! **************************************************************
-!
-! This file contains the subroutines:  anneal
-!
-! 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
-!
-! $Id: anneal.f 334 2007-08-07 09:23:59Z meinke $
-! **************************************************************
+c **************************************************************
+c
+c This file contains the subroutines:  anneal
+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 $Id: anneal.f 334 2007-08-07 09:23:59Z meinke $
+c **************************************************************
 
       subroutine  anneal(nequi, nswp, nmes, tmax, tmin, lrand)
 
-! --------------------------------------------------------------
-! PURPOSE: SIMULATED ANNEALING SEARCH OF LOWEST-POTENTIAL-ENERGY
-!          CONFORMATIONS OF PROTEINS
-!
-! CALLS: addang,energy,metropolis,outvar,outpdb,rgyr,setvar,zimmer
-!
-! ---------------------------------------------------------------
+C --------------------------------------------------------------
+C PURPOSE: SIMULATED ANNEALING SEARCH OF LOWEST-POTENTIAL-ENERGY
+C          CONFORMATIONS OF PROTEINS
+C
+C CALLS: addang,energy,metropolis,outvar,outpdb,rgyr,setvar,zimmer
+C
+C ---------------------------------------------------------------
  
       include 'INCL.H'
 
-!f2py intent(in) nequi
-!f2py intent(in) nswp
-!f2py intent(in) nmes
-!f2py intent(in) Tmax
-!f2py intent(in) Tmin
-!f2py logical optional, intent(in):: lrand = 1
+cf2py intent(in) nequi
+cf2py intent(in) nswp
+cf2py intent(in) nmes
+cf2py intent(in) Tmax
+cf2py intent(in) Tmin
+cf2py logical optional, intent(in):: lrand = 1
 
-!     external rand
+c     external rand
       external can_weight
-      
-      double precision bmin, bmax, db, dv, grnd, vr, addang, eol, energy
-      double precision acz, ymin, vlvrm, rgy, ee, temp
-
-      integer nresi, i, iv, nsw, nemin, j
-      
-!      parameter(lrand=.true.)
-!      parameter(nequi=100, nswp=100000,nmes=1000)
-!      parameter(tmax=1000.0,tmin=100.0)
-!     lrand=.true.: creates random start configuration 
+c      parameter(lrand=.true.)
+c      parameter(nequi=100, nswp=100000,nmes=1000)
+c      parameter(tmax=1000.0,tmin=100.0)
+C     lrand=.true.: creates random start configuration 
       logical lrand
-!     nequi: Number of sweeps for equilibrisation of system
+C     nequi: Number of sweeps for equilibrisation of system
       integer nequi
-!     nswp:  Number of sweeps for simulation run
+C     nswp:  Number of sweeps for simulation run
       integer nswp
-!     nmes:  Number of sweeps between measurments
+c     nmes:  Number of sweeps between measurments
       integer nmes
-!     tmax: Start temperature
+C     tmax: Start temperature
       double precision tmax
-!     tmin: Final temperature
+C     tmin: Final temperature
       double precision tmin
      
       
 !      common/bet/beta
-!
+C
       dimension vlvrm(mxvr)
 
      
  
-!     Define files for output:
+c     Define files for output:
       open(14,file='time.d')
       write(14, *) '# $Id: anneal.f 334 2007-08-07 09:23:59Z meinke $'
@@ -70,8 +64,8 @@
       db = exp(log(bmax/bmin)/nswp)
 
-!     nresi: Number of residues
-! FIXME: Should loop over all proteins
+c     nresi: Number of residues
+c FIXME: Should loop over all proteins
       nresi=irsml2(ntlml)-irsml1(1)+1
-! _________________________________ random start
+c _________________________________ random start
       if(lrand) then
        do i=1,nvr
@@ -84,19 +78,17 @@
 
       eol=energy()
-      write (logString, '(a,e12.5,/)')  
-     &   'energy of start configuration: ',eol
+      write (*,'(a,e12.5,/)')  'energy of start configuration: ',eol
 
-! Write start configuration in pdb-format into file
+C Write start configuration in pdb-format into file
         call outpdb(0, "start.pdb")
 
-! =====================Equilibration by  Metropolis
+c =====================Equilibration by  Metropolis
       beta =  bmin
       do nsw=1,nequi
          call metropolis(eol,acz,can_weight)
       end do
-      write (logString, *) 
-     &   'Energy after  equilibration:', eol
+      write(*,*) 'Energy after  equilibration:',eol
 
-!======================Simulation by simulated annealing
+C======================Simulation by simulated annealing
       acz = 0.0d0
       ymin = eol
@@ -104,10 +96,10 @@
         beta = bmin*db**nsw
         call metropolis(eol,acz,can_weight)
-! Store lowest-energy conformation
+c Store lowest-energy conformation
         if(eol.lt.ymin) then
          ymin = eol
          nemin = nsw
          call outvar(0,'global.var')
-!     Output of lowest-energy conformation as pdb-file
+C     Output of lowest-energy conformation as pdb-file
          call outpdb(0,"global.pdb")
          do j=1,nvr
@@ -116,11 +108,11 @@
          end do
         end if
-!
+c
         if(mod(nsw,nmes).eq.0) then
-! Measure radius of gyration and end-to-end distance
+C Measure radius of gyration and end-to-end distance
          call rgyr(1, rgy, ee)
-! Determine Zimmerman code of actual conformation
+C Determine Zimmerman code of actual conformation
          call zimmer(nresi)
-! Write down information on actual conformation
+C Write down information on actual conformation
          temp =  1.0d0/beta/0.00198773
          write(14,'(i6,13f12.3,1x,a)')  
@@ -129,21 +121,21 @@
      &   eyhb, eyvw, eyel, eyvr, zimm(1:nresi)
         end if
-!
+C
       end do
 
       acz = acz/dble(nsw*nvr)
-      write (logString, *) 'acceptance rate:',acz
-      write (logString, *)
-! ------------ Output Dihedreals of final configuration
-      write (logString, *) 'last energy',eol
+      write(*,*) 'acceptance rate:',acz
+      write(*,*)
+c ------------ Output Dihedreals of final configuration
+      write(*,*) 'last energy',eol
       call outvar(0,' ')
-!     Output final conformation as pdb-file
+C     Output final conformation as pdb-file
       call outpdb(0,"final.pdb")
-      write (logString, *)
+      write(*,*)
 
-! ------------ Output Dihedreals of conformation with lowest energy
-      write (logString, *) 'lowest energy ever found:',nemin,ymin
+c ------------ Output Dihedreals of conformation with lowest energy
+      write(*,*) 'lowest energy ever found:',nemin,ymin
       close(14)
-! =====================
+c =====================
 
 
Index: bgs.f
===================================================================
--- bgs.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ bgs.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -2,5 +2,5 @@
 ! Trial version implementing the semi-local conformational update
 ! BGS (Biased Gaussian Steps). This file presently contains the
-! functions initlund, bgsposs and bgs.
+! functions initlund, bgsposs and bgs. 
 !
 ! Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
@@ -8,12 +8,66 @@
 ! ****************************************************************
 
-
-! Checks if it is possible to perform a BGS update starting at the
+! Subroutine initlund: Initializes data structures used frequently 
+! in connection with Biased Gaussian Steps and the energy functions
+! from Anders Irback's protein folding model. Calls: none.
+!
+      subroutine init_lund
+      include 'INCL.H'
+      include 'incl_lund.h'
+      logical bgsposs
+      do i=1,mxrs
+         iN(i)=-1
+         iCa(i)=-1
+         iC(i)=-1
+         iphi(i)=-34
+         ipsi(i)=-35
+      enddo
+!      print *,'total number of variables = ',nvr
+
+      do i=1,ntlml
+         npprs=1
+         do j=ivrml1(i),ivrml1(i)+nvrml(i)-1
+            mlvr(j)=i
+            if (nmvr(j).eq.'phi') then 
+               iphi(npprs)=j
+! Now if the residue is a proline, there is no phi angle in the variable
+! list in SMMP, and so iphi(j) will remain at the initial value. 
+! So, make sure you never use iphi(i) for proline. 
+            endif
+            if (nmvr(j).eq.'psi'.or.nmvr(j).eq.'pst') then 
+               ipsi(npprs)=j
+               npprs=npprs+1
+            endif
+         enddo
+         do j=irsml1(i),irsml2(i)
+            iN(j)=iatrs1(j) 
+            do k=iatrs1(j),iatrs2(j)
+               if (nmat(k)(1:2).eq.'ca') then 
+                  iCa(j)=k 
+               endif
+               if (nmat(k)(1:1).eq.'c') then 
+                  iC(j)=k 
+               endif 
+            enddo
+!            print *,'determined phi,psi serial for residue',j,' as '
+!     #           ,iphi(j),ipsi(j)
+         enddo
+      enddo
+      abgs=300.0
+      bbgs=10.0
+      bgsnvar=0
+      do i=1,nvr
+         if (bgsposs(i)) then
+            bgsnvar=bgsnvar+1
+            bgsvar(bgsnvar)=i
+         endif
+      enddo
+      end
+
+! Checks if it is possible to perform a BGS update starting at the 
 ! variable indexed ipos. Calls: none.
       logical function bgsposs(ips)
       include 'INCL.H'
       include 'incl_lund.h'
-      integer jv, ips, iaa, nursvr, nnonfx, i
-
       logical ians
 
@@ -22,20 +76,20 @@
       ians=.true.
 !      print *,'evaluating bgs possibility for ',ips,nmvr(jv)
-      if (nmvr(jv).ne.'phi') then
+      if (nmvr(jv).ne.'phi') then 
 !         print *,'bgs not possible because variable name is ',nmvr(jv)
          ians=.false.
-      else if (iaa.gt.(irsml2(mlvr(jv))-3)) then
+      else if (iaa.gt.(irsml2(mlvr(jv))-3)) then 
 !         print *,'bgs impossible, residue too close to end'
 !         print *,'iaa = ',iaa,' end = ',irsml2(mlvr(jv))
          ians=.false.
-      else
-         nnonfx=0
+      else 
+         nnonfx=0 
          do i=iaa,iaa+3
-            if (iphi(i).gt.0) then
+            if (iphi(i).gt.0) then 
                if (.not.fxvr(iphi(i))) then
                   nnonfx=nnonfx+1
                endif
             endif
-            if (.not.fxvr(ipsi(i))) then
+            if (.not.fxvr(ipsi(i))) then 
                nnonfx=nnonfx+1
             endif
@@ -54,15 +108,15 @@
 
 ! Biased Gaussian Steps. Implements a semi-local conformational update
-! which modifies the protein backbone locally in a certain range of
-! amino acids. The 'down-stream' parts of the molecule outside the
+! which modifies the protein backbone locally in a certain range of 
+! amino acids. The 'down-stream' parts of the molecule outside the 
 ! region of update get small rigid body translations and rotations.
 !
-! Use the update sparingly. It is rather local, and is not of great
+! Use the update sparingly. It is rather local, and is not of great 
 ! value if we need big changes in the conformation. It is recommended
-! that this update be used to refine a structure around a low energy
+! that this update be used to refine a structure around a low energy 
 ! candidate structure. Even at low energies, if you always
-! perform BGS, the chances of coming out of that minimum are small.
-! So, there is a probability bgsprob, which decides whether BGS or the
-! normal single angle update is used.
+! perform BGS, the chances of coming out of that minimum are small. 
+! So, there is a probability bgsprob, which decides whether BGS or the 
+! normal single angle update is used. 
 !
 ! Calls: energy, dummy (function provided as argument), addang, (rand)
@@ -72,10 +126,4 @@
       include 'INCL.H'
       include 'incl_lund.h'
-      double precision grnd, xiv, bv, ab, rv, dv, a, sum, p, r1, r2
-      double precision ppsi, wfw, addang, enw, energy, wbw, rd, delta
-      double precision dummy, eol1
-
-      integer ivar, i, nph, jv, ia, nursvr, icurraa, j, k, l
-
       external dummy
       dimension xiv(8,3),bv(8,3),rv(3,3),dv(3,8,3)
@@ -84,5 +132,5 @@
 ! Initialize
 !      print *,'using BGS on angle ',nmvr(idvr(ivar))
-      if (bgsnvar.eq.0) then
+      if (bgsnvar.eq.0) then 
          bgs=0
          goto 171
@@ -99,5 +147,5 @@
       do i=1,4
          icurraa=ia+i-1
-         if (iphi(icurraa).gt.0.and..not.fxvr(iphi(icurraa))) then
+         if (iphi(icurraa).gt.0.and..not.fxvr(iphi(icurraa))) then 
             nph=nph+1
             xiv(nph,1)=xat(iCa(icurraa))
@@ -108,7 +156,7 @@
             bv(nph,3)=xiv(nph,3)-zat(iN(icurraa))
             ab(nph)=bv(nph,1)*bv(nph,1)+bv(nph,2)*bv(nph,2)
-     &           +bv(nph,3)*bv(nph,3)
+     #           +bv(nph,3)*bv(nph,3)
             iph(nph)=iphi(icurraa)
-         endif
+         endif 
          if (.not.fxvr(ipsi(icurraa))) then
             nph=nph+1
@@ -120,5 +168,5 @@
             bv(nph,3)=xiv(nph,3)-zat(iCa(icurraa))
             ab(nph)=bv(nph,1)*bv(nph,1)+bv(nph,2)*bv(nph,2)
-     &           +bv(nph,3)*bv(nph,3)
+     #           +bv(nph,3)*bv(nph,3)
             iph(nph)=ipsi(icurraa)
          endif
@@ -137,12 +185,12 @@
          do j=1,nph
             dv(i,j,1)=(1.0/ab(j))*(bv(j,2)*(rv(i,3)-xiv(j,3))-
-     &           bv(j,3)*(rv(i,2)-xiv(j,2)))
+     c           bv(j,3)*(rv(i,2)-xiv(j,2)))
             dv(i,j,2)=(-1.0/ab(j))*(bv(j,1)*(rv(i,3)-xiv(j,3))-
-     &           bv(j,3)*(rv(i,1)-xiv(j,1)))
+     c           bv(j,3)*(rv(i,1)-xiv(j,1)))
             dv(i,j,3)=(1.0/ab(j))*(bv(j,1)*(rv(i,2)-xiv(j,2))-
-     &           bv(j,2)*(rv(i,1)-xiv(j,1)))
-         enddo
-      enddo
-      do i=1,nph
+     c           bv(j,2)*(rv(i,1)-xiv(j,1)))
+         enddo
+      enddo
+      do i=1,nph 
          do j=i,nph
             A(i,j)=0
@@ -165,7 +213,7 @@
                sum=sum-A(i,k)*A(j,k)
             enddo
-            if (i.eq.j) then
-               p(i)=sqrt(sum)
-            else
+            if (i.eq.j) then 
+               p(i)=sqrt(sum) 
+            else 
                A(j,i)=sum/p(i)
             endif
@@ -185,5 +233,5 @@
          dph(i)=0
       enddo
-! Solve lower triangular matrix to get dphi proposals
+! Solve lower triangular matrix to get dphi proposals 
       do i=nph,1,-1
          sum=ppsi(i)
@@ -198,5 +246,5 @@
       do i=1,nph
          sum=sum+ppsi(i)*ppsi(i)
-      enddo
+      enddo 
       wfw=exp(-sum)
       do i=1,nph
@@ -216,5 +264,5 @@
       do i=1,4
          icurraa=ia+i-1
-         if (iphi(icurraa).gt.0.and..not.fxvr(iphi(icurraa))) then
+         if (iphi(icurraa).gt.0.and..not.fxvr(iphi(icurraa))) then 
             nph=nph+1
             xiv(nph,1)=xat(iCa(icurraa))
@@ -225,8 +273,8 @@
             bv(nph,3)=xiv(nph,3)-zat(iN(icurraa))
             ab(nph)=bv(nph,1)*bv(nph,1)+bv(nph,2)*bv(nph,2)
-     &           +bv(nph,3)*bv(nph,3)
+     #           +bv(nph,3)*bv(nph,3)
             iph(nph)=iphi(icurraa)
-         endif
-         if (.not.fxvr(ipsi(icurraa))) then
+         endif 
+         if (.not.fxvr(ipsi(icurraa))) then 
             nph=nph+1
             xiv(nph,1)=xat(iC(icurraa))
@@ -237,5 +285,5 @@
             bv(nph,3)=xiv(nph,3)-zat(iCa(icurraa))
             ab(nph)=bv(nph,1)*bv(nph,1)+bv(nph,2)*bv(nph,2)
-     &           +bv(nph,3)*bv(nph,3)
+     #           +bv(nph,3)*bv(nph,3)
             iph(nph)=ipsi(icurraa)
          endif
@@ -254,12 +302,12 @@
          do j=1,nph
             dv(i,j,1)=(1.0/ab(j))*(bv(j,2)*(rv(i,3)-xiv(j,3))-
-     &           bv(j,3)*(rv(i,2)-xiv(j,2)))
+     c           bv(j,3)*(rv(i,2)-xiv(j,2)))
             dv(i,j,2)=(-1.0/ab(j))*(bv(j,1)*(rv(i,3)-xiv(j,3))-
-     &           bv(j,3)*(rv(i,1)-xiv(j,1)))
+     c           bv(j,3)*(rv(i,1)-xiv(j,1)))
             dv(i,j,3)=(1.0/ab(j))*(bv(j,1)*(rv(i,2)-xiv(j,2))-
-     &           bv(j,2)*(rv(i,1)-xiv(j,1)))
-         enddo
-      enddo
-      do i=1,nph
+     c           bv(j,2)*(rv(i,1)-xiv(j,1)))
+         enddo
+      enddo
+      do i=1,nph 
          do j=i,nph
             A(i,j)=0
@@ -270,5 +318,5 @@
             enddo
             A(i,j)=bbgs*A(i,j)
-            if (i.eq.j) then
+            if (i.eq.j) then 
                A(i,j)=A(i,j)+1
             endif
@@ -282,7 +330,7 @@
                sum=sum-A(i,k)*A(j,k)
             enddo
-            if (i.eq.j) then
-               p(i)=sqrt(sum)
-            else
+            if (i.eq.j) then 
+               p(i)=sqrt(sum) 
+            else 
                A(j,i)=sum/p(i)
             endif
@@ -293,5 +341,5 @@
          do j=i+1,nph
             ppsi(i)=ppsi(i)+A(j,i)*dph(j)
-         enddo
+         enddo  
       enddo
       sum=0
@@ -299,5 +347,5 @@
          sum=sum+ppsi(i)*ppsi(i)
       enddo
-      wbw=exp(-sum)
+      wbw=exp(-sum) 
       do i=1,nph
          wbw=wbw*p(i)
@@ -314,20 +362,20 @@
 !       call outpdb(0,'after.pdb')
 !      print *,'after outpdb for after.pdb'
-!      do i=1,nph
+!      do i=1,nph 
 !         print *,'BGS>',i,iph(i),vlvr(iph(i)),dph(i)
 !      enddo
-      if (rd.ge.delta) then
+      if (rd.ge.delta) then 
 !     accept
          eol1=enw
          bgs=1
 !         print *,'BGS move accepted'
-      else
+      else 
 !     reject
          vlvr = ovr
 !          enw=energy()
 !          if (abs(enw-eol1).gt.0.000001) then
-!             write (logString, *) 'rejected bgs move: energy change :',eol1,enw
+!             write(*,*) 'rejected bgs move: energy change :',eol1,enw
 !          endif
-!         write (logString, *) 'rejected bgs move: ',eol1,enw,wfw,wbw,rd
+!         write(*,*) 'rejected bgs move: ',eol1,enw,wfw,wbw,rd
          bgs=0
       endif
Index: bldmol.f
===================================================================
--- bldmol.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ bldmol.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,49 +1,43 @@
-! **************************************************************
-!
-! This file contains the subroutines:  bldmol, fnd3ba,eyring,
-!                                      setsys,setgbl
-!
-! 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:  bldmol, fnd3ba,eyring,
+c                                      setsys,setgbl
+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 **************************************************************
 
       subroutine bldmol(nml)
 
-! .................................................
-! PURPOSE: calculate coordinates for molecule 'nml'
-!
-! OUTPUT:  xat,yat,zat,xbaat,ybaat,zbaat,xtoat,ytoat,
-!          ztoat (via 'eyring')
-!
-!          1st backbone atom of 1st residue of 'nml': 
-!
-!          - it's position: from 'gbpr(1-3,nml)'
-!          - it's axes: from 'setgbl' according to
-!            global angles 'gbpr(4-5,nml)'
-!
-! CALLS: eyring, fnd3ba,setgbl,setsys
-! .................................................
-
-      include 'INCL.H'
-      ! Subroutine arguments
-      integer nml
-      
-      integer i, i1, i2, i3, ifirs, jow, j, jj
-      double precision x1, x2, x3, y1, y2, y3, z1, z2, z3
-      
-      double precision xg, zg
+c .................................................
+c PURPOSE: calculate coordinates for molecule 'nml'
+c
+c OUTPUT:  xat,yat,zat,xbaat,ybaat,zbaat,xtoat,ytoat,
+c          ztoat (via 'eyring')
+c
+c          1st backbone atom of 1st residue of 'nml': 
+c
+c          - it's position: from 'gbpr(1-3,nml)'
+c          - it's axes: from 'setgbl' according to
+c            global angles 'gbpr(4-5,nml)'
+c
+c CALLS: eyring, fnd3ba,setgbl,setsys
+c .................................................
+
+      include 'INCL.H'
+
       dimension xg(3),zg(3)
 
 
       call fnd3ba(nml,i1,i2,i3)
-! ------------------------------ first 3 bb atoms of 'nml'
+c ------------------------------ first 3 bb atoms of 'nml'
       ixrfpt(1,nml)=i1
       ixrfpt(2,nml)=i2
       ixrfpt(3,nml)=i3
 
-! ------------------------------ position of 1st bb atom
+c ------------------------------ position of 1st bb atom
       xat(i1) = gbpr(1,nml)
       yat(i1) = gbpr(2,nml)
@@ -92,19 +86,16 @@
       return
       end
-! ***********************************
+c ***********************************
       subroutine fnd3ba(nml,i1,i2,i3)
  
-! .................................................
-! PURPOSE: return indices 'i1,i2,i3' of
-!          first 3 backbone atoms in molecule 'nml'
-!
-! CALLS:   fndbrn
-! .................................................
+c .................................................
+c PURPOSE: return indices 'i1,i2,i3' of
+c          first 3 backbone atoms in molecule 'nml'
+c
+c CALLS:   fndbrn
+c .................................................
  
       include 'INCL.H'
-! arguments      
-      integer nml, i1, i2, i3
-      
-      integer ibd, i, irs, ix
+
       dimension ibd(4)
       logical bb
@@ -113,13 +104,13 @@
       irs=irsml1(nml)
 
-! --------------------------- 1st bb atom
+c --------------------------- 1st bb atom
       i1=iatrs1(irs)
 
       call fndbrn(nml,irs,i1,i,ix,i2,bb)
 
-! --------------------------- 2nd bb atom
+c --------------------------- 2nd bb atom
       i2=i+1
 
-! ------------------------ check for ring
+c ------------------------ check for ring
 
       ibd(1)=iowat(i1)
@@ -134,7 +125,7 @@
 
           if (ix.ne.0) then
-            write (logString, '(2a,i3)') 
-     &         ' fnd3ba> Can handle only simple ring at 1st',
-     &         ' atom of molecule #',nml
+            write (*,'(2a,i3)') 
+     #         ' fnd3ba> Can handle only simple ring at 1st',
+     #         ' atom of molecule #',nml
             stop
           endif
@@ -144,5 +135,5 @@
       enddo
 
-! --------------------------- 3rd bb atom
+c --------------------------- 3rd bb atom
 
       ix=ixatrs(irs)
@@ -166,30 +157,26 @@
       endif
 
-      write (logString, '(4a,i4,a,i4)') 
-     &   ' fnd3ba> Cannot find backbone atom following ',nmat(i2),
-     &   ' of residue ',seq(irs),irs,' in molecule #',nml
+      write (*,'(4a,i4,a,i4)') 
+     #   ' fnd3ba> Cannot find backbone atom following ',nmat(i2),
+     #   ' of residue ',seq(irs),irs,' in molecule #',nml
       stop
 
       end
-! ***************************
+c ***************************
       subroutine eyring(i,ia)
 
-! .........................................................
-! PURPOSE:  calculate cartesian coordinates of atom 'i'
-!           using EYRING's algorithm
-! INPUT:    i - index of atom to be constructed
-!               for 'i': blat,csbaat,snbaat,cstoat,sntoat
-!           ia- index of atom from which 'i' is to be built
-! OUTPUT:   for 'i': xat,yat,zat,xbaat,ybaat,zbaat,xtoat,ytoat,ztoat
-!
-! CALLS: none
-! .........................................................
-
-      include 'INCL.H'
-!     arguments
-      integer i, ia
-      double precision ct, st, ca, sa, bl, x1, x2, x3, z1, z2, z3
-      double precision y1, y2, y3, h2, h3, dx, dz
-      
+c .........................................................
+c PURPOSE:  calculate cartesian coordinates of atom 'i'
+c           using EYRING's algorithm
+c INPUT:    i - index of atom to be constructed
+c               for 'i': blat,csbaat,snbaat,cstoat,sntoat
+c           ia- index of atom from which 'i' is to be built
+c OUTPUT:   for 'i': xat,yat,zat,xbaat,ybaat,zbaat,xtoat,ytoat,ztoat
+c
+c CALLS: none
+c .........................................................
+
+      include 'INCL.H'
+
       ct=cstoat(i)
       st=sntoat(i)
@@ -241,30 +228,26 @@
       return
       end
-! ***********************************************************
+c ***********************************************************
       subroutine setsys(i1,i2,i3, x1,x2,x3,y1,y2,y3,z1,z2,z3)
 
-! ..........................................................
-!  PURPOSE:  calculate axes X,Y,Z of right-handed orthogonal
-!            system given by three atom positions R1, R2, R3
-!
-!            X = (R2-R1)/ |( )|
-!            Z = {X x (R2-R3)} / |{ }|
-!            Y = Z x X
-!
-!  INPUT:    i1, i2, i3 - indices of three atoms
-!  OUTPUT:   x1,x2,x3 |
-!            y1,y2,y3 | -direction cosines of X,Y,Z
-!            z1,z2,z3 |
-!
-!  CALLS:    none
-! ...................................................
-
-
-      include 'INCL.H'
-!     arguments
-      integer i1, i2, i3
-      double precision x1, x2, x3, y1, y2, y3, z1, z2, z3, h1, h2, h3
-      double precision dz, dx
-      
+c ..........................................................
+c  PURPOSE:  calculate axes X,Y,Z of right-handed orthogonal
+c            system given by three atom positions R1, R2, R3
+c
+c            X = (R2-R1)/ |( )|
+c            Z = {X x (R2-R3)} / |{ }|
+c            Y = Z x X
+c
+c  INPUT:    i1, i2, i3 - indices of three atoms
+c  OUTPUT:   x1,x2,x3 |
+c            y1,y2,y3 | -direction cosines of X,Y,Z
+c            z1,z2,z3 |
+c
+c  CALLS:    none
+c ...................................................
+
+
+      include 'INCL.H'
+
       h1=xat(i2)
       h2=yat(i2)
@@ -300,37 +283,32 @@
       end
 
-! *****************************************
+c *****************************************
       subroutine setgbl(nml,i1,i2,i3,xg,zg)
 
-! ...................................................
-!
-! PURPOSE: 1. Obtain global axes (J,K,L)
-!             related to x(1 0 0),y(0 1 0),z(0 0 1)
-!             by 3 rotations (gbl. parameters #4-#6):
-!
-!             - round z by angle alpha 
-!	      - round x' by a. beta 
-!	      - round y" by a. gamma
-!
-!          2. Return x-axis (xg) & z-axis (zg)
-!             for atom #1 in order to orientate J
-!             along the bond from backbone atom #1
-!             to bb.a. #2 and L according to the
-!             cross product [ bond(#1->#2) x
-!             bond(#2->#3) ] when using Eyring's
-!             algorithm to get the coordinates
-!
-! CALLS:   none
-! ..............................................
-
-      include 'INCL.H'
-!     arguments
-      integer nml, i1, i2, i3
-      double precision xg, zg, ag
+c ...................................................
+c
+c PURPOSE: 1. Obtain global axes (J,K,L)
+c             related to x(1 0 0),y(0 1 0),z(0 0 1)
+c             by 3 rotations (gbl. parameters #4-#6):
+c
+c             - round z by angle alpha 
+c	      - round x' by a. beta 
+c	      - round y" by a. gamma
+c
+c          2. Return x-axis (xg) & z-axis (zg)
+c             for atom #1 in order to orientate J
+c             along the bond from backbone atom #1
+c             to bb.a. #2 and L according to the
+c             cross product [ bond(#1->#2) x
+c             bond(#2->#3) ] when using Eyring's
+c             algorithm to get the coordinates
+c
+c CALLS:   none
+c ..............................................
+
+      include 'INCL.H'
+      
       dimension xg(3),zg(3),ag(3,3)
 
-      integer i
-      double precision ca, sa, cb,sb, cg, sg, d, ct2, ct3, dx, dz
-      double precision x1, x2, x3, y1, y2, y3, z1, z2, z3, st2, sa2, st3
 
       ca = cos(gbpr(4,nml))  ! alpha
@@ -341,5 +319,5 @@
       sg = sin(gbpr(6,nml))
 
-! ----------------------------- J
+c ----------------------------- J
       x1 =  ca*cg - sa*sb*sg
       x2 =  sa*cg + ca*sb*sg
@@ -350,5 +328,5 @@
       ag(2,1) = x2/d
       ag(3,1) = x3/d
-! ----------------------------- K
+c ----------------------------- K
       y1 = -sa*cb
       y2 =  ca*cb
@@ -359,5 +337,5 @@
       ag(2,2) = y2/d
       ag(3,2) = y3/d
-! ----------------------------- L
+c ----------------------------- L
       z1 =  ca*sg + sa*sb*cg
       z2 =  sa*sg - ca*sb*cg
@@ -369,5 +347,5 @@
       ag(3,3) = z3/d
 
-! ------------------------------------ X1
+c ------------------------------------ X1
       ct2 = cstoat(i2)
       st2 = sntoat(i2)
@@ -382,5 +360,5 @@
       x2 = x2/dx
       x3 = x3/dx
-! ------------------------------------- Z1
+c ------------------------------------- Z1
       st3 = sntoat(i3)
       ct3 = cstoat(i3)
@@ -394,9 +372,9 @@
       z2 = z2/dz
       z3 = z3/dz
-! ------------------------------------- Y1
+c ------------------------------------- Y1
       y1 = z2 * x3 - z3 * x2
       y3 = z1 * x2 - z2 * x1  ! do not need y2
 
-! ----------------------------- into global system
+c ----------------------------- into global system
 
       xg(1) = ag(1,1)*x1 + ag(1,2)*y1 + ag(1,3)*z1
Index: callbacktest.f
===================================================================
--- callbacktest.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ callbacktest.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,5 +1,5 @@
       subroutine metropolis(eol,enw,dummy)
-!f2py real*8 intent(in,out) eol
-!f2py real*8 intent(in,out) enw
+cf2py real*8 intent(in,out) eol
+cf2py real*8 intent(in,out) enw
         external dummy
         delta =  dummy(enw) - dummy(eol)
Index: canon.f
===================================================================
--- canon.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ canon.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,55 +1,50 @@
-! **************************************************************
-!
-! This file contains the subroutines: canon,can_weight 
-!
-! 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: canon,can_weight 
+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 **************************************************************
 
       subroutine  canon(nequi, nswp, nmes, temp, lrand)
-! -----------------------------------------------------------------
-! PURPOSE: CANONICAL SIMULATION OF PROTEINS USING METROPOLIS UPDATES
-!
-! CALLS:  addang,energy,metropolis,hbond,helix,outvar,outpdb,rgyr
-!
-!-------------------------------------------------------------------
+C -----------------------------------------------------------------
+C PURPOSE: CANONICAL SIMULATION OF PROTEINS USING METROPOLIS UPDATES
+C
+C CALLS:  addang,energy,metropolis,hbond,helix,outvar,outpdb,rgyr
+C
+C-------------------------------------------------------------------
       include 'INCL.H'
 
-!f2py intent(in) nequi
-!f2py intent(in) nswp
-!f2py intent(in) nmes
-!f2py intent(in) temp
-!f2py logical optional, intent(in):: lrand = 1
+cf2py intent(in) nequi
+cf2py intent(in) nswp
+cf2py intent(in) nmes
+cf2py intent(in) temp
+cf2py logical optional, intent(in):: lrand = 1
 
-!     external rand
+c     external rand
       external can_weight
-      
-      double precision dv, grnd, vr, addang, eol, energy, acz, rgy, ee
-
-      integer i, iv, nsw, nhel, mhel, nbet, mbet, mhb
-
      
       logical lrand
-!      parameter(lrand=.false.)
-!      parameter(nequi=10, nswp=1000,nmes=10)
-!      parameter(temp=300.0)
-!     lrand=.true.: creates random start configuration 
-!     nequi: Number of sweeps for equilibrisation of system
+c      parameter(lrand=.false.)
+c      parameter(nequi=10, nswp=1000,nmes=10)
+c      parameter(temp=300.0)
+C     lrand=.true.: creates random start configuration 
+C     nequi: Number of sweeps for equilibrisation of system
       integer nequi
-!     nswp:  Number of sweeps for simulation run
+C     nswp:  Number of sweeps for simulation run
       integer nswp
-!     nmes:  Number of sweeps between measurments
+c     nmes:  Number of sweeps between measurments
       integer nmes
-!     temp:  Temperature of simulation
-      double precision temp, e_min
-!
+C     temp:  Temperature of simulation
+      double precision temp
+C
 !      common/bet/beta
 
       character*80 file
 
-!     Define files for output:
+c     Define files for output:
       open(13,file='time.d')
 
@@ -57,5 +52,5 @@
       beta=1.0/ ( temp * 1.98773d-3 )
 
-! _________________________________ random start
+c _________________________________ random start
       if(lrand) then
        do i=1,nvr
@@ -68,58 +63,50 @@
 
       eol = energy()
-      e_min = eol
-      write (logString, '(a,e12.5,/)')  'energy of start configuration:',eol
+      write (*,'(a,e12.5,/)')  'energy of start configuration:',eol
 
-! Write start configuration in pdb-format into file
+C Write start configuration in pdb-format into file
       call outpdb(0,'start.pdb')
 
-! =====================Equilibration by  Metropolis
+c =====================Equilibration by  Metropolis
       acz = 0.0d0
       do nsw=1,nequi
          call metropolis(eol,acz,can_weight)
       end do
-      write (logString, *) 'Energy after equilibration:',eol
+      write(*,*) 'Energy after equilibration:',eol
 
-!======================Simulation in canonical ensemble
+C======================Simulation in canonical ensemble
       acz = 0.0d0
       do nsw=0,nswp
         call metropolis(eol,acz,can_weight)
-        if (eol.lt.e_min) then
-           write (logString, *) "New minimum energy:", eol, "t=", nsw
-           write (logString, *) eyel,eyhb,eyvr,eysl
-           e_min = eol
-           call outpdb(0, "minen.pdb")
-        endif
-!
+c
         if(mod(nsw,nmes).eq.0) then
-! Measure radius of gyration and end-to-end distance
-! rgy: radius of gyration
-! ee:  end-to-end distance
+C Measure radius of gyration and end-to-end distance
+C rgy: radius of gyration
+C ee:  end-to-end distance
          call rgyr(1,rgy,ee)
-! Measure helicity 
-! nhel: number of helical residues
-! mhel: number of helical segments
-! nbet: number of sheet-like residues
-! mbet: number of sheet-like segments
+C Measure helicity 
+C nhel: number of helical residues
+c mhel: number of helical segments
+c nbet: number of sheet-like residues
+c mbet: number of sheet-like segments
          call helix(nhel,mhel,nbet,mbet) 
-! Measure number of hydrogen bonds (mhb)
+C Measure number of hydrogen bonds (mhb)
         do i=1,ntlml
          call hbond(i,mhb,0)
         end do
-! Write down information on actual conformation
-         write(13,'(i7,2f15.3,5i7,4f15.3)')  nsw,  eol, rgy,
-     &                              nhel,mhel,nbet,mbet,mhb,
-     &                              eyel,eyhb,eyvr,eysl
+C Write down information on actual conformation
+         write(13,'(i5,2f12.3,5i7)')  nsw,  eol, rgy,
+     &                              nhel,mhel,nbet,mbet,mhb
         end if
-!
+C
       end do
 
       acz = acz/dble(nsw*nvr)
-      write (logString, *) 'acceptance rate:',acz
-      write (logString, *)
-! ------------ Output Dihedreals of final configuration
-      write (logString, *) 'last energy',eol
+      write(*,*) 'acceptance rate:',acz
+      write(*,*)
+c ------------ Output Dihedreals of final configuration
+      write(*,*) 'last energy',eol
       call outvar(0,'lastconf.var')
-!     Output final conformation as pdb-file
+C     Output final conformation as pdb-file
       call outpdb(0,'final.pdb')
 
@@ -127,17 +114,16 @@
       close(12)
       close(13)
-! =====================
+c =====================
 
 
        end
 
-! ********************************************************
+c ********************************************************
       real*8 function can_weight(x)
-!
-! CALLS: none
-!
-      implicit none
-      double precision beta, x
+c
+c CALLS: none
+c
 
+      implicit real*8 (a-h,o-z) 
 
       common/bet/beta
Index: cnteny.f
===================================================================
--- cnteny.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ cnteny.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,31 +1,24 @@
-! **************************************************************
-!
-! This file contains the subroutines: cnteny
-!
-! Copyright 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: cnteny
+c
+c Copyright 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 **************************************************************
 
       subroutine cnteny(nml)
 
-! ................................................................................
-! PURPOSE: Calculate atomic contact energy of molecule 'nml' with ECEPP parameters
-!
-! CALLS: nursat
-! ................................................................................
+c ................................................................................
+c PURPOSE: Calculate atomic contact energy of molecule 'nml' with ECEPP parameters
+c
+c CALLS: nursat
+c ................................................................................
 
       include 'INCL.H'
 
-      double precision coeycn, coey, eyatcn, cqi, xi, yi, zi, xij, yij
-      double precision zij, rij2, rij4, rij6, rij, sr, ep, ey
-
-      integer ieyel, ntlvr, nml, iat1, nat, i, ifivr, i1s, io, iv, ia
-      integer it, ic, i2s, ims, i1, i2, ii, ity, ivw, j, jj, jty, i14
-      integer nbc, ir, nursat, idxat
-
-      parameter (coeycn=2.d0)  ! min. cont. energy to display
+      parameter (coeycn=2.d0)  ! min. cont. energy to display 
 
       dimension eyatcn(mxat),idxat(mxat)
@@ -37,6 +30,6 @@
 
       if (ntlvr.eq.0) then
-        write (logString, '(a,i4)')
-     &           ' cnteny> No variables defined in molecule #',nml
+        write (*,'(a,i4)')
+     #           ' cnteny> No variables defined in molecule #',nml
         return
       endif
@@ -184,6 +177,6 @@
           nbc=nbc+1
           ir=nursat(i)
-          write (logString, '(1x,i4,1x,a4,1x,a4,a2,e11.4)') ir,seq(ir),
-     &       nmat(i), ': ',ey
+          write(*,'(1x,i4,1x,a4,1x,a4,a2,e11.4)') ir,seq(ir),nmat(i),
+     #                                            ': ',ey
         endif
       enddo
Index: contacts.f
===================================================================
--- contacts.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ contacts.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,24 +1,24 @@
-! **************************************************************
-!
-! This file contains the subroutines: contacts,c_alfa,c_cont
-!
-! 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: contacts,c_alfa,c_cont
+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 **************************************************************
       
        subroutine contacts(ncn,nham2,dham)
 
-! ..............................................................
-!
-! Calculates number of contacts in given conformation, number of
-! contacts which are the same in given and reference conformation,
-! and the hamming distance between given conformation and the 
-! reference conformation.
-!
-! CALLS: c_cont
-! ..............................................................
+c ..............................................................
+c
+c CALCULATES NUMBER OF CONTACTS IN GIVEN CONFORMATION, NUMBER OF
+c CONTACTS WHICH ARE THE SAME IN GIVEN AND REFERENCE ONFORMATION,
+c AND THE HAMMING DISTANCE BETWEEN GIVEN  CONFORMATION AND THE 
+c REFERENCE CONFORMATIONa
+c
+c CALLS: c_cont
+c ..............................................................
 
       include 'INCL.H'
@@ -26,11 +26,4 @@
 !f2py integer, intent(out) :: ncn, nham2 
 !f2py double precistion, intent(out) :: dham
-      integer ncn
-
-      integer nham2
-
-      double precision dham
-
-      integer i, j, nham, ncode, nresi
 
       call c_cont(1,ncode)
@@ -62,30 +55,27 @@
 
 
-! ********************************* 
+c ********************************* 
       subroutine c_alfa(nmol,ncode)
 
-! ......................................................
-!    Calculates the indices of C-alpha atoms and 
-!    stores in the array ind_alf(mxrs)
-!                        
-!    Usage: call c_alfa(nmol,ncode)
-!
-!           nmol - index of the molecule
-!           ncode ---> not in use in the current version
-!
-!    OUTPUT:  ind_alf(mxrs)
-!
-! CALLS: none
-! ......................................................
+c ......................................................
+c    Calculates the indices of C-alpha atoms and 
+c    stores in the array ind_alf(mxrs)
+c                        
+c    Usage: call c_alfa(nmol,ncode)
+c
+c           nmol - index of the molecule
+c           ncode ---> not in use in the current version
+c
+c    OUTPUT:  ind_alf(mxrs)
+c
+c CALLS: none
+c ......................................................
 
       include 'INCL.H'
-      integer nmol
-
-      integer ncode, ia, n_res
               
       do n_res=irsml1(nmol),irsml2(nmol) ! Over res. 
         do ia=iatrs1(n_res),iatrs2(n_res) ! Over the atoms of res. 
 
-!     Check for C_alpha atoms
+c     Check for C_alpha atoms
 
          if (nmat(ia)(1:2).eq.'ca') then
@@ -99,48 +89,43 @@
       end
 
-! **********************************
+c **********************************
       subroutine c_cont (nmol,ncode)
 
-!..............................................................
-!  Calculates the matrix of contacts between aminoacid residues 
-!  of the molecule "nmol" according to  L.Mirny and E.Domany, 
-!  PROTEINS:Structure, Function, and Genetics 26:391-410 (1996)
-!                
-!  Two residues are in contact if their C_alpha atoms are
-!  closer than 8.5 Angstrem
-!
-!  Usage: call c_cont(nmol,ncode)
-!
-!       Where nmol is the index of the molecule (always 1, in the 
-!       current version of SMM)
-!       ncode ---> not in use in the current version
-!
-!  IMPORTANT: Before the first call of this subroutine  "c_alfa"
-!          must be called to calculate the inices of C_alpha atoms.
-!          (ONLY ONCE)
-!
-!   OUTPUT: The output of this routine is the contact matrix
-!          ijcont(mxrs,mxrs) 
-!
-!              ijcont(i,j)=0---> residues i and j are not in contact
-!              ijcont(i,j)=1---> ---------''----- are in contact
-!              ijcont(i,j)=2---> residues i and j are adjacent
-!
-!    NOTE:  Adjacent residues are always in contact (and therefore not
-!           counted)
-!
-!         Here "mxrs" is the maximum number of residues for SMM
-!         Obviously, this subroutine calculates only NxN part
-!         of that matrix, N -is the number of res. in "nmol"
-! 
-! CALLS:  none
-!..............................................................
+c..............................................................
+c  Calculates the matrix of contacts between aminoacid residues 
+c  of the molecule "nmol" according to  L.Mirny and E.Domany, 
+c  PROTEINS:Structure, Function, and Genetics 26:391-410 (1996)
+c                
+c  Two residues are in contact if their C_alpha atoms are
+c  closer than 8.5 Angstrem
+c
+c  Usage: call c_cont(nmol,ncode)
+c
+c       Where nmol is the index of the molecule (always 1, in the 
+c       current version of SMM)
+c       ncode ---> not in use in the current version
+c
+c  IMPORTANT: Before the first call of this subroutine  "c_alfa"
+c          must be called to calculate the inices of C_alpha atoms.
+c          (ONLY ONCE)
+c
+c   OUTPUT: The output of this routine is the contact matrix
+c          ijcont(mxrs,mxrs) 
+c
+c              ijcont(i,j)=0---> residues i and j are not in contact
+c              ijcont(i,j)=1---> ---------''----- are in contact
+c              ijcont(i,j)=2---> residues i and j are adjacent
+c
+c    NOTE:  Adjacent residues are always in contact (and therefore not
+c           counted)
+c
+c         Here "mxrs" is the maximum number of residues for SMM
+c         Obviously, this subroutine calculates only NxN part
+c         of that matrix, N -is the number of res. in "nmol"
+c 
+c CALLS:  none
+c..............................................................
 
        include 'INCL.H'
-      integer nmol
-
-      double precision rcut, rij2
-
-      integer ncode, ic, ialf, jalf, nr_j, nr_i
 
        rcut=8.5   ! Domany
@@ -161,5 +146,5 @@
            do nr_j=nr_i+3,irsml2(nmol) ! Over res. j 
 
-!             write (logString, '(2i3)'),nr_i,nr_j
+c             write(*,'(2i3)'),nr_i,nr_j
 
               ic=0
@@ -169,9 +154,9 @@
 
               rij2=(xat(ialf)-xat(jalf))**2
-     &              +(yat(ialf)-yat(jalf))**2
-     &                   + (zat(ialf)-zat(jalf))**2
+     #              +(yat(ialf)-yat(jalf))**2
+     #                   + (zat(ialf)-zat(jalf))**2
               if(sqrt(rij2).lt.rcut) ic=1
 
-!             write (logString, '(2i3)'),nr_i,nr_j
+c             write(*,'(2i3)'),nr_i,nr_j
 
               ijcont(nr_i,nr_j)=ic
Index: difang.f
===================================================================
--- difang.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ difang.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,28 +1,28 @@
-! **************************************************************
-!
-! This file contains the subroutines: difang,addang
-!
-! Copyright 2003       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: difang,addang
+c
+c Copyright 2003       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 difang(a1,a2)
 
-! ......................................................
-!  PURPOSE:  difang = a2 - a1  with:  -pi < difang <= pi
-!            
-!  INPUT:    a1,a2-two angles [rad.]
-!
-!  CALLS: none
-!
-! ......................................................
+c ......................................................
+c  PURPOSE:  difang = a2 - a1  with:  -pi < difang <= pi
+c            
+c  INPUT:    a1,a2-two angles [rad.]
+c
+c  CALLS: none
+c
+c ......................................................
 
-      implicit none
-      double precision pi, pi2, d, a2, a1
+      implicit real*8 (a-h,o-z)
+
       parameter (pi=3.141592653589793d0,
-     &           pi2=2.d0*pi)
+     #           pi2=2.d0*pi)
 
       d=mod((a2-a1),pi2)
@@ -35,21 +35,20 @@
       return
       end
-! *********************************
+c *********************************
       real*8 function addang(a1,a2)
 
-! ......................................................
-!  PURPOSE:  addang = a1 + a2  with:  -pi < addang <= pi
-!            
-!  INPUT:    a1,a2-two angles [rad.]
-!
-!  CALLS: none
-!
-! ......................................................
+c ......................................................
+c  PURPOSE:  addang = a1 + a2  with:  -pi < addang <= pi
+c            
+c  INPUT:    a1,a2-two angles [rad.]
+c
+c  CALLS: none
+c
+c ......................................................
 
-      implicit none
-      double precision pi, pi2, d, a1, a2
+      implicit real*8 (a-h,o-z)
 
       parameter (pi=3.141592653589793d0,
-     &           pi2=2.d0*pi)
+     #           pi2=2.d0*pi)
 
       d=mod((a1+a2),pi2)
Index: dihedr.f
===================================================================
--- dihedr.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ dihedr.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,30 +1,25 @@
-! **************************************************************
-!
-! This file contains the subroutines: dihedr,valang
-!
-! 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: dihedr,valang
+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 dihedr(i1,i2,i3,i4)
 
-! .............................................
-!  PURPOSE: return dihedral angle (i1,i2,i3,i4)
-!           [in rad.]
-!
-!  INPUT:   i1,i2,i3,i4 - indices of four atoms
-!
-!  CALLS:   none
-! .............................................
+c .............................................
+c  PURPOSE: return dihedral angle (i1,i2,i3,i4)
+c           [in rad.]
+c
+c  INPUT:   i1,i2,i3,i4 - indices of four atoms
+c
+c  CALLS:   none
+c .............................................
 
       include 'INCL.H'
-      
-      integer i1, i2, i3, i4
-      
-      double precision x1, y1, z1, x2, y2, z2, ux1,uy1, uz1, a, u, u1,
-     &                 u2, ux2, uy2, uz2
 
       x1=xat(i2)-xat(i1)
@@ -54,15 +49,14 @@
         dihedr=acos(a)
         if (ux1*(uy2*z2-uz2*y2)+uy1*(uz2*x2-ux2*z2)+
-     &      uz1*(ux2*y2-uy2*x2).lt.zero) dihedr =-dihedr
+     #      uz1*(ux2*y2-uy2*x2).lt.zero) dihedr =-dihedr
         return
       else
-        write (logString, '(a,4i5)')
-     &     ' dihedr> Error in coordinates of atoms #: '
-     &                     ,i1,i2,i3,i4
+        write (*,'(a,4i5)')' dihedr> Error in coordinates of atoms #: '
+     #                     ,i1,i2,i3,i4
 
-        write (logString, *) 'stored coordinates are xvals :',
-     &       xat(i1),xat(i2),xat(i3),xat(i4) 
-        write (logString, *) 'yvals:', yat(i1),yat(i2),yat(i3),yat(i4) 
-        write (logString, *) 'zvals:', zat(i1),zat(i2),zat(i3),zat(i4) 
+        write (*,*) 'stored coordinates are xvals :',
+     #       xat(i1),xat(i2),xat(i3),xat(i4) 
+        write (*,*) 'yvals:', yat(i1),yat(i2),yat(i3),yat(i4) 
+        write (*,*) 'zvals:', zat(i1),zat(i2),zat(i3),zat(i4) 
         call outvar(0,'crash.var')        
         stop
@@ -70,22 +64,17 @@
 
       end
-! ************************************
+c ************************************
       real*8 function valang(i1,i2,i3)
 
-! .........................................
-!  PURPOSE: return valence angle (i1,i2,i3)
-!           [in rad.] with 'i2' as vertex
-!
-!  INPUT:   i1,i2,i3 - indices of 3 atoms
-!
-!  CALLS:   none
-! .............................................
+c .........................................
+c  PURPOSE: return valence angle (i1,i2,i3)
+c           [in rad.] with 'i2' as vertex
+c
+c  INPUT:   i1,i2,i3 - indices of 3 atoms
+c
+c  CALLS:   none
+c .............................................
 
       include 'INCL.H'
-      
-      integer i1, i2, i3
-      
-      double precision h1, h2, h3, x1, x2, x3, y1, y2, y3, x, y, u, a
-      
       h1=xat(i2)
       h2=yat(i2)
@@ -111,11 +100,10 @@
 
       else
-        write (logString, '(a,3i5)')
-     &   ' valang> Error in coordinates of atoms #: '
-     &                     ,i1,i2,i3
-        write (logString, *) 'stored coordinates are xvals :',
-     &       xat(i1),xat(i2),xat(i3) 
-        write (logString, *) 'yvals:', yat(i1),yat(i2),yat(i3) 
-        write (logString, *) 'zvals:', zat(i1),zat(i2),zat(i3) 
+        write (*,'(a,3i5)')' valang> Error in coordinates of atoms #: '
+     #                     ,i1,i2,i3
+        write (*,*) 'stored coordinates are xvals :',
+     #       xat(i1),xat(i2),xat(i3) 
+        write (*,*) 'yvals:', yat(i1),yat(i2),yat(i3) 
+        write (*,*) 'zvals:', zat(i1),zat(i2),zat(i3) 
         call outvar(0,'crash.var') 
         stop
Index: doc/manual.lyx
===================================================================
--- doc/manual.lyx	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ doc/manual.lyx	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,3 +1,3 @@
-#LyX 1.5.6 created this file. For more info see http://www.lyx.org/
+#LyX 1.5.0rc2 created this file. For more info see http://www.lyx.org/
 \lyxformat 276
 \begin_document
@@ -39,6 +39,5 @@
 \tracking_changes false
 \output_changes false
-\author "" 
-\author "" 
+\author "Jan H. Meinke" 
 \end_header
 
@@ -2537,11 +2536,5 @@
  original ECEPP/2/3 and FLEX potentials.
  However, it should be noted that SMMP has its own numeration of the atom
- types and the types of torsions (see 
-\begin_inset LatexCommand cite
-key "Eisenmenger2001,Eisenmenger2006"
-
-\end_inset
-
- for more details).
+ types and the types of torsions (see [1,2] for more details).
 \end_layout
 
Index: energy.f
===================================================================
--- energy.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ energy.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,32 +1,27 @@
-! **************************************************************
-!
-! This file contains the subroutines: energy, enyinternal
-!
-! 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: energy, enyinternal
+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 energy()
-! ------------------------------------------
-! PURPOSE: calculate the *total* energy of the system
-!
-! ientyp = 0 for ECEPP3, 1 for FLEX, 2 for Lund
-!          3 for ECEPP3 with Abagyan corrections
-!
-! CALLS:  enyflx,enyreg,enyshe,enysol,esolan,setvar, eninteract
-!
-! -------------------------------------------------
+c ------------------------------------------
+c PURPOSE: calculate the *total* energy of the system
+c
+c ientyp = 0 for ECEPP3, 1 for FLEX, 2 for Lund
+c          3 for ECEPP3 with Abagyan corrections
+c
+c CALLS:  enyflx,enyreg,enyshe,enysol,esolan,setvar, eninteract
+c
+c -------------------------------------------------
 
       include 'INCL.H'
-      double precision esm, teysl, enyshe, enyflx, enylun, enyreg
-      double precision enysol, esolan, exvlun, eyabgn, eninteract
-
-      integer i
-
       double precision teysm, teyel, teyvw, teyhb, teyvr
-!      print *,'energy function with ientyp  = ',ientyp
+c      print *,'energy function with ientyp  = ',ientyp   
       esm = 0.d0
       teysm = 0.d0
@@ -37,5 +32,5 @@
       teysl = 0.d0
 
-      do i = 1,ntlml
+      do i = 1,ntlml  
          eysm=0
          eyel=0
@@ -49,6 +44,6 @@
         if (ientyp.eq.0.or.ientyp.eq.3) then
           esm=esm+enyshe(i)
-        else if (ientyp.eq.1) then
-          esm=esm+enyflx(i)
+        else if (ientyp.eq.1) then 
+          esm=esm+enyshe(i)
         else if (ientyp.eq.2) then
            esm=enylun(i)
@@ -60,46 +55,44 @@
         teyvr = teyvr + eyvr
         if (ientyp.eq.2) then
-!     The Lund term stores the hydrophobicity energy in eysl
+c     The Lund term stores the hydrophobicity energy in eysl
            teysl = teysl + eysl
-        else
-!     .. and the excluded volume term in eyvw, which is calculated once.
+        else 
+c     .. and the excluded volume term in eyvw, which is calculated once.
            teyvw = teyvw + eyvw
         endif
 
-        if (ireg.eq.1)  eyrg=enyreg(i)
+        if (ireg.eq.1)  eyrg=enyreg(i)        
 
       enddo
 
-      if (ientyp.ne.2) then
-!     Don't touch eysl if using Lund potential, as enylun stores
-!     its hydrophobicity term there.
+      if (ientyp.ne.2) then 
+c     Don't touch eysl if using Lund potential, as enylun stores 
+c     its hydrophobicity term there.
          if (itysol.gt.0) then
             esm=esm+enysol(0)
             teysl = teysl+eysl
-         else if (itysol.lt.0) then
-            eysl = esolan(0)
-            teysl = teysl + eysl
-            esm = esm + eysl
+!     elseif (itysol.lt.0) then
+!     esm=esm+esolan(0)
          else
             eysl=0.d0
          endif
-      else
-!     Add excluded volume term and save it in eyvw
+      else 
+c     Add excluded volume term and save it in eyvw
          esm=esm+exvlun(0)
          teyvw = teyvw+eyvw
       endif
 
-! The Abagyan entropic corrections depend on the area exposed to the
-! solvent for each residue. So, this term has to be evaluated after the
-! solvent term.
+c The Abagyan entropic corrections depend on the area exposed to the 
+c solvent for each residue. So, this term has to be evaluated after the
+c solvent term.
       eyab=0.0
       if (ientyp.eq.3) then
-         do i = 1,ntlml
+         do i = 1,ntlml  
             eyab=eyab+eyabgn(i)
          enddo
       endif
       esm=esm+eyab
-! Partial energies for the entire system. If you need the partial
-! energies for a single molecule call enyinternal.
+c Partial energies for the entire system. If you need the partial
+c energies for a single molecule call enyinternal.
       eysm = teysm
       eyel = teyel
@@ -108,8 +101,8 @@
       eyvr = teyvr
       eysl = teysl
-
+      
       if (ientyp.ne.2) then
-!     This is temporary. eninteract() does not yet know how to calculate
-!     interactions using the Lund potential.
+c     This is temporary. eninteract() does not yet know how to calculate
+c     interactions using the Lund potential.
          energy = esm + eninteract()
          return
@@ -119,25 +112,20 @@
       end
 
-!c Calculates the internal energy for a single molecule.
-!  All the partial energies are thus set to their values for molecule
-!  nml.
-!
-!  @param nml the ID of the molecule
-!  @return internal energy of a single molecule
-!
-!  @author Jan H. Meinke <j.meinke@fz-juelich.de>
+cc Calculates the internal energy for a single molecule.
+c  All the partial energies are thus set to their values for molecule
+c  nml. 
+c
+c  @param nml the ID of the molecule
+c  @return internal energy of a single molecule
+c
+c  @author Jan H. Meinke <j.meinke@fz-juelich.de>
       real*8 function enyinternal(nml)
 
-!f2py intent(in) nml
-
+cf2py intent(in) nml
+      
       include 'INCL.H'
-      double precision esm, enyshe, enyflx, enylun, enyreg, enysol
-      double precision esolan, exvlun, eyabgn
-
-      integer nml, i
-
       esm = 0.d0
 
-      call setvar(nml,vlvr)
+      call setvar(nml,vlvr)  
 
       if (ientyp.eq.0.or.ientyp.eq.3) then
@@ -154,15 +142,15 @@
          if (itysol.gt.0) then
             esm=esm+enysol(nml)
-      elseif (itysol.lt.0) then
-            esm=esm+esolan(nml)
+!     elseif (itysol.lt.0) then
+!     esm=esm+esolan(nml)
          else
             eysl=0.d0
          endif
-      else
+      else 
          esm=esm+exvlun(nml)
       endif
-! The Abagyan entropic corrections depend on the area exposed to the
-! solvent for each residue. So, this term has to be evaluated after the
-! solvent term.
+c The Abagyan entropic corrections depend on the area exposed to the 
+c solvent for each residue. So, this term has to be evaluated after the
+c solvent term.
       eyab=0.0
       if (ientyp.eq.3) then
Index: eninteract.f
===================================================================
--- eninteract.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ eninteract.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,24 +1,19 @@
-! *********************************************************************
-! This file contains eninteract
-!
-! Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-!                      Jan H. Meinke, Sandipan Mohanty
-!
-!
-! Description: Calculates the interaction energy between molecules
-! The function assumes that all molecules are up-to-date. If in doubt
-! call energy first.
-! The energy function is based on the ECEPP/3 dataset.
-!
-! TODO: Intermolecular interaction energy for FLEX and ECEPP/2
+c *********************************************************************
+c This file contains eninteract
+c
+c Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+c                      Jan H. Meinke, Sandipan Mohanty
+c
+c
+c Description: Calculates the interaction energy between molecules
+c The function assumes that all molecules are up-to-date. If in doubt
+c call energy first.
+c The energy function is based on the ECEPP/3 dataset.
+c
+c TODO: Intermolecular interaction energy for FLEX and ECEPP/2
       real*8 function eninteract()
 
         include 'INCL.H'
-
-      double precision cqi, xi, yi, zi, xj, yj, zj, xij, yij, zij, rij2
-      double precision rij4, rij6, rij, sr, ep
-
-      integer iml, jml, ires, jres, iat, ity, jat, jty
-
+                
         eysmi=0.0
         eyeli=0.0
@@ -31,9 +26,9 @@
               do jres= irsml1(jml), irsml2(jml)
                 do iat = iatrs1(ires), iatrs2(ires)
-! Atom class of current atom
+c Atom class of current atom
                   ity=ityat(iat)
-! Point charge at current atom
+c Point charge at current atom
                   cqi=conv*cgat(iat)
-! Cartesian coordinates of current atom
+c Cartesian coordinates of current atom
                   xi=xat(iat)
                   yi=yat(iat)
@@ -41,20 +36,20 @@
 
                   do jat = iatrs1(jres), iatrs2(jres)
-! Atom type of partner
+c Atom type of partner
                     jty=ityat(jat)
-! Differences in cartesian coordinates
+c Differences in cartesian coordinates
                     xj=xat(jat)
                     yj=yat(jat)
                     zj=zat(jat)
-
+                    
                     xij=xat(jat)-xi
                     yij=yat(jat)-yi
                     zij=zat(jat)-zi
-! Cartesian distance and higher powers
+c Cartesian distance and higher powers
                     rij2=xij*xij+yij*yij+zij*zij
                     rij4=rij2*rij2
                     rij6=rij4*rij2
                     rij=sqrt(rij2)
-! Are we using a distance dependent dielectric constant?
+c Are we using a distance dependent dielectric constant?
                     if(epsd) then
                       sr=slp*rij
@@ -63,16 +58,16 @@
                       ep = 1.0d0
                     end if
-! Coulomb interaction
+c Coulomb interaction
                     eyeli=eyeli+cqi*cgat(jat)/(rij*ep)
-! If the two atoms cannot form a hydrogen bond use 6-12 Lennard-Jones potential
+c If the two atoms cannot form a hydrogen bond use 6-12 Lennard-Jones potential
                     if (ihbty(ity,jty).eq.0) then
                       eyvwi=eyvwi+aij(ity,jty)/(rij6*rij6)
-     &                          -cij(ity,jty)/rij6
+     #                          -cij(ity,jty)/rij6
                     else
-! For hydrogen bonding use 10-12 Lennard-Jones potential
+c For hydrogen bonding use 10-12 Lennard-Jones potential
                       eyhbi=eyhbi+ahb(ity,jty)/(rij6*rij6)
-     &                          -chb(ity,jty)/(rij6*rij4)
+     #                          -chb(ity,jty)/(rij6*rij4)
                     endif
-                  enddo
+                  enddo 
                 enddo
               enddo
@@ -83,4 +78,4 @@
         eysmi = eyeli + eyvwi + eyhbi
         eninteract = eysmi
-        return
-      end
+        return 
+      end   
Index: enyflx.f
===================================================================
--- enyflx.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ enyflx.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,38 +1,30 @@
-! **************************************************************
-!
-! This file contains the subroutines: enyflx
-!
-! Copyright 2003       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: enyflx
+c
+c Copyright 2003       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 enyflx(nml)
 
-! .......................................................................
-!
-!  PURPOSE: Calculate internal energy of molecule 'nml' with FLEX dataset
-!
-!  CALLS: none
-!
-! .......................................................................
+c .......................................................................
+c
+c  PURPOSE: Calculate internal energy of molecule 'nml' with FLEX dataset
+c
+c  CALLS: none
+c
+c .......................................................................
 
       include 'INCL.H'
-      
-      integer nml
-      
-      integer ntlvr, i, i14, i1, i1s, i2, i2s, ia, ic, ijhb, ifivr, 
-     &        ims, io, iowh, it, jowh, ity, iv, ivw, j, jty
-      double precision cqi, cth, qp, e0, evw, vr, ep, rij, py, px, pz, 
-     &                 rij2, rij6, rij12, sr, xij, xi, yij, xj, yj, yi, 
-     &                 zj, zi, zij
 
       ntlvr=nvrml(nml)
       if (ntlvr.eq.0) then
-        write (logString, '(a,i4)')
-     &           ' enyflx> No variables defined in molecule #',nml
+        write (*,'(a,i4)')
+     #           ' enyflx> No variables defined in molecule #',nml
         return
       endif
@@ -100,5 +92,5 @@
                 rij=sqrt(rij2)
                 if(epsd) then
-! --------------------------------- distance dependent dielectric constant
+c --------------------------------- distance dependent dielectric constant
                 sr=slp_f*rij
                 ep=plt-(sr*sr+2.0*sr+2.0)*(plt-1.0)*exp(-sr)/2.0
@@ -127,10 +119,10 @@
 
                   cth=(xij*px+yij*py+zij*pz)/(rij*
-     &                 sqrt(px*px+py*py+pz*pz))
+     #                 sqrt(px*px+py*py+pz*pz))
 
                   if (cth.gt.0.0) then
                     eyhb=eyhb+ evw + cth*(
-     &                   (ahb(ity,jty)-aij(ity,jty))/rij12-
-     &                   (chb(ity,jty)-cij(ity,jty))/rij6 )
+     #                   (ahb(ity,jty)-aij(ity,jty))/rij12-
+     #                   (chb(ity,jty)-cij(ity,jty))/rij6 )
                   else                             ! No Hydrogen Bond
                     eyvw=eyvw + evw
@@ -161,5 +153,5 @@
               rij=sqrt(rij2)
               if(epsd) then
-! --------------------------------- distance dependent dielectric constant
+c --------------------------------- distance dependent dielectric constant
               sr=slp_f*rij
               ep=plt-(sr*sr+2.0*sr+2.0)*(plt-1.)*exp(-sr)/2.0
@@ -188,10 +180,10 @@
 
                 cth=(xij*px+yij*py+zij*pz)/(rij*
-     &               sqrt(px*px+py*py+pz*pz))
+     #               sqrt(px*px+py*py+pz*pz))
 
                 if (cth.gt.0.0) then
                   eyhb=eyhb+ evw + cth*(
-     &                 (ahb(ity,jty)-a14(ity,jty))/rij12-
-     &                 (chb(ity,jty)-cij(ity,jty))/rij6 )
+     #                 (ahb(ity,jty)-a14(ity,jty))/rij12-
+     #                 (chb(ity,jty)-cij(ity,jty))/rij6 )
                 else                             ! No Hydrogen Bond
                   eyvw=eyvw + evw
Index: enylun.f
===================================================================
--- enylun.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ enylun.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,78 +1,53 @@
-! *******************************************************************
-! SMMP version of Anders Irback's force field, to be called the Lund
-! force field. This file contains the function enylun, which in turn
-! calls all the terms in the energy function. The terms Bias (ebias),
-! Hydrogen bonds (ehbmm and ehbms), Hydrophobicity (ehp) and the
-! Excluded volume (eexvol and eloexv) are also implemented in this
-! file.
-!
-! Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-!                      Jan H. Meinke, Sandipan Mohanty
-!
-      subroutine set_local_constr(ires,frst,lst,root)
-      include 'INCL.H'
-      include 'incl_lund.h'
-      integer iat1, iat2
-
-          integer ires,frst,lst,root
-          do iat1=iCa(ires)+frst,iCa(ires)+lst
-             do iat2=iat1+1,iCa(ires)+lst
-                matcon(iat2-iat1,iat1)=0
-                matcon(iat1-iat2,iat2)=0
-             enddo
-          enddo
-          iat1=iCa(ires)+root
-          do iat2=iCa(ires)+root,iCa(ires)+lst
-                matcon(iat2-iat1,iat1)=0
-                matcon(iat1-iat2,iat2)=0
-          enddo
-      end subroutine set_local_constr
-
+c *******************************************************************
+c SMMP version of Anders Irback's force field, to be called the Lund
+c force field. This file contains the function enylun, which in turn 
+c calls all the terms in the energy function. The terms Bias (ebias), 
+c Hydrogen bonds (ehbmm and ehbms), Hydrophobicity (ehp) and the 
+c Excluded volume (eexvol and eloexv) are also implemented in this 
+c file.
+c
+c Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+c                      Jan H. Meinke, Sandipan Mohanty
+c
       subroutine init_lundff
       include 'INCL.H'
       include 'incl_lund.h'
-      double precision eunit, csacc
-
-      integer i, j, iml, iat1, iat2, k, iat3, l, iat4, m, iat3p, irs
-      integer iatoff, iatmrg, ilp, lci
-
       character mynm*4
       logical prlvr
 
       print *,'initializing Lund forcefield'
-!     Some parameters in the Lund force field.
-!     The correspondence between internal energy scale and kcal/mol
-      eunit=1.3315d0
-!      eunit=1.0
-!     Bias
-      kbias=100.0d0*eunit
-!      print *,'Bias'
-!     Hydrogen bonds
-      epshb1=3.1d0*eunit
-      epshb2=2.0d0*eunit
-      sighb=2.0d0
-      cthb=4.5d0
+c     Some parameters in the Lund force field.
+c     The correspondence between internal energy scale and kcal/mol
+      eunit=1.3315
+c     Bias
+      kbias=100.0*eunit
+c      print *,'Bias'
+c     Hydrogen bonds
+      epshb1=3.1*eunit
+      epshb2=2.0*eunit
+      sighb=2.0
+      cthb=4.5
       cthb2=cthb*cthb
-      powa=0.5d0
-      powb=0.5d0
-      blhb=-30.0d0*(((sighb/cthb)**10-(sighb/cthb)**12))/cthb2
+      powa=0.5
+      powb=0.5
+      blhb=-30.0*(((sighb/cthb)**10-(sighb/cthb)**12))/cthb2
       alhb=-(5*((sighb/cthb)**12)-6*((sighb/cthb)**10))-blhb*cthb2
       sighb2=sighb*sighb
-      cdon=1.0d0
-      cacc=(1.0d0/1.23d0)**powb
-      csacc=(1.0d0/1.25d0)**powb
-!      print *,'Hydrogen bonds'
-!     Hydrophobicity
-!      print *,'Hydrophobicity with nhptyp = ',nhptyp
-
-      hpstrg(1)=0.0d0*eunit
-      hpstrg(2)=0.1d0*eunit
-      hpstrg(3)=0.1d0*eunit
-      hpstrg(4)=0.1d0*eunit
-      hpstrg(5)=0.9d0*eunit
-      hpstrg(6)=2.8d0*eunit
-      hpstrg(7)=0.1d0*eunit
-      hpstrg(8)=2.8d0*eunit
-      hpstrg(9)=3.2d0*eunit
+      cdon=1.0
+      cacc=(1.0/1.23)**powb
+      csacc=(1.0/1.25)**powb
+c      print *,'Hydrogen bonds'
+c     Hydrophobicity
+c      print *,'Hydrophobicity with nhptyp = ',nhptyp
+
+      hpstrg(1)=0.0*eunit
+      hpstrg(2)=0.1*eunit
+      hpstrg(3)=0.1*eunit
+      hpstrg(4)=0.1*eunit
+      hpstrg(5)=0.9*eunit
+      hpstrg(6)=2.8*eunit
+      hpstrg(7)=0.1*eunit
+      hpstrg(8)=2.8*eunit
+      hpstrg(9)=3.2*eunit
 
       do i=1,mxrs
@@ -86,13 +61,12 @@
          call tolost(mynm)
          if ((mynm.eq.'pro').or.(mynm.eq.'cpro')
-     &           .or.(mynm.eq.'cpru').or.(mynm.eq.'prou')
-     &           .or.(mynm.eq.'pron').or.(mynm.eq.'pro+')) then
+     #           .or.(mynm.eq.'cpru').or.(mynm.eq.'prou')
+     #           .or.(mynm.eq.'pron').or.(mynm.eq.'pro+')) then
             prlvr=.true.        ! residue i is a proline variant
-            print *, 'proline variant ',mynm,i
-         else
+         else 
             prlvr=.false.
-         endif
-
-         if (mynm.eq.'ala') then
+         endif 
+
+         if (mynm.eq.'ala') then 
             nhpat(i)=1
             ihpat(i,1)=iCa(i)+2
@@ -112,5 +86,5 @@
             ihpat(i,2)=iCa(i)+5
             ihpat(i,3)=iCa(i)+7
-            ihpat(i,4)=iCa(i)+11
+            ihpat(i,3)=iCa(i)+11
          else if (mynm.eq.'ile') then
             nhpat(i)=4
@@ -118,5 +92,5 @@
             ihpat(i,2)=iCa(i)+4
             ihpat(i,3)=iCa(i)+8
-            ihpat(i,4)=iCa(i)+11
+            ihpat(i,3)=iCa(i)+11
          else if (mynm.eq.'met') then
             nhpat(i)=4
@@ -124,5 +98,5 @@
             ihpat(i,2)=iCa(i)+5
             ihpat(i,3)=iCa(i)+8
-            ihpat(i,4)=iCa(i)+9
+            ihpat(i,3)=iCa(i)+9
          else if (mynm.eq.'phe') then
             nhpat(i)=6
@@ -130,7 +104,7 @@
             ihpat(i,2)=iCa(i)+6
             ihpat(i,3)=iCa(i)+8
-            ihpat(i,4)=iCa(i)+10
-            ihpat(i,5)=iCa(i)+12
-            ihpat(i,6)=iCa(i)+14
+            ihpat(i,3)=iCa(i)+10
+            ihpat(i,3)=iCa(i)+12
+            ihpat(i,3)=iCa(i)+14
          else if (mynm.eq.'tyr') then
             nhpat(i)=6
@@ -138,7 +112,7 @@
             ihpat(i,2)=iCa(i)+6
             ihpat(i,3)=iCa(i)+8
-            ihpat(i,4)=iCa(i)+10
-            ihpat(i,5)=iCa(i)+13
-            ihpat(i,6)=iCa(i)+15
+            ihpat(i,3)=iCa(i)+10
+            ihpat(i,3)=iCa(i)+13
+            ihpat(i,3)=iCa(i)+15
          else if (mynm.eq.'trp') then
             nhpat(i)=6
@@ -146,45 +120,45 @@
             ihpat(i,2)=iCa(i)+11
             ihpat(i,3)=iCa(i)+13
-            ihpat(i,4)=iCa(i)+15
-            ihpat(i,5)=iCa(i)+17
-            ihpat(i,6)=iCa(i)+19
-         endif
-      enddo
-!      print *,'Hydrophobicity'
-
-!     Excluded volume and local pair excluded volume terms
+            ihpat(i,3)=iCa(i)+15
+            ihpat(i,3)=iCa(i)+17
+            ihpat(i,3)=iCa(i)+19
+         endif
+      enddo
+c      print *,'Hydrophobicity'
+
+c     Excluded volume and local pair excluded volume terms
       exvk=0.1*eunit
       exvcut=4.3
       exvcut2=exvcut*exvcut
 
-      sigsa(1)=1.0d0  ! hydrogen
-      sigsa(2)=1.0d0  ! hydrogen
-      sigsa(3)=1.0d0  ! hydrogen
-      sigsa(4)=1.0d0  ! hydrogen
-      sigsa(5)=1.0d0  ! hydrogen
-      sigsa(6)=1.0d0  ! hydrogen
-      sigsa(7)=1.75d0 ! carbon
-      sigsa(8)=1.75d0 ! carbon
-      sigsa(9)=1.75d0 ! carbon
-      sigsa(10)=1.42d0 ! oxygen
-      sigsa(11)=1.42d0 ! oxygen
-      sigsa(12)=1.42d0 ! oxygen
-      sigsa(13)=1.55d0 ! nitrogen
-      sigsa(14)=1.55d0 ! nitrogen
-      sigsa(15)=1.55d0 ! nitrogen
-      sigsa(16)=1.77d0 ! sulfur
-      sigsa(17)=1.0d0  ! hydrogen
-      sigsa(18)=1.75d0 ! carbon
+      sigsa(1)=1.0  ! hydrogen
+      sigsa(2)=1.0  ! hydrogen
+      sigsa(3)=1.0  ! hydrogen
+      sigsa(4)=1.0  ! hydrogen
+      sigsa(5)=1.0  ! hydrogen
+      sigsa(6)=1.0  ! hydrogen
+      sigsa(7)=1.75 ! carbon
+      sigsa(8)=1.75 ! carbon
+      sigsa(9)=1.75 ! carbon
+      sigsa(10)=1.42 ! oxygen
+      sigsa(11)=1.42 ! oxygen
+      sigsa(12)=1.42 ! oxygen
+      sigsa(13)=1.55 ! nitrogen
+      sigsa(14)=1.55 ! nitrogen
+      sigsa(15)=1.55 ! nitrogen
+      sigsa(16)=1.77 ! sulfur
+      sigsa(17)=1.0  ! hydrogen
+      sigsa(18)=1.75 ! carbon
 
       do i=1,mxtyat
          do j=1,mxtyat
             sig2lcp(i,j)=(sigsa(i)+sigsa(j))**2
-            asalcp(i,j)=-7*((sig2lcp(i,j)/exvcut2)**6.0d0)
-            bsalcp(i,j)=6*((sig2lcp(i,j)/exvcut2)**6.0d0)/exvcut2
-         enddo
-      enddo
-!      print *,'Local pair excluded volume constants'
-
-      exvlam=0.75d0
+            asalcp(i,j)=-7*((sig2lcp(i,j)/exvcut2)**6.0)
+            bsalcp(i,j)=6*((sig2lcp(i,j)/exvcut2)**6.0)/exvcut2
+         enddo
+      enddo
+c      print *,'Local pair excluded volume constants'
+
+      exvlam=0.75
       exvcutg=exvcut*exvlam
       exvcutg2=exvcutg*exvcutg
@@ -197,16 +171,16 @@
          enddo
       enddo
-!      print *,'General excluded volume constants'
-
-!     Initialization of the connections matrix matcon(i,j). The index
-!     i runs from -mxconr to +mxconr, and j from 1 to mxat.
-!     matcon(i2-i1,i1) = 0, if the distance between atoms i1 and i2 is fixed
-!                      = 2, if atoms i1 and i2 are separated by 3 covalent
-!                           bonds and their distance can change
-!                      = 1, for all other pairs
-!     if abs(i2-i1) > mxconr, the atoms are assumed to be separated by
-!     many bonds, and with no restriction on their distances. On a protein
-!     molecule made of natural amino acids, atoms with indices separated
-!     by more than 35 can not be connected by three covalent bonds.
+c      print *,'General excluded volume constants'
+
+c     Initialization of the connections matrix matcon(i,j). The index
+c     i runs from -mxconr to +mxconr, and j from 1 to mxat. 
+c     matcon(i2-i1,i1) = 0, if the distance between atoms i1 and i2 is fixed
+c                      = 2, if atoms i1 and i2 are separated by 3 covalent
+c                           bonds and their distance can change
+c                      = 1, for all other pairs
+c     if abs(i2-i1) > mxconr, the atoms are assumed to be separated by 
+c     many bonds, and with no restriction on their distances. On a protein 
+c     molecule made of natural amino acids, atoms with indices separated
+c     by more than 35 can not be connected by three covalent bonds.
 
       do i=1,mxat
@@ -216,5 +190,5 @@
          matcon(0,i)=0
       enddo
-!     continued...
+c     continued...
       do iml=1,ntlml
          do iat1=iatrs1(irsml1(iml)),iatrs2(irsml2(iml))
@@ -235,5 +209,5 @@
                      do m=1,nbdat(iat2)
                         iat3p=ibdat(m,iat2)
-                        if (iat3p.ne.iat3) then
+                        if (iat3p.ne.iat3) then 
                            matcon(iat4-iat3p,iat3p)=2 ! 3 covalent bonds
                            matcon(iat3p-iat4,iat4)=2 !
@@ -250,17 +224,14 @@
          enddo
 
-!         print *,'going to initialize connections for first residue'
-!         print *,'iN,iCa,iC =',iN(irsml1(iml)),
-!     #        iCa(irsml1(iml)),iC(irsml1(iml))
+c         print *,'going to initialize connections for first residue'
+c         print *,'iN,iCa,iC =',iN(irsml1(iml)),
+c     #        iCa(irsml1(iml)),iC(irsml1(iml))
          do iat1=iN(irsml1(iml))+1,iCa(irsml1(iml))-1
-!            print *,'connections for iat1 = ',iat1
+c            print *,'connections for iat1 = ',iat1
             matcon(iat1-iN(irsml1(iml)),iN(irsml1(iml)))=0
             matcon(iN(irsml1(iml))-iat1,iat1)=0
             matcon(iat1-iCa(irsml1(iml)),iCa(irsml1(iml)))=0
             matcon(iCa(irsml1(iml))-iat1,iat1)=0
-            do iat2=iat1,iCa(irsml1(iml))-1
-                matcon(iat2-iat1,iat1)=0
-                matcon(iat1-iat2,iat2)=0
-            enddo
+
             matcon(iat1-iCa(irsml1(iml))-1,iCa(irsml1(iml))+1)=2
             matcon(iCa(irsml1(iml))+1-iat1,iat1)=2
@@ -271,12 +242,12 @@
          enddo
 
-!     Below: for certain residues, some atoms separated by 3 or more bonds
-!     do not change distance. So, the connection matrix term for such pairs
-!     should be zero.
+c     Below: for certain residues, some atoms separated by 3 or more bonds
+c     do not change distance. So, the connection matrix term for such pairs
+c     should be zero. 
 
          do irs=irsml1(iml),irsml2(iml)
             if (irs.eq.irsml1(iml)) then
                iatoff=1
-            else
+            else 
                iatoff=0
             endif
@@ -288,58 +259,74 @@
             mynm=seq(irs)
             call tolost(mynm)
-            if ((mynm.eq.'pro')) then
+            if ((mynm.eq.'pro').or.(mynm.eq.'cpro')
+     #              .or.(mynm.eq.'cpru').or.(mynm.eq.'prou')
+     #              .or.(mynm.eq.'pron').or.(mynm.eq.'pro+')) then
                prlvr=.true.     ! residue i is a proline variant
-            else
+            else 
                prlvr=.false.
+            endif 
+
+            if ((mynm.eq.'arg').or.(mynm.eq.'arg+')) then
+               do iat1=iatoff+iatrs1(irs)+13,iatrs2(irs)-2-iatmrg
+                  do iat2=iat1+1,iatrs2(irs)-2-iatmrg
+                     matcon(iat2-iat1,iat1)=0
+                     matcon(iat1-iat2,iat2)=0
+                  enddo
+               enddo
+            else if ((mynm.eq.'his').or.(mynm.eq.'hise')
+     #              .or.(mynm.eq.'hisd').or.(mynm.eq.'his+')) then
+               do iat1=iatoff+iatrs1(irs)+7,iatrs2(irs)-2-iatmrg
+                  do iat2=iat1+1,iatrs2(irs)-2-iatmrg
+                     matcon(iat2-iat1,iat1)=0
+                     matcon(iat1-iat2,iat2)=0
+                  enddo
+               enddo
+            else if (mynm.eq.'phe') then 
+               do iat1=iatoff+iatrs1(irs)+7,iatrs2(irs)-2-iatmrg
+                  do iat2=iat1+1,iatrs2(irs)-2-iatmrg
+                     matcon(iat2-iat1,iat1)=0
+                     matcon(iat1-iat2,iat2)=0
+                  enddo
+               enddo
+            else if (mynm.eq.'tyr') then
+               do iat1=iatoff+iatrs1(irs)+7,iatrs2(irs)-2-iatmrg
+                  do iat2=iat1+1,iatrs2(irs)-2-iatmrg
+                     if (iat2.ne.iatrs1(irs)+15) then
+                        matcon(iat2-iat1,iat1)=0
+                        matcon(iat1-iat2,iat2)=0
+                     endif
+                  enddo
+               enddo
+            else if (mynm.eq.'trp') then
+               do iat1=iatoff+iatrs1(irs)+7,iatrs2(irs)-2-iatmrg
+                  do iat2=iat1+1,iatrs2(irs)-2-iatmrg
+                     matcon(iat2-iat1,iat1)=0
+                     matcon(iat1-iat2,iat2)=0
+                  enddo
+               enddo
+            else if (prlvr) then
+c           Proline. Many more distances are fixed because of the fixed 
+c           phi angle
+               do iat1=iatoff+iatrs1(irs),iatrs2(irs)-2-iatmrg
+                  do iat2=iat1+1,iatrs2(irs)-2-iatmrg
+                     matcon(iat2-iat1,iat1)=0
+                     matcon(iat1-iat2,iat2)=0
+                  enddo
+               enddo
+c           distances to the C' atom of the previous residue are also fixed
+               if (irs.ne.irsml1(iml)) then
+                  iat1=iowat(iatrs1(irs))
+                  do iat2=iatrs1(irs),iatrs2(irs)-1-iatmrg
+                     matcon(iat2-iat1,iat1)=0
+                     matcon(iat1-iat2,iat2)=0
+                  enddo
+               endif
             endif
-            if ((mynm.eq.'asn')) then
-                call set_local_constr(irs,5,9,2)
-            else if ((mynm.eq.'gln')) then
-                call set_local_constr(irs,8,12,5)
-            else if ((mynm.eq.'arg')) then
-                call set_local_constr(irs,11,19,8)
-            else if ((mynm.eq.'his')) then
-                call set_local_constr(irs,5,12,2)
-            else if (mynm.eq.'phe') then
-                call set_local_constr(irs,5,15,2)
-            else if (mynm.eq.'tyr') then
-                call set_local_constr(irs,5,16,2)
-                iat1=iCa(irs)+12 ! H_h
-                iat2=iCa(irs)+13 ! C_e2
-                iat3=iCa(irs)+8  ! C_e1
-                matcon(iat2-iat1,iat1)=2
-                matcon(iat1-iat2,iat2)=2
-                matcon(iat3-iat1,iat1)=2
-                matcon(iat1-iat3,iat3)=2
-            else if (mynm.eq.'trp') then
-                call set_local_constr(irs,5,19,2)
-            else if (prlvr) then
-!           Proline. Many more distances are fixed because of the fixed
-!           phi angle
-                call set_local_constr(irs,-3,11,-3)
-                matcon(iCa(irs-1)-iCa(irs)-8,iCa(irs)+8)=0
-                matcon(iCa(irs)+8-iCa(irs-1),iCa(irs-1))=0
-            endif
-         enddo
-
-!        Distances fixed because of the constant omega angle
-         do irs=irsml1(iml),irsml2(iml)-1
-            matcon(iCa(irs+1)-iC(irs)-1,iC(irs)+1)=0 ! O_i -- Ca_{i+1}
-            matcon(-iCa(irs+1)+iC(irs)+1,iCa(irs+1))=0 ! O_i -- Ca_{i+1}
-
-            matcon(iN(irs+1)-iC(irs),iC(irs)+1)=0    ! O_i -- H_{i+1}
-            matcon(-iN(irs+1)+iC(irs),iN(irs+1)+1)=0    ! O_i -- H_{i+1}
-
-            matcon(iCa(irs+1)-iCa(irs),iCa(irs))=0   ! Ca_i -- Ca_{i+1}
-            matcon(-iCa(irs+1)+iCa(irs),iCa(irs+1))=0   ! Ca_i -- Ca_{i+1}
-
-            matcon(iN(irs+1)+1-iCa(irs),iCa(irs))=0  ! Ca_i -- H_{i+1}
-            matcon(-iN(irs+1)-1+iCa(irs),iN(irs+1)+1)=0  ! Ca_i -- H_{i+1}
-         enddo
-
-      enddo
-!     finished initializing matrix conmat
-!      print *,'Connections matrix'
-!     Local pair excluded volume
+         enddo
+      enddo
+c     finished initializing matrix conmat
+c      print *,'Connections matrix'
+
+c     Local pair excluded volume
       do i=1,mxml
          ilpst(i)=1
@@ -355,5 +342,5 @@
             do iat2=iat1+1,iatrs2(irsml2(iml))
                if ((iat2-iat1.le.mxconr).and.
-     &                 matcon(iat2-iat1,iat1).eq.2) then
+     #                 matcon(iat2-iat1,iat1).eq.2) then
                   ilp=ilp+1
                   lcp1(ilp)=iat1
@@ -364,13 +351,13 @@
 
          ilpnd(iml)=ilp
-         if (iml.lt.ntlml) then
+         if (iml.lt.ntlml) then 
             ilpst(iml+1)=ilp+1
          endif
-         print *,'molecule ',iml,' lc pair range ',ilpst(iml),ilpnd(iml)
-!        print *,'local pair list'
+c         print *,'molecule ',iml,' lc pair range ',ilpst(iml),ilpnd(iml)
+c         print *,'local pair list'
          do lci=ilpst(iml),ilpnd(iml)
             iat1=lcp1(lci)
             iat2=lcp2(lci)
-!            print *,lci,iat1,iat2,ityat(iat1),ityat(iat2)
+c            print *,lci,iat1,iat2,matcon(iat2-iat1,iat1)
          enddo
       enddo
@@ -381,6 +368,4 @@
       integer function ihptype(iaa)
       include 'INCL.H'
-      integer iaa, ityp
-
       character mynm*4
       mynm=seq(iaa)
@@ -390,12 +375,14 @@
          ityp=1
       else if ((mynm.eq.'val').or.(mynm.eq.'leu').or.(mynm.eq.'ile')
-     &        .or.(mynm.eq.'met').or.(mynm.eq.'pro')) then
+     #        .or.(mynm.eq.'met').or.(mynm.eq.'pro').or.(mynm.eq.'cpro')
+     #        .or.(mynm.eq.'cpru').or.(mynm.eq.'prou')
+     #        .or.(mynm.eq.'pron').or.(mynm.eq.'pro+')) then
          ityp=2
-      else if ((mynm.eq.'phe').or.(mynm.eq.'tyr').or.(mynm.eq.'trp'))
-     &        then
+      else if ((mynm.eq.'phe').or.(mynm.eq.'tyr').or.(mynm.eq.'trp')) 
+     #        then
          ityp=3
       endif
       ihptype=ityp
-      return
+      return 
       end
 
@@ -403,11 +390,7 @@
       include 'INCL.H'
       include 'incl_lund.h'
-      double precision q1, q2, et, xij, yij, zij
-
-      integer i, iat1, irsd, j, iat2
-
       dimension q1(2),q2(2)
       data q1/-0.2,0.2/
-      data q2/0.42,-0.42/
+      data q2/0.42,-0.42/ 
 
       et=0.0
@@ -425,13 +408,9 @@
       return
       end
-!     Evaluates backbone backbone hydrogen bond strength for residues
-!     i and j, taking the donor from residue i and acceptor from residue j
+c     Evaluates backbone backbone hydrogen bond strength for residues 
+c     i and j, taking the donor from residue i and acceptor from residue j
       real*8 function ehbmmrs(i,j)
       include 'INCL.H'
       include 'incl_lund.h'
-      double precision rdon2, racc2, evlu
-
-      integer i, j
-
       double precision r2,r4,r6,dx,dy,dz,ca,cb
       integer d1,d2,a1,a2
@@ -444,7 +423,7 @@
       dz=zat(a1)-zat(d2)
       r2=dx*dx+dy*dy+dz*dz
-      if (r2.gt.cthb2) then
-!         print *,'hbmm = 0 ',cthb2,r2,a1,a2,d1,d2
-!         print *,'a1,a2,d1,d2,r2 = ',a1,a2,d1,d2,r2,sighb2,cthb
+      if (r2.gt.cthb2) then 
+c         print *,'hbmm = 0 ',cthb2,r2,a1,a2,d1,d2
+c         print *,'a1,a2,d1,d2,r2 = ',a1,a2,d1,d2,r2,sighb2,cthb
          ehbmmrs=0
          return
@@ -453,10 +432,10 @@
       cb=(xat(a2)-xat(a1))*dx+(yat(a2)-yat(a1))*dy+(zat(a2)-zat(a1))*dz
       if (powa.gt.0.and.ca.le.0) then
-!         print *,'hbmm, returning 0 because of angle a'
+c         print *,'hbmm, returning 0 because of angle a'
          ehbmmrs=0
          return
       endif
       if (powb.gt.0.and.cb.le.0) then
-!         print *,'hbmm, returning 0 because of angle b'
+c         print *,'hbmm, returning 0 because of angle b'
          ehbmmrs=0
          return
@@ -465,26 +444,15 @@
       r4=r6*r6
       r6=r6*r4
-      rdon2=(xat(d2)-xat(d1))**2+(yat(d2)-yat(d1))**2+
-     & (zat(d2)-zat(d1))**2
-      racc2=(xat(a2)-xat(a1))**2+(yat(a2)-yat(a1))**2+
-     & (zat(a2)-zat(a1))**2
-      evlu=((ca*ca/(r2*rdon2))**(0.5*powa))*
-     & ((cb*cb/(r2*racc2))**(0.5*powb))
+      evlu=((ca*ca/r2)**(0.5*powa))*((cb*cb/r2)**(0.5*powb))
       evlu=evlu*(r6*(5*r6-6*r4)+alhb+blhb*r2)
-!      print *,'found hbmm contribution ',i,j,epshb1,evlu
+c      print *,'found hbmm contribution ',evlu
       ehbmmrs=epshb1*evlu
       return
       end
       real*8 function enylun(nml)
-!     nml = 1 .. ntlml. No provision exists to handle out of range values
-!     for nml inside this function.
+c     nml = 1 .. ntlml. No provision exists to handle out of range values
+c     for nml inside this function.
       include 'INCL.H'
       include 'incl_lund.h'
-      double precision ebiasrs, shbm1, shbm2, etmp, ehbmmrs, ehp, etmp1
-      double precision xij, yij, zij, r2, r6
-
-      integer istres, nml, indres, i, j, ihpi, ihptype, ihpj, i1, i2
-      integer iat1, iat2, iatt1, iatt2
-
       character mynm*4
       logical prlvr
@@ -494,50 +462,47 @@
       eyvr=0.0   ! Local pair excluded volume, in a sense a variable potential
       eyvw=0.0   ! atom-atom repulsion, excluded volume
-!     atom-atom repulsion is calculated on a system wide basis, instead of
-!     molecule by molecule for efficiency. Look into function exvlun.
+c     atom-atom repulsion is calculated on a system wide basis, instead of
+c     molecule by molecule for efficiency. Look into function exvlun.
 
       istres=irsml1(nml)
       indres=irsml2(nml)
 
-!     First, all terms that can be calculated on a residue by residue basis
+c     First, all terms that can be calculated on a residue by residue basis
       do i=istres,indres
          mynm=seq(i)
          call tolost(mynm)
          if ((mynm.eq.'pro').or.(mynm.eq.'cpro')
-     &           .or.(mynm.eq.'cpru').or.(mynm.eq.'prou')
-     &           .or.(mynm.eq.'pron').or.(mynm.eq.'pro+')) then
+     #           .or.(mynm.eq.'cpru').or.(mynm.eq.'prou')
+     #           .or.(mynm.eq.'pron').or.(mynm.eq.'pro+')) then
             prlvr=.true.        ! residue i is a proline variant
-         else
+         else 
             prlvr=.false.
-         endif
-
-!     Bias, or local electrostatic term. Excluded from the list are
-!     residues at the ends of the chain, glycine and all proline variants
+         endif 
+
+c     Bias, or local electrostatic term. Excluded from the list are
+c     residues at the ends of the chain, glycine and all proline variants
          if ((i.ne.istres).and.(i.ne.indres).and.
-     &           .not.prlvr.and.mynm.ne.'gly') then
+     #           .not.prlvr.and.mynm.ne.'gly') then
             eyel=eyel+ebiasrs(i)
          endif
-!     Backbone--backbone hydrogen bonds
+c     Backbone--backbone hydrogen bonds
          shbm1=1.0
          shbm2=1.0
          if ((i.eq.istres).or.(i.eq.indres)) shbm1=0.5
-!     Residue i contributes the donor, and j, the acceptor, so both i and
-!     j run over the whole set of amino acids.
-!     No terms for residue i, if it is a proline variant.
-         if (.not.prlvr) then
+c     Residue i contributes the donor, and j, the acceptor, so both i and
+c     j run over the whole set of amino acids.
+c     No terms for residue i, if it is a proline variant.
+         if (.not.prlvr) then  
             do j=istres,indres
-               if ((j.lt.(i-2)).or.(j.gt.(i+1))) then
-                    shbm2=1.0
-                    if ((j.eq.istres).or.(j.eq.indres)) shbm2=0.5
-                    etmp=ehbmmrs(i,j)
-                    eyhb=eyhb+shbm1*shbm2*etmp
-                endif
+               if ((j.eq.istres).or.(j.eq.indres)) shbm2=0.5
+               etmp=ehbmmrs(i,j)
+               eyhb=eyhb+shbm1*shbm2*etmp
             enddo
          endif
-!     Hydrophobicity, only if residue i is hydrophobic to start with
+c     Hydrophobicity, only if residue i is hydrophobic to start with
          ihpi=ihptype(i)
-         if (ihpi.ge.0) then
-!        Unlike hydrogen bonds, the hydrophobicity potential is symmetric
-!        in i and j. So, the loop for j runs from i+1 to the end.
+         if (ihpi.ge.0) then 
+c        Unlike hydrogen bonds, the hydrophobicity potential is symmetric
+c        in i and j. So, the loop for j runs from i+1 to the end.
 
             do j=i+1,indres
@@ -547,16 +512,15 @@
                   if (j.eq.(i+1)) etmp=0
                   if (j.eq.(i+2)) etmp=0.5*etmp
-!                  print *, 'hydrophobicity contribution ',etmp,i,j
                   eysl=eysl+etmp
-               endif
+               endif 
             enddo
          endif
       enddo
 
-!     Terms that are not calculated residue by residue ...
-
-!     Local pair or third-neighbour excluded volume
-!     Numerically this is normally the term with largest positive
-!     contribution to the energy in an equilibrated stystem.
+c     Terms that are not calculated residue by residue ...
+
+c     Local pair or third-neighbour excluded volume
+c     Numerically this is normally the term with largest positive
+c     contribution to the energy in an equilibrated stystem. 
 
       i1=ilpst(nml)
@@ -574,15 +538,14 @@
          r2=(xij*xij + yij*yij + zij*zij)
          if (r2.le.exvcut2) then
-            r6=sig2lcp(iatt1,iatt2)/r2
+            r6=sig2lcp(iatt1,iatt2)/r2 
             r6=r6*r6*r6
             etmp1=(r6*r6+asalcp(iatt1,iatt2)+bsalcp(iatt1,iatt2)*r2)
-            if (etmp1.ge.0) then
-!               print *,'local pair contribution ',iat1,iat2,iatt1,
-!     & iatt2,sqrt(sig2lcp(iatt1,iatt2)),etmp1
+            if (etmp1.ge.500) then
+               print *,'local pair contribution ',iat1,iat2,etmp1
             endif
             etmp=etmp+etmp1
          endif
-!         print *,'pair : ',iat1,iat2,' contribution ',etmp1
-!         print *,exvcut2,r2
+c         print *,'pair : ',iat1,iat2,' contribution ',etmp1 
+c         print *,exvcut2,r2
       enddo
       eyvr=exvk*etmp
@@ -602,14 +565,10 @@
       include 'INCL.H'
       include 'incl_lund.h'
-      double precision b2, a2, r2min, xij, yij, zij, dtmp, ssum
-
-      integer ihp1, ihp2, ni, i1, nj, i2, i, k, j, l
-
       dimension r2min(12)
 
       b2=20.25
       a2=12.25
-!      ihp1=ihptype(i1)
-!      ihp2=ihptype(i2)
+c      ihp1=ihptype(i1)
+c      ihp2=ihptype(i2)
       if ((ihp1.le.0).or.(ihp2.le.0)) then
          ehp=0.0
@@ -633,17 +592,15 @@
          enddo
       enddo
-      ssum=0
+      sum=0
       do i=1,ni+nj
-         if (r2min(i).le.b2) then
-            if (r2min(i).lt.a2) then
-               ssum=ssum+1
-            else
-               ssum=ssum+(b2-r2min(i))/(b2-a2)
+         if (r2min(i).le.b2) then 
+            if (r2min(i).lt.a2) then 
+               sum=sum+1
+            else 
+               sum=sum+(b2-r2min(i))/(b2-a2)
             endif
          endif
-!         hpstrgth=hpstrg((ihp1-1)*nhptyp+ihp2)
-!         print *, 'hp diagnosis ',ni,nj,ssum/(ni+nj),hpstrgth
-      enddo
-      ehp=-hpstrg((ihp1-1)*nhptyp+ihp2)*ssum/(ni+nj)
+      enddo
+      ehp=-hpstrg((ihp1-1)*nhptyp+ihp2)*sum/(ni+nj)
       return
       end
@@ -652,27 +609,16 @@
       include 'INCL.H'
       include 'incl_lund.h'
-!     For multi-chain systems it makes little sense to split the calculation
-!     of this term into an 'interaction part' and a contribution from
-!     individual molecules. So, normally this should always be called with
-!     argument nml=0. Only for diagnostic reasons, you might want to find
-!     the contribution from one molecule in a multi-chain system assuming
-!     there was no other molecule.
-      double precision xmin, ymin, zmin, xmax, ymax, zmax, sizex, sizey
-      double precision sizez, shiftx, shifty, shiftz, etmp, xij, yij
-      double precision zij, r2, r6, etmp1
-
-      integer nml, istat, indat, i, incell, ndx, ndy, ndz, nxy, ncell
-      integer nocccl, locccl, j, mx, my, mz, icellj, icell, jj, isort
-      integer icl, lcell, ix, iz, iy, nex, ney, nez, nsame, nngbr, jx
-      integer jy, jz, jcl, ii, ngbr, i1, iat1, i2, iat2, iatt1, iatt2
-
+c     For multi-chain systems it makes little sense to split the calculation
+c     of this term into an 'interaction part' and a contribution from 
+c     individual molecules. So, normally this should always be called with
+c     argument nml=0. Only for diagnostic reasons, you might want to find
+c     the contribution from one molecule in a multi-chain system assuming 
+c     there was no other molecule.
       dimension isort(mxat),ngbr(mxat),locccl(mxat),incell(mxcell)
       dimension icell(mxat)
-      integer :: jx1, jy1, jz1
-
-      if (nml.eq.0) then
+      if (nml.eq.0) then 
          istat=iatrs1(irsml1(1))
          indat=iatrs2(irsml2(ntlml))
-      else
+      else 
          istat=iatrs1(irsml1(nml))
          indat=iatrs2(irsml2(nml))
@@ -680,16 +626,16 @@
 
       eyvw=0.0
-!     The beginning part of this implementation is very similar to the
-!     assignment of cells to the atoms during calculation of solvent
-!     accessible surface area. So, much of that part is similar. But
-!     unlike the accessible surface calculations, this term is symmetric
-!     in any two participating atoms. So, the part after the assignment
-!     of cells differs even in the structure of the code.
+c     The beginning part of this implementation is very similar to the 
+c     assignment of cells to the atoms during calculation of solvent 
+c     accessible surface area. So, much of that part is similar. But 
+c     unlike the accessible surface calculations, this term is symmetric
+c     in any two participating atoms. So, the part after the assignment
+c     of cells differs even in the structure of the code.
 
       do i=1,mxcell
          incell(i)=0
       enddo
-!      print *,'evaluating general excluded volume :',istat,',',indat
-!     Find minimal containing box
+c      print *,'evaluating general excluded volume :',istat,',',indat
+c     Find minimal containing box
       xmin=xat(istat)
       ymin=yat(istat)
@@ -720,5 +666,5 @@
       sizey=ymax-ymin
       sizez=zmax-zmin
-!     Number of cells along each directions that fit into the box.
+c     Number of cells along each directions that fit into the box.
       ndx=int(sizex/exvcutg)+1
       ndy=int(sizey/exvcutg)+1
@@ -727,12 +673,12 @@
       nxy=ndx*ndy
       ncell=nxy*ndz
-!      print *,'Number of cells along x,y,z = ',ndx,',',ndy,',',ndz
+c      print *,'Number of cells along x,y,z = ',ndx,',',ndy,',',ndz
       if (ncell.ge.mxcell) then
          print *,'exvlun> required number of cells',ncell,
-     &        ' exceeded the limit ',mxcell
+     #        ' exceeded the limit ',mxcell
          print *,'recompile with a higher mxcell.'
          stop
       endif
-!     Expand box to contain an integral number of cells along each direction
+c     Expand box to contain an integral number of cells along each direction
       shiftx=(dble(ndx)*exvcutg-sizex)/2.0
       shifty=(dble(ndy)*exvcutg-sizey)/2.0
@@ -745,6 +691,6 @@
       zmax=zmax+shiftz
 
-!     Set occupied cells to zero. Note that the maximum number of occupied
-!     cells is the number of atoms in the system.
+c     Set occupied cells to zero. Note that the maximum number of occupied
+c     cells is the number of atoms in the system.
       nocccl=0
       do i=1,mxat
@@ -752,5 +698,5 @@
       enddo
 
-!     Put atoms in cells
+c     Put atoms in cells
       do j=istat,indat
          mx=min(int(max((xat(j)-xmin)/exvcutg,0.0d0)),ndx-1)
@@ -759,10 +705,10 @@
          icellj=mx+my*ndx+mz*nxy+1
          icell(j)=icellj
-         if (icellj.gt.mxcell) then
+         if (icellj.gt.mxcell) then 
             print *,'exvlun> bad cell index ',icellj,' for atom ',j
             stop
-         else
-            if (incell(icellj).eq.0) then
-!           previously unoccupied cell
+         else 
+            if (incell(icellj).eq.0) then 
+c           previously unoccupied cell
                nocccl=nocccl+1
                locccl(nocccl)=icellj
@@ -771,11 +717,11 @@
          endif
       enddo
-!      print *,'finished assigning cells. nocccl = ',nocccl
-!     Cummulative occupancy of i'th cell
+c      print *,'finished assigning cells. nocccl = ',nocccl
+c     Cummulative occupancy of i'th cell
       do i=1,ncell
          incell(i+1)=incell(i+1)+incell(i)
       enddo
-!      print *,'finished making cumulative cell sums'
-!     Sorting atoms by their cell index
+c      print *,'finished making cumulative cell sums'
+c     Sorting atoms by their cell index
       do i=istat,indat
          j=icell(i)
@@ -784,46 +730,29 @@
          incell(j)=jj-1
       enddo
-!      print *,'sorted atoms by cell index'
+c      print *,'sorted atoms by cell index'
       etmp=0.0
       do icl=1,nocccl
-!     loop through occupied cells
+c     loop through occupied cells
          lcell=locccl(icl)
          ix=mod(lcell-1,ndx)
-         iz = (lcell - 1) / nxy
-         iy = ((lcell - 1) - iz * nxy) / ndx
-
+         iy=(mod(lcell-1,nxy)-ix)/ndx
+         iz=(lcell-1-ix-ndx*iy)/nxy
 c         print *,'icl=',icl,'absolute index of cell = ',lcell
 c         print *,'iz,iy,ix = ',iz,iy,ix
 c     find all atoms in current cell and all its forward-going neighbours
-         nex=ix+1
-         ney=iy+1
-         nez=iz+1
+         nex=min(ix+1,ndx-1)
+         ney=min(iy+1,ndy-1)
+         nez=min(iz+1,ndz-1)
          nsame=0
          nngbr=0
          do jx=ix,nex
-            if (jx.ge.ndx) then
-               jx1=0
-            else
-               jx1=jx
-            endif
             do jy=iy,ney
-               if (jy.ge.ndy) then
-                  jy1=0
-               else
-                  jy1=jy
-               endif
                do jz=iz,nez
-                  if (jz.ge.ndz) then
-                     jz1=0
-                  else
-                     jz1=jz
-                  endif
-                  jcl=jx1 + ndx*jy1 + nxy*jz1 + 1
-!                  write (logString, *)'jcl,jx1,jy1,jz1:', jcl,jx1,jy1,jz1
+                  jcl=jx+ndx*jy+nxy*jz+1
                   do ii=incell(jcl)+1,incell(jcl+1)
-!     count the total number of neighbours
+c                    count the total number of neighbours
                      nngbr=nngbr+1
                      if (jx.eq.ix.and.jy.eq.iy.and.jz.eq.iz) then
-!     count how many neighbours are from the same cell
+c                    count how many neighbours are from the same cell
                         nsame=nsame+1
                      endif
@@ -833,12 +762,10 @@
             enddo
          enddo
-!     A few more cells need to be searched, so that we cover 13 of the 26
-!     neighbouring cells.
-!        1
+c     A few more cells need to be searched, so that we cover 13 of the 26
+c     neighbouring cells. 
+c        1
          jx=ix+1
-         if (jx.ge.ndx) jx=0
          jy=iy
          jz=iz-1
-         if (jz.lt.0) jz=ndz-1
          jcl=jx+ndx*jy+nxy*jz+1
          do ii=incell(jcl)+1,incell(jcl+1)
@@ -846,10 +773,8 @@
             ngbr(nngbr)=isort(ii)
          enddo
-!        2
+c        2
          jx=ix
          jy=iy-1
-         if (jy.lt.0) jy =ndy-1
          jz=iz+1
-         if (jz.ge.ndz) jz=0
          jcl=jx+ndx*jy+nxy*jz+1
          do ii=incell(jcl)+1,incell(jcl+1)
@@ -857,9 +782,7 @@
             ngbr(nngbr)=isort(ii)
          enddo
-!        3
+c        3
          jx=ix-1
-         if (jx.lt.0)jx =ndx-1
          jy=iy+1
-         if (jy.ge.ndy) jy=0
          jz=iz
          jcl=jx+ndx*jy+nxy*jz+1
@@ -868,11 +791,8 @@
             ngbr(nngbr)=isort(ii)
          enddo
-!        4
+c        4
          jx=ix+1
-         if (jx.ge.ndx) jx=0
          jy=iy+1
-         if (jy.ge.ndy) jy=0
          jz=iz-1
-         if (jz.lt.0) jz=ndz-1
          jcl=jx+ndx*jy+nxy*jz+1
          do ii=incell(jcl)+1,incell(jcl+1)
@@ -880,11 +800,8 @@
             ngbr(nngbr)=isort(ii)
          enddo
-!        5
+c        5
          jx=ix+1
-         if (jx.ge.ndx) jx = 0
          jy=iy-1
-         if (jy.lt.0) jy=ndy-1
          jz=iz+1
-         if (jz.ge.ndz) jz=0
          jcl=jx+ndx*jy+nxy*jz+1
          do ii=incell(jcl)+1,incell(jcl+1)
@@ -892,11 +809,8 @@
             ngbr(nngbr)=isort(ii)
          enddo
-!        6
+c        6
          jx=ix+1
-         if (jx.ge.ndx) jx=0
          jy=iy-1
-         if (jy.lt.0) jy=ndy-1
          jz=iz-1
-         if (jz.lt.0) jz=ndy-1
          jcl=jx+ndx*jy+nxy*jz+1
          do ii=incell(jcl)+1,incell(jcl+1)
@@ -905,11 +819,11 @@
          enddo
 
-!         print *,'atoms in same cell ',nsame
-!         print *,'atoms in neighbouring cells ',nngbr
+c         print *,'atoms in same cell ',nsame
+c         print *,'atoms in neighbouring cells ',nngbr
          do i1=1,nsame
-!        Over all atoms from the original cell
+c        Over all atoms from the original cell
             iat1=ngbr(i1)
             do i2=i1,nngbr
-!           Over all atoms in the original+neighbouring cells
+c           Over all atoms in the original+neighbouring cells
                iat2=ngbr(i2)
                xij=xat(iat1)-xat(iat2)
@@ -918,7 +832,7 @@
                r2=(xij*xij+yij*yij+zij*zij)
 
-               if (r2.le.exvcutg2) then
+               if (r2.le.exvcutg2) then 
                   if (abs(iat2-iat1).gt.mxconr.or.
-     &                 matcon(iat2-iat1,iat1).eq.1) then
+     #                 matcon(iat2-iat1,iat1).eq.1) then
                      iatt1=ityat(iat1)
                      iatt2=ityat(iat2)
@@ -926,11 +840,11 @@
                      r6=r6*r6*r6
                      etmp1=r6*r6+asaexv(iatt1,iatt2)
-     &                    +bsaexv(iatt1,iatt2)*r2
+     #                    +bsaexv(iatt1,iatt2)*r2
                      etmp=etmp+etmp1
-!                     if (etmp1.ge.2000) then
-!                        print *,'contribution ',iat1,iat2,etmp1
-!                        call outpdb(1,'EXAMPLES/clash.pdb')
-!                        stop
-!                     endif
+c                     if (etmp1.ge.2000) then
+c                        print *,'contribution ',iat1,iat2,etmp1
+c                        call outpdb(1,'EXAMPLES/clash.pdb')
+c                        stop
+c                     endif
                   endif
                endif
@@ -938,16 +852,16 @@
          enddo
       enddo
-!      irs=1
-!      do iat=iatrs1(irs),iatrs2(irs)
-!         do j=-mxconr,mxconr
-!            print *,iat,j,':',matcon(j,iat)
-!         enddo
-!      enddo
-!      irs=irsml2(1)
-!      do iat=iatrs1(irs),iatrs2(irs)
-!         do j=-mxconr,mxconr
-!            print *,iat,j,':',matcon(j,iat)
-!         enddo
-!      enddo
+c      irs=1
+c      do iat=iatrs1(irs),iatrs2(irs)
+c         do j=-mxconr,mxconr
+c            print *,iat,j,':',matcon(j,iat)
+c         enddo
+c      enddo
+c      irs=irsml2(1)
+c      do iat=iatrs1(irs),iatrs2(irs)
+c         do j=-mxconr,mxconr
+c            print *,iat,j,':',matcon(j,iat)
+c         enddo
+c      enddo
 
       eyvw=exvk*etmp
@@ -957,11 +871,7 @@
 
       real*8 function exvbrfc()
-!     Brute force excluded volume evaluation
+c     Brute force excluded volume evaluation
       include 'INCL.H'
       include 'incl_lund.h'
-
-      double precision etmp, etmp1, xij, yij, zij, r2, r6
-
-      integer iat1, iat2, iatt1, iatt2
 
       etmp=0.0
@@ -975,7 +885,7 @@
             r2=(xij*xij+yij*yij+zij*zij)
 
-            if (r2.le.exvcutg2) then
+            if (r2.le.exvcutg2) then 
                if (abs(iat2-iat1).gt.mxconr.or.
-     &                 matcon(iat2-iat1,iat1).eq.1) then
+     #                 matcon(iat2-iat1,iat1).eq.1) then
                   iatt1=ityat(iat1)
                   iatt2=ityat(iat2)
@@ -983,9 +893,20 @@
                   r6=r6*r6*r6
                   etmp1=r6*r6+asaexv(iatt1,iatt2)
-     &                 +bsaexv(iatt1,iatt2)*r2
+     #                 +bsaexv(iatt1,iatt2)*r2
                   etmp=etmp+etmp1
-               else
-!                  print *,'atoms ', iat1,' and ',iat2,' were close',
-!     #                 'but matcon is ',matcon(iat2-iat1,iat1)
+                  if (iat1.eq.43.and.iat2.eq.785) then
+                     print *,'contribution ',iat1,iat2,etmp1
+                     print *,'r2 = ',r2
+                     print *,'atom types : ',iatt1,iatt2
+                     print *,'sig2exv = ',sig2exv(iatt1,iatt2)
+                     print *,'asa = ',asaexv(iatt1,iatt2)
+                     print *,'bsa = ',bsaexv(iatt1,iatt2)
+
+c     call outpdb(1,'EXAMPLES/clash.pdb')
+c     stop
+                  endif
+               else 
+c                  print *,'atoms ', iat1,' and ',iat2,' were close',
+c     #                 'but matcon is ',matcon(iat2-iat1,iat1)
                endif
             endif
Index: enyreg.f
===================================================================
--- enyreg.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ enyreg.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -3,25 +3,21 @@
 ! Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
 !                      Jan H. Meinke, Sandipan Mohanty
-! *******************************
+c *******************************
       real*8 function enyreg(nml)
 
-! ----------------------------------------------------
-!
-! PURPOSE: sum( ( R_i - R^ref_j )**2 )
-!
-!    with: R_i     - atom position i in SMMP structure
-!          R^ref_j - corresponding atom j in PDB str.
-!
-! CALLS: none
-!
-! ----------------------------------------------------
+c ----------------------------------------------------
+c
+c PURPOSE: sum( ( R_i - R^ref_j )**2 )
+c
+c    with: R_i     - atom position i in SMMP structure
+c          R^ref_j - corresponding atom j in PDB str.
+c
+c CALLS: none
+c
+c ----------------------------------------------------
 
       include 'INCL.H'
       include 'INCP.H'
 
-
-      double precision eny
-
-      integer i, nml, j
 
       eny = 0.d0
@@ -33,5 +29,5 @@
 
           eny = eny + (xat(i)-xatp(j))**2+(yat(i)-yatp(j))**2+
-     &                (zat(i)-zatp(j))**2
+     #                (zat(i)-zatp(j))**2
         endif
       enddo   ! atoms
Index: enyshe.f
===================================================================
--- enyshe.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ enyshe.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,35 +1,31 @@
-! **************************************************************
-!
-! This file contains the subroutines: enyshe
-!
-! 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: enyshe 
+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 **************************************************************
 
-!> PURPOSE: Calculate internal energy of molecule 'nml' with ECEPP parameters
-!!
-!! CALLS: none
-!!
-!! The function loops over all moving sets within the molecule. Within
-!! this loop it loops over the van-der-Waals domains of each atom in the
-!! moving set and finally over the atoms that belong to the 1-4 interaction
-!! set.
-!< ............................................................................
 
       real*8 function enyshe(nml)
 
+c ............................................................................
+c
+c PURPOSE: Calculate internal energy of molecule 'nml' with ECEPP parameters
+c
+c CALLS: none
+c
+c The function loops over all moving sets within the molecule. Within
+c this loop it loops over the van-der-Waals domains of each atom in the 
+c moving set and finally over the atoms that belong to the 1-4 interaction
+c set.
+c ............................................................................
 
       include 'INCL.H'
 
-! If nml == 0 calculate the interaction between all pairs.
-      double precision e0, vr, cqi, xi, yi, zi, xij, yij, zij, rij2
-      double precision rij4, rij6, rij, sr, ep
-
-      integer nml, ntlvr, ifivr, i1s, io, iv, ia, it, ic, i2s, ims, i1
-      integer i2, i, ity, ivw, j, jty, i14
-
+c If nml == 0 calculate the interaction between all pairs.
       if (nml.eq.0) then
           ntlvr = nvr
@@ -37,8 +33,8 @@
         ntlvr=nvrml(nml)
       endif
-
+      
       if (ntlvr.eq.0) then
-        write (logString, '(a,i4)')
-     &           ' enyshe> No variables defined in molecule #',nml
+        write (*,'(a,i4)')
+     #           ' enyshe> No variables defined in molecule #',nml
         return
       endif
@@ -52,77 +48,77 @@
         ifivr = ivrml1(1)
         i1s = imsml1(ntlml) + nmsml(ntlml)
-      else
-! Index of first variable in molecule.
+      else 
+c Index of first variable in molecule.
         ifivr=ivrml1(nml)
-! Index of last moving set in molecule
+c Index of last moving set in molecule
         i1s=imsml1(nml)+nmsml(nml)
       endif
-! Loop over moving sets/variables in reverse order
-      do io=ifivr+ntlvr-1,ifivr,-1
-! The array iorvr contains the variables in an "apropriate" order.
-        iv=iorvr(io)
-! Index of the primary moving atom for the variable with index iv
-        ia=iatvr(iv)
-! Get the type of variable iv (valence length, valence angle, dihedral angle)
-        it=ityvr(iv)
-! Class of variable iv's potential  (Q: What are they)
-        ic=iclvr(iv)
-! If iv is a dihedral angle ...
-        if (it.eq.3) then
-! Barrier height * 1/2 of the potential of iv.
+c Loop over moving sets/variables in reverse order     
+      do io=ifivr+ntlvr-1,ifivr,-1  
+c The array iorvr contains the variables in an "apropriate" order.
+        iv=iorvr(io)       
+c Index of the primary moving atom for the variable with index iv
+        ia=iatvr(iv)       
+c Get the type of variable iv (valence length, valence angle, dihedral angle)
+        it=ityvr(iv)       
+c Class of variable iv's potential  (Q: What are they)
+        ic=iclvr(iv)       
+c If iv is a dihedral angle ...
+        if (it.eq.3) then      
+c Barrier height * 1/2 of the potential of iv.
           e0=e0to(ic)
-! Calculate the periodic potential term. sgto is the sign of the barrier, rnto is
-! the periodicity and toat is torsion angle(?) associate with atom ia.
-          if (e0.ne.0.)
-     &         eyvr=eyvr+e0*(1.0+sgto(ic)*cos(toat(ia)*rnto(ic)))
-! else if iv is a valence angle ...
-        elseif (it.eq.2) then
-! vr is the valence angle of ia
+c Calculate the periodic potential term. sgto is the sign of the barrier, rnto is
+c the periodicity and toat is torsion angle(?) associate with atom ia.
+          if (e0.ne.0.) 
+     #         eyvr=eyvr+e0*(1.0+sgto(ic)*cos(toat(ia)*rnto(ic)))
+c else if iv is a valence angle ...
+        elseif (it.eq.2) then  
+c vr is the valence angle of ia
           vr=baat(ia)
-! else if iv is a valence length...
-        elseif (it.eq.1) then
-! vr is the length of the valence bond
+c else if iv is a valence length...
+        elseif (it.eq.1) then  
+c vr is the length of the valence bond
           vr=blat(ia)
         endif
 
-! ============================================ Energies & Atomic forces
-! index of next to last moving set
+c ============================================ Energies & Atomic forces
+c index of next to last moving set
         i2s=i1s-1
-! index of first moving set associated with iv
-        i1s=imsvr1(iv)
-! Loop over all moving sets starting from the one associated with vr to the end.
-        do ims=i1s,i2s
-! First atom of the current moving set
+c index of first moving set associated with iv
+        i1s=imsvr1(iv) 
+c Loop over all moving sets starting from the one associated with vr to the end.
+        do ims=i1s,i2s  
+c First atom of the current moving set
           i1=latms1(ims)
-! Last atom of the current moving set
+c Last atom of the current moving set
           i2=latms2(ims)
-! Loop over all atoms of the current moving set.
-          do i=i1,i2
-! Atom class of current atom
+c Loop over all atoms of the current moving set.
+          do i=i1,i2  
+c Atom class of current atom
             ity=ityat(i)
-! Point charge at current atom
+c Point charge at current atom
             cqi=conv*cgat(i)
-! Cartesian coordinates of current atom
+c Cartesian coordinates of current atom
             xi=xat(i)
             yi=yat(i)
             zi=zat(i)
-! Loop over the atoms of the van der Waals domain belonging to atom i
-            do ivw=ivwat1(i),ivwat2(i)
-! Loop over the atoms of the van der Waals domain of the atoms of the
-! van der Waals domain of atom i
-! Q: Which atoms are in these domains?
-              do j=lvwat1(ivw),lvwat2(ivw)
-! Atom type of partner
+c Loop over the atoms of the van der Waals domain belonging to atom i
+            do ivw=ivwat1(i),ivwat2(i)  
+c Loop over the atoms of the van der Waals domain of the atoms of the 
+c van der Waals domain of atom i
+c Q: Which atoms are in these domains?
+              do j=lvwat1(ivw),lvwat2(ivw)  
+c Atom type of partner
                 jty=ityat(j)
-! Differences in cartesian coordinates
+c Differences in cartesian coordinates
                 xij=xat(j)-xi
                 yij=yat(j)-yi
                 zij=zat(j)-zi
-! Cartesian distance and higher powers
+c Cartesian distance and higher powers
                 rij2=xij*xij+yij*yij+zij*zij
                 rij4=rij2*rij2
                 rij6=rij4*rij2
                 rij=sqrt(rij2)
-! Are we using a distance dependent dielectric constant?
+c Are we using a distance dependent dielectric constant?
                 if(epsd) then
                  sr=slp*rij
@@ -131,23 +127,23 @@
                  ep = 1.0d0
                 end if
-! Coulomb interaction
+c Coulomb interaction
                 eyel=eyel+cqi*cgat(j)/(rij*ep)
-! If the two atoms cannot form a hydrogen bond use 6-12 Lennard-Jones potential
+c If the two atoms cannot form a hydrogen bond use 6-12 Lennard-Jones potential
                 if (ihbty(ity,jty).eq.0) then
                   eyvw=eyvw+aij(ity,jty)/(rij6*rij6)
-     &                     -cij(ity,jty)/rij6
+     #                     -cij(ity,jty)/rij6
                 else
-! For hydrogen bonding use 10-12 Lennard-Jones potential
+c For hydrogen bonding use 10-12 Lennard-Jones potential
                   eyhb=eyhb+ahb(ity,jty)/(rij6*rij6)
-     &                     -chb(ity,jty)/(rij6*rij4)
+     #                     -chb(ity,jty)/(rij6*rij4)
                 endif
 
-              enddo
-            enddo
-
-! Loop over 1-4 interaction partners
-! The interactions between atoms that are three bonds apart in the protein are
-! dominated by quantum mechanical effects. They are treated separately.
-            do i14=i14at1(i),i14at2(i)
+              enddo  
+            enddo  
+            
+c Loop over 1-4 interaction partners
+c The interactions between atoms that are three bonds apart in the protein are
+c dominated by quantum mechanical effects. They are treated separately.
+            do i14=i14at1(i),i14at2(i)   
               j=l14at(i14)
 
@@ -161,5 +157,5 @@
               rij6=rij4*rij2
               rij = sqrt(rij2)
-! Are we using a distance dependent dielectric constant?
+c Are we using a distance dependent dielectric constant?
               if(epsd) then
                sr=slp*rij
@@ -170,12 +166,12 @@
 
               eyel=eyel+cqi*cgat(j)/(rij*ep)
-! If hydrogen bonding is not possible use 6-12 Lennard-Jones potential.
+c If hydrogen bonding is not possible use 6-12 Lennard-Jones potential.
               if (ihbty(ity,jty).eq.0) then
                 eyvw=eyvw+a14(ity,jty)/(rij6*rij6)
-     &                   -cij(ity,jty)/rij6
+     #                   -cij(ity,jty)/rij6
               else
-! Use 10-12 Lennard-Jones potential for hydrogen bonds.
+c Use 10-12 Lennard-Jones potential for hydrogen bonds.
                 eyhb=eyhb+ahb(ity,jty)/(rij6*rij6)
-     &                   -chb(ity,jty)/(rij6*rij4)
+     #                   -chb(ity,jty)/(rij6*rij4)
               endif
 
Index: enyshe_p.f
===================================================================
--- enyshe_p.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ enyshe_p.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,25 +1,27 @@
-! **************************************************************
-!
-! This file contains the subroutines: enyshe
-!
-! 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: enyshe 
+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 enyshe(nml)
 
-!>     PURPOSE: Calculate internal energy of molecule 'nml' with ECEPP parameters
-!!
-!!     CALLS: none
-!!
-!!     The function loops over all moving sets within the molecule. Within
-!!     this loop it loops over the van-der-Waals domains of each atom in the
-!!     moving set and finally over the atoms that belong to the 1-4 interaction
-!!     set.
-!<     ............................................................................
+c     ............................................................................
+c     
+c     PURPOSE: Calculate internal energy of molecule 'nml' with ECEPP parameters
+c     
+c     CALLS: none
+c     
+c     The function loops over all moving sets within the molecule. Within
+c     this loop it loops over the van-der-Waals domains of each atom in the 
+c     moving set and finally over the atoms that belong to the 1-4 interaction
+c     set.
+c     ............................................................................
 
       include 'INCL.H'
@@ -28,13 +30,5 @@
 
 
-! If nml == 0 calculate the interaction between all pairs.
-      double precision eysmsum, teysm, teyel, teyvw, teyhb, teyvr
-      double precision startwtime, e0, vr, cqi, xi, yi, zi, xij, yij
-      double precision zij, rij2, rij4, rij6, rij, sr, ep, endwtime
-
-      integer nml, ntlvr, ifivr, i1s, iend, istart, loopcounter, io, iv
-      integer ia, it, ic, i2s, ims, i1, i2, i, ity, ivw, j, jty, i14
-      integer ierror
-
+c If nml == 0 calculate the interaction between all pairs.
       if (nml.eq.0) then
          ntlvr = nvr
@@ -42,8 +36,8 @@
          ntlvr=nvrml(nml)
       endif
-
+      
       if (ntlvr.eq.0) then
-         write (logString, '(a,i4)')
-     &        ' enyshe> No variables defined in molecule #',nml
+         write (*,'(a,i4)')
+     #        ' enyshe> No variables defined in molecule #',nml
          return
       endif
@@ -62,15 +56,15 @@
          ifivr = ivrml1(1)
          i1s = imsml1(ntlml) + nmsml(ntlml)
-      else
-!     Index of first variable in molecule.
+      else 
+c     Index of first variable in molecule.
          ifivr=ivrml1(nml)
-!     Index of last moving set in molecule
+c     Index of last moving set in molecule
          i1s=imsml1(nml)+nmsml(nml)
       endif
-!     Loop over variables in reverse order
-!     This is the first loop to parallize. We'll just split the moving sets
-!     over the number of available processors and sum the energy up in the end.
-
-!     Number of moving sets per processor
+c     Loop over variables in reverse order     
+c     This is the first loop to parallize. We'll just split the moving sets
+c     over the number of available processors and sum the energy up in the end.
+
+c     Number of moving sets per processor
       iend = ifivr
       istart = ifivr + ntlvr - 1
@@ -78,77 +72,77 @@
       startwtime = MPI_Wtime()
       loopcounter = 0
-!      do io=ifivr+ntlvr-1,ifivr,-1
-      do io = workPerProcessor(nml, myrank) - 1,
+c      do io=ifivr+ntlvr-1,ifivr,-1  
+      do io = workPerProcessor(nml, myrank) - 1, 
      &        workPerProcessor(nml, myrank+1), -1
          if (io.lt.istart) then
             i1s = imsvr1(iorvr(io + 1))
          endif
-!     The array iorvr contains the variables in an "apropriate" order.
-         iv=iorvr(io)
-!     Index of the primary moving atom for the variable with index iv
-         ia=iatvr(iv)
-!     Get the type of variable iv (valence length, valence angle, dihedral angle)
-         it=ityvr(iv)
-!     Class of variable iv's potential  (Q: What are they)
-         ic=iclvr(iv)
-!     If iv is a dihedral angle ...
-         if (it.eq.3) then
-!     Barrier height * 1/2 of the potential of iv.
+c     The array iorvr contains the variables in an "apropriate" order.
+         iv=iorvr(io)       
+c     Index of the primary moving atom for the variable with index iv
+         ia=iatvr(iv)       
+c     Get the type of variable iv (valence length, valence angle, dihedral angle)
+         it=ityvr(iv)       
+c     Class of variable iv's potential  (Q: What are they)
+         ic=iclvr(iv)       
+c     If iv is a dihedral angle ...
+         if (it.eq.3) then      
+c     Barrier height * 1/2 of the potential of iv.
             e0=e0to(ic)
-!     Calculate the periodic potential term. sgto is the sign of the barrier, rnto is
-!     the periodicity and toat is torsion angle(?) associate with atom ia.
-            if (e0.ne.0.)
-     &           teyvr=teyvr+e0*(1.0+sgto(ic)*cos(toat(ia)*rnto(ic)))
-!     else if iv is a valence angle ...
-         elseif (it.eq.2) then
-!     vr is the valence angle of ia
+c     Calculate the periodic potential term. sgto is the sign of the barrier, rnto is
+c     the periodicity and toat is torsion angle(?) associate with atom ia.
+            if (e0.ne.0.) 
+     #           teyvr=teyvr+e0*(1.0+sgto(ic)*cos(toat(ia)*rnto(ic)))
+c     else if iv is a valence angle ...
+         elseif (it.eq.2) then  
+c     vr is the valence angle of ia
             vr=baat(ia)
-!     else if iv is a valence length...
-         elseif (it.eq.1) then
-!     vr is the length of the valence bond
+c     else if iv is a valence length...
+         elseif (it.eq.1) then  
+c     vr is the length of the valence bond
             vr=blat(ia)
          endif
 
-!     ============================================ Energies & Atomic forces
-!     index of next to last moving set
+c     ============================================ Energies & Atomic forces
+c     index of next to last moving set
          i2s=i1s-1
-!     index of first moving set associated with iv
-         i1s=imsvr1(iv)
-!     Loop over all moving sets starting from the one associated with vr to the end.
-         do ims=i1s,i2s
-!     First atom of the current moving set
+c     index of first moving set associated with iv
+         i1s=imsvr1(iv) 
+c     Loop over all moving sets starting from the one associated with vr to the end.
+         do ims=i1s,i2s  
+c     First atom of the current moving set
             i1=latms1(ims)
-!     Last atom of the current moving set
+c     Last atom of the current moving set
             i2=latms2(ims)
-!     Loop over all atoms of the current moving set.
-            do i=i1,i2
-!     Atom class of current atom
+c     Loop over all atoms of the current moving set.
+            do i=i1,i2  
+c     Atom class of current atom
                ity=ityat(i)
-!     Point charge at current atom
+c     Point charge at current atom
                cqi=conv*cgat(i)
-!     Cartesian coordinates of current atom
+c     Cartesian coordinates of current atom
                xi=xat(i)
                yi=yat(i)
                zi=zat(i)
-!     Loop over the atoms of the van der Waals domain belonging to atom i
-               do ivw=ivwat1(i),ivwat2(i)
-!     Loop over the atoms of the van der Waals domain of the atoms of the
-!     van der Waals domain of atom i
-!     Q: Which atoms are in these domains?
-                  do j=lvwat1(ivw),lvwat2(ivw)
+c     Loop over the atoms of the van der Waals domain belonging to atom i
+               do ivw=ivwat1(i),ivwat2(i)  
+c     Loop over the atoms of the van der Waals domain of the atoms of the 
+c     van der Waals domain of atom i
+c     Q: Which atoms are in these domains?
+                  do j=lvwat1(ivw),lvwat2(ivw)  
 
                      loopcounter = loopcounter + 1
-!     Atom type of partner
+c     Atom type of partner
                      jty=ityat(j)
-!     Differences in cartesian coordinates
+c     Differences in cartesian coordinates
                      xij=xat(j)-xi
                      yij=yat(j)-yi
                      zij=zat(j)-zi
-!     Cartesian distance and higher powers
+c     Cartesian distance and higher powers
                      rij2=xij*xij+yij*yij+zij*zij
                      rij4=rij2*rij2
                      rij6=rij4*rij2
                      rij=sqrt(rij2)
-!     Are we using a distance dependent dielectric constant?
+c     Are we using a distance dependent dielectric constant?
                      if(epsd) then
                         sr=slp*rij
@@ -157,23 +151,23 @@
                         ep = 1.0d0
                      end if
-!     Coulomb interaction
+c     Coulomb interaction
                      teyel=teyel+cqi*cgat(j)/(rij*ep)
-!     If the two atoms cannot form a hydrogen bond use 6-12 Lennard-Jones potential
+c     If the two atoms cannot form a hydrogen bond use 6-12 Lennard-Jones potential
                      if (ihbty(ity,jty).eq.0) then
                         teyvw=teyvw+aij(ity,jty)/(rij6*rij6)
-     &                       -cij(ity,jty)/rij6
+     #                       -cij(ity,jty)/rij6
                      else
-!     For hydrogen bonding use 10-12 Lennard-Jones potential
+c     For hydrogen bonding use 10-12 Lennard-Jones potential
                         teyhb=teyhb+ahb(ity,jty)/(rij6*rij6)
-     &                       -chb(ity,jty)/(rij6*rij4)
+     #                       -chb(ity,jty)/(rij6*rij4)
                      endif
 
-                  enddo
-               enddo
-
-!     Loop over 1-4 interaction partners
-!     The interactions between atoms that are three bonds apart in the protein are
-!     dominated by quantum mechanical effects. They are treated separately.
-               do i14=i14at1(i),i14at2(i)
+                  enddo  
+               enddo  
+               
+c     Loop over 1-4 interaction partners
+c     The interactions between atoms that are three bonds apart in the protein are
+c     dominated by quantum mechanical effects. They are treated separately.
+               do i14=i14at1(i),i14at2(i)   
                   loopcounter = loopcounter + 1
                   j=l14at(i14)
@@ -188,5 +182,5 @@
                   rij6=rij4*rij2
                   rij = sqrt(rij2)
-!     Are we using a distance dependent dielectric constant?
+c     Are we using a distance dependent dielectric constant?
                   if(epsd) then
                      sr=slp*rij
@@ -197,12 +191,12 @@
 
                   teyel=teyel+cqi*cgat(j)/(rij*ep)
-!     If hydrogen bonding is not possible use 6-12 Lennard-Jones potential.
+c     If hydrogen bonding is not possible use 6-12 Lennard-Jones potential.
                   if (ihbty(ity,jty).eq.0) then
                      teyvw=teyvw+a14(ity,jty)/(rij6*rij6)
-     &                    -cij(ity,jty)/rij6
+     #                    -cij(ity,jty)/rij6
                   else
-!     Use 10-12 Lennard-Jones potential for hydrogen bonds.
+c     Use 10-12 Lennard-Jones potential for hydrogen bonds.
                      teyhb=teyhb+ahb(ity,jty)/(rij6*rij6)
-     &                    -chb(ity,jty)/(rij6*rij4)
+     #                    -chb(ity,jty)/(rij6*rij4)
                   endif
                enddo            ! ... 1-4-partners of i
@@ -215,14 +209,14 @@
       endwtime = MPI_Wtime()
 
-!     Collect energies from all nodes and sum them up
-      call MPI_ALLREDUCE(teysm, eysmsum, 1, MPI_DOUBLE_PRECISION,
+c     Collect energies from all nodes and sum them up
+      call MPI_ALLREDUCE(teysm, eysmsum, 1, MPI_DOUBLE_PRECISION,  
      &     MPI_SUM, my_mpi_comm, ierror)
       call MPI_ALLREDUCE(teyel, eyel, 1, MPI_DOUBLE_PRECISION, MPI_SUM,
      &     my_mpi_comm, ierror)
-      call MPI_ALLREDUCE(teyvw, eyvw, 1, MPI_DOUBLE_PRECISION, MPI_SUM,
-     &     my_mpi_comm, ierror)
-      call MPI_ALLREDUCE(teyhb, eyhb, 1, MPI_DOUBLE_PRECISION, MPI_SUM,
-     &     my_mpi_comm, ierror)
-      call MPI_ALLREDUCE(teyvr, eyvr, 1, MPI_DOUBLE_PRECISION, MPI_SUM,
+      call MPI_ALLREDUCE(teyvw, eyvw, 1, MPI_DOUBLE_PRECISION, MPI_SUM, 
+     &     my_mpi_comm, ierror)
+      call MPI_ALLREDUCE(teyhb, eyhb, 1, MPI_DOUBLE_PRECISION, MPI_SUM, 
+     &     my_mpi_comm, ierror)
+      call MPI_ALLREDUCE(teyvr, eyvr, 1, MPI_DOUBLE_PRECISION, MPI_SUM, 
      &     my_mpi_comm, ierror)
 
Index: yshe_simple.f90
===================================================================
--- enyshe_simple.f90	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,78 +1,0 @@
-real*8 function enyshe_simple()
-
-    include "INCL.H"
-
-    integer i,j,numberOfAtoms,indexOfMolecule, i14
-    integer indexOfFirstResidue, indexOfLastResidue
-    integer indexOfFirstAtom, indexOfLastAtom, atomTypeI, indexOfAtom
-    integer typeOfDihedral, classOfPotential
-    integer indexOfFirstDihedral, indexOfLastDihedral
-    real*8 totalEnergy, coulombEnergy, rij2, rij4, rij6, rij12, E0
-    real*8 vdWEnergy, vdWDiff, torsionEnergy,xatI, yatI, zatI, cgI, tmpE
-    real*8 hydrogenBondEnergy
-
-    indexOfMolecule = 1
-    indexOfFirstResidue = irsml1(indexOfMolecule)
-    indexOfLastResidue = irsml2(indexOfMolecule)
-    indexOfFirstAtom = iatrs1(indexOfFirstResidue)
-    indexOfLastAtom = iatrs2(indexOfLastResidue)
-    numberOfAtoms = indexOfLastAtom - indexOfFirstAtom
-!$acc region
-    do i = indexOfFirstAtom, indexOfLastAtom
-        xatI = xat(i)
-        yatI = yat(i)
-        zatI = zat(i)
-        cgI = cgat(i)
-        atomTypeI = ityat(i)
-        
-        do j = i + 1, indexOfLastAtom
-            rij2 = (xatI - xat(j)) * (xatI - xat(j)) + (yatI - yat(j)) * (yatI - yat(j)) &
-                 + (zatI - zat(j)) * (zatI - zat(j))
-            rij4 = rij2 * rij2
-            rij6 = rij4 * rij2
-
-            ! Calculate Coulomb energy
-            coulombEnergy = coulombEnergy + cgI * cgat(j) / sqrt(rij2)
-            ! Calculate van-der-Waals and hydrogen bond energy
-            vdWEnergy = vdWEnergy + aij(atomTypeI, ityat(j)) / (rij6 * rij6) - cij(atomTypeI, ityat(j)) / rij6
-            ! Calculate hydrogen bond energy
-            hydrogenBondEnergy = hydrogenBondEnergy + ahb(ityat(i),ityat(j))/(rij6*rij6) &
-                                              - chb(ityat(i),ityat(j))/(rij6*rij4)
-        end do
-
-        do i14=i14at1(i),i14at2(i)
-            j = l14at(i14)
-            rij2 = (xat(i) - xat(j)) * (xat(i) - xat(j)) + (yat(i) - yat(j)) * (yat(i) - yat(j)) &
-                + (zat(i) - zat(j)) * (zat(i) - zat(j))
-            rij4 = rij2 * rij2
-            rij12 = rij4 * rij4 * rij4
-
-            vdWDiff = vdWDiff - 0.5 * aij(ityat(i), ityat(j)) / (rij12)
-        end do
-
-    end do
-
-    indexOfFirstDihedral = ivrml1(indexOfMolecule)
-    indexOfLastDihedral = indexOfFirstDihedral + nvrml(indexOfMolecule)
-
-    do i = indexOfFirstDihedral, indexOfLastDihedral
-        indexOfAtom = iatvr(i)
-        typeOfDihedral = ityvr(i)
-        classOfPotential = iclvr(i)
-        if (typeOfDihedral == 3) then
-            if (e0to(classOfPotential) == 0.0) then
-                tmpE = torsionEnergy + e0to(classOfPotential) * (1.0 + sgto(classOfPotential) &
-                         * cos(toat(indexOfAtom) * rnto(classOfPotential)))
-            endif
-        endif
-        
-        torsionEnergy = tmpE
-        end do
-
-        totalEnergy = coulombEnergy + vdWEnergy + vdWDiff + torsionEnergy
-
-        enyshe_simple = totalEnergy
-!$acc end region
-        return
-
-end function enyshe_simple
Index: enysol.f
===================================================================
--- enysol.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ enysol.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,46 +1,28 @@
-! **************************************************************
-!
-! This file contains the subroutines: enysol,tessel
-!
-! 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: enysol,tessel
+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 enysol(nmol)
 
       include 'INCL.H'
-! --------------------------------------------------------------
-!
-!     Double Cubic Lattice algorithm for calculating the
-!     solvation energy of proteins using
-!     solvent accessible area method.
-!
-!     if nmol == 0 do solvation energy over all residues.
-! CALLS: nursat
-!
-! -------------------------------------------------------------
-! TODO: Check the solvent energy for multiple molecules
-!     arguments
-      integer nmol
-
-!     functions
-      integer nursat
-
-
-      integer numbox, inbox, indsort, look, i, ii, ia, ib, ibox, icount
-      integer ilk, il, ik, ix, iy, iz, j, jy, jbox, jbi, jres, jj, jcnt
-      integer jtk, jx, jz, lbn, lst, mhx, mx, nsy, ndy, mz, my, nboxj
-      integer ndx, ncbox, nbt, nez, ndz, nex, ney, nlow, nhx, nnei
-      integer nrshi, nqxy, nrslow, mbt, nsx, nsz, numat, nup
-      double precision xyz, radb, radb2, ymin, diamax, area, akrad
-      double precision avr_x, avr_y, avr_z, dd, dr, dx, dy, dz, sizex
-      double precision rmax, shiftx, shifty, shiftz, sizey, sizez
-      double precision sizes, trad, zmin, xmax, xmin, ymax, zmax
-      double precision sdr, sdd, volume
-
+c --------------------------------------------------------------
+c
+c     Double Cubic Lattice algorithm for calculating the
+c     solvation energy of proteins using 
+c     solvent accessible area method.
+c
+c     if nmol == 0 do solvation energy over all residues.
+c CALLS: nursat
+c
+c -------------------------------------------------------------
+c TODO: Check the solvent energy for multiple molecules     
       dimension numbox(mxat),inbox(mxbox+1),indsort(mxat),look(mxat)
       dimension xyz(mxinbox,3),radb(mxinbox),radb2(mxinbox)
@@ -48,5 +30,5 @@
 
 !      common/ressurf/surfres(mxrs)
-
+      
       eyslh = 0.0
       eyslp = 0.0
@@ -62,5 +44,5 @@
       do i=nrslow,nrshi
        surfres(i) = 0.0d0
-      end do
+      end do 
 
       numat= nup - nlow + 1
@@ -69,5 +51,5 @@
          inbox(i)=0
       end do
-
+     
       asa=0.0d0
       vdvol=0.0d0
@@ -113,5 +95,5 @@
       diamax=2.d0*rmax
 
-!  The sizes of the big box
+c  The sizes of the big box
 
       sizex=xmax-xmin
@@ -119,5 +101,5 @@
       sizez=zmax-zmin
 
-!  How many maximal diameters in each size ?
+c  How many maximal diameters in each size ?
 
       ndx=sizex/diamax + 1
@@ -125,9 +107,9 @@
       ndz=sizez/diamax + 1
 
-! We may need the number of quadratic boxes in (X,Y) plane
+c We may need the number of quadratic boxes in (X,Y) plane
 
       nqxy=ndx*ndy
 
-!   The number of cubic boxes of the size "diamax"
+c   The number of cubic boxes of the size "diamax"
 
       ncbox=nqxy*ndz
@@ -136,6 +118,6 @@
        stop
       end if
-
-! Let us shift the borders to home all boxes
+        
+c Let us shift the borders to home all boxes
 
       shiftx=(dble(ndx)*diamax-sizex)/2.d0
@@ -149,5 +131,5 @@
       zmax=zmax+shiftz
 
-! Finding the box of each atom
+c Finding the box of each atom
 
       do j=nlow,nup
@@ -158,11 +140,10 @@
         numbox(j)=nboxj
         if (nboxj.gt.mxbox) then
-         write (logString, '(a)') 'enysol> bad mxboxe-2'
-         write (logString, *) 'diagnostics ...'
-         write (logString, *) 'atom ',j
-         write (logString, *) 'position ',xat(j),yat(j),zat(j)
-         write (logString, *) 'box indices ',mx,my,mz
-         write (logString, *) 'resulting boxindex and limit ',
-     &      nboxj,mxbox
+         write(*,'(a)') 'enysol> bad mxboxe-2'
+         write(*,*) 'diagnostics ...'
+         write(*,*) 'atom ',j
+         write(*,*) 'position ',xat(j),yat(j),zat(j)
+         write(*,*) 'box indices ',mx,my,mz
+         write(*,*) 'resulting boxindex and limit ',nboxj,mxbox
 
          stop
@@ -172,12 +153,12 @@
       end do
 
-!  Summation over the boxes
+c  Summation over the boxes
 
       do i=1,ncbox
         inbox(i+1)=inbox(i+1)+inbox(i)
       end do
-
-
-!   Sorting the atoms by the their box numbers
+         
+        
+c   Sorting the atoms by the their box numbers
 
       do i=nlow,nup
@@ -186,7 +167,7 @@
          indsort(jj)=i
          inbox(j)=jj-1
-      end do
-
-! Getting started
+      end do   
+         
+c Getting started
 
       do iz=0,ndz-1 ! Over the boxes along Z-axis
@@ -196,5 +177,5 @@
            ibox=ix+iy*ndx+iz*nqxy + 1
 
-!  Does this box contain atoms ?
+c  Does this box contain atoms ?
 
            lbn=inbox(ibox+1)-inbox(ibox)
@@ -207,6 +188,6 @@
              ney=min(iy+1,ndy-1)
              nez=min(iz+1,ndz-1)
-
-!  Atoms in the boxes around
+                     
+c  Atoms in the boxes around
 
              jcnt=1
@@ -223,6 +204,6 @@
                end do
               end do
-             end do
-
+             end do     
+                             
              do  ia=inbox(ibox)+1,inbox(ibox+1)
                jbi=indsort(ia)
@@ -240,5 +221,5 @@
                      dr=1.0d0+akrad
                      dr=dr*dr
-!c if contact
+cc if contact
                      if(dd.le.dr) then
                        nnei=nnei+1
@@ -251,10 +232,10 @@
                    end if
                  end do
-!c
+cc
                   do il=1,npnt
                      surfc(il)=.false.
                   end do
 
-!  Check overlap
+c  Check overlap
 
                   lst=1
@@ -276,5 +257,5 @@
                      end do
  99                  continue
-
+    
                      if(ik.gt.nnei)then
                        surfc(il)=.true.
@@ -298,12 +279,12 @@
                  area   = sdr*dble(icount)
                  volume = sdr/3.0d0*(trad*dble(icount)
-     &                               +(xat(jbi)-avr_x)*dx
-     &                               +(yat(jbi)-avr_y)*dy
-     &                               +(zat(jbi)-avr_z)*dz)
+     #                               +(xat(jbi)-avr_x)*dx
+     #                               +(yat(jbi)-avr_y)*dy
+     #                               +(zat(jbi)-avr_z)*dz)
 
                  asa=asa+area
                  vdvol=vdvol+volume
                  eysl=eysl+area*sigma(jbi)
-! Separate hydrophilic (h) and hyrdophobic (p) contributions to eysl
+c Separate hydrophilic (h) and hyrdophobic (p) contributions to eysl
                  if (sigma(jbi).lt.0) then
                     eyslp = eyslp + area * sigma(jbi)
@@ -314,9 +295,9 @@
                     asah = asah + area
                  endif
-! Measure how much a residue is solvent accessible:
+c Measure how much a residue is solvent accessible:
                  jres = nursat(jbi)
                  surfres(jres) = surfres(jres) + area
                end if
-             end do
+             end do 
            end if
           end do
@@ -324,5 +305,5 @@
        end do
 
-!
+c
        if (isolscl) then
           nhx=0
@@ -338,10 +319,11 @@
        return
        end
-! *********************
+c *********************
       subroutine tessel
       include 'INCL.H'
       character lin*80
-      integer i
-!    Skipping comment lines, which begin with '!'
+
+c    Skipping comment lines, which begin with '!'  
+
       read(20,'(a)') lin
       do while(lin(1:1).eq.'!')
@@ -349,18 +331,19 @@
       end do
 
-!   The first non-comment line is the number of the surface points
+c   The first non-comment line is the number of the surface points
 
       read(lin(1:5),'(i5)') npnt
-!       write (logString, '(a,i5)') 'the number of points---->',npnt
-
-!    Read the surface points
+c        write(*,'(a,i5)') 'the number of points---->',npnt
+
+c    Read the surface points   
 
       do i=1,npnt
          read(20,'(3f20.10)') spoint(i,1),spoint(i,2),spoint(i,3)
-!          write(31,'(3f20.10)') spoint(i,1),spoint(i,2),spoint(i,3)
-      end do
-
+         
+c        write(31,'(3f20.10)') spoint(i,1),spoint(i,2),spoint(i,3)
+      end do
+ 
       return
-
+ 
       end
 
Index: enysol_p.f
===================================================================
--- enysol_p.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ enysol_p.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,14 +1,14 @@
-! **************************************************************
-!
-! This file contains the subroutines: enysol,tessel
-!
-! 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: enysol,tessel
+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 enysol(nmol)
 
@@ -16,28 +16,15 @@
       include 'mpif.h'
 
-! --------------------------------------------------------------
-!
-!     Double Cubic Lattice algorithm for calculating the
-!     solvation energy of proteins using
-!     solvent accessible area method.
-!
-!     if nmol == 0 do solvation energy over all residues.
-! CALLS: nursat
-!
-! -------------------------------------------------------------
-! TODO: Check the solvent energy for multiple molecules
-      double precision startwtime, avr_x, avr_y, avr_z, xmin, ymin, zmin
-      double precision xmax, ymax, zmax, rmax, diamax, sizex, sizey
-      double precision sizez, shiftx, shifty, shiftz, boxpp, trad, dx
-      double precision dy, dz, dd, akrad, dr, xyz, radb, radb2, sdd, sdr
-      double precision area, volume, eyslsum, endwtime
-
-      integer nmol, nrslow, nrshi, nlow, nup, i, numat, inbox, j, ndx
-      integer ndy, ndz, nqxy, ncbox, mx, my, mz, nboxj, numbox, jj
-      integer indsort, iboxmin, iboxmax, ibox, iz, iy, ix, lbn, nsx, nsy
-      integer nsz, nex, ney, nez, jcnt, jz, jy, jx, jbox, ii, look, ia
-      integer jbi, nnei, ib, jtk, il, lst, ilk, ik, icount, jres, nursat
-      integer ierror, nhx, mhx, nbt, mbt
-
+c --------------------------------------------------------------
+c
+c     Double Cubic Lattice algorithm for calculating the
+c     solvation energy of proteins using 
+c     solvent accessible area method.
+c
+c     if nmol == 0 do solvation energy over all residues.
+c CALLS: nursat
+c
+c -------------------------------------------------------------
+c TODO: Check the solvent energy for multiple molecules     
       dimension numbox(mxat),inbox(mxbox+1),indsort(mxat),look(mxat)
       dimension xyz(mxinbox,3),radb(mxinbox),radb2(mxinbox)
@@ -46,5 +33,5 @@
 
 !       common/ressurf/surfres(mxrs)
-      real*8 tsurfres(mxrs)
+      real*8 tsurfres(mxrs) 
       startwtime = MPI_Wtime()
       root = 0
@@ -63,5 +50,5 @@
       do i=nrslow,nrshi
        surfres(i) = 0.0d0
-      end do
+      end do 
 
       numat= nup - nlow + 1
@@ -70,5 +57,5 @@
          inbox(i)=0
       end do
-
+     
       asa=0.0d0
       vdvol=0.0d0
@@ -114,5 +101,5 @@
       diamax=2.d0*rmax
 
-!  The sizes of the big box
+c  The sizes of the big box
 
       sizex=xmax-xmin
@@ -120,5 +107,5 @@
       sizez=zmax-zmin
 
-!  How many maximal diameters in each size ?
+c  How many maximal diameters in each size ?
 
       ndx=sizex/diamax + 1
@@ -126,9 +113,9 @@
       ndz=sizez/diamax + 1
 
-! We may need the number of quadratic boxes in (X,Y) plane
+c We may need the number of quadratic boxes in (X,Y) plane
 
       nqxy=ndx*ndy
 
-!   The number of cubic boxes of the size "diamax"
+c   The number of cubic boxes of the size "diamax"
 
       ncbox=nqxy*ndz
@@ -137,6 +124,6 @@
        stop
       end if
-
-! Let us shift the borders to home all boxes
+        
+c Let us shift the borders to home all boxes
 
       shiftx=(dble(ndx)*diamax-sizex)/2.d0
@@ -150,5 +137,5 @@
       zmax=zmax+shiftz
 
-! Finding the box of each atom
+c Finding the box of each atom
 
       do j=nlow,nup
@@ -159,11 +146,10 @@
         numbox(j)=nboxj
         if (nboxj.gt.mxbox) then
-         write (logString, '(a)') 'enysol> bad mxboxe-2'
-         write (logString, *) 'diagnostics ...'
-         write (logString, *) 'atom ',j
-         write (logString, *) 'position ',xat(j),yat(j),zat(j)
-         write (logString, *) 'box indices ',mx,my,mz
-         write (logString, *) 'resulting boxindex and limit ',nboxj,
-     &      mxbox
+         write(*,'(a)') 'enysol> bad mxboxe-2'
+         write(*,*) 'diagnostics ...'
+         write(*,*) 'atom ',j
+         write(*,*) 'position ',xat(j),yat(j),zat(j)
+         write(*,*) 'box indices ',mx,my,mz
+         write(*,*) 'resulting boxindex and limit ',nboxj,mxbox
 
          stop
@@ -173,12 +159,12 @@
       end do
 
-!  Summation over the boxes
+c  Summation over the boxes
 
       do i=1,ncbox
         inbox(i+1)=inbox(i+1)+inbox(i)
       end do
-
-
-!   Sorting the atoms by the their box numbers
+         
+        
+c   Sorting the atoms by the their box numbers
 
       do i=nlow,nup
@@ -187,8 +173,8 @@
          indsort(jj)=i
          inbox(j)=jj-1
-      end do
-
-!    Getting started
-!    We have to loop over ncbox boxes and have no processors available
+      end do   
+         
+c    Getting started
+c    We have to loop over ncbox boxes and have no processors available
       boxpp = 1.0 * ncbox / no
       iboxmin = boxpp * myrank
@@ -196,6 +182,6 @@
       if (myrank.eq.(no - 1)) iboxmax = ncbox
       if (myrank.eq.-1) then
-         write (logString, *) 'enysol> Summary:', enysolct, ncbox, 
-     &               boxpp, ndx, ndy, ndz
+         write (*,*) 'enysol> Summary:', enysolct, ncbox, boxpp,
+     &               ndx, ndy, ndz
       endif
       do ibox = iboxmin + 1, iboxmax + 1
@@ -205,5 +191,5 @@
 !     ibox=ix+iy*ndx+iz*nqxy + 1
 
-!  Does this box contain atoms ?
+c  Does this box contain atoms ?
 
            lbn=inbox(ibox+1)-inbox(ibox)
@@ -216,6 +202,6 @@
              ney=min(iy+1,ndy-1)
              nez=min(iz+1,ndz-1)
-
-!  Atoms in the boxes around
+                     
+c  Atoms in the boxes around
 
              jcnt=1
@@ -232,6 +218,6 @@
                end do
               end do
-             end do
-
+             end do     
+                             
              do  ia=inbox(ibox)+1,inbox(ibox+1)
                jbi=indsort(ia)
@@ -249,5 +235,5 @@
                      dr=1.0d0+akrad
                      dr=dr*dr
-!c if contact
+cc if contact
                      if(dd.le.dr) then
                        nnei=nnei+1
@@ -260,10 +246,10 @@
                    end if
                  end do
-!c
+cc
                   do il=1,npnt
                      surfc(il)=.false.
                   end do
 
-!  Check overlap
+c  Check overlap
 
                   lst=1
@@ -285,5 +271,5 @@
                      end do
  99                  continue
-
+    
                      if(ik.gt.nnei)then
                        surfc(il)=.true.
@@ -307,12 +293,12 @@
                  area   = sdr*dble(icount)
                  volume = sdr/3.0d0*(trad*dble(icount)
-     &                               +(xat(jbi)-avr_x)*dx
-     &                               +(yat(jbi)-avr_y)*dy
-     &                               +(zat(jbi)-avr_z)*dz)
+     #                               +(xat(jbi)-avr_x)*dx
+     #                               +(yat(jbi)-avr_y)*dy
+     #                               +(zat(jbi)-avr_z)*dz)
 
                  asa=asa+area
                  vdvol=vdvol+volume
                  eysl=eysl+area*sigma(jbi)
-! Separate hydrophilic (h) and hyrdophobic (p) contributions to eysl
+c Separate hydrophilic (h) and hyrdophobic (p) contributions to eysl
                  if (sigma(jbi).lt.0) then
                     eyslp = eyslp + area * sigma(jbi)
@@ -323,28 +309,28 @@
                     asah = asah + area
                  endif
-! Measure how much a residue is solvent accessible:
+c Measure how much a residue is solvent accessible:
                  jres = nursat(jbi)
                  surfres(jres) = surfres(jres) + area
                end if
-             end do
+             end do 
            end if
 !           end do
 !          end do
        end do
-      call MPI_ALLREDUCE(eysl, eyslsum, 1, MPI_DOUBLE_PRECISION,
+      call MPI_ALLREDUCE(eysl, eyslsum, 1, MPI_DOUBLE_PRECISION, 
      &      MPI_SUM,my_mpi_comm, ierror)
-      write (logString, *) 'enysol>', myrank, eysl, eyslsum
+!       write(*,*) 'enysol>', myrank, eysl, eyslsum
       tsurfres = surfres
-      call MPI_ALLREDUCE(tsurfres, surfres, mxrs, MPI_DOUBLE_PRECISION,
+      call MPI_ALLREDUCE(tsurfres, surfres, mxrs, MPI_DOUBLE_PRECISION, 
      &      MPI_SUM,my_mpi_comm, ierror)
       eysl = eyslsum
-
+      
       endwtime = MPI_Wtime()
       if (myrank.le.-1) then
-         write (logString, *) 'enysol>',myrank,enysolct,
+         write (*,*) 'enysol>',myrank,enysolct,
      &               iboxmin + 1, iboxmax + 1,
      &               endwtime - startwtime, "s"
       endif
-!
+c
        if (isolscl) then
           nhx=0
@@ -360,12 +346,10 @@
        return
        end
-! *********************
+c *********************
       subroutine tessel
       include 'INCL.H'
-      integer i
-
       character lin*80
 
-!    Skipping comment lines, which begin with '!'
+c    Skipping comment lines, which begin with '!'  
 
       read(20,'(a)') lin
@@ -374,19 +358,19 @@
       end do
 
-!   The first non-comment line is the number of the surface points
+c   The first non-comment line is the number of the surface points
 
       read(lin(1:5),'(i5)') npnt
-!        write (logString, '(a,i5)') 'the number of points---->',npnt
-
-!    Read the surface points
+c        write(*,'(a,i5)') 'the number of points---->',npnt
+
+c    Read the surface points   
 
       do i=1,npnt
          read(20,'(3f20.10)') spoint(i,1),spoint(i,2),spoint(i,3)
-
-!        write(31,'(3f20.10)') spoint(i,1),spoint(i,2),spoint(i,3)
-      end do
-
+         
+c        write(31,'(3f20.10)') spoint(i,1),spoint(i,2),spoint(i,3)
+      end do
+ 
       return
-
+ 
       end
 
Index: esolan.f
===================================================================
--- esolan.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ esolan.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,100 +1,71 @@
-! **************************************************************
-!
-! This file contains the subroutines: esolan
-!
-! 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: esolan
+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 esolan(nmol)
 
-! -----------------------------------------------------------------
-!
-! Calculates the solvation energy of the protein with
-! solavtion parameters model E=\sum\sigma_iA_i.
-! The solvent accessible surface area per atom
-! and its gradients with respect to the Cartesian coordinates of
-! the atoms are calculated using the projection method described in
-!
-!            J Comp Phys 26, 334-343, 2005
-!
-! USAGE: eysl=esolan(nmol)-Returns the value of the solvation energy
-!
-! INPUT: nmol - the order number of the protein chain.
-!      The atomic coordinates, radii and solvation parameters
-!      are taken from the global arrays of SMMP
-!
-! OUTPUT: global array gradan(mxat,3) contains the gradients of
-!         solvation energy per atom
-!         local array as(mxat) contains accessible surface area per atom
-!
-! Output file "solvation.dat' conatains detailed data.
-!
-! Correctness of this program was last time rechecked with GETAREA
-!
-! CALLS: none
-!
-! ----------------------------------------------------------------------
-! TODO Test the solvent energy for multiple molecules
+c -----------------------------------------------------------------
+c
+c Calculates the solvation energy of the protein with 
+c solavtion parameters model E=\sum\sigma_iA_i. 
+c The solvent accessible surface area per atom
+c and its gradients with respect to the Cartesian coordinates of 
+c the atoms are calculated using the projection method described in
+c
+c            J Comp Phys 26, 334-343, 2005
+c
+C USAGE: eysl=esolan(nmol)-Returns the value of the solvation energy
+c
+c INPUT: nmol - the order number of the protein chain.
+c      The atomic coordinates, radii and solvation parameters  
+c      are taken from the global arrays of SMMP
+c
+c OUTPUT: global array gradan(mxat,3) contains the gradients of 
+c         solvation energy per atom
+c         local array as(mxat) contains accessible surface area per atom
+c
+c Output file "solvation.dat' conatains detailed data.
+c
+c Correctness of this program was last time rechecked with GETAREA
+c
+c CALLS: none
+c
+c ----------------------------------------------------------------------
+c TODO Test the solvent energy for multiple molecules
 
       include 'INCL.H'
-
-
-      integer nmol, ks0, ks2
-Cf2py intent(in) nmol
-
+      
+      
       parameter (ks0=mxat*(mxat+1))
       parameter (ks2=mxat+mxat)
-! Functions
-      real*8 grnd
-
-      integer neib, neibp, ivrx, iv, ial, i, ij, j, iii, idi,ivr, ifu,
-     &          ita2, ita3, ine, kk, j2, jkk, jjj, jj, jk, k, l, ll,
-     &          nb, numat, nyx
-      real*8 vertex, ax, pol, as, ayx, ayx1, probe, dd, ddat, dadx, gp,
-     &          dalp,dbet, daalp, dabet, vrx, dv, dx, dy, dz, dt, di,
-     &          dii, ss, dta, dtb, di1, di2, gs, xold, yold, zold,
-     &          energy, sss, a1, a, ab1, a2, aa, ac2, ac1, ab2, am2,
-     &          am, aia, ak, alp, am1, ap1, amibe, amabe, amaal, amial,
-     &          ang, D, ddp, cf, b2, arg2, arg1, ap2, b, b1, b2c2, ca,
-     &          ba, bcd, bc, bet, c1, c, c2, cc, sfcg, caba, cg, cfsg,
-     &          cfcg, daba, ct, cs, d1, d2, dbe, dal, dcotbma, dcbet,
-     &          dcalp, dcbetmalp, dcbetpalp, ddp2, div, dsbetmalp,
-     &          dsalp, dsbet, yy, dsbetpalp, enr, p1, p2, r42, r22,
-     &          r22p, r2, pom, prob, r, r42p, ratom, rr, s, sfsg, sf,
-     &          sg, vv1, t, ufi, tt, uga, uv, vv, vv2, wv, xx, xv, yv,
-     &          zz, zv
-      dimension neib(0:mxat),neibp(0:mxat),ivrx(ks0)
-      dimension vertex(ks0,4),ax(ks0,2),
-     &          pol(mxat),as(mxat),ayx(ks0,2),
-     &          ayx1(ks0),probe(ks0),dd(mxat),ddat(mxat,4)
-      dimension dadx(4,3),gp(4),dalp(4),dbet(4),
-     &   daalp(4),dabet(4),vrx(ks0,4),dv(4),dx(4),dy(4),dz(4),dt(4),
-     &   di(4),dii(4,3),ss(mxat),dta(4),dtb(4),di1(4),di2(4),gs(3)
+      
+      dimension neib(0:mxat),vertex(ks0,4),ax(ks0,2),
+     1          pol(mxat),neibp(0:mxat),as(mxat),ayx(ks0,2),
+     2          ayx1(ks0),probe(ks0),dd(mxat),ddat(mxat,4),ivrx(ks0)
+       
+      dimension grad(mxat,mxat,3),dadx(4,3),gp(4),dalp(4),dbet(4),
+     1   daalp(4),dabet(4),vrx(ks0,4),dv(4),dx(4),dy(4),dz(4),dt(4),
+     2   di(4),dii(4,3),ss(mxat),dta(4),dtb(4),di1(4),di2(4),gs(3)
       dimension xold(-1:mxat),yold(-1:mxat),zold(-1:mxat)
       integer ta2(0:mxat),ta3(0:mxat),fullarc(0:mxat),al(0:ks2)
       real*8 neibor(mxat,4)
-
-      real*8, dimension(:, :, :), allocatable :: grad
-
-      allocate(grad(mxat, mxat, 3))
-
-
-!     open(3,file='solvation.dat')! Output file with solvation data
+      
+      
+c     open(3,file='solvation.dat')! Output file with solvation data
 
       energy=0.0d0 ! Total solvation energy
       sss=0.0d0 ! Total solvent accessible surface area
-      if (nmol.eq.0) then
-         numat=iatrs2(irsml2(ntlml))-iatrs1(irsml1(1))+1 ! Number of atoms
-      else
-         numat=iatrs2(irsml2(nmol))-iatrs1(irsml1(nmol))+1 ! Number of atoms
-      endif
+      numat=iatrs2(irsml2(nmol))-iatrs1(irsml1(nmol))+1 ! Number of atoms
 
       do i=1,numat
         do j=1,3
-         gradan(i,j)=0.0d0
+         gradan(i,j)=0.0d0 
       end do
       end do
@@ -102,10 +73,10 @@
       do i=1,numat
          xold(i)=xat(i)! Redefine the coordinates just for safety
-         yold(i)=yat(i)!
-         zold(i)=zat(i)!
-      pol(i)=rvdw(i)*rvdw(i)!The water radius is already added in 'main'
+         yold(i)=yat(i)! 
+         zold(i)=zat(i)! 
+      pol(i)=rvdw(i)*rvdw(i)!The water radius is already added in 'main' 
       As(i)=pi4*pol(i)! Initially the whole surface of the atom is accessible.
       end do
-
+      
              do iii=1,numat
               do jjj=1,numat
@@ -116,22 +87,21 @@
              enddo
 
-!***************************
-!   Start the computations *
-!***************************
-
-      do 1 i=1,numat ! Lop over atoms "i"
-! ----------------------------------------------------
-
-       R=rvdw(i)
+c***************************
+c   Start the computations *
+c***************************
+
+      do 1 i=1,numat ! Lop over atoms "i"           
+c ----------------------------------------------------
+         
+       R=rvdw(i) 
        jj=0
         do j=1,numat !Find the neighbours of "i"
        if(i.ne.j) then
        ddp=(xold(j)-xold(i))**2+(yold(j)-yold(i))**2
-     &   +(zold(j)-zold(i))**2! Distance between atom i and j
+     #   +(zold(j)-zold(i))**2! Distance between atom i and j
        if(ddp.lt.1e-10) then
-         write (logString, *)
-     &      'ERROR in data: centres of two atoms coincide!'
-         write (logString, *)i,j,xold(i),yold(i),zold(i),rvdw(i),
-     &                   xold(j),yold(j),zold(j),rvdw(j)
+         write(*,*)'ERROR in data: centres of two atoms coincide!'
+         write(*,*)i,j,xold(i),yold(i),zold(i),rvdw(i),
+     #                   xold(j),yold(j),zold(j),rvdw(j) 
          stop 'Centres of atoms coincide!'
        endif
@@ -147,10 +117,10 @@
          end if
          end do!Neighbours
-
+       
        neib(0)=jj   ! The number of neighbors of "i"
 
        if(neib(0).eq.0) goto 1 !Finish the atom i if it doesn't have neighbors
 
-!----
+c----
        R2=R*R                   ! R square
        R22=R2+R2             ! 2 * R square
@@ -170,33 +140,33 @@
            ddat(i,4)=0d0
            ddat(i,1)=R
-!
-!    Verification of the north point of ith sphere
-!
+c
+c    Verification of the north point of ith sphere
+c
        jjj=0
-!
-!      If jjj=0 then - no transformation
-!             else the transformation is necessary
-!
+c
+c      If jjj=0 then - no transformation
+c             else the transformation is necessary
+c
        k=neib(1)  ! The order number of the first neighbour
-! ddp - the square minimal distance of NP from the neighboring surfaces
+c ddp - the square minimal distance of NP from the neighboring surfaces
        ddp=dabs((ddat(k,2))**2+(ddat(k,3))**2+
-     &    (R-ddat(k,4))**2-pol(k))
+     #    (R-ddat(k,4))**2-pol(k))
 
        do j=2,neib(0)
         k=neib(j)
         ddp2=dabs((ddat(k,2))**2+(ddat(k,3))**2+
-     &      (R-ddat(k,4))**2-pol(k))
+     #      (R-ddat(k,4))**2-pol(k))
         if(ddp2.lt.ddp) ddp=ddp2
        enddo
-!
-!   Check whether the NP of ith sphere is too close to the intersection line
-!
+c
+c   Check whether the NP of ith sphere is too close to the intersection line
+c
        do while (ddp.lt.1.d-6)
         jjj=jjj+1
-!
-!       generate grndom numbers
-!
+c
+c       generate grndom numbers
+c
         uga=grnd() ! Random \gamma angle
-        ufi=grnd() ! Random \pi angle
+        ufi=grnd() ! Random \pi angle 
         uga=pi*uga/2
         ufi=pi*ufi/2
@@ -212,14 +182,14 @@
         k=neib(1)
         ddp=dabs((xx-ddat(k,2))**2+(yy-ddat(k,3))**2+
-     &     (zz-ddat(k,4))**2-pol(k))
+     #     (zz-ddat(k,4))**2-pol(k))
         do j=2,neib(0)
          k=neib(j)
          ddp2=dabs((xx-ddat(k,2))**2+(yy-ddat(k,3))**2+
-     &       (zz-ddat(k,4))**2-pol(k))
+     #       (zz-ddat(k,4))**2-pol(k))
          if(ddp2.lt.ddp) ddp=ddp2
         end do
       end do
-!
-
+c       
+      
        if(jjj.ne.0) then ! Rotation is necessary
          sfsg=sf*sg
@@ -236,21 +206,21 @@
        endif
 
-!  iiiiiiiiiii
+c  iiiiiiiiiii
 
        pom=8.d0*pol(i)
 
-! In this loop the parameters a,b,c,d for the equation
-!      a*(t^2+s^2)+b*t+c*s+d=0 are calculated (see the reference article)
+C In this loop the parameters a,b,c,d for the equation
+c      a*(t^2+s^2)+b*t+c*s+d=0 are calculated (see the reference article)
       do jj=1,neib(0)
       j=neib(jj)
-       neibor(j,1)=(ddat(j,2))**2+(ddat(j,3))**2+
-     &            (ddat(j,4)-R)**2-pol(j)           ! a
+       neibor(j,1)=(ddat(j,2))**2+(ddat(j,3))**2+      
+     #            (ddat(j,4)-R)**2-pol(j)           ! a
         neibor(j,2)=-pom*ddat(j,2)                  ! b
         neibor(j,3)=-pom*ddat(j,3)                  ! c
         neibor(j,4)=4d0*pol(i)*((ddat(j,2))**2+
-     &      (ddat(j,3))**2+(R+ddat(j,4))**2-pol(j)) ! d
+     #      (ddat(j,3))**2+(R+ddat(j,4))**2-pol(j)) ! d
        enddo
 
-!       end of the 1st cleaning
+c       end of the 1st cleaning
 
        iv=0
@@ -260,5 +230,5 @@
        do while(k.gt.1)               ! B
         k=k-1
-! Analyse mutual disposition of every pair of neighbours
+C Analyse mutual disposition of every pair of neighbours                                                      
         do 13 L=neib(0),k+1,-1        ! A
 
@@ -272,9 +242,9 @@
           d2=neibor(neib(L),4)/neibor(neib(L),1)
           D=4d0*((b1-b2)*(b2*d1-b1*d2)+(c1-c2)*(c2*d1-c1*d2)-
-     &      (d1-d2)**2)+(b1*c2-b2*c1)**2
-! if D<0 then the circles neib(k) and neib(L) don't intersect
+     #      (d1-d2)**2)+(b1*c2-b2*c1)**2
+C if D<0 then the circles neib(k) and neib(L) don't intersect
           if(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le.      ! a01 01
-     &     dsqrt(b2*b2+c2*c2-4d0*d2)-dsqrt(b1*b1+c1*c1-4d0*d1)) then ! 04
-! Circle neib(L) encloses circle neib(k) and the later is discarded
+     #     dsqrt(b2*b2+c2*c2-4d0*d2)-dsqrt(b1*b1+c1*c1-4d0*d1)) then ! 04
+C Circle neib(L) encloses circle neib(k) and the later is discarded
            neib(0)=neib(0)-1
            do j=k,neib(0)
@@ -283,6 +253,6 @@
            goto 12
           elseif(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le.      ! a01 02
-     &    -dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
-! The circle neib(k) encloses circle neib(L) and the later is discarded
+     #    -dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
+C The circle neib(k) encloses circle neib(L) and the later is discarded 
            neib(0)=neib(0)-1
            do j=L,neib(0)
@@ -290,5 +260,5 @@
            enddo
           elseif(D.gt.0d0) then                        ! a01 03
-! The circles nieb(L) and neib(k) have two intersection points (IP)
+C The circles nieb(L) and neib(k) have two intersection points (IP)
            am=2d0*((b1-b2)**2+(c1-c2)**2)
            t=-2d0*(b1-b2)*(d1-d2)-(b2*c1-b1*c2)*(c1-c2)
@@ -310,5 +280,5 @@
 
          elseif(neibor(neib(k),1).gt.0d0.and.      ! a03
-     &              neibor(neib(L),1).lt.0d0) then
+     #              neibor(neib(L),1).lt.0d0) then
           b1=neibor(neib(k),2)/neibor(neib(k),1)
           c1=neibor(neib(k),3)/neibor(neib(k),1)
@@ -318,14 +288,14 @@
           d2=neibor(neib(L),4)/neibor(neib(L),1)
           D=4d0*((b1-b2)*(b2*d1-b1*d2)+(c1-c2)*(c2*d1-c1*d2)-
-     &        (d1-d2)**2)+(b1*c2-b2*c1)**2
-! if D<0 then neib(k) and neib(L) don't intersect
+     #        (d1-d2)**2)+(b1*c2-b2*c1)**2
+C if D<0 then neib(k) and neib(L) don't intersect
           if(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le.  ! a03 01
-     &     -dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then ! 06
-! Neighbours neib(k) and neib(L) cover fully the atom "i" and as(i)=0
+     #     -dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then ! 06
+C Neighbours neib(k) and neib(L) cover fully the atom "i" and as(i)=0
            As(i)=0.d0
            goto 11
           elseif(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).ge.  ! a03 02
-     &      dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
-! Don't exclude neib(k)
+     #      dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
+C Don't exclude neib(k) 
            neib(0)=neib(0)-1
            do j=k,neib(0)
@@ -334,5 +304,5 @@
            goto 12
           elseif(D.gt.0.d0) then                        ! a03 03
-! Circles neib(L) and neib(k) have two intersection points.
+C Circles neib(L) and neib(k) have two intersection points.
            am=2d0*((b1-b2)**2+(c1-c2)**2)
            t=-2d0*(b1-b2)*(d1-d2)-(b2*c1-b1*c2)*(c1-c2)
@@ -354,5 +324,5 @@
 
          elseif(neibor(neib(k),1).lt.0d0.and.neibor(neib(L),1).gt.0d0)! a07
-     &           then
+     #           then
           b1=neibor(neib(k),2)/neibor(neib(k),1)
           c1=neibor(neib(k),3)/neibor(neib(k),1)
@@ -362,14 +332,14 @@
           d2=neibor(neib(L),4)/neibor(neib(L),1)
           D=4d0*((b1-b2)*(b2*d1-b1*d2)+(c1-c2)*(c2*d1-c1*d2)-
-     &        (d1-d2)**2)+(b1*c2-b2*c1)**2
-! If D<0 then the circles neib(k) and neib(L) don't intersect
+     #        (d1-d2)**2)+(b1*c2-b2*c1)**2
+C If D<0 then the circles neib(k) and neib(L) don't intersect
           if(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le.   ! a07 01
-     &     dsqrt(b2*b2+c2*c2-4d0*d2)-dsqrt(b1*b1+c1*c1-4d0*d1)) then    ! 10
-! atom "i" is covered fully by neib(k) and neib(L) and as(i)=0.
+     #     dsqrt(b2*b2+c2*c2-4d0*d2)-dsqrt(b1*b1+c1*c1-4d0*d1)) then    ! 10
+C atom "i" is covered fully by neib(k) and neib(L) and as(i)=0.
            As(i)=0.d0
            goto 12
           elseif(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).ge.   ! a07 02
-     &      dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
-! discard the circle neib(L)
+     #      dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
+C discard the circle neib(L) 
            neib(0)=neib(0)-1
            do j=L,neib(0)
@@ -377,5 +347,5 @@
            enddo
           elseif(D.gt.0d0) then                          ! a07 03
-! There are two IP's between neib(k) and neib(L).
+C There are two IP's between neib(k) and neib(L).
            am=2d0*((b1-b2)**2+(c1-c2)**2)
            t=-2d0*(b1-b2)*(d1-d2)-(b2*c1-b1*c2)*(c1-c2)
@@ -385,6 +355,6 @@
            p1=(c1-c2)*pom
            p2=(b1-b2)*pom
-!-- Assign t and s coordinates and the order number of circles
-           vertex(iv,1)=(t+p1)/am
+c-- Assign t and s coordinates and the order number of circles
+           vertex(iv,1)=(t+p1)/am 
            vertex(iv,2)=(s-p2)/am
            vertex(iv,3)=neib(k)
@@ -395,9 +365,9 @@
            vertex(iv,3)=neib(k)
            vertex(iv,4)=neib(L)
-!--
+c--  
           endif                                                 ! 10
 
          elseif(neibor(neib(k),1).lt.0d0.and.neibor(neib(L),1).lt.0d0) ! a09
-     &           then
+     #           then
           b1=neibor(neib(k),2)/neibor(neib(k),1)
           c1=neibor(neib(k),3)/neibor(neib(k),1)
@@ -407,9 +377,9 @@
           d2=neibor(neib(L),4)/neibor(neib(L),1)
           D=4d0*((b1-b2)*(b2*d1-b1*d2)+(c1-c2)*(c2*d1-c1*d2)-
-     &        (d1-d2)**2)+(b1*c2-b2*c1)**2
-! D<0 - no intersection poit between neib(k) and neib(L)
+     #        (d1-d2)**2)+(b1*c2-b2*c1)**2
+C D<0 - no intersection poit between neib(k) and neib(L)
           if(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le.
-     &   dsqrt(b2*b2+c2*c2-4d0*d2)-dsqrt(b1*b1+c1*c1-4d0*d1)) then!12 ! a09 01
-! omit the circle neib(L)
+     #   dsqrt(b2*b2+c2*c2-4d0*d2)-dsqrt(b1*b1+c1*c1-4d0*d1)) then!12 ! a09 01
+C omit the circle neib(L)
            neib(0)=neib(0)-1
            do j=L,neib(0)
@@ -417,6 +387,6 @@
            enddo
           elseif(D.le.0d0.and.dsqrt((b1-b2)**2+(c1-c2)**2).le. ! a09 02
-     &     -dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
-! Omit the circle neib(k)
+     #     -dsqrt(b2*b2+c2*c2-4d0*d2)+dsqrt(b1*b1+c1*c1-4d0*d1)) then
+C Omit the circle neib(k)
            neib(0)=neib(0)-1
            do j=k,neib(0)
@@ -425,9 +395,9 @@
            goto 12
           elseif(D.le.0.d0) then                            ! a09 03
-! The whole surface of atom "i" is covered fully, and as(i)=0.
+C The whole surface of atom "i" is covered fully, and as(i)=0.
            As(i)=0.d0
            goto 11
           else                                             ! a09 04
-! Two intersection points
+C Two intersection points
            am=2.d0*((b1-b2)**2+(c1-c2)**2)
            t=-2.d0*(b1-b2)*(d1-d2)-(b2*c1-b1*c2)*(c1-c2)
@@ -437,5 +407,5 @@
            p1=(c1-c2)*pom
            p2=(b1-b2)*pom
-! Assign the t and s coordinates and order numbers of the circles
+C Assign the t and s coordinates and order numbers of the circles
            vertex(iv,1)=(t+p1)/am
            vertex(iv,2)=(s-p2)/am
@@ -458,10 +428,10 @@
         do j=1,neib(0)
         if(neibor(neib(j),1).eq.0.d0) then
-! Collect the lines (after rotation it is empty).
+C Collect the lines (after rotation it is empty).
          ita2=ita2+1
          ta2(ita2)=j
         endif
         if(neibor(neib(j),1).lt.0.d0) then
-! Collect the neighbours with inner part
+C Collect the neighbours with inner part
          ita3=ita3+1
          ta3(ita3)=j
@@ -469,5 +439,5 @@
        enddo
 
-!*** Consider to remove this part.
+c*** Consider to remove this part.
          if(ita2.gt.0.and.ita3.lt.1) then
            As(i)=R22p
@@ -492,5 +462,5 @@
             dbe=amabe-amibe
             if(dal.lt.pi) then
-             As(i)=R22*(pi-dal)
+             As(i)=R22*(pi-dal)  
             elseif(dbe.lt.pi) then
              As(i)=R22*(pi-dbe)
@@ -502,5 +472,5 @@
           As(i)=0d0
          endif
-!****** End of could-be-removed part
+c****** End of could-be-removed part
 
        neibp(0)=neib(0)
@@ -511,10 +481,10 @@
        enddo
        do j=1,neib(0)
-! "iv" is the number of intersection point.
+C "iv" is the number of intersection point. 
         do k=1,iv
        if(neibp(j).eq.vertex(k,3).or.neibp(j).eq.vertex(k,4)) goto 30
         enddo
          ifu=ifu+1
-! Arrays with the ordering numbers of full arcs.
+C Arrays with the ordering numbers of full arcs.
          fullarc(ifu)=neibp(j)
          al(ifu)=neibp(j)
@@ -530,8 +500,8 @@
        al(0)=ifu
 
-! Loop over full arcs.
+C Loop over full arcs.
        do k=1,ifu
          a=neibor(fullarc(k),1)
-         if(a.lt.0.d0) then
+         if(a.lt.0.d0) then 
           aia=-1.d0
          else
@@ -542,7 +512,7 @@
          d=neibor(fullarc(k),4)
          if(a.ne.0d0) then !True if rotation has taken place.
-! Remove the part of the atomic surface covered cut by this full arc
+C Remove the part of the atomic surface covered cut by this full arc
           As(i)=As(i)-aia*R22p*(1d0+(-d/a-R42)*dabs(a)/dsqrt((R42*a-
-     &                 d)**2+R42*(b*b+c*c)))
+     #                 d)**2+R42*(b*b+c*c)))
           dadx(1,1)=2d0*ddat(fullarc(k),2)
           dadx(1,2)=2d0*ddat(fullarc(k),3)
@@ -563,9 +533,9 @@
           gp(4)=(b*b+c*c-2d0*a*d+(R42+R42)*a*a)*div
           grad(i,fullarc(k),1)=gp(1)*dadx(1,1)+gp(2)*dadx(2,1)+
-     &        gp(3)*dadx(3,1)+gp(4)*dadx(4,1)
+     #        gp(3)*dadx(3,1)+gp(4)*dadx(4,1)
           grad(i,fullarc(k),2)=gp(1)*dadx(1,2)+gp(2)*dadx(2,2)+
-     &        gp(3)*dadx(3,2)+gp(4)*dadx(4,2)
+     #        gp(3)*dadx(3,2)+gp(4)*dadx(4,2)
           grad(i,fullarc(k),3)=gp(1)*dadx(1,3)+gp(2)*dadx(2,3)+
-     &        gp(3)*dadx(3,3)+gp(4)*dadx(4,3)
+     #        gp(3)*dadx(3,3)+gp(4)*dadx(4,3)
 
          else
@@ -574,5 +544,5 @@
        enddo
 
-! Loop over the circles with intersection points.
+c Loop over the circles with intersection points.
        do k=1,ine
          jk=neib(k) ! The order number of kth neighbour.
@@ -580,5 +550,5 @@
          ak=a*a
          daba=dabs(a)
-         if(a.lt.0d0) then
+         if(a.lt.0d0) then 
           aia=-1d0
           else
@@ -632,6 +602,6 @@
              yv=(bcd+2d0*R42*ak)/daba*vv1
              zv=wv/a*vv1
-! Move the (t,s) origo into the centre of this circle.
-! Modify t and s coordinates of IP.
+C Move the (t,s) origo into the centre of this circle.
+C Modify t and s coordinates of IP.
           do j=1,nyx
            ayx(j,1)=ayx(j,1)+ba ! t
@@ -642,9 +612,9 @@
           cs=-ca
           rr=0.5d0*wv/daba
-! Calculate the polar angle of IP.
+C Calculate the polar angle of IP.
           do j=1,nyx
            ayx1(j)=datan2(ayx(j,2),ayx(j,1))
           enddo
-! Sort the angles in ascending order.
+C Sort the angles in ascending order.
           do j=1,nyx-1
            a1=ayx1(j)
@@ -680,6 +650,6 @@
           do j=1,nyx
 
-!
-!  Escape 'bad' intersections.
+c  
+c  Escape 'bad' intersections.
            if(dabs(ayx1(j+1)-ayx1(j)).lt.1d-8) goto 40
 
@@ -687,9 +657,9 @@
            ap1=ct+rr*dcos(prob) ! The middle point of the arc.
            ap2=cs+rr*dsin(prob)
-! Verify if the middle point belongs to a covered part.
-! If yes then omit.
+C Verify if the middle point belongs to a covered part. 
+C If yes then omit.
            do ij=1,ial
           if(neibor(al(ij),1)*(ap1*ap1+ap2*ap2)+neibor(al(ij),2)*ap1+
-     &         neibor(al(ij),3)*ap2+neibor(al(ij),4).lt.0d0) goto 40
+     #         neibor(al(ij),3)*ap2+neibor(al(ij),4).lt.0d0) goto 40
            enddo
              alp=ayx1(j)
@@ -705,7 +675,7 @@
              dcotbma=1.d0/dtan(5d-1*(bet-alp))
              uv=daba*(bcd+2d0*R42*ak)*dcbetmalp
-     &          -a*dsqrt(b2c2-4d0*a*d)*(b*dcbetpalp+c*dsbetpalp)
+     #          -a*dsqrt(b2c2-4d0*a*d)*(b*dcbetpalp+c*dsbetpalp)
              As(i)=As(i)+R2*(aia*(alp-bet)+(d+R42*a)*vv1*(pi-2d0*
-     &             datan(uv/(2d0*ak*vv*dsbetmalp))))
+     #             datan(uv/(2d0*ak*vv*dsbetmalp))))
              kk=vrx(j,4)
              LL=vrx(j+1,4)
@@ -726,49 +696,49 @@
              am2=wv*aia*a2*(ab2*dsbet-ac2*dcbet)
              dalp(1)=(b1*ab1+c1*ac1-2d0*d*a1*a1-a*
-     &               (b1*b1+c1*c1-4d0*a1*d1)-2d0*d*aia*a1*(ab1*
-     &               dcalp+ac1*dsalp)/wv+wv*aia*a1*
-     &               (b1*dcalp+c1*dsalp))/am1
+     1               (b1*b1+c1*c1-4d0*a1*d1)-2d0*d*aia*a1*(ab1*
+     2               dcalp+ac1*dsalp)/wv+wv*aia*a1*
+     3               (b1*dcalp+c1*dsalp))/am1
              dalp(2)=(-a1*ab1+b*a1*a1+b*aia*a1*(ab1*
-     &               dcalp+ac1*dsalp)/wv-wv*aia*a1*a1*dcalp)/am1
+     1               dcalp+ac1*dsalp)/wv-wv*aia*a1*a1*dcalp)/am1
              dalp(3)=(-a1*ac1+c*a1*a1+c*aia*a1*(ab1*
-     &               dcalp+ac1*dsalp)/wv-wv*aia*a1*a1*dsalp)/am1
+     #               dcalp+ac1*dsalp)/wv-wv*aia*a1*a1*dsalp)/am1
              dalp(4)=(-2d0*a*a1*a1-2d0*daba*a1*(ab1*
-     &               dcalp+ac1*dsalp)/wv)/am1
+     #               dcalp+ac1*dsalp)/wv)/am1
              dbet(1)=(b2*ab2+c2*ac2-2d0*d*a2*a2-a*
-     &               (b2*b2+c2*c2-4d0*a2*d2)-2d0*d*aia*a2*(ab2*
-     &               dcbet+ac2*dsbet)/wv+wv*aia*a2*
-     &               (b2*dcbet+c2*dsbet))/am2
+     #               (b2*b2+c2*c2-4d0*a2*d2)-2d0*d*aia*a2*(ab2*
+     #               dcbet+ac2*dsbet)/wv+wv*aia*a2*
+     #               (b2*dcbet+c2*dsbet))/am2
              dbet(2)=(-a2*ab2+b*a2*a2+b*aia*a2*(ab2*
-     &               dcbet+ac2*dsbet)/wv-wv*aia*a2*a2*dcbet)/am2
+     #               dcbet+ac2*dsbet)/wv-wv*aia*a2*a2*dcbet)/am2
              dbet(3)=(-a2*ac2+c*a2*a2+c*aia*a2*(ab2*
-     &               dcbet+ac2*dsbet)/wv-wv*aia*a2*a2*dsbet)/am2
+     #               dcbet+ac2*dsbet)/wv-wv*aia*a2*a2*dsbet)/am2
              dbet(4)=(-2d0*a*a2*a2-2d0*daba*a2*(ab2*
-     &               dcbet+ac2*dsbet)/wv)/am2
+     #               dcbet+ac2*dsbet)/wv)/am2
              daalp(1)=(-b*ab1-c*ac1+wv*wv*a1+2d0*ak*d1+
-     &              wv*aia*((ab1-b*a1)*dcalp+(ac1-c*a1)*dsalp))/am1
+     #              wv*aia*((ab1-b*a1)*dcalp+(ac1-c*a1)*dsalp))/am1
              daalp(2)=(a*ab1-ak*b1+wv*daba*a1*dcalp)/am1
              daalp(3)=(a*ac1-ak*c1+wv*daba*a1*dsalp)/am1
              daalp(4)=(2d0*ak*a1)/am1
              dabet(1)=(-b*ab2-c*ac2+wv*wv*a2+2d0*ak*d2+
-     &             wv*aia*((ab2-b*a2)*dcbet+(ac2-c*a2)*dsbet))/am2
+     #             wv*aia*((ab2-b*a2)*dcbet+(ac2-c*a2)*dsbet))/am2
              dabet(2)=(a*ab2-ak*b2+wv*daba*a2*dcbet)/am2
              dabet(3)=(a*ac2-ak*c2+wv*daba*a2*dsbet)/am2
              dabet(4)=(2d0*ak*a2)/am2
-               dv(2)=R42*b*vv1
-               dv(3)=R42*c*vv1
-               dv(4)=(d-R42*a)*vv1
-               dv(1)=-dv(4)*R42
-               dx(1)=R42*vv1-(d+R42*a)*dv(1)*vv2
-             dx(2)=-(d+R42*a)*dv(2)*vv2
-             dx(3)=-(d+R42*a)*dv(3)*vv2
-             dx(4)=1d0*vv1-(d+R42*a)*dv(4)*vv2
+               dv(2)=R42*b*vv1      
+               dv(3)=R42*c*vv1      
+               dv(4)=(d-R42*a)*vv1      
+               dv(1)=-dv(4)*R42      
+               dx(1)=R42*vv1-(d+R42*a)*dv(1)*vv2      
+             dx(2)=-(d+R42*a)*dv(2)*vv2      
+             dx(3)=-(d+R42*a)*dv(3)*vv2      
+             dx(4)=1d0*vv1-(d+R42*a)*dv(4)*vv2      
              dy(1)=(-2d0*d+4d0*R42*a)/daba*vv1-(b*b+c*c-2d0*a*d+2d0*
-     &             R42*ak)*(aia*vv+daba*dv(1))/ak*vv2
+     #             R42*ak)*(aia*vv+daba*dv(1))/ak*vv2
                dy(2)=2d0*b/daba*vv1-(b*b+c*c-2d0*a*d+2d0*
-     &             R42*ak)*aia*dv(2)/a*vv2
+     #             R42*ak)*aia*dv(2)/a*vv2
                dy(3)=2d0*c/daba*vv1-(b*b+c*c-2d0*a*d+2d0*
-     &             R42*ak)*aia*dv(3)/a*vv2
+     #             R42*ak)*aia*dv(3)/a*vv2
                dy(4)=-2.d0*a/daba*vv1-(b*b+c*c-2.d0*a*d+2.d0*
-     &             R42*ak)*aia*dv(4)/a*vv2
+     #             R42*ak)*aia*dv(4)/a*vv2      
              dz(1)=-2d0*d/wv/a*vv1-wv*(vv+a*dv(1))/ak*vv2
              dz(2)=b/wv/a*vv1-wv*dv(2)/a*vv2
@@ -776,37 +746,37 @@
              dz(4)=-2d0/wv*vv1-wv*dv(4)/a*vv2
              dt(1)=dcotbma*dy(1)-5d-1*yv*
-     &               (dbet(1)-dalp(1))/dsbetmalp**2-((b*dcbetpalp+
-     &             c*dsbetpalp)/dsbetmalp)*dz(1)-
-     &             5d-1*zv*(((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp)*
-     &             (dalp(1)+dbet(1))-((b*dcbetpalp+c*dsbetpalp)*
-     &             dcbetmalp)*(dbet(1)-dalp(1)))/dsbetmalp**2
+     1               (dbet(1)-dalp(1))/dsbetmalp**2-((b*dcbetpalp+
+     2             c*dsbetpalp)/dsbetmalp)*dz(1)-
+     3             5d-1*zv*(((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp)*
+     4             (dalp(1)+dbet(1))-((b*dcbetpalp+c*dsbetpalp)*
+     5             dcbetmalp)*(dbet(1)-dalp(1)))/dsbetmalp**2
              dt(2)=dcotbma*dy(2)-5d-1*yv*
-     &             (dbet(2)-dalp(2))/dsbetmalp**2-(b*dcbetpalp+
-     &             c*dsbetpalp)/dsbetmalp*dz(2)-
-     &             5d-1*zv*((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp*
-     &             (dalp(2)+dbet(2))-(b*dcbetpalp+c*dsbetpalp)*
-     &             dcbetmalp*(dbet(2)-dalp(2))+dcbetpalp
-     &             *2d0*dsbetmalp)/dsbetmalp**2
+     1             (dbet(2)-dalp(2))/dsbetmalp**2-(b*dcbetpalp+
+     2             c*dsbetpalp)/dsbetmalp*dz(2)-
+     3             5d-1*zv*((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp*
+     4             (dalp(2)+dbet(2))-(b*dcbetpalp+c*dsbetpalp)*
+     5             dcbetmalp*(dbet(2)-dalp(2))+dcbetpalp
+     6             *2d0*dsbetmalp)/dsbetmalp**2
              dt(3)=dcotbma*dy(3)-5d-1*yv*
-     &             (dbet(3)-dalp(3))/dsbetmalp**2-(b*dcbetpalp+
-     &             c*dsbetpalp)/dsbetmalp*dz(3)-
-     &             5d-1*zv*((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp*
-     &             (dalp(3)+dbet(3))-(b*dcbetpalp+c*dsbetpalp)*
-     &             dcbetmalp*(dbet(3)-dalp(3))+dsbetpalp*2d0*
-     &             dsbetmalp)/dsbetmalp**2
+     1             (dbet(3)-dalp(3))/dsbetmalp**2-(b*dcbetpalp+
+     2             c*dsbetpalp)/dsbetmalp*dz(3)-
+     3             5d-1*zv*((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp*
+     4             (dalp(3)+dbet(3))-(b*dcbetpalp+c*dsbetpalp)*
+     5             dcbetmalp*(dbet(3)-dalp(3))+dsbetpalp*2d0*
+     6             dsbetmalp)/dsbetmalp**2
              dt(4)=dcotbma*dy(4)-5d-1*yv*
-     &             (dbet(4)-dalp(4))/dsbetmalp**2-(b*dcbetpalp+
-     &             c*dsbetpalp)/dsbetmalp*dz(4)-
-     &             5d-1*zv*((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp*
-     &             (dalp(4)+dbet(4))-(b*dcbetpalp+c*dsbetpalp)*
-     &             dcbetmalp*(dbet(4)-dalp(4)))/dsbetmalp**2
+     1             (dbet(4)-dalp(4))/dsbetmalp**2-(b*dcbetpalp+
+     2             c*dsbetpalp)/dsbetmalp*dz(4)-
+     3             5d-1*zv*((-b*dsbetpalp+c*dcbetpalp)*dsbetmalp*
+     4             (dalp(4)+dbet(4))-(b*dcbetpalp+c*dsbetpalp)*
+     5             dcbetmalp*(dbet(4)-dalp(4)))/dsbetmalp**2
              di(1)=R2*(aia*(dalp(1)-dbet(1))+(pi-2d0*datan(5d-1*tt))*
-     &               dx(1)-4d0*xv*dt(1)/(4d0+tt**2))
+     #               dx(1)-4d0*xv*dt(1)/(4d0+tt**2))
              di(2)=R2*(aia*(dalp(2)-dbet(2))+(pi-2d0*datan(5d-1*tt))*
-     &               dx(2)-4d0*xv*dt(2)/(4d0+tt**2))
+     #               dx(2)-4d0*xv*dt(2)/(4d0+tt**2))
              di(3)=R2*(aia*(dalp(3)-dbet(3))+(pi-2d0*datan(5d-1*tt))*
-     &               dx(3)-4d0*xv*dt(3)/(4d0+tt**2))
+     #               dx(3)-4d0*xv*dt(3)/(4d0+tt**2))
              di(4)=R2*(aia*(dalp(4)-dbet(4))+(pi-2d0*datan(5d-1*tt))*
-     &               dx(4)-4d0*xv*dt(4)/(4d0+tt**2))
+     #               dx(4)-4d0*xv*dt(4)/(4d0+tt**2))
              dii(1,1)=2d0*ddat(jk,2)
              dii(1,2)=2d0*ddat(jk,3)
@@ -821,23 +791,23 @@
              dii(4,2)=dii(1,2)*R42
              dii(4,3)=2d0*(ddat(jk,4)+R)*R42
-
+             
              do idi=1,3
               grad(i,jk,idi)=grad(i,jk,idi)+
-     &                   di(1)*dii(1,idi)+di(2)*dii(2,idi)+
-     &                   di(3)*dii(3,idi)+di(4)*dii(4,idi)
-
-             enddo
+     #                   di(1)*dii(1,idi)+di(2)*dii(2,idi)+
+     #                   di(3)*dii(3,idi)+di(4)*dii(4,idi)
+
+             enddo             
              do idi=1,4
                dta(idi)=5d-1*daalp(idi)*(((yv-zv*((-b*dsbetpalp
-     &                  +c*dcbetpalp)*dsbetmalp+
-     &                (b*dcbetpalp+c*dsbetpalp)*
-     &                dcbetmalp))/dsbetmalp**2))
+     1                  +c*dcbetpalp)*dsbetmalp+
+     2                (b*dcbetpalp+c*dsbetpalp)*
+     3                dcbetmalp))/dsbetmalp**2))
                dtb(idi)=5d-1*dabet(idi)*(((-yv-zv*((-b*dsbetpalp
-     &                  +c*dcbetpalp)*dsbetmalp-
-     &                (b*dcbetpalp+c*dsbetpalp)*
-     &                dcbetmalp))/dsbetmalp**2))
+     1                  +c*dcbetpalp)*dsbetmalp-
+     2                (b*dcbetpalp+c*dsbetpalp)*
+     3                dcbetmalp))/dsbetmalp**2))
              di1(idi)=R2*(aia*daalp(idi)-4d0*xv*dta(idi)/(4d0+tt*tt))
             di2(idi)=R2*(-aia*dabet(idi)-4d0*xv*dtb(idi)/(4d0+tt*tt))
-             enddo
+             enddo             
 
              dii(1,1)=2d0*ddat(kk,2)
@@ -849,6 +819,6 @@
              do idi=1,3
               grad(i,kk,idi)=grad(i,kk,idi)+
-     &                   di1(1)*dii(1,idi)+di1(2)*dii(2,idi)+
-     &                       di1(3)*dii(3,idi)+di1(4)*dii(4,idi)
+     1                   di1(1)*dii(1,idi)+di1(2)*dii(2,idi)+
+     2                       di1(3)*dii(3,idi)+di1(4)*dii(4,idi)
              enddo
 
@@ -861,11 +831,11 @@
              do idi=1,3
               grad(i,LL,idi)=grad(i,LL,idi)+
-     &                   di2(1)*dii(1,idi)+di2(2)*dii(2,idi)+
-     &                       di2(3)*dii(3,idi)+di2(4)*dii(4,idi)
+     1                   di2(1)*dii(1,idi)+di2(2)*dii(2,idi)+
+     2                       di2(3)*dii(3,idi)+di2(4)*dii(4,idi)
              enddo
 
 40           continue
           enddo
-
+         
          else ! analyse the case with lines (not necessary after rotation).
 
@@ -873,12 +843,12 @@
            a1=dsin(ang)
            a2=dcos(ang)
-! Rotate the intersection points by the angle "ang".
-! After rotation the position of IP will be defined
-! by its first coordinate "ax(.,1)".
+c Rotate the intersection points by the angle "ang".
+c After rotation the position of IP will be defined
+c by its first coordinate "ax(.,1)".
            do j=1,nyx
             ax(j,1)=ayx(j,1)*a2-ayx(j,2)*a1
             ax(j,2)=ayx(j,1)*a1+ayx(j,2)*a2
            enddo
-! Sorting by acsending order.
+C Sorting by acsending order.
            do j=1,nyx-1
             a1=ax(j,1)
@@ -921,5 +891,5 @@
            enddo
            probe(nyx+1)=ayx1(nyx)+1d0
-
+           
 
            bc=b*b+c*c
@@ -929,9 +899,9 @@
            p1=ayx(1,1)+c*probe(1)
            p2=ayx(1,2)-b*probe(1)
-! Verify if the middle point belongs to a covered part.
-! Omit, if yes.
+C Verify if the middle point belongs to a covered part.
+C Omit, if yes.
            do L=1,ial
             if(neibor(al(L),1)*(p1*p1+p2*p2)+neibor(al(L),2)*p1+
-     &         neibor(al(L),3)*p2+neibor(al(L),4).lt.0d0) goto 20
+     #         neibor(al(L),3)*p2+neibor(al(L),4).lt.0d0) goto 20
            enddo
            arg2=bc*ayx1(1)+caba
@@ -944,5 +914,5 @@
             do L=1,ial
              if(neibor(al(L),1)*(p1*p1+p2*p2)+neibor(al(L),2)*p1+
-     &          neibor(al(L),3)*p2+neibor(al(L),4).lt.0d0) goto 21
+     #          neibor(al(L),3)*p2+neibor(al(L),4).lt.0d0) goto 21
             enddo
             arg1=bc*ayx1(j-1)+caba
@@ -955,5 +925,5 @@
            do      L=1,ial
             if(neibor(al(L),1)*(p1*p1+p2*p2)+neibor(al(L),2)*p1+
-     &         neibor(al(L),3)*p2+neibor(al(L),4).lt.0d0) goto 22
+     1         neibor(al(L),3)*p2+neibor(al(L),4).lt.0d0) goto 22
            enddo
            arg1=bc*ayx1(nyx)+caba
@@ -961,9 +931,9 @@
 22           continue
             endif
-         enddo
+         enddo       
 11      continue
 
-!
-!         changed in 2004
+c
+c         changed in 2004
 
       do j=1,ine
@@ -982,6 +952,6 @@
 
       if(jjj.ne.0) then
-! Restore the original configuration if the molecule has been rotated.
-! This is necessary for calculation of gradients.
+C Restore the original configuration if the molecule has been rotated.
+C This is necessary for calculation of gradients.
           xx=grad(i,i,1)
           yy=grad(i,i,2)
@@ -1018,9 +988,9 @@
 111   continue
 
-!     write(3,*)'   No   Area    sigma   Enrg    gradx   grady',
-!    & '   gradz   Rad    Atom'
-!     write(3,*)
-
-
+c     write(3,*)'   No   Area    sigma   Enrg    gradx   grady',     
+c    # '   gradz   Rad    Atom'
+c     write(3,*)
+
+      
       do i=1,numat
         enr=As(i)*sigma(i)
@@ -1030,16 +1000,15 @@
         if (nmat(i)(1:1).eq.'h') ratom=0.0
 
-!     write(3,700),i,As(i),sigma(i),
-!    &        enr,(gradan(i,k),k=1,3),ratom,nmat(i)
+c     write(3,700),i,As(i),sigma(i),
+c    #        enr,(gradan(i,k),k=1,3),ratom,nmat(i)
 
       enddo
 
-!     write(3,*)'Total Area: ',sss
-!     write(3,*)'Total solvation energy: ',energy
+c     write(3,*)'Total Area: ',sss
+c     write(3,*)'Total solvation energy: ',energy
 
       esolan=sss
 
-      deallocate(grad)
-!     close(3)
+c     close(3)
       return
 
@@ -1047,4 +1016,4 @@
 200   format(2i4,3f16.6)
 700   format(i5,7f8.3,5x,a4)
-
+         
       end
Index: eyabgn.f
===================================================================
--- eyabgn.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ eyabgn.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,23 +1,19 @@
-! *********************************************************************
-! This file contains eyrccr, init_abgn, eyentr, eyabgn
-!
-! Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-!                      Jan H. Meinke, Sandipan Mohanty
-!
-! Corrections to ECEPP energy terms due to R. A. Abagyan et al.
-!
-! Two terms are calculated: eyrccr and eyentr, representing respectively
-! c a term to slightly shift the backbone dihedral angle preferences in
-! the ECEPP potential slightly away from the helix region, and another
-! term to estimate the side-chain entropy from a given configuration.
-!
-!
-! *********************************************************************
+c *********************************************************************
+c This file contains eyrccr, init_abgn, eyentr, eyabgn
+c
+c Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+c                      Jan H. Meinke, Sandipan Mohanty
+c
+c Corrections to ECEPP energy terms due to R. A. Abagyan et al. 
+c 
+c Two terms are calculated: eyrccr and eyentr, representing respectively
+c c a term to slightly shift the backbone dihedral angle preferences in 
+c the ECEPP potential slightly away from the helix region, and another
+c term to estimate the side-chain entropy from a given configuration. 
+c
+c
+c *********************************************************************
       real*8 function eyrccr(nml)
       include 'INCL.H'
-      double precision et, rsscl
-
-      integer nml, istres, indres, i, ipsi, in, ica, ic, mlvr, iphi
-
       dimension iN(mxrs),iCa(mxrs),iC(mxrs),mlvr(mxvr)
       dimension iphi(mxrs),ipsi(mxrs)
@@ -33,24 +29,24 @@
       endif
       et=0.0
-!      print *,'***********'
+c      print *,'***********'
       do i=istres,indres
          mynm=seq(i)
          call tolost(mynm)
          if ((mynm.eq.'val').or.(mynm.eq.'ile').or.
-     &           (mynm.eq.'thr')) then
+     #           (mynm.eq.'thr')) then 
             rsscl=1.0
-         else
+         else 
             rsscl=0.5
          endif
          et=et+rsscl*(1.0-sin(vlvr(ipsi(i))))
-!         print *,'  contribution = ',rsscl*(1.0-sin(vlvr(ipsi(i))))
-!         print *,'obtained using scale ',rsscl,' and angle ',
-!     #        vlvr(ipsi(i))
+c         print *,'  contribution = ',rsscl*(1.0-sin(vlvr(ipsi(i))))
+c         print *,'obtained using scale ',rsscl,' and angle ',
+c     #        vlvr(ipsi(i))
       enddo
-!      print *,'abagyan dihedral term = ',et
-!      print *,'***********'
+c      print *,'abagyan dihedral term = ',et
+c      print *,'***********'
       eyrccr=et
       return
-      end
+      end 
 
       subroutine init_abgn
@@ -58,43 +54,39 @@
 !       dimension rsstrg(mxrs)
 !       common /abgncor/rsstrg
-      double precision xarea, estrg
-
-      integer i, istres, indres, imytyp, j
-
       dimension xarea(nrsty),estrg(nrsty)
       character mynm*4
-!      print *,'Initialization of Abagyan entropic term'
-!     Maximum accessible surface areas for different residue types
+c      print *,'Initialization of Abagyan entropic term'
+c     Maximum accessible surface areas for different residue types
       data (xarea(i),i=1,nrsty)/
-!             1         2         3         4         5
-     &     117.417 , 244.686 , 245.582 , 146.467 , 144.485 ,
-!             6         7         8         9        10
-     &     144.192 , 142.805 , 147.568 , 183.103 , 177.094 ,
-!            11       12        13        14        15
-     &     186.293 , 83.782 , 187.864 , 187.864 , 187.864 ,
-!            16       17        18        19        20
-     &     187.864 , 160.887 , 161.741 , 184.644 , 179.334 ,
-!            21       22        23        24        25
-     &     209.276 , 209.276 , 203.148 , 208.902 , 153.124 ,
-!            26       27        28        29        30
-     &     153.973 , 153.037 , 158.695 , 157.504 , 157.504 ,
-!            31       32        33        34        35
-     &     119.786 , 146.488 , 238.641 , 223.299 , 160.283 /
-!     Entropic contribution for maximally exposed residue
+c             1         2         3         4         5
+     #     117.417 , 244.686 , 245.582 , 146.467 , 144.485 ,
+c             6         7         8         9        10
+     #     144.192 , 142.805 , 147.568 , 183.103 , 177.094 ,
+c            11       12        13        14        15
+     #     186.293 , 83.782 , 187.864 , 187.864 , 187.864 ,
+c            16       17        18        19        20
+     #     187.864 , 160.887 , 161.741 , 184.644 , 179.334 ,
+c            21       22        23        24        25
+     #     209.276 , 209.276 , 203.148 , 208.902 , 153.124 ,
+c            26       27        28        29        30
+     #     153.973 , 153.037 , 158.695 , 157.504 , 157.504 ,
+c            31       32        33        34        35
+     #     119.786 , 146.488 , 238.641 , 223.299 , 160.283 /
+c     Entropic contribution for maximally exposed residue
       data (estrg(i),i=1,nrsty)/
-!             1ala      2arg      3arg+     4asn      5asp
-     &       0.0   ,   2.13  ,   2.13  ,   0.81  ,   0.61  ,
-!             6asp-     7cys      8cyss     9gln     10glu
-     &       0.61  ,   1.14  ,   1.14  ,   2.02  ,   1.65  ,
-!            11glu-   12gly     13his     14hise    15hisd
-     &       1.65  ,  0.0    ,   0.99  ,   0.99  ,   0.99  ,
-!            16his+   17hyp     18hypu    19ile     20leu
-     &       0.99  ,   0.99  ,   0.99  ,  0.75   ,   0.75  ,
-!            21lys    22lys+     23met     24phe     25cpro
-     &       2.21  ,   2.21  ,   1.53  ,   0.58  ,   0.0   ,
-!            26pro     27cpru    28prou    29pron    30pro+
-     &       0.0   ,   0.0   ,   0.0   ,   0.0   ,   0.0   ,
-!            31ser     32thr     33trp     34tyr     35val
-     &       1.19  ,   1.12  ,   0.97  ,   0.99  ,   0.50  /
+c             1ala      2arg      3arg+     4asn      5asp
+     #       0.0   ,   2.13  ,   2.13  ,   0.81  ,   0.61  ,
+c             6asp-     7cys      8cyss     9gln     10glu
+     #       0.61  ,   1.14  ,   1.14  ,   2.02  ,   1.65  ,
+c            11glu-   12gly     13his     14hise    15hisd
+     #       1.65  ,  0.0    ,   0.99  ,   0.99  ,   0.99  ,
+c            16his+   17hyp     18hypu    19ile     20leu
+     #       0.99  ,   0.99  ,   0.99  ,  0.75   ,   0.75  ,
+c            21lys    22lys+     23met     24phe     25cpro
+     #       2.21  ,   2.21  ,   1.53  ,   0.58  ,   0.0   ,
+c            26pro     27cpru    28prou    29pron    30pro+
+     #       0.0   ,   0.0   ,   0.0   ,   0.0   ,   0.0   ,
+c            31ser     32thr     33trp     34tyr     35val
+     #       1.19  ,   1.12  ,   0.97  ,   0.99  ,   0.50  /
       do i=1,mxrs
          rsstrg(i)=0.0
@@ -108,19 +100,19 @@
          do j=1,nrsty
             if (rsnmcd(j).eq.mynm) imytyp=j
-!            print *,'comparing ',mynm,' with ',rsnmcd(j),imytyp
+c            print *,'comparing ',mynm,' with ',rsnmcd(j),imytyp
          enddo
-         if (imytyp.eq.0) then
+         if (imytyp.eq.0) then 
             print *, 'Unknown residue type ',seq(i)
             print *, 'Abagyan term strength set to 0'
             rsstrg(i)=0.0
-         else
+         else 
             rsstrg(i)=estrg(imytyp)/xarea(imytyp)
          endif
-!         print *,'residue ',i,seq(i),' type ',imytyp
-!         print *, 'strength for residue ',i,seq(i),' is ',rsstrg(i)
+c         print *,'residue ',i,seq(i),' type ',imytyp
+c         print *, 'strength for residue ',i,seq(i),' is ',rsstrg(i) 
       enddo
       print *, 'initialized Abagyan corrections to ECEPP force field'
       end
-
+      
       real*8 function eyentr(nml)
       include 'INCL.H'
@@ -129,8 +121,4 @@
 !       common/ressurf/surfres(mxrs)
 !      common/bet/beta
-      double precision eentr, aars, strh
-
-      integer nml, istres, indres, i
-
       eentr=0
       if (nml.eq.0) then
@@ -141,33 +129,29 @@
          indres=irsml2(nml)
       endif
-!      print *,'residue range ',istres,indres
-!      print *,'for molecule ',nml
+c      print *,'residue range ',istres,indres
+c      print *,'for molecule ',nml
       do i=istres, indres
          aars=surfres(i)
          strh=rsstrg(i)
-!        The maximal burial entropies were estimated at temperature 300k
-!        The values in the array estrg are k_B * T (=300k) * Entropy
-!        Presently we need it at temperature 1/beta, so we need to
-!        multiply the strengths in estrg with (1/beta)/(300 kelvin)
-!        300 kelvin is approximately 0.59576607 kcal/mol.
+c        The maximal burial entropies were estimated at temperature 300k
+c        The values in the array estrg are k_B * T (=300k) * Entropy
+c        Presently we need it at temperature 1/beta, so we need to 
+c        multiply the strengths in estrg with (1/beta)/(300 kelvin)
+c        300 kelvin is approximately 0.59576607 kcal/mol.
          eentr=eentr+aars*strh/(0.59576607*beta)
-!         print *,'contribution = ',aars*strh/(0.59576607*beta)
-!         print *,'residue, exposed area = ',i,aars
-!         print *,'strength = ',strh,' for residue index = ',i
-!         print *,'beta = ',beta
+c         print *,'contribution = ',aars*strh/(0.59576607*beta)
+c         print *,'residue, exposed area = ',i,aars
+c         print *,'strength = ',strh,' for residue index = ',i
+c         print *,'beta = ',beta
       enddo
-!      print *,'abagyan entropic term = ',eentr
+c      print *,'abagyan entropic term = ',eentr
       eyentr=eentr
       return
       end
-
-      real*8 function eyabgn(nml)
+      
+      real*8 function eyabgn(nml) 
       include 'INCL.H'
-      double precision eyrccr, eyentr
-
-      integer nml
-
       eyabgn=eyrccr(nml)+eyentr(nml)
-!      print *,'Abagyan term = ',eyabgn
+c      print *,'Abagyan term = ',eyabgn
       return
       end
Index: getmol.f
===================================================================
--- getmol.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ getmol.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,55 +1,48 @@
-! **************************
-! **************************************************************
-!
-! This file contains the subroutines: getmol,redres
-!
-! 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
+c This file contains the subroutines: getmol,redres
+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 **************************************************************
 
 
       subroutine getmol(nml)
 
-! ...................................................................
-! PURPOSE:  assemble data for molecule 'nml' according to
-!           its sequence using residue library 'reslib'
-!
-! ! Molecules must be assembled in sequential order (1 -> ntlml)
-!            (or number of atoms & variables must remain the same)
-!
-! INPUT:    irsml1(nml),irsml2(nml),seq(irsml1()...irsml2())
-!           nml>1: irsml1(nml-1),iatrs2(irsml2(nml-1))
-!                  ivrrs1(irsml2(nml-1)),nvrrs(irsml2(nml-1))
-!
-! OUTPUT:   molecule  - ivrml1,nvrml
-!           residues  - iatrs1,ixatrs,iatrs2,ivrrs1,nvrrs
-!           atoms     - nmat,ityat,cgat,blat,baat,csbaat,snbaat,
-!                       toat,cstoat,sntoat
-!           bonds     - nbdat,iowat,iyowat,ibdat(1-mxbd,),iybdat(1-mxbd,)
-!                       ! 1st atom of 'nml': iowat indicates 1st bond
-!                          to a FOLLOWING atom (not previous) !
-!           variables - ityvr,iclvr,iatvr,nmvr
-!                                    
-! CALLS:    iopfil,redres,iendst
-! ...................................................................
+c ...................................................................
+c PURPOSE:  assemble data for molecule 'nml' according to
+c           its sequence using residue library 'reslib'
+c
+c ! Molecules must be assembled in sequential order (1 -> ntlml)
+c            (or number of atoms & variables must remain the same)
+c
+c INPUT:    irsml1(nml),irsml2(nml),seq(irsml1()...irsml2())
+c           nml>1: irsml1(nml-1),iatrs2(irsml2(nml-1))
+c                  ivrrs1(irsml2(nml-1)),nvrrs(irsml2(nml-1))
+c
+c OUTPUT:   molecule  - ivrml1,nvrml
+c           residues  - iatrs1,ixatrs,iatrs2,ivrrs1,nvrrs
+c           atoms     - nmat,ityat,cgat,blat,baat,csbaat,snbaat,
+c                       toat,cstoat,sntoat
+c           bonds     - nbdat,iowat,iyowat,ibdat(1-mxbd,),iybdat(1-mxbd,)
+c                       ! 1st atom of 'nml': iowat indicates 1st bond
+c                          to a FOLLOWING atom (not previous) !
+c           variables - ityvr,iclvr,iatvr,nmvr
+c                                    
+c CALLS:    iopfil,redres,iendst
+c ...................................................................
 
       include 'INCL.H'
-!     arguments
-      integer nml
-!     functions      
-      integer iopfil, iendst
-      
-      integer i, iat, iow, ifirs, ibd, ilars, j, mvr, nbd, n, nbd1, nj
-      integer nh, nrs, ntlat, ntlvr, nat, nxt
-      double precision ba, t, to
+
       character res*4
 
       if (iopfil(lunlib,reslib,'old','formatted').le.izero) then
-        write (logString, '(a,/,a,i3,2a)') 
-     &    ' getmol> ERROR opening library of residues:',
-     &    ' LUN=',lunlib,' FILE=',reslib(1:iendst(reslib))
+        write (*,'(a,/,a,i3,2a)') 
+     #    ' getmol> ERROR opening library of residues:',
+     #    ' LUN=',lunlib,' FILE=',reslib(1:iendst(reslib))
         stop
       endif
@@ -74,11 +67,11 @@
 
         if (res(:3).eq.'nme'.and.nrs.ne.ilars) then
-          write (logString, '(3a)') ' getmol> residue >',res,
-     &                     '< allowed at C-terminus only !'
+          write (*,'(3a)') ' getmol> residue >',res,
+     #                     '< allowed at C-terminus only !'
           close(lunlib)
           stop
         elseif (res(:3).eq.'ace'.and.nrs.ne.ifirs) then
-          write (logString, '(3a)') ' getmol> residue >',res,
-     &                     '< allowed at N-terminus only !'
+          write (*,'(3a)') ' getmol> residue >',res,
+     #                     '< allowed at N-terminus only !'
           close(lunlib)
           stop
@@ -88,11 +81,10 @@
 
         if ((nat+ntlat).gt.mxat) then
-          write (logString, '(a,i5)') ' getmol> number of atoms > ',mxat
+          write (*,'(a,i5)') ' getmol> number of atoms > ',mxat
           close(lunlib)
           stop
         endif
         if ((nvr+ntlvr).gt.mxvr) then
-          write (logString, '(a,i5)') ' getmol> number of variables > '
-     &       ,mxvr
+          write (*,'(a,i5)') ' getmol> number of variables > ',mxvr
           close(lunlib)
           stop
@@ -101,5 +93,5 @@
         rewind lunlib
 
-! ___________________________________________________________ Atoms
+c ___________________________________________________________ Atoms
         do i=1,nat
           n=i+ntlat
@@ -116,5 +108,5 @@
           cstoat(n)=cos(to)
           sntoat(n)=sin(to)
-! ______________________________ bonds to previous & following atoms
+c ______________________________ bonds to previous & following atoms
           iow=iowath(i)
           if (iow.eq.0) then          ! 1st atom of residue
@@ -137,16 +129,16 @@
               iyowat(n)=1         !!! only single bonds assumed !!!
 
-! ___________________________ correct atom to 'next' res.
+c ___________________________ correct atom to 'next' res.
               nbd=nbdat(nh)
               if (nbd.eq.mxbd) then
-                write (logString, '(a,i2,a,i4,2a,i4,a)') 
-     &           ' getmol> need ',(mxbd+2),
-     &           'th bond to connect residues ',
-     &           nrs-1,seq(nrs-1),' and ',nrs,seq(nrs)
+                write(*,'(a,i2,a,i4,2a,i4,a)') 
+     #           ' getmol> need ',(mxbd+2),
+     #           'th bond to connect residues ',
+     #           nrs-1,seq(nrs-1),' and ',nrs,seq(nrs)
                 close(lunlib)
                 stop
               else  !  correct atom to 'next' res.
-! _______________________________!! dihedrals for atoms bound to 'nh'
-!                                   are assumed to be phase angles !!
+c _______________________________!! dihedrals for atoms bound to 'nh'
+c                                   are assumed to be phase angles !!
                 do j=1,nbd
 
@@ -155,8 +147,8 @@
 
                   if (t.eq.0.0) then
-                    write (logString, '(3a,/,2a)') 
-     &               ' getmol> DIHEDRAL for atom ',nmat(nj),
-     &               ' should be PHASE angle with respect to atom ',
-     &               nmat(n),' & therefore must be not 0.0 !!'
+                    write (*,'(3a,/,2a)') 
+     #               ' getmol> DIHEDRAL for atom ',nmat(nj),
+     #               ' should be PHASE angle with respect to atom ',
+     #               nmat(n),' & therefore must be not 0.0 !!'
                     close(lunlib)
                     stop
@@ -205,5 +197,5 @@
         enddo  ! ... atoms
 
-! ________________________________________________________ Variables
+c ________________________________________________________ Variables
         ivrrs1(nrs)=ntlvr+1
         mvr=0
@@ -214,8 +206,8 @@
 
             iat=iatvrh(i)
-! ____________________________________ Exclude all variables for 1st atom
-!                                       & torsion for atoms bound to it
+c ____________________________________ Exclude all variables for 1st atom
+c                                       & torsion for atoms bound to it
             if ( iat.eq.1.or.
-     &        (iowath(iat).eq.1.and.ityvrh(i).eq.3)) goto 1
+     #        (iowath(iat).eq.1.and.ityvrh(i).eq.3)) goto 1
 
           endif
@@ -241,5 +233,5 @@
       close(lunlib)
 
-! _______________________________ Variables
+c _______________________________ Variables
       if (nml.eq.1) then
         nvrml(nml)=ntlvr
@@ -250,45 +242,37 @@
       return
       end
-! **************************************
+c **************************************
       subroutine redres(res,nat,nxt,nvrr)
 
-! .......................................................
-! PURPOSE:  read atom data for residue 'res' from library
-!           (file 'lunlib' 'reslib' opened in routine calling
-!            this one)
-!
-! OUTPUT:   nat   - number of atoms in residue
-!           nxt   - atom which may bind to following residue
-!           nvrr  - number of variables in residue
-!           for atoms     - nmath,blath,baath(rad),toath(rad),
-!                           ityath,iyowath,iowath (INSIDE residue,
-!                                                  =0 if 1st atom)
-!           for variables - ityvrh (1=bl/2=ba/3=to),iclvrh,iatvrh,nmvrh
-!
-! LIBRARY:  residue-lines:
-!            '#', res, nat, nxt;  Format: a1,a4,2i4
-!           atom-lines:
-!           nmat,3{"fix" =' ', clvr,nmvr, blat/baat(deg)/toat(deg)},
-!             cgat, ityat, iowat,ibdat1,ibdat2,ibdat3;
-!           Format: a4, 3(1x,i2,a1,a3,f9.3), f7.4, i4,4i4
-!
-! CALLS: iendst,tolost
-!
-! .......................................................
+c .......................................................
+c PURPOSE:  read atom data for residue 'res' from library
+c           (file 'lunlib' 'reslib' opened in routine calling
+c            this one)
+c
+c OUTPUT:   nat   - number of atoms in residue
+c           nxt   - atom which may bind to following residue
+c           nvrr  - number of variables in residue
+c           for atoms     - nmath,blath,baath(rad),toath(rad),
+c                           ityath,iyowath,iowath (INSIDE residue,
+c                                                  =0 if 1st atom)
+c           for variables - ityvrh (1=bl/2=ba/3=to),iclvrh,iatvrh,nmvrh
+c
+c LIBRARY:  residue-lines:
+c            '#', res, nat, nxt;  Format: a1,a4,2i4
+c           atom-lines:
+c           nmat,3{"fix" =' ', clvr,nmvr, blat/baat(deg)/toat(deg)},
+c             cgat, ityat, iowat,ibdat1,ibdat2,ibdat3;
+c           Format: a4, 3(1x,i2,a1,a3,f9.3), f7.4, i4,4i4
+c
+C CALLS: iendst,tolost
+c
+c .......................................................
 
       include 'INCL.H'
-!     arguments
-      integer nat, nxt, nvrr
-      
-!     functions
-      integer iendst
-      
-      integer icl, ibd, ib3, i, ib1, ib2, ic, iow, iexcp, ity, jow, lg
-      integer nln, j
+
       dimension icl(3),ibd(mxbd)
       character blnk,fix(3),nm(3)*3,res*4,resl*4,line*132
       data blnk/' '/
 
-      double precision ba, to
 
       nln=0
@@ -301,5 +285,5 @@
       call tolost(resl)  ! ensure lower case for residue name
 
-! ________________________________ find residue 'resl'
+c ________________________________ find residue 'resl'
     1 line=blnk
       nln=nln+1
@@ -309,9 +293,9 @@
 
       if (lg.ge.13.and.line(1:1).eq.'#'.and.line(2:5).eq.resl) then
-! _____________________________________________ read atom data for 'resl'
+c _____________________________________________ read atom data for 'resl'
         read (line(6:13),'(2i4)',err=3) nat,nxt
 
         if (nat.gt.mxath) then
-          write (logString, '(a,i5)') ' redres> number of atoms > ',mxath
+          write (*,'(a,i5)') ' redres> number of atoms > ',mxath
           close(lunlib)
           stop
@@ -324,7 +308,7 @@
 
           read (lunlib,'(a4,3(1x,i2,a1,a3,d9.3),d7.4,i4,4i4)',
-     &                 end=3,err=3)
-     &     nmath(i),icl(1),fix(1),nm(1),blath(i),icl(2),fix(2),nm(2),ba,
-     &     icl(3),fix(3),nm(3),to,cgath(i),ity,iow,(ibd(j),j=1,mxbd)
+     #                 end=3,err=3)
+     #     nmath(i),icl(1),fix(1),nm(1),blath(i),icl(2),fix(2),nm(2),ba,
+     #     icl(3),fix(3),nm(3),to,cgath(i),ity,iow,(ibd(j),j=1,mxbd)
 
           if (ity.le.0.or.ity.gt.mxtyat) goto 6
@@ -341,10 +325,9 @@
           if (iexcp.eq.0.and.i.le.jow) then
             if (i.eq.jow) then
-              write(logString,'(5a)') ' redres> atom ',nmath(i),' of ',
-     &                          resl,' cannot preceed itself '
+              write (*,'(5a)') ' redres> atom ',nmath(i),' of ',
+     #                          resl,' cannot preceed itself '
             else
-              write (logString, '(5a,i4)') 
-     &                    ' redres> atom ',nmath(i),' of ',
-     &                    resl,' should be placed AFTER atom #',jow
+              write (*,'(5a,i4)') ' redres> atom ',nmath(i),' of ',
+     #                    resl,' should be placed AFTER atom #',jow
             endif
             goto 5
@@ -353,6 +336,6 @@
           iowath(i)=jow
           iyowath(i)=sign(1,iow)
-! ____________________________________ check order & find number of bonds
-!                                      (bonds closing ring must be last !)
+c ____________________________________ check order & find number of bonds
+c                                      (bonds closing ring must be last !)
           ib1=abs(ibd(1))
           ib2=abs(ibd(2))
@@ -371,10 +354,10 @@
             else
               if ( ib2.eq.jow.or.ib2.eq.ib1.or.
-     &            (ib2.gt.i.and.ib2.lt.ib1) ) goto 4
+     #            (ib2.gt.i.and.ib2.lt.ib1) ) goto 4
               if (ib3.eq.0) then
                 nbdath(i)=2
               else
                 if (ib3.eq.jow.or.ib3.eq.ib1.or.ib3.eq.ib2.or.
-     &              (ib3.gt.i.and.(ib3.lt.ib1.or.ib3.lt.ib2)) ) goto 4
+     #              (ib3.gt.i.and.(ib3.lt.ib1.or.ib3.lt.ib2)) ) goto 4
                 nbdath(i)=3
               endif
@@ -390,5 +373,5 @@
           toath(i)=to*cdr
 
-! ______________________________ internal degrees of freedom
+c ______________________________ internal degrees of freedom
           do j=1,3
             if (fix(j).ne.blnk) then
@@ -396,7 +379,6 @@
 
               if (nvrr.gt.mxvrh) then
-                write (logString, '(a,i5)') 
-     &           ' redres> number of variables > ',
-     &                             mxvrh
+                write (*,'(a,i5)') ' redres> number of variables > ',
+     #                             mxvrh
                 close(lunlib)
                 stop
@@ -406,7 +388,7 @@
 
               if ( ic.le.0    
-     &         .or.(j.eq.3.and.ic.gt.mxtyto)           ! dihedral
-     &         .or.(j.eq.2.and.ic.gt.mxtyba)           ! bond angle
-     &         .or.(j.eq.1.and.ic.gt.mxtybl) ) goto 7  ! b. length
+     #         .or.(j.eq.3.and.ic.gt.mxtyto)           ! dihedral
+     #         .or.(j.eq.2.and.ic.gt.mxtyba)           ! bond angle
+     #         .or.(j.eq.1.and.ic.gt.mxtybl) ) goto 7  ! b. length
 
               ityvrh(nvrr)=j
@@ -425,33 +407,30 @@
       goto 1
 
-! ____________________________________________________________ ERRORS
-    2 write (logString, '(4a)') ' redres> residue >',resl,
-     &      '< NOT FOUND in ',
-     &reslib(1:iendst(reslib))
+c ____________________________________________________________ ERRORS
+    2 write (*,'(4a)') ' redres> residue >',resl,'< NOT FOUND in ',
+     #reslib(1:iendst(reslib))
       close(lunlib)
       stop
 
-    3 write (logString, '(a,i4,2a)') ' redres> ERROR reading line No. ',
-     &   nln,
-     &   ' in ',reslib(1:iendst(reslib))
+    3 write (*,'(a,i4,2a)') ' redres> ERROR reading line No. ',nln,
+     #' in ',reslib(1:iendst(reslib))
       close(lunlib)
       stop
 
-    4 write (logString, '(4a)') 
-     &   ' redres> Incorrect order of bonds for atom ',
-     &                      nmath(i),' of ',resl
-
-    5 write (logString, '(8x,2a)') '... must correct ',
-     &                      reslib(1:iendst(reslib))
+    4 write (*,'(4a)') ' redres> Incorrect order of bonds for atom ',
+     #                      nmath(i),' of ',resl
+
+    5 write (*,'(8x,2a)') '... must correct ',
+     #                      reslib(1:iendst(reslib))
       close(lunlib)
       stop
 
-    6 write (logString, '(a,i2,4a)') ' redres> unknown type :',ity,
-     &                   ': for atom ',nmath(i),' in residue ',resl
+    6 write (*,'(a,i2,4a)') ' redres> unknown type :',ity,
+     #                   ': for atom ',nmath(i),' in residue ',resl
       close(lunlib)
       stop
 
-    7 write (logString, '(a,i2,4a)') ' redres> unknown class :',ic,
-     &                   ': for variable ',nm(j),' in residue ',resl
+    7 write (*,'(a,i2,4a)') ' redres> unknown class :',ic,
+     #                   ': for variable ',nm(j),' in residue ',resl
       close(lunlib)
       stop
Index: gradient.f
===================================================================
--- gradient.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ gradient.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,28 +1,24 @@
-! **************************************************************
-!
-! This file contains the subroutines: gradient
-!
-! 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: gradient
+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 **************************************************************
 
 
       subroutine gradient()
 
-! -------------------------------------------
-! PURPOSE: calculate energy & gradients
-!
-! CALLS:   opeflx,opereg,opeshe,opesol,setvar
-! -------------------------------------------
+c -------------------------------------------
+c PURPOSE: calculate energy & gradients
+c
+c CALLS:   opeflx,opereg,opeshe,opesol,setvar
+c -------------------------------------------
 
       include 'INCL.H'
 
-
-      double precision esm
-
-      integer i, ivr1, ivr2, j
 
       esm = 0.d0
@@ -57,5 +53,5 @@
         else
 
-          write (logString, *)  'gradient> Set itysol < 0'
+          write(*,*)  'gradient> Set itysol < 0'
           stop
         endif
Index: hbond.f
===================================================================
--- hbond.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ hbond.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,47 +1,37 @@
-!**************************************************************
-!
-! This file contains the subroutines: hbond,chhb,ishybd,
-!                                     ishybdo,nursat,interhbond
-!
-! 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: hbond,chhb,ishybd,
+c                                     ishybdo,nursat,interhbond
+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 **************************************************************
 
 
       subroutine hbond(nml,mhb,ipr)
-! .................................................................
-! PURPOSE: find hydrogen bonds in molecule 'nml'
-!
-!          prints HBonds, if ipr > 0
-!
-! OUTPUT: mhb - number of hyd.bds. of type i->i+4
-!  
-!   to INCL.H:
-!
-!         ntyhb  - number of different types of hyd. bds. found
-!         nutyhb - number of hyd.bds. found for each type
-!         ixtyhb - index for each type of hyd. bd. composed as
-!                  (atom idx. of H) * 1000 + atm.idx. of acceptor
-!
-! CALLS: chhb,ishybd  (ishybdo),nursat
-!
-!................................................................
-
-      include 'INCL.H'
-
-      integer nml
-
-      integer mhb
-
-      integer nursat
-      double precision atbase
-
-      integer ipr, i2s, i, i14, i1, i1s, i2, ia, ixhb, id, ifivr, ii, ih
-      integer ims, io, iv, ivw, ix, k, jj, j, n, na, nd, ntlvr, iat
-
-!f2py intent(out) mhb  
+c .................................................................
+c PURPOSE: find hydrogen bonds in molecule 'nml'
+c
+c          prints HBonds, if ipr > 0
+c
+c OUTPUT: mhb - number of hyd.bds. of type i->i+4
+c  
+c   to INCL.H:
+c
+c         ntyhb  - number of different types of hyd. bds. found
+c         nutyhb - number of hyd.bds. found for each type
+c         ixtyhb - index for each type of hyd. bd. composed as
+c                  (atom idx. of H) * 1000 + atm.idx. of acceptor
+c
+c CALLS: chhb,ishybd  (ishybdo),nursat
+C
+c................................................................
+
+      include 'INCL.H'
+
+cf2py intent(out) mhb  
       parameter (atbase=mxat)      
       logical ishb
@@ -59,33 +49,33 @@
         ntlvr=nvrml(nml)
         if (ntlvr.eq.0) then
-          write (logString, '(a,i4)')
-     &           ' hbond> No variables defined in molecule #',nml
+          write (*,'(a,i4)')
+     #           ' hbond> No variables defined in molecule #',nml
           return
         endif
 
         ifivr=ivrml1(nml)
-! Index of last moving set
+c Index of last moving set
         i1s=imsml1(nml)+nmsml(nml)
       endif 
-! Loop over all variables
+c Loop over all variables
       do io=ifivr+ntlvr-1,ifivr,-1  
-! Get index of variable
+c Get index of variable
         iv=iorvr(io)       
-! Index of next to last moving set
+c Index of next to last moving set
         i2s=i1s-1      
-! Index of moving set belonging to iv
+c Index of moving set belonging to iv
         i1s=imsvr1(iv) 
-! Loop over all moving sets between the one belonging to iv and the 
-! next to last one
+c Loop over all moving sets between the one belonging to iv and the 
+c next to last one
         do ims=i1s,i2s  
-! First atom in moving set
+c First atom in moving set
           i1=latms1(ims)
-! Last atom in moving set
+c Last atom in moving set
           i2=latms2(ims)
-! Loop over all atoms in moving set.
+c Loop over all atoms in moving set.
           do i=i1,i2  
-! Loop over van der Waals domains of atom i
+c Loop over van der Waals domains of atom i
             do ivw=ivwat1(i),ivwat2(i)
-! Loop over atoms in van der Waals domain.  
+c Loop over atoms in van der Waals domain.  
               do j=lvwat1(ivw),lvwat2(ivw)  
 
@@ -108,6 +98,5 @@
                     ixtyhb(ntyhb)=ixhb
                   else
-                    write (logString, *) 
-     &                    ' hbond> increase parameter MXTYHB'
+                    write(*,*) ' hbond> increase parameter MXTYHB'
                     stop
                   endif
@@ -122,5 +111,5 @@
 
               call ishybd(i,j,ishb,ih,ia)   ! Thornton criteria
-!              call ishybdo(i,j,ishb,ih,ia)  
+c              call ishybdo(i,j,ishb,ih,ia)  
 
               if (ishb) then
@@ -140,6 +129,5 @@
                   ixtyhb(ntyhb)=ixhb
                 else
-                  write (logString, *) 
-     &               ' hbond> increase parameter MXTYHB'
+                  write(*,*) ' hbond> increase parameter MXTYHB'
                   stop
                 endif
@@ -156,10 +144,9 @@
       mhb=0
 
-!     do inhb=1,ntyhb
-!      mhb = mhb+nutyhb(inhb)
-!     enddo
-
-      if (ipr.gt.0) write (logString, '(1x,a,/)') 
-     &   ' hbond>  Hydrogen Bonds:'
+c     do inhb=1,ntyhb
+c      mhb = mhb+nutyhb(inhb)
+c     enddo
+
+      if (ipr.gt.0) write(*,'(1x,a,/)') ' hbond>  Hydrogen Bonds:'
 
       if (ntyhb.gt.0) then
@@ -186,12 +173,12 @@
               if (n.gt.0) then
                 write(*,'(1x,i3,a2,a4,a3,i3,1x,a4,a7,a4,a3,i3,1x,a4,a9,
-     &                    i2)')
-     &           ii,') ',nmat(ia),' ( ',na,seq(na),' ) <-- ',nmat(id),
-     &           ' ( ', nd,seq(nd),' ) = i +',n
+     #                    i2)')
+     #           ii,') ',nmat(ia),' ( ',na,seq(na),' ) <-- ',nmat(id),
+     #           ' ( ', nd,seq(nd),' ) = i +',n
               else
                 write(*,'(1x,i3,a2,a4,a3,i3,1x,a4,a7,a4,a3,i3,1x,a4,a9,
-     &                    i2)')
-     &           ii,') ',nmat(ia),' ( ',na,seq(na),' ) <-- ',nmat(id),
-     &           ' ( ', nd,seq(nd),' ) = i -',abs(n)
+     #                    i2)')
+     #           ii,') ',nmat(ia),' ( ',na,seq(na),' ) <-- ',nmat(id),
+     #           ' ( ', nd,seq(nd),' ) = i -',abs(n)
               endif
 
@@ -205,27 +192,23 @@
       return
       end
-! .....................................................................
-! Calculates hydrogen bonds between different chains.
-! 
-! @return number of intermolecular hydrogen bonds. Returns 0 if only 
-!         one molecule is present. The value is returned in the 
-!         variable mhb.
-!
-! @author Jan H. Meinke <j.meinke@fz-juelich.de>
-!                                            
-! .....................................................................
+c .....................................................................
+c Calculates hydrogen bonds between different chains.
+c 
+c @return number of intermolecular hydrogen bonds. Returns 0 if only 
+c         one molecule is present. The value is returned in the 
+c         variable mhb.
+c
+c @author Jan H. Meinke <j.meinke@fz-juelich.de>
+c                                            
+c .....................................................................
       subroutine interhbond(mhb)
 
       include 'INCL.H'
       
-!f2py intent(out) mhb     
+cf2py intent(out) mhb     
       
       logical ishb
       
       integer*4 mhb
-      integer iml, ires, jml, jat, jres
-
-      integer ia, iat, ih
-      
       mhb = 0
       do iml = 1, ntlml
@@ -250,20 +233,9 @@
       
       end ! subroutine interhbond
-! ************************
+c ************************
       subroutine chhb(i,j)
 
       include 'INCL.H'
-      integer i
-
-      integer j
-
-      integer ih
-
-      integer ia, ib, id, ihb
-      
-      double precision valang
-      
-      double precision cdah, cdad, adab, adha, ahab, dah, dad
-            
+
       ihb = ihbty(ityat(i),ityat(j))
 
@@ -277,10 +249,10 @@
 
       dah=sqrt((xat(ih)-xat(ia))**2+(yat(ih)-yat(ia))**2+
-     &          (zat(ih)-zat(ia))**2)
+     #          (zat(ih)-zat(ia))**2)
 
       id=iowat(ih)
 
       dad=sqrt((xat(id)-xat(ia))**2+(yat(id)-yat(ia))**2+
-     &          (zat(id)-zat(ia))**2)
+     #          (zat(id)-zat(ia))**2)
       adha=valang(id,ih,ia)*crd
 
@@ -290,48 +262,38 @@
       adab=valang(id,ia,ib)*crd
 
-      write (logString, *) '  '
-      write (logString, *) ' Dah: ',dah,' Dad: ',dad
-      write (logString, *) ' Adha: ',adha,' Ahab: ',adha,' Adab: ',adab
-      write (logString, *) '  '
+      write(*,*) '  '
+      write(*,*) ' Dah: ',dah,' Dad: ',dad
+      write(*,*) ' Adha: ',adha,' Ahab: ',adha,' Adab: ',adab
+      write(*,*) '  '
 
       return
       end
-! *************************************
+c *************************************
       subroutine ishybd(i,j,ishb,ih,ia)
       
 
-! ..........................................................
-!  PURPOSE: checks for hydrogen bond between atoms 'i' & 'j'
-!           according to geometric criteria
-! 
-!  OUTPUT:  logical 'ishb' - true, if have Hydrogen bond
-!           ih - index of Hydrogen atom
-!           ia - index of Acceptor atom
-!
-!  [I.K.McDonald,J.M.Thornton,Satisfying hydrogen bond
-!   potential in proteins.J.Mol.Biol.238(5),777-793 (1994)]
-!
-!  D: hydrogen(=H) donor, A: acceptor, B: atom bound to A
-!
-!  Dis_HA <= 2.5 & Dis_DA <= 3.9 & Angle(D-H-A) > 90 &
-!  Angle(H-A-B) > 90 & Angle(D-A-B) > 90
-! ..........................................................
-
-      include 'INCL.H'
-      double precision cdah, cang, cahb, cdad
-      integer i
-
-      integer j
-
-      integer ih
-
-      integer ia, ib, id, ihb
- 
-      double precision valang
- 
+c ..........................................................
+c  PURPOSE: checks for hydrogen bond between atoms 'i' & 'j'
+c           according to geometric criteria
+c 
+c  OUTPUT:  logical 'ishb' - true, if have Hydrogen bond
+c           ih - index of Hydrogen atom
+c           ia - index of Acceptor atom
+c
+c  [I.K.McDonald,J.M.Thornton,Satisfying hydrogen bond
+c   potential in proteins.J.Mol.Biol.238(5),777-793 (1994)]
+c
+c  D: hydrogen(=H) donor, A: acceptor, B: atom bound to A
+c
+c  Dis_HA <= 2.5 & Dis_DA <= 3.9 & Angle(D-H-A) > 90 &
+c  Angle(H-A-B) > 90 & Angle(D-A-B) > 90
+c ..........................................................
+
+      include 'INCL.H'
+
       parameter (cdad=3.9d0,
-     &           cdah=2.5d0,
-     &           cang=110.d0)
-!     #           cang=90.d0)
+     #           cdah=2.5d0,
+     #           cang=110.d0)
+c     #           cang=90.d0)
 
       logical ishb
@@ -356,48 +318,40 @@
 
       if (sqrt((xat(ih)-xat(ia))**2+(yat(ih)-yat(ia))**2+
-     &         (zat(ih)-zat(ia))**2).gt.cdah) return
+     #         (zat(ih)-zat(ia))**2).gt.cdah) return
 
       id=iowat(ih)
 
       if (id.le.0.or.sqrt((xat(id)-xat(ia))**2+(yat(id)-yat(ia))**2+
-     &                    (zat(id)-zat(ia))**2).gt.cdad
-     &           .or.valang(id,ih,ia).lt.cahb) return
+     #                    (zat(id)-zat(ia))**2).gt.cdad
+     #           .or.valang(id,ih,ia).lt.cahb) return
 
       ib=iowat(ia)
 
       if (ib.gt.0.and.valang(ih,ia,ib).ge.cahb
-     &           .and.valang(id,ia,ib).ge.cahb) ishb=.true.
+     #           .and.valang(id,ia,ib).ge.cahb) ishb=.true.
 
       return
       end
-! **************************************
+c **************************************
 
       subroutine ishybdo(i,j,ishb,ih,ia)
 
-! ..........................................................
-!  PURPOSE: checks for hydrogen bond between atoms 'i' & 'j'
-!           according to geometric criteria
-! 
-!  OUTPUT:  logical 'ishb' - true, if have Hydrogen bond
-!           ih - index of Hydrogen atom
-!           ia - index of Acceptor atom
-!
-!  D: hydrogen(=H) donor, A: acceptor
-!
-!    Dis_AH <= 2.5 & Angle(D-H-A) >= 160
-! ...........................................................
-
-      include 'INCL.H'
-      integer i
-
-      integer j
-
-      integer ih
-
-      double precision cahb, cdah, cang, valang
-
-      integer ia, ihb, id
+c ..........................................................
+c  PURPOSE: checks for hydrogen bond between atoms 'i' & 'j'
+c           according to geometric criteria
+c 
+c  OUTPUT:  logical 'ishb' - true, if have Hydrogen bond
+c           ih - index of Hydrogen atom
+c           ia - index of Acceptor atom
+c
+c  D: hydrogen(=H) donor, A: acceptor
+c
+c    Dis_AH <= 2.5 & Angle(D-H-A) >= 160
+c ...........................................................
+
+      include 'INCL.H'
+
       parameter (cdah=2.5d0,
-     &           cang=140.d0)
+     #           cang=140.d0)
 
       logical ishb
@@ -423,5 +377,5 @@
 
       if (sqrt((xat(ih)-xat(ia))**2+(yat(ih)-yat(ia))**2+
-     &         (zat(ih)-zat(ia))**2).gt.cdah) return
+     #         (zat(ih)-zat(ia))**2).gt.cdah) return
 
       id=iowat(ih)
Index: helix.f
===================================================================
--- helix.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ helix.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,34 +1,30 @@
-! **************************************************************
-!
-! This file contains the subroutines: helix
-!
-! Copyright 2003       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: helix
+c
+c Copyright 2003       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 **************************************************************
 
 
       subroutine helix(nhel,mhel,nbet,mbet) 
-!---------------------------------------------------------------
-!
-!   PURPOSE: simple identification of secondary structure content
-!
-!   CALLS: none
-!
-! ---------------------------------------------------------------
+c---------------------------------------------------------------
+c
+c   PURPOSE: simple identification of secondary structure content
+c
+c   CALLS: none
+c
+c ---------------------------------------------------------------
       include 'INCL.H'
 
-!f2py intent(out) nhel
-!f2py intent(out) mhel
-!f2py intent(out) nbet
-!f2py intent(out) mbet
+cf2py intent(out) nhel
+cf2py intent(out) mhel
+cf2py intent(out) nbet
+cf2py intent(out) mbet
            
       logical lhel,lbet
-      double precision hlim, philim, psilim, hlim2, philim2, psilim2
-      double precision xphi, xpsi
-
-      integer nhel, mhel, nbet, mbet, i, iv
 
       parameter(hlim=30.0d0,philim=-70.0d0,psilim=-37.0d0)
@@ -46,5 +42,5 @@
          xphi = vlvr(iv)*crd
          xpsi = vlvr(idvr(i+1))*crd
-! Helicity
+C Helicity
          if(abs(xphi-philim).le.hlim) then
           lbet=.false.
@@ -56,5 +52,5 @@
             lhel = .false.
           end if
-! Sheetness
+C Sheetness
          else if(abs(xphi-philim2).le.hlim2) then
           lhel = .false.
Index: incl_lund.h
===================================================================
--- incl_lund.h	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ incl_lund.h	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,3 +1,2 @@
-      integer nhptyp, mxconr, mxcell, iN, iCa, iC, mlvr, iphi, ipsi
       parameter (nhptyp=3,mxconr=40,mxcell=125000)
       dimension iN(mxrs),iCa(mxrs),iC(mxrs),mlvr(mxvr)
@@ -9,10 +8,9 @@
       double precision alhb,blhb,sighb2,cdon,cacc,casc
 
-! -----Probability for using BGS when it is possible
+c -----Probability for using BGS when it is possible
       double precision abgs,bbgs, dph(8)
       integer bgsnvar,bgsvar(mxrs), iph(8)
       common /bgs_i/ bgsnvar,iph
       common /bgs_r/ abgs,bbgs,dph, bgsvar
-      integer ihpat, nhpat
       dimension ihpat(mxrs,6),nhpat(mxrs)
       double precision hpstrg
@@ -20,5 +18,4 @@
       
       double precision exvk,exvcut,exvcut2
-      integer matcon
       dimension matcon(-mxconr:mxconr,mxat)
 
@@ -33,15 +30,15 @@
       dimension sig2exv(mxtyat,mxtyat)
       dimension asaexv(mxtyat,mxtyat),bsaexv(mxtyat,mxtyat)
-      integer lcp1, lcp2, ilpst, ilpnd
-      common /lundff/kbias,                                             &
-     &     epshb1,epshb2,powa,powb,sighb,cthb,                          &
-     &     cthb2,                                                       &
-     &     alhb,blhb,sighb2,cdon,cacc,casc,                             &
-     &     ihpat,nhpat,hpstrg,                                          & 
-     &     exvk,exvcut,exvcut2,                                         &
-     &     matcon,                                                      & 
-     &     sigsa,sig2lcp,asalcp,bsalcp,                                 &
-     &     lcp1,lcp2,ilpst,ilpnd,                                       &
-     &     exvlam,exvcutg,exvcutg2,                                     &
-     &     sig2exv,asaexv,bsaexv 
+
+      common /lundff/kbias,
+     #     epshb1,epshb2,powa,powb,sighb,cthb,
+     #     cthb2,
+     #     alhb,blhb,sighb2,cdon,cacc,casc,
+     #     ihpat,nhpat,hpstrg,
+     #     exvk,exvcut,exvcut2,
+     #     matcon,
+     #     sigsa,sig2lcp,asalcp,bsalcp,
+     #     lcp1,lcp2,ilpst,ilpnd,
+     #     exvlam,exvcutg,exvcutg2,
+     #     sig2exv,asaexv,bsaexv
       save /lundff/
Index: init_energy.f
===================================================================
--- init_energy.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ init_energy.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,42 +1,40 @@
-! **************************************************************
-!
-! This file contains the subroutines: init_energy,setpar
-! This file contains a BLOCK DATA statement
-!
-! 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: init_energy,setpar
+C This file contains a BLOCK DATA statement
+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 **************************************************************
 
 
       subroutine init_energy(libdir)
 
-! ----------------------------------------------
-! PURPOSE: initialize energy parameters
-!        0  => ECEPP2 or ECEPP3 depending on the value of sh2
-!        1  => FLEX
-!        2  => Lund force field
-!        3  => ECEPP with Abagyan corrections
-!
-!
-! CALLS:   setpar, tessel,iendst
-!
-! contains: BLOCK DATA
-! ----------------------------------------------
+c ----------------------------------------------
+c PURPOSE: initialize energy parameters
+c        0  => ECEPP2 or ECEPP3 depending on the value of sh2
+c        1  => FLEX 
+c        2  => Lund force field
+c        3  => ECEPP with Abagyan corrections
+c
+c
+c CALLS:   setpar, tessel,iendst
+c
+c contains: BLOCK DATA
+c ----------------------------------------------
 
       include 'INCL.H'
 
-      integer ll, iendst, its
-
       character libdir*(*),tesfil*80
-
+      
       if (ientyp.eq.1) then
           flex = .true.
-      else
+      else 
           flex = .false.
       end if
-
+      
       lunlib=10
       ll=iendst(libdir)
@@ -58,14 +56,10 @@
       endif
 
-      if (ientyp .eq. 2) then
-        reslib=libdir(1:ll)//'lib.lun'
-      endif
-
       call setpar()  ! Initialize force field parameters
 
 
-!----Initialize solvation part if necessary
-      write (logString, *) 'init_energy: itysol = ',itysol
-      write (logString, *) 'init_energy: esol_scaling = ',isolscl
+C----Initialize solvation part if necessary
+      write (*,*) 'init_energy: itysol = ',itysol
+      write(*,*) 'init_energy: esol_scaling = ',isolscl
 
       its = iabs(itysol)
@@ -75,13 +69,15 @@
         ll=iendst(libdir)
         tesfil = libdir(1:ll)//'tes.dat'
+
         open(unit=20,file=tesfil,status='old',err=10)
+
         call tessel()
+
         close(20)
 
       else
-
+ 
         if (itysol.ne.0) then
-          write (logString, '(a)') 
-     &      ' init_energy>  undefined solvent type !'
+          write(*,'(a)') ' init_energy>  undefined solvent type !'
           stop
         endif
@@ -89,5 +85,5 @@
       endif
 
-! ___________________________ initialise COMMON 'con_r'
+c ___________________________ initialise COMMON 'con_r'
       idloa=ichar('a')
       idloz=ichar('z')
@@ -97,25 +93,20 @@
       return
 
- 10   write (logString,  '(a)') 
-     &   'Cannot open the file with surface points'
+ 10   write (*, '(a)') 'Cannot open the file with surface points'
       stop
 
       end
 
-! *********************
+c *********************
       subroutine setpar
 
-! __________________________________________________________
-! PURPOSE: initialize parameter set for empirical potentials
-!          depending on variable 'flex'
-!
-! CALLS:   None
-! __________________________________________________________
+c __________________________________________________________
+c PURPOSE: initialize parameter set for empirical potentials
+c          depending on variable 'flex'
+c
+c CALLS:   None
+c __________________________________________________________
 
       include 'INCL.H'
-
-      double precision hbc, hba, ri, ai, aei, aic, a, aj, c, rij
-
-      integer i, j, iac, ido, jac, jdo
 
       dimension hbc(mxhbdo,mxhbac),hba(mxhbdo,mxhbac)
@@ -125,5 +116,5 @@
       tesgrd = .false.  ! numerical check of analytical gradients
 
-! ______________________________________ Lennard-Jones parameters
+c ______________________________________ Lennard-Jones parameters
       if (flex) then
 
@@ -175,6 +166,6 @@
           ai=atpl(i)
           aei=sqrt(ai/efel(i))
-!c          aic=ai/ehm             !!  ICM
-!c          do j=i,mxtyat          !!  -"-
+cc          aic=ai/ehm             !!  ICM
+cc          do j=i,mxtyat          !!  -"-
           aic=ai*ehm                 !!  comment for ICM:
           cij(i,i)=aic*ai/(aei+aei)  !!        -"-
@@ -184,9 +175,9 @@
           do j=i+1,mxtyat            !!
             aj=atpl(j)
-! _______ Constant for 6-12 attractive term (Slater-Kirkwood formula)
+c _______ Constant for 6-12 attractive term (Slater-Kirkwood formula)
             c=aic*aj/(aei+sqrt(aj/efel(j)))
             cij(i,j)=c
             cij(j,i)=c
-! ____________________________ repulsive term (form. 3 & 6 of ref 2)
+c ____________________________ repulsive term (form. 3 & 6 of ref 2)
             rij=.5*(ri+rmin(j))
             a=.5*c*rij**6
@@ -201,5 +192,5 @@
         enddo
 
-! +++++++++++++++++++++++++++++++++
+c +++++++++++++++++++++++++++++++++
         cij(1,1)=45.5d0
         aij(1,1)=14090.0d0
@@ -238,12 +229,12 @@
         cij(18,18)=370.5d0
         aij(18,18)=909000.0d0
-! +++++++++++++++++++++++++++++++++
+c +++++++++++++++++++++++++++++++++
         do i=1,mxtyat
           a14(i,i)=.5*aij(i,i)
         enddo
-! +++++++++++++++++++++++++++++++++
+c +++++++++++++++++++++++++++++++++
 
         do i=1,mxtyat
-!	  write( *, '(18f14.6)' )  ( a14(i,j), j = 1, mxtyat )
+c	  write( *, '(18f14.6)' )  ( a14(i,j), j = 1, mxtyat )
         enddo
 
@@ -263,5 +254,5 @@
 
       endif
-! -------------------------------------------- Hydrogen Bond Parameters
+c -------------------------------------------- Hydrogen Bond Parameters
       do i=1,mxtyat
         do j=1,mxtyat
@@ -312,299 +303,297 @@
       return
       end
-! **************
+c **************
       BLOCK DATA
 
       include 'INCL.H'
-      
-      integer i
-
-!  Atom types ------------------------------------------------------------
-!                                    Original types  -Scheraga:  -Flex:
-!  H  1 - with aliphatic carbon                               1      12
-!     2 - with aromatic carbon                                3      13
-!     3 - with non-sp3 types of nitrogen                      2       1
-!     4 - with sp3-hybr. nitrogen                             2       2
-!     5 - with oxygen                                         4       1
-!     6 - with sulfur                                         3(was 5)1
-!  C  7 - sp3-hybr. carbon                                    6,9     3
-!     8 - sp2-carbon (carbonyl,carboxyl,carboxylate)          7,11    4
-!     9 - aromatic carbon                                     8,10    4
-!  O 10 - hydroxyl, ester oxygen (inc. water)                 18,19   8
-!    11 - carbonyl oxygen                                     17      9
-!    12 - carboxylate oxygen                                  18,19  10
-!  N 13 - aliph. nitrogen with 0/1 hydrogen & charged N       13-15   6
-!    14 - nitrogen with two hydrogens                         13-15   5
-!    15 - all other nitrogens (+ sp2-hybrid. in heteroc.)     13-15   7
-!  S 16 - any sulfur                                          20,21  18,19
-!  H 17 - H-delta of Pro, Hyp of ECEPP/3 dataset               5(new) -
-!  C 18 - C-delta of Pro, Hyp of ECEPP/3 dataset              12(new) -
-
-!  Classes for torsional potential ---------------------------------------
-!
-!   1 : 'Omega' = C'(pept.)-N(pept.)  [Cpept-Npept]
-!   2 : 'Phi'   = N(pept.)-C(sp3)     [C4-Npept]
-!   3 : 'Psi'   = C(sp3)-C'(pept.)    [C4-Cpept]
-!   4 : 'Chi1'  = C(sp3)-C(sp3)       [C4-C4]
-!   5 : C(sp3)-OH (Hydroxyl)          [C4-OH]
-!   6 : C(sp3)-NH2                    [C4-NH2]
-!   7 : C(sp3)-NH3+                   [C4-NH3+]
-!   8 : C(sp3)-NH-(guanidyl)          [C4-NHX]
-!   9 : C(sp3)-COOH(carboxyl)         [C4-COO]
-!  10 : C(sp3)-COO-(carboxylate)      [C4-COO]
-!  11 : C(sp3)-CO(sp2 of amide)       [C4-Cpept]
-!  12 : C(sp3)-C(aromatic ring)       [C4-C3]
-!  13 : C(sp3)-S                      [C4-SC4]
-!  14 : C(sp3)-SH                     [C4-SH]
-!  15 : C(aromatic ring)-OH           [C3-OH]
-! ________________________________________________ "rigid" torsions:
-!  16 : C(carboxyl)-OH                [C3-OH]
-!  17 : -NH-C(sp2 of guanidyl)        [C3-NHX]
-!  18 : -C(sp3)-NH2 (guanidyl)        [not in Flex]
-!  19 : -C(sp3)-NH2 (amide)           [Cpept-Npept]
+
+c  Atom types ------------------------------------------------------------
+c                                    Original types  -Scheraga:  -Flex:
+c  H  1 - with aliphatic carbon                               1      12
+c     2 - with aromatic carbon                                3      13
+c     3 - with non-sp3 types of nitrogen                      2       1
+c     4 - with sp3-hybr. nitrogen                             2       2
+c     5 - with oxygen                                         4       1
+c     6 - with sulfur                                         3(was 5)1
+c  C  7 - sp3-hybr. carbon                                    6,9     3
+c     8 - sp2-carbon (carbonyl,carboxyl,carboxylate)          7,11    4
+c     9 - aromatic carbon                                     8,10    4
+c  O 10 - hydroxyl, ester oxygen (inc. water)                 18,19   8
+c    11 - carbonyl oxygen                                     17      9
+c    12 - carboxylate oxygen                                  18,19  10
+c  N 13 - aliph. nitrogen with 0/1 hydrogen & charged N       13-15   6
+c    14 - nitrogen with two hydrogens                         13-15   5
+c    15 - all other nitrogens (+ sp2-hybrid. in heteroc.)     13-15   7
+c  S 16 - any sulfur                                          20,21  18,19
+c  H 17 - H-delta of Pro, Hyp of ECEPP/3 dataset               5(new) -
+c  C 18 - C-delta of Pro, Hyp of ECEPP/3 dataset              12(new) -
+
+c  Classes for torsional potential ---------------------------------------
+c
+c   1 : 'Omega' = C'(pept.)-N(pept.)  [Cpept-Npept]
+c   2 : 'Phi'   = N(pept.)-C(sp3)     [C4-Npept]
+c   3 : 'Psi'   = C(sp3)-C'(pept.)    [C4-Cpept]
+c   4 : 'Chi1'  = C(sp3)-C(sp3)       [C4-C4]
+c   5 : C(sp3)-OH (Hydroxyl)          [C4-OH]
+c   6 : C(sp3)-NH2                    [C4-NH2]
+c   7 : C(sp3)-NH3+                   [C4-NH3+]
+c   8 : C(sp3)-NH-(guanidyl)          [C4-NHX]
+c   9 : C(sp3)-COOH(carboxyl)         [C4-COO]
+c  10 : C(sp3)-COO-(carboxylate)      [C4-COO]
+c  11 : C(sp3)-CO(sp2 of amide)       [C4-Cpept]
+c  12 : C(sp3)-C(aromatic ring)       [C4-C3]
+c  13 : C(sp3)-S                      [C4-SC4]
+c  14 : C(sp3)-SH                     [C4-SH]
+c  15 : C(aromatic ring)-OH           [C3-OH]
+c ________________________________________________ "rigid" torsions:
+c  16 : C(carboxyl)-OH                [C3-OH]
+c  17 : -NH-C(sp2 of guanidyl)        [C3-NHX]
+c  18 : -C(sp3)-NH2 (guanidyl)        [not in Flex]
+c  19 : -C(sp3)-NH2 (amide)           [Cpept-Npept]
 
       data conv/332.d0/  ! to convert electrost. energy into [kcal/mole]
 
-! ------------------------- ECEPP/3 potential --------------------------------
-! 1) Momany F.A McGuire R.F Burgess A.W Scheraga H.A J Phys Chem v79 2361-2381
-!    1975
-! 2) Nemethy G Pottle M.S Scheraga H.A, J Phys Chem v87 1883-1887 1983
-! 3) Sippl M.J Nemethy G Scheraga H.A J Phys Chem v88 6231-6233 1984
-! 4) Nemethy G Gibson K.D Palmer K.A Yoon C.N Paterlini G Zagari A Rumsey S
-!    Scheraga H.A J Phys Chem v96 6472-6484 1992
-! ----------------------------------------------------------------------------
+c ------------------------- ECEPP/3 potential --------------------------------
+c 1) Momany F.A McGuire R.F Burgess A.W Scheraga H.A J Phys Chem v79 2361-2381
+c    1975
+c 2) Nemethy G Pottle M.S Scheraga H.A, J Phys Chem v87 1883-1887 1983
+c 3) Sippl M.J Nemethy G Scheraga H.A J Phys Chem v88 6231-6233 1984
+c 4) Nemethy G Gibson K.D Palmer K.A Yoon C.N Paterlini G Zagari A Rumsey S
+c    Scheraga H.A J Phys Chem v96 6472-6484 1992
+c ----------------------------------------------------------------------------
 
       data eps_s/2.d0/  ! Distance-INdependent diel. constant
-!     data eps_s/6.d0/  ! Distance-INdependent diel. constant
+c     data eps_s/6.d0/  ! Distance-INdependent diel. constant
       data plt/78.d0/,  slp/0.3d0/   ! Parameters for Epsilon(R)
 
       data ehm /362.55d0/  !  Angstrom**2/3 * kcal / mol  ! from KONF90
-!      data ehm /362.09561409d0/  !  Angstrom**2/3 * kcal / mol
-! From:
-!   1.5
-! * elementary charge       = 4.80325   *e+2  Angstrom**3/2 * g**1/2 * s**(-1)
-! * Planck's constant/2*Pi  = 1.0545887 *e-34 Joule * s
-! * Avogadro's number       = 6.022045  *e+23 mol**(-1)
-! / sqrt (mass of electron) = sqrt (9.109534  *e-28 g )
-! / thermal equivalent      = 4.1868    *e+3  Joule * kcal**(-1)
-!      data ehm /362.36d0/         ! calculated using Tab II in ref. 2
-!      data 1/ehm /2.757670d-3/    ! 3*sqrt(m)/(2*e*h) taken from ICM
-
-! ---------------------- atomic polarizabilties (*100,[Angstrom**3])
-!                1   2   3   4   5   6   7    8    9  10  11  12
+cc      data ehm /362.09561409d0/  !  Angstrom**2/3 * kcal / mol
+c From:
+c   1.5
+c * elementary charge       = 4.80325   *e+2  Angstrom**3/2 * g**1/2 * s**(-1)
+c * Planck's constant/2*Pi  = 1.0545887 *e-34 Joule * s
+c * Avogadro's number       = 6.022045  *e+23 mol**(-1)
+c / sqrt (mass of electron) = sqrt (9.109534  *e-28 g )
+c / thermal equivalent      = 4.1868    *e+3  Joule * kcal**(-1)
+cc      data ehm /362.36d0/         ! calculated using Tab II in ref. 2
+cc      data 1/ehm /2.757670d-3/    ! 3*sqrt(m)/(2*e*h) taken from ICM
+
+c ---------------------- atomic polarizabilties (*100,[Angstrom**3])
+c                1   2   3   4   5   6   7    8    9  10  11  12
       data atpl/42.,42.,42.,42.,42.,42.,93.,151.,115.,59.,84.,59.,
-!               13  14  15   16  17  18
-     &          93.,93.,93.,220.,42.,93./
-! ---------------------- effective numbers of electrons (*100,ref. 2)
-!                1   2   3   4   5   6    7    8    9   10   11   12
+c               13  14  15   16  17  18
+     #          93.,93.,93.,220.,42.,93./
+c ---------------------- effective numbers of electrons (*100,ref. 2)
+c                1   2   3   4   5   6    7    8    9   10   11   12
       data efel/85.,85.,85.,85.,85.,85.,520.,520.,520.,700.,700.,700.,
-!                13   14   15    16  17   18
-     &          610.,610.,610.,1480.,85.,520./
-! ------------------------- min. pairwise 6-12 energy (*1000,[kcal/mol])
-!                1   2   3   4   5   6   7    8   9  10   11  12
+c                13   14   15    16  17   18
+     #          610.,610.,610.,1480.,85.,520./
+c ------------------------- min. pairwise 6-12 energy (*1000,[kcal/mol])
+c                1   2   3   4   5   6   7    8   9  10   11  12
       data emin/37.,36.,61.,61.,44.,36.,38.,140.,99.,94.,200.,94.,
-!                13   14   15   16  17  18
-     &          107.,107.,107.,223.,99.,38./
-! ---------------------------- opt. pairwise distance (*100,[Angstrom])
-!                 1    2    3    4    5    6    7    8    9   10   11
+c                13   14   15   16  17  18
+     #          107.,107.,107.,223.,99.,38./
+c ---------------------------- opt. pairwise distance (*100,[Angstrom])
+c                 1    2    3    4    5    6    7    8    9   10   11
       data rmin/292.,293.,268.,268.,283.,293.,412.,374.,370.,324.,312.,
-!                12   13   14   15   16   17   18
-     &          324.,351.,351.,351.,415.,248.,412./
-! ---------------------------------------------- Hydrogen-bond donors
-!                  1       2       3      4      5      6
+c                12   13   14   15   16   17   18
+     #          324.,351.,351.,351.,415.,248.,412./
+c ---------------------------------------------- Hydrogen-bond donors
+c                  1       2       3      4      5      6
       data do_s/.false.,.false.,.true.,.true.,.true.,.false.,
-!                  7       8       9      10      11      12
-     &          .false.,.false.,.false.,.false.,.false.,.false.,
-!                 13      14      15      16      17      18
-     &          .false.,.false.,.false.,.false.,.false.,.false./
-! -------------------------------------------- Hydrogen-bond acceptors
-!                  1       2       3       4       5       6
+c                  7       8       9      10      11      12
+     #          .false.,.false.,.false.,.false.,.false.,.false.,
+c                 13      14      15      16      17      18
+     #          .false.,.false.,.false.,.false.,.false.,.false./
+c -------------------------------------------- Hydrogen-bond acceptors
+c                  1       2       3       4       5       6
       data ac_s/.false.,.false.,.false.,.false.,.false.,.false.,
-!                  7       8       9      10     11     12
-     &          .false.,.false.,.false.,.true.,.true.,.true.,
-!                 13     14     15     16      17      18
-     &          .true.,.true.,.true.,.false.,.false.,.false./
-!     &        .false.,.true.,.true.,.false.,.false.,.false./ !! ICM
-! --------------------------------- HB-parameters (/1000,attraction)
+c                  7       8       9      10     11     12
+     #          .false.,.false.,.false.,.true.,.true.,.true.,
+c                 13     14     15     16      17      18
+     #          .true.,.true.,.true.,.false.,.false.,.false./
+cc     #        .false.,.true.,.true.,.false.,.false.,.false./ !! ICM
+c --------------------------------- HB-parameters (/1000,attraction)
       data chb_s/2624.,2624.,4610.,.0,  ! given as:
-     &           4014.,4014.,5783.,.0,  !  (ac_typ x do_typ)
-     &           2624.,2624.,4610.,.0,  ! to be used:
-     &           8244.,8244.,8244.,.0,  !  (DO_typ x AC_typ)
-     &           8244.,8244.,8244.,.0,  ! i.e.:
-     &           8244.,8244.,8244.,.0/  !  ( 3-5 x 10-15 )
-! --------------------------------- HB-parameters (/1000,repulsion)
+     #           4014.,4014.,5783.,.0,  !  (ac_typ x do_typ)
+     #           2624.,2624.,4610.,.0,  ! to be used:
+     #           8244.,8244.,8244.,.0,  !  (DO_typ x AC_typ)
+     #           8244.,8244.,8244.,.0,  ! i.e.:
+     #           8244.,8244.,8244.,.0/  !  ( 3-5 x 10-15 )
+c --------------------------------- HB-parameters (/1000,repulsion)
       data ahb_s/ 5890., 5890.,11220.,.0,
-     &           12040.,12040.,16583.,.0,  ! 13344 -> 16583 = Ref. 3
-     &            5890., 5890.,11220.,.0,
-     &           32897.,32897.,32897.,.0,
-     &           32897.,32897.,32897.,.0,
-     &           32897.,32897.,32897.,.0/
-
-!                   1  2  3   4   5   6   7  8  9 10 11 12 13  14  15
+     #           12040.,12040.,16583.,.0,  ! 13344 -> 16583 = Ref. 3
+     #            5890., 5890.,11220.,.0,
+     #           32897.,32897.,32897.,.0,
+     #           32897.,32897.,32897.,.0,
+     #           32897.,32897.,32897.,.0/
+
+c                   1  2  3   4   5   6   7  8  9 10 11 12 13  14  15
       data e0to_s /20.,0.,0.,2.7,.6,1.8,1.8,0.,0.,0.,0.,0.,2.,1.5,3.5
-!                   16 17  18  19
-     &             ,8.,18.,20.,15./
+c                   16 17  18  19
+     #             ,8.,18.,20.,15./
       data sgto_s /-1.,0.,0., 1.,1., 1., 1.,0.,0.,0.,0.,0.,1., 1.,-1.
-     &            ,-1.,-1.,-1.,-1./
+     #            ,-1.,-1.,-1.,-1./
       data rnto_s / 2.,0.,0., 3.,3., 3., 3.,0.,0.,0.,0.,0.,3., 3., 2.
-     &             ,2., 2., 2., 2./
-
-! ---------------------------- Flex potential ----------------------------------
-! Lavery R Sklenar H Zakrzewska K Pullman B J Biomol Struct Dyn v3 989-1014 1986
-! VdW-parameters from: Zhurkin V.B Poltiev V.I Florent'ev V.L Molekulyarnaya
-!                      Biologiya v14 116 1980
-! ------------------------------------------------------------------------------
+     #             ,2., 2., 2., 2./
+
+c ---------------------------- Flex potential ----------------------------------
+c Lavery R Sklenar H Zakrzewska K Pullman B J Biomol Struct Dyn v3 989-1014 1986
+c VdW-parameters from: Zhurkin V.B Poltiev V.I Florent'ev V.L Molekulyarnaya
+c                      Biologiya v14 116 1980
+c ------------------------------------------------------------------------------
 
       data plt_f/78.d0/,  slp_f/0.16d0/   ! Parameters for Epsilon(R)
       data cohb_f/6.d0/  ! Cut-off distance betw. H- & acceptor atom for HB
       data c_f/  ! ----------- Lennard-Jones C6-parameters (attraction)
-     &40.,40.,40.,40.,40.,40.,100.,126.,126.,86.,121.,105.,126.,105.,
-     &146.,213.1,3*0.,40.,40.,40.,40.,40.,100.,126.,126.,86.,121.,105.,
-     &126.,105.,146.,213.1,4*0.,40.,40.,40.,40.,100.,126.,126.,86.,121.,
-     &105.,126.,105.,146.,213.1,5*0.,40.,40.,40.,100.,126.,126.,86.,121.
-     &,105.,126.,105.,146.,213.1,6*0.,40.,40.,100.,126.,126.,86.,121.,
-     &105.,126.,105.,146.,213.1,7*0.,40.,100.,126.,126.,86.,121.,105.,
-     &126.,105.,146.,213.1,8*0.,250.,316.,316.,217.,305.,264.,316.,264.,
-     &367.,489.,9*0.,400.,400.,274.,385.,334.,400.,334.,464.,537.4,10*0.
-     &,400.,274.,385.,334.,400.,334.,464.,537.4,11*0.,200.,283.,245.,
-     &278.,233.,330.,424.,12*0.,400.,347.,391.,327.,465.,583.,13*0.,300.
-     &,339.,284.,403.,530.,14*0.,400.,334.,467.,556.5,15*0.,280.,391.,
-     &484.,16*0.,550.,673.4,17*0.,246.,38*0./
+     #40.,40.,40.,40.,40.,40.,100.,126.,126.,86.,121.,105.,126.,105.,
+     #146.,213.1,3*0.,40.,40.,40.,40.,40.,100.,126.,126.,86.,121.,105.,
+     #126.,105.,146.,213.1,4*0.,40.,40.,40.,40.,100.,126.,126.,86.,121.,
+     #105.,126.,105.,146.,213.1,5*0.,40.,40.,40.,100.,126.,126.,86.,121.
+     #,105.,126.,105.,146.,213.1,6*0.,40.,40.,100.,126.,126.,86.,121.,
+     #105.,126.,105.,146.,213.1,7*0.,40.,100.,126.,126.,86.,121.,105.,
+     #126.,105.,146.,213.1,8*0.,250.,316.,316.,217.,305.,264.,316.,264.,
+     #367.,489.,9*0.,400.,400.,274.,385.,334.,400.,334.,464.,537.4,10*0.
+     #,400.,274.,385.,334.,400.,334.,464.,537.4,11*0.,200.,283.,245.,
+     #278.,233.,330.,424.,12*0.,400.,347.,391.,327.,465.,583.,13*0.,300.
+     #,339.,284.,403.,530.,14*0.,400.,334.,467.,556.5,15*0.,280.,391.,
+     #484.,16*0.,550.,673.4,17*0.,246.,38*0./
       data a_f/  ! ---- Lennard-Jones A12-parameters (/1000,repulsion)
-     &7.74,7.74,7.74,7.74,7.74,7.74,70.6,81.6,81.6,31.3,42.2,36.6,71.4,
-     &62.,78.3,189.3,3*0.,7.74,7.74,7.74,7.74,7.74,70.6,61.7,61.7,31.3,
-     &17.8,15.4,53.7,62.,58.7,189.3,4*0.,7.74,7.74,7.74,7.74,70.6,81.6,
-     &81.6,31.3,42.2,36.6,71.4,62.,78.3,189.3,5*0.,7.74,7.74,7.74,70.6,
-     &61.7,61.7,31.3,17.8,15.4,53.7,62.,58.7,189.3,6*0.,7.74,7.74,70.6,
-     &81.6,81.6,31.3,42.2,36.6,71.4,62.,78.3,189.3,7*0.,7.74,70.6,81.6,
-     &81.6,31.3,42.2,36.6,71.4,62.,78.3,189.3,8*0.,512.,601.,601.,256.,
-     &349.,302.,538.,464.,598.,1196.,9*0.,704.,704.,298.,406.,351.,630.,
-     &544.,699.,1203.5,10*0.,704.,298.,406.,351.,630.,544.,699.,1203.5,
-     &11*0.,129.,176.,153.,269.,233.,303.,561.8,12*0.,240.,208.,366.,
-     &317.,413.,772.5,13*0.,180.,317.,274.,358.,702.3,14*0.,565.,488.,
-     &629.,1105.8,15*0.,421.,544.,976.8,16*0.,705.,1259.5,17*0.,503.3,
-     &38*0./
-! ---------------------------------------------- Hydrogen-bond donors
-!                  1       2       3      4      5      6
+     #7.74,7.74,7.74,7.74,7.74,7.74,70.6,81.6,81.6,31.3,42.2,36.6,71.4,
+     #62.,78.3,189.3,3*0.,7.74,7.74,7.74,7.74,7.74,70.6,61.7,61.7,31.3,
+     #17.8,15.4,53.7,62.,58.7,189.3,4*0.,7.74,7.74,7.74,7.74,70.6,81.6,
+     #81.6,31.3,42.2,36.6,71.4,62.,78.3,189.3,5*0.,7.74,7.74,7.74,70.6,
+     #61.7,61.7,31.3,17.8,15.4,53.7,62.,58.7,189.3,6*0.,7.74,7.74,70.6,
+     #81.6,81.6,31.3,42.2,36.6,71.4,62.,78.3,189.3,7*0.,7.74,70.6,81.6,
+     #81.6,31.3,42.2,36.6,71.4,62.,78.3,189.3,8*0.,512.,601.,601.,256.,
+     #349.,302.,538.,464.,598.,1196.,9*0.,704.,704.,298.,406.,351.,630.,
+     #544.,699.,1203.5,10*0.,704.,298.,406.,351.,630.,544.,699.,1203.5,
+     #11*0.,129.,176.,153.,269.,233.,303.,561.8,12*0.,240.,208.,366.,
+     #317.,413.,772.5,13*0.,180.,317.,274.,358.,702.3,14*0.,565.,488.,
+     #629.,1105.8,15*0.,421.,544.,976.8,16*0.,705.,1259.5,17*0.,503.3,
+     #38*0./
+c ---------------------------------------------- Hydrogen-bond donors
+c                  1       2       3      4      5      6
       data do_f/.false.,.false.,.true.,.true.,.true.,.true.,
-!                  7       8       9      10      11      12
-     &          .false.,.false.,.false.,.false.,.false.,.false.,
-!                 13      14      15      16      17      18
-     &          .false.,.false.,.false.,.false.,.false.,.false./
-! -------------------------------------------- Hydrogen-bond acceptors
-!                  1       2       3       4       5       6
+c                  7       8       9      10      11      12
+     #          .false.,.false.,.false.,.false.,.false.,.false.,
+c                 13      14      15      16      17      18
+     #          .false.,.false.,.false.,.false.,.false.,.false./
+c -------------------------------------------- Hydrogen-bond acceptors
+c                  1       2       3       4       5       6
       data ac_f/.false.,.false.,.false.,.false.,.false.,.false.,
-!                  7       8       9      10     11     12
-     &          .false.,.false.,.false.,.true.,.true.,.true.,
-!                 13      14      15     16     17      18
-     &          .false.,.false.,.true.,.true.,.false.,.false./
-! --------------------------------- HB-parameters (/1000,attraction)
+c                  7       8       9      10     11     12
+     #          .false.,.false.,.false.,.true.,.true.,.true.,
+c                 13      14      15     16     17      18
+     #          .false.,.false.,.true.,.true.,.false.,.false./
+c --------------------------------- HB-parameters (/1000,attraction)
       data chb_f/180.,180.,160. ,226.8,  ! given as  (ac_typ x do_typ)
-     &           175.,175.,150. ,305.8,  ! to be used as:
-     &           100.,100., 85. , 85. ,  !   (Do_typ x Ac_typ)
-     &           165.,165.,150. ,305.8,  ! i.e.:
-     &           720.,720.,643.1,845.6,  !   ( 3-6 x 10-12,15,16 )
-     &             0.,  0.,  0. ,  0. /
-! --------------------------------- HB-parameters (/1000,repulsion)
+     #           175.,175.,150. ,305.8,  ! to be used as:
+     #           100.,100., 85. , 85. ,  !   (Do_typ x Ac_typ)
+     #           165.,165.,150. ,305.8,  ! i.e.:
+     #           720.,720.,643.1,845.6,  !   ( 3-6 x 10-12,15,16 )
+     #             0.,  0.,  0. ,  0. /
+c --------------------------------- HB-parameters (/1000,repulsion)
       data ahb_f/  6600.,  6600.,  6200., 12855.,
-     &             6400.,  6400.,  7100., 29216.,
-     &             2400.,  2400.,  2400.,  2000.,
-     &             6200.,  6200.,  7100., 29216.,
-     &           185000.,185000.,172301.,308235.,
-     &                0.,      0.,    0.,     0./
-
-!                   1  2   3   4  5   6   7  8   9 10 11  12  13 14  15
+     #             6400.,  6400.,  7100., 29216.,
+     #             2400.,  2400.,  2400.,  2000.,
+     #             6200.,  6200.,  7100., 29216.,
+     #           185000.,185000.,172301.,308235.,
+     #                0.,      0.,    0.,     0./
+
+c                   1  2   3   4  5   6   7  8   9 10 11  12  13 14  15
       data e0to_f /20.,2.,.8,2.6,.6,2.1,1.8,3.2,.5,.5,.8,1.2,1.3,1.,6.2
-!                  16  17 18 19
-     &           ,6.2, 8.,0.,20./
+c                  16  17 18 19
+     #           ,6.2, 8.,0.,20./
       data sgto_f /-1.,1.,-1., 1.,1., 1., 1.,1.,1.,1.,-1.,1., 1.,1.,-1.
-     &           ,-1.,-1.,0.,-1./
+     #           ,-1.,-1.,0.,-1./
       data rnto_f / 2.,3., 3., 3.,3., 6., 3.,3.,6.,6., 3.,6., 3.,3., 2.
-     &            ,2., 2.,0.,2./
+     #            ,2., 2.,0.,2./
 
       data (rsnmcd(i),i=1,nrsty)/  ! Names for all amino acid residue types
-     & 'ala ','arg ','arg+','asn ','asp ','asp-','cys ','cyss','gln ',
-     & 'glu ','glu-','gly ','his ','hise','hisd','his+','hyp ','hypu',
-     & 'ile ','leu ','lys ','lys+','met ','phe ','cpro','pro ','cpru',
-     & 'prou','pron','pro+','ser ','thr ','trp ','tyr ','val ' /
-
+     # 'ala ','arg ','arg+','asn ','asp ','asp-','cys ','cyss','gln ',
+     # 'glu ','glu-','gly ','his ','hise','hisd','his+','hyp ','hypu',
+     # 'ile ','leu ','lys ','lys+','met ','phe ','cpro','pro ','cpru',
+     # 'prou','pron','pro+','ser ','thr ','trp ','tyr ','val ' /
+  
       data (onltcd(i),i=1,nrsty)/  ! One-letter codes for amino acid types
-     & 'A',   'R',   'R',   'N',   'D',   'D',   'C',   'C',   'Q',
-     & 'E',   'E',   'G',   'H',   'H',   'H',   'H',   'P',   'P',
-     & 'I',   'L',   'K',   'K',   'M',   'F',   'P',   'P',   'P',
-     & 'P',   'P',   'P',   'S',   'T',   'W',   'Y',   'V' /
-
-!     The vdW radii (in Angstr.) for the atomic groups and
-!      coefficients for their solvation free energy (kcal/molxA**2)
-
-!  Method:
-
-!  itysol=1 : OONS --> T.Ooi, et al,
-!                      Proc. Natl. Acad. Sci. USA 8 (1987) 3086-3090.
-!  itysol=2 : JRF  --> J.Vila, et al,
-!                      PROTEINS: Struct Funct Genet 10(1991) 199-218.
-!  itysol=3 : WE92 --> L.Wesson, D.Eisenberg,
-!                      Protein Science 1 (1992) 227-235.
-!  itysol=4 : SCH1 --> D.Eisenberg, et al,
-!                      Chem Scrip 29A (1989) 217-221.
-!  itysol=5 : SCH2 --> A.H.Juffer, et al,
-!                      Proteine Science 4 (1995) 2499-2509.
-!  itysol=6 : SCH3 --> L.Wesson, D.Eisenberg,
-!                      Protein Science 1 (1992) 227-235.
-!  itysol=7 : SCH4 --> C.A. Schiffer, et al,
-!                      Mol. Simul. 10(1993) 121-149.
-!  itysol=8 : EM86 --> D.Eisenberg, A.D. Mclachlan,
-!                      Nature 319 (1986) 199-203.
-!  itysol=9 : BM   --> B. Freyberg, et al,
-!                      J. Mol. Biol. 233 (1993) 275-292.
-
-! ATOM
-! TYPE OONS    JRF     WE92    SCH1    SCH2    SCH3    SCH4   EM86   BM
-
-! 1   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
-! 2   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
-! 3   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
-! 4   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
-! 5   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
-! 6   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
-! 7   0.0080  0.2160  0.0120  0.0180  0.0130  0.0040  0.0325  0.016 1.000
-! 8   0.4270 -0.7320  0.0120  0.0180  0.0130  0.0040  0.0325  0.016 1.000
-! 9  -0.0080 -0.6780  0.0120  0.0180  0.0130  0.0040  0.0325  0.016 1.000
-!10  -0.1720 -0.9100 -0.1160 -0.0090 -0.0070 -0.1130 -0.0175 -0.006 0.000
-!11  -0.0380 -0.2620 -0.1750 -0.0090 -0.0070 -0.1660 -0.2800 -0.006 0.000
-!12  -0.0380 -0.9100 -0.1750 -0.0370 -0.1120 -0.1660 -0.2800 -0.024 0.000
-!13  -0.1320 -0.3120 -0.1860 -0.0380 -0.0870 -0.1690 -0.2175 -0.05  0.000
-!14  -0.1320 -0.3120 -0.1160 -0.0090 -0.0070 -0.1130 -0.0175 -0.006 0.000
-!15  -0.1320 -0.3120 -0.1160 -0.0090 -0.0070 -0.1130 -0.0175 -0.006 0.000
-!16  -0.0210 -0.2810 -0.0180  0.0050 -0.0036 -0.0170 -0.0090  0.021 0.000
-!17   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
-!18   0.0080  0.2160  0.0120  0.0180  0.0130  0.0040  0.0325  0.016 1.000
+     # 'A',   'R',   'R',   'N',   'D',   'D',   'C',   'C',   'Q',
+     # 'E',   'E',   'G',   'H',   'H',   'H',   'H',   'P',   'P',
+     # 'I',   'L',   'K',   'K',   'M',   'F',   'P',   'P',   'P',
+     # 'P',   'P',   'P',   'S',   'T',   'W',   'Y',   'V' /
+
+c     The vdW radii (in Angstr.) for the atomic groups and
+c      coefficients for their solvation free energy (kcal/molxA**2)
+
+c  Method: 
+
+c  itysol=1 : OONS --> T.Ooi, et al, 
+c                      Proc. Natl. Acad. Sci. USA 8 (1987) 3086-3090.
+C  itysol=2 : JRF  --> J.Vila, et al, 
+c                      PROTEINS: Struct Funct Genet 10(1991) 199-218.
+C  itysol=3 : WE92 --> L.Wesson, D.Eisenberg, 
+c                      Protein Science 1 (1992) 227-235.
+C  itysol=4 : SCH1 --> D.Eisenberg, et al,
+c                      Chem Scrip 29A (1989) 217-221.
+C  itysol=5 : SCH2 --> A.H.Juffer, et al,
+c                      Proteine Science 4 (1995) 2499-2509.
+C  itysol=6 : SCH3 --> L.Wesson, D.Eisenberg, 
+c                      Protein Science 1 (1992) 227-235.
+C  itysol=7 : SCH4 --> C.A. Schiffer, et al,
+c                      Mol. Simul. 10(1993) 121-149.
+C  itysol=8 : EM86 --> D.Eisenberg, A.D. Mclachlan, 
+c                      Nature 319 (1986) 199-203.
+C  itysol=9 : BM   --> B. Freyberg, et al,
+c                      J. Mol. Biol. 233 (1993) 275-292.
+
+c ATOM
+c TYPE OONS    JRF     WE92    SCH1    SCH2    SCH3    SCH4   EM86   BM
+
+c 1   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
+c 2   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
+c 3   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
+c 4   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
+c 5   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
+c 6   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
+c 7   0.0080  0.2160  0.0120  0.0180  0.0130  0.0040  0.0325  0.016 1.000
+c 8   0.4270 -0.7320  0.0120  0.0180  0.0130  0.0040  0.0325  0.016 1.000
+c 9  -0.0080 -0.6780  0.0120  0.0180  0.0130  0.0040  0.0325  0.016 1.000
+c10  -0.1720 -0.9100 -0.1160 -0.0090 -0.0070 -0.1130 -0.0175 -0.006 0.000
+c11  -0.0380 -0.2620 -0.1750 -0.0090 -0.0070 -0.1660 -0.2800 -0.006 0.000
+c12  -0.0380 -0.9100 -0.1750 -0.0370 -0.1120 -0.1660 -0.2800 -0.024 0.000
+c13  -0.1320 -0.3120 -0.1860 -0.0380 -0.0870 -0.1690 -0.2175 -0.05  0.000
+c14  -0.1320 -0.3120 -0.1160 -0.0090 -0.0070 -0.1130 -0.0175 -0.006 0.000
+c15  -0.1320 -0.3120 -0.1160 -0.0090 -0.0070 -0.1130 -0.0175 -0.006 0.000
+c16  -0.0210 -0.2810 -0.0180  0.0050 -0.0036 -0.0170 -0.0090  0.021 0.000
+c17   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.000 0.000
+c18   0.0080  0.2160  0.0120  0.0180  0.0130  0.0040  0.0325  0.016 1.000
 
        data coef_sl/54*0.0,
-     & 0.008, 0.216, 0.012, 0.018, 0.013, 0.004, 0.0325, 0.016,1.000,
-     & 0.427,-0.732, 0.012, 0.018, 0.013, 0.004, 0.0325, 0.016,1.000,
-     & -.008,-0.678, 0.012, 0.018, 0.013, 0.004, 0.0325, 0.016,1.000,
-     & -.172,-0.910,-0.116,-0.009,-0.007,-0.113,-0.0175,-0.006,0.000,
-     & -.038,-0.262,-0.116,-0.009,-0.007,-0.113,-0.0175,-0.006,0.000,
-     & -.038,-0.910,-0.175,-0.037,-0.112,-0.166,-0.2800,-0.024,0.000,
-     & -.132,-0.312,-0.186,-0.038,-0.087,-0.169,-0.2175,-0.05, 0.000,
-     & -.132,-0.312,-0.116,-0.009,-0.007,-0.113,-0.0175,-0.006,0.000,
-     & -.132,-0.312,-0.116,-0.009,-0.007,-0.113,-0.0175,-0.006,0.000,
-     & -.021,-0.281,-0.018, 0.005,-.0036,-0.017,-0.0090, 0.021,0.000,
-     &  9*0.0,
-     & 0.008, 0.216, 0.012, 0.018, 0.013, 0.004, 0.0325, 0.016,1.000/
+     # 0.008, 0.216, 0.012, 0.018, 0.013, 0.004, 0.0325, 0.016,1.000,
+     # 0.427,-0.732, 0.012, 0.018, 0.013, 0.004, 0.0325, 0.016,1.000,
+     # -.008,-0.678, 0.012, 0.018, 0.013, 0.004, 0.0325, 0.016,1.000,
+     # -.172,-0.910,-0.116,-0.009,-0.007,-0.113,-0.0175,-0.006,0.000,
+     # -.038,-0.262,-0.116,-0.009,-0.007,-0.113,-0.0175,-0.006,0.000,
+     # -.038,-0.910,-0.175,-0.037,-0.112,-0.166,-0.2800,-0.024,0.000,
+     # -.132,-0.312,-0.186,-0.038,-0.087,-0.169,-0.2175,-0.05, 0.000,
+     # -.132,-0.312,-0.116,-0.009,-0.007,-0.113,-0.0175,-0.006,0.000,
+     # -.132,-0.312,-0.116,-0.009,-0.007,-0.113,-0.0175,-0.006,0.000,
+     # -.021,-0.281,-0.018, 0.005,-.0036,-0.017,-0.0090, 0.021,0.000,
+     #  9*0.0,
+     # 0.008, 0.216, 0.012, 0.018, 0.013, 0.004, 0.0325, 0.016,1.000/
 
        data rad_vdw/54*0.,
-     &              2*2.0,6*1.9,2.0,
-     &              2*1.55,6*1.9,1.5,
-     &              2*1.75,6*1.9,1.85,
-     &              9*1.4,
-     &              9*1.4,
-     &              9*1.4,
-     &              2*1.55,6*1.7,1.5,
-     &              2*1.55,6*1.7,1.5,
-     &              2*1.55,6*1.7,1.5,
-     &              2*2.0,6*1.8,1.85,
-     &              9*0.,
-     &              2*2.0,6*1.9,2.0/
+     #              2*2.0,6*1.9,2.0,
+     #              2*1.55,6*1.9,1.5,
+     #              2*1.75,6*1.9,1.85,
+     #              9*1.4,
+     #              9*1.4,
+     #              9*1.4,
+     #              2*1.55,6*1.7,1.5,
+     #              2*1.55,6*1.7,1.5,
+     #              2*1.55,6*1.7,1.5,
+     #              2*2.0,6*1.8,1.85,
+     #              9*0.,
+     #              2*2.0,6*1.9,2.0/
 
       end
Index: it_lund.f90
===================================================================
--- init_lund.f90	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,60 +1,0 @@
-! Subroutine initlund: Initializes data structures used frequently 
-! in connection with Biased Gaussian Steps and the energy functions
-! from Anders Irback's protein folding model. Calls: none.
-!
-subroutine init_lund
-    include 'INCL.H'
-    include 'incl_lund.h'
-    integer i, npprs, j, k
-
-    logical bgsposs
-    do i=1,mxrs
-        iN(i)=-1
-        iCa(i)=-1
-        iC(i)=-1
-        iphi(i)=-34
-        ipsi(i)=-35
-    enddo
-!      print *,'total number of variables = ',nvr
-
-    do i=1,ntlml
-        npprs=1
-        do j=ivrml1(i),ivrml1(i)+nvrml(i)-1
-            mlvr(j)=i
-            if (nmvr(j).eq.'phi') then 
-                iphi(npprs)=j
-! Now if the residue is a proline, there is no phi angle in the variable
-! list in SMMP, and so iphi(j) will remain at the initial value. 
-! So, make sure you never use iphi(i) for proline. 
-            endif
-            if (nmvr(j).eq.'psi'.or.nmvr(j).eq.'pst') then 
-                ipsi(npprs)=j
-                npprs=npprs+1
-            endif
-        enddo
-        do j=irsml1(i),irsml2(i)
-            iN(j)=iatrs1(j) 
-            do k=iatrs1(j),iatrs2(j)
-            if (nmat(k)(1:2).eq.'ca') then 
-                iCa(j)=k 
-            endif
-            if (nmat(k)(1:1).eq.'c') then 
-                iC(j)=k 
-            endif 
-            enddo
-    !            print *,'determined phi,psi serial for residue',j,' as '
-    !     #           ,iphi(j),ipsi(j)
-        enddo
-    enddo
-    abgs=300.0
-    bbgs=10.0
-    bgsnvar=0
-! JHM: Took the following lines out to avoid another dependency.
-!     do i=1,nvr
-!         if (bgsposs(i)) then
-!             bgsnvar=bgsnvar+1
-!             bgsvar(bgsnvar)=i
-!         endif
-!     enddo
-end subroutine init_lund
-
Index: init_molecule.f
===================================================================
--- init_molecule.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ init_molecule.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,43 +1,40 @@
-! **************************************************************
-!
-! This file contains the subroutines: init_molecule
-!
-! 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
-!
-! **************************************************************
-! FIXME: Data in varfile determines which molecule is changed.
+c **************************************************************
+c
+c This file contains the subroutines: init_molecule
+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 **************************************************************
+c FIXME: Data in varfile determines which molecule is changed.
 
       subroutine init_molecule(iabin,grpn,grpc,seqfile,varfile)
 
-! ----------------------------------------------------------
-! PURPOSE: construct starting structure of molecule(s)
-!
-!          iabin = 1  : ab Initio using sequence &
-!                       variables given in input files
-!          iabin != 1 : sequence, variable information
-!                       from PDB-file
-!
-!          grpn:        N-terminal group
-!          grpc:        C-terminal group
-!
-! CALLS:   addend,bldmol,c_alfa,getmol,iendst, mklist, nursvr,
-!          pdbread,pdbvars,redseq,redvar,setmvs
-!
-! ----------------------------------------------------------
+c ----------------------------------------------------------
+c PURPOSE: construct starting structure of molecule(s)
+c
+c          iabin = 1  : ab Initio using sequence & 
+c                       variables given in input files
+c          iabin != 1 : sequence, variable information
+c                       from PDB-file
+c
+c          grpn:        N-terminal group
+c          grpc:        C-terminal group
+c
+c CALLS:   addend,bldmol,c_alfa,getmol,iendst, mklist, nursvr,
+C          pdbread,pdbvars,redseq,redvar,setmvs
+C
+c ----------------------------------------------------------
 
       include 'INCL.H'
       include 'INCP.H'
 
-      integer iabin, iendst, ntl, i, j, l, it, ier, ir, nursvr, i1, i2
-      integer its
-
-Cf2py character*80 optional, intent(in) :: seqfile = ' '
-Cf2py character*80 optional, intent(in) :: varfile = ' '
-
+cf2py character*80 optional, intent(in) :: seqfile = ' '
+cf2py character*80 optional, intent(in) :: varfile = ' ' 
+      
       character grpn*4,grpc*4
-      character navr*3, nars*4
+      character navr*3, nars*4  
       character seqfile*80, varfile*80
       integer ontlml
@@ -47,8 +44,8 @@
       readFromStdin = .false.
 
-      write (logString, *) 'init_molecule: Solvent: ', itysol
-      if (iabin.eq.1) then
-
-!     ----------------------------------------- get sequence for molecule(s)
+      write (*,*) 'init_molecule: Solvent: ', itysol
+      if (iabin.eq.1) then  
+         
+c     ----------------------------------------- get sequence for molecule(s)
          lunseq=11
          if (ntlml.gt.0) then
@@ -56,41 +53,40 @@
          endif
          if (iendst(seqfile).le.1.or.seqfile.eq.' ') then
- 1          write (logString, '(/,a,$)') ' file with SEQUENCE:'
+ 1          write (*,'(/,a,$)') ' file with SEQUENCE:'
             seqfil=' '
             read (*,'(a)',err=1) seqfil
             readFromStdin = .true.
-         else
+         else 
             seqfil = seqfile
-         endif
+         endif 
          call redseq
-
-         write (logString, *) 'File with sequence is ', 
-     &      seqfil(1:iendst(seqfil))
-
-!     --------------------------------- read & assemble data from libraries
-!     initial coordinates, interaction lists
-
+         
+         write (*,*) 'File with sequence is ', seqfil(1:iendst(seqfil))
+         
+c     --------------------------------- read & assemble data from libraries
+c     initial coordinates, interaction lists
+         
          ntl = ntlml
          do i=ontlml, ntl
-
+            
             call getmol(i)      ! assemble data from libraries
-
+            
             do j=1,6            ! initialize global parameters
                gbpr(j,i)=0.d0
             enddo
-
+            
             call bldmol(i)      ! co-ordinates
-
+            
             ntlml = i
             call addend(i,grpn,grpc) ! modify ends
             call setmvs(i) ! determine sets of moving atoms for given variables
             call mklist(i)      ! compile lists of interaction partners
-
+            
          enddo
-
-!     --------------------------- Read the initial conformation if necessary
-         if(readFromStdin) then
-            write (logString, '(a,$)') ' file with VARIABLES:'
-!
+         
+c     --------------------------- Read the initial conformation if necessary
+         if(readFromStdin) then 
+            write (*,'(a,$)') ' file with VARIABLES:'
+c     
             varfil=' '
             read(*,'(a)',end=2,err=2) varfil
@@ -100,24 +96,24 @@
          l=iendst(varfil)
          if (l.gt.0.and.varfil.ne.' ') then
-!            write (logString, '(1x,a,/)') varfil(1:l)
+            write (*,'(1x,a,/)') varfil(1:l)
             lunvar=13
-
+            
             call redvar         ! get vars. and rebuild
-
-         endif
-
- 2       write (logString, *) ' '
-
-!     -------------------- get: nvr,idvr, vlvr, olvlvr
+            
+         endif
+         
+ 2       write(*,*) ' '
+         
+c     -------------------- get: nvr,idvr, vlvr, olvlvr
          nvr = 0
          do i=1,ivrml1(ntlml)+nvrml(ntlml)-1
-
+            
             if (.not.fxvr(i)) then
                nvr=nvr+1
                idvr(nvr)=i      ! index of not fixed var.
             endif
-
+            
             it=ityvr(i)
-
+            
             if (it.eq.3) then   ! torsion
                vlvr(i)=toat(iatvr(i))
@@ -128,12 +124,12 @@
             endif
 
-            olvlvr(i) = vlvr(i)
+            olvlvr(i) = vlvr(i) 
          enddo
-
+         
          ireg = 0
-
+         
       else                      ! =========================== from PDB
          if (iendst(seqfile).le.1) then
- 3          write (logString, '(/,a,$)') ' PDB-file:'
+ 3          write (*,'(/,a,$)') ' PDB-file:'
             seqfil=' '
             read (*,'(a)',err=3) seqfil
@@ -141,81 +137,81 @@
             seqfil = seqfile
          endif
-         write (logString, *) 'PDB structure ',seqfil(1:iendst(seqfil))
+         write (*,*) 'PDB structure ',seqfil(1:iendst(seqfil))
          print *, 'calling readpdb with ',seqfile
          call pdbread(seqfil,ier)
-
+         
          if (ier.ne.0) stop
-
+         
          call pdbvars()
-
+         
          ireg = 1
-
+         
       endif
-
-!     -------------------------- set var. amplitudes for simulations
-
+      
+c     -------------------------- set var. amplitudes for simulations
+      
       do i=1,ivrml1(ntlml)+nvrml(ntlml)-1
-
+         
          if (ityvr(i).eq.3.and..not.fxvr(i)) then ! torsion
-
+            
             navr = nmvr(i)
-
+            
             ir = nursvr(i)
             nars = seq(ir)
-
+            
             if (                         navr(1:2).eq.'om'
-
-     &     .or.nars(1:3).eq.'arg'.and.(navr(1:2).eq.'x5'
-     &           .or.navr(1:2).eq.'x6')
-
-     &           .or.(nars(1:3).eq.'asn'.or.nars(1:3).eq.'asp')
-     &           .and.navr(1:2).eq.'x3'
-
-     &           .or.(nars(1:3).eq.'gln'.or.nars(1:3).eq.'glu')
-     &           .and.navr(1:2).eq.'x4'
-
-     &           ) then
-
-!     axvr(i) = pi/9.d0  ! 20 deg.
+            
+     #     .or.nars(1:3).eq.'arg'.and.(navr(1:2).eq.'x5'
+     #           .or.navr(1:2).eq.'x6')
+            
+     #           .or.(nars(1:3).eq.'asn'.or.nars(1:3).eq.'asp')
+     #           .and.navr(1:2).eq.'x3'
+            
+     #           .or.(nars(1:3).eq.'gln'.or.nars(1:3).eq.'glu')
+     #           .and.navr(1:2).eq.'x4'
+            
+     #           ) then
+            
+c     axvr(i) = pi/9.d0  ! 20 deg.
             axvr(i) = pi2       ! Trying out 360 deg. for these as well
-
+            
          else
             axvr(i) = pi2       ! 360 deg.
          endif
-
+         
       else
          axvr(i) = 0.d0
       endif
-
+      
       enddo                     ! vars.
-
-!     --------------------- initialize solvation pars. if necessary
+      
+c     --------------------- initialize solvation pars. if necessary
 
       if (itysol.ne.0) then
-
+         
          i1=iatrs1(irsml1(1))   ! 1st atom of 1st molecule
          i2=iatrs2(irsml2(ntlml)) ! last atom of last molecule
-
+         
          its = iabs(itysol)
-
+         
          do i=i1,i2             ! all atoms
             it=ityat(i)
             sigma(i)=coef_sl(its,it)
             rvdw(i) =rad_vdw(its,it)
-
+            
             if (nmat(i)(1:1).ne.'h') rvdw(i)=rvdw(i)+rwater
-
+            
          enddo
-
+         
       endif
 ! Initialize calpha array
       do i=ontlml, ntlml
-         call c_alfa(i,1)
+         call c_alfa(i,1)    
       enddo
 
 !     Initialize arrays used in the BGS update
-      call init_lund()
+      call init_lund()      
       return
       end
-
-
+      
+      
Index: main.f
===================================================================
--- main.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ main.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,61 +1,46 @@
-! **************************************************************
-! This file contains the:  main (SINGLE PROCESSOR JOBS ONLY,
-!                                FOR PARALLEL JOBS USE pmain)
-!
-! 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
-!
-! CALLS: init_energy,init_molecule
-! CALLS TASK SUBROUTINE: anneal,canon,elp,minim,mulcan_par,
-!                        mulcan_sim,partem_s, or regul
-! CAN ALSO CALL MEASUREMENT ROUTINES: cnteny,contacts,helix,hbond,
-!                                    outpdb,outvar,rgyr,
-!                                    rmsinit and rsmdfun,zimmer
-! $Id: main.f 334 2007-08-07 09:23:59Z meinke $
-! **************************************************************
-
+c **************************************************************
+c This file contains the:  main (SINGLE PROCESSOR JOBS ONLY,
+C                                FOR PARALLEL JOBS USE pmain)
+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 CALLS: init_energy,init_molecule
+C CALLS TASK SUBROUTINE: anneal,canon,elp,minim,mulcan_par,
+c                        mulcan_sim,partem_s, or regul
+C CAN ALSO CALL MEASUREMENT ROUTINES: cnteny,contacts,helix,hbond,
+C                                    outpdb,outvar,rgyr,
+C                                    rmsinit and rsmdfun,zimmer
+c $Id: main.f 334 2007-08-07 09:23:59Z meinke $
+c **************************************************************
+      
       program main
 
-      use timer
       include 'INCL.H'
       include 'INCP.H'
-      double precision eps, temp, e, energy, enyshe_simple
-
-      integer iabin, imin, maxit, nequi
-      integer nsweep, nmes, ncalls, nacalls, i
-
       common/updstats/ncalls(5),nacalls(5)
       character*80 libdir, seqfile, varfile
       character grpn*4,grpc*4
       logical lrand,bgsposs
-      integer argc, status, argv_length
-      character(len=255) :: argv
 
-! =================================================== Energy setup
+c =================================================== Energy setup
 
-!            Directory for SMMP libraries
-!     Change the following directory path to where you want to put SMMP
-!     libraries of residues.
+c            Directory for SMMP libraries
+c     Change the following directory path to where you want to put SMMP
+c     libraries of residues. 
       libdir='./SMMP/'
 
-!     Set the maximum log level. The larger the number the more detailed
-!     the log.
-      MAXLOGLEVEL = 100
-!     File unit to use for the log file.
-      LOGFILEUNIT = 27
-      open(LOGFILEUNIT, file="smmp.log")
-
-!      The switch in the following line is now not used.
+c      The switch in the following line is now not used.
       flex=.false.        ! .true. for Flex  / .false. for ECEPP
 
-!     Choose energy type with the following switch instead ...
+c     Choose energy type with the following switch instead ...
       ientyp = 0
-!        0  => ECEPP2 or ECEPP3 depending on the value of sh2
-!        1  => FLEX
-!        2  => Lund force field
-!        3  => ECEPP with Abagyan corrections
-!
+c        0  => ECEPP2 or ECEPP3 depending on the value of sh2
+c        1  => FLEX 
+c        2  => Lund force field
+c        3  => ECEPP with Abagyan corrections
+c
 
       sh2=.false.         ! .true. for ECEPP/2; .false. for ECEPP3
@@ -69,5 +54,5 @@
       call init_energy(libdir)
 
-! ================================================= Structure setup
+c ================================================= Structure setup
 
       grpn = 'nh2' ! N-terminal group
@@ -76,14 +61,13 @@
       iabin = 1  ! =0: read from PDB-file
                  ! =1: ab Initio from sequence (& variables)
-      seqfile='polyq.seq'
-!      seqfile='polyA.pdb'
-      varfile='polyq.var'
-       varfile = ' '
-
+      seqfile='EXAMPLES/enkefa.seq'
+      varfile='EXAMPLES/enkefa.var'
+!       varfile = ' '
+      
       ntlml = 0
-      write (logString, *) 'Solvent: ', itysol
-!     Initialize random number generator.
+      write (*,*) 'Solvent: ', itysol
+c     Initialize random number generator.
       call sgrnd(31433)
-
+      
       if (itysol.eq.0.and.ientyp.eq.3) then
          print *,'Can not use Abagyan entropic corrections without '
@@ -94,8 +78,8 @@
       call init_molecule(iabin,grpn,grpc,seqfile,varfile)
 
-! Decide if and when to use BGS, and initialize Lund data structures
+c Decide if and when to use BGS, and initialize Lund data structures 
       bgsprob=0.75   ! Prob for BGS, given that it is possible
-! upchswitch= 0 => No BGS 1 => BGS with probability bgsprob
-! 2 => temperature dependent choice
+c upchswitch= 0 => No BGS 1 => BGS with probability bgsprob 
+c 2 => temperature dependent choice 
       upchswitch=1
       rndord=.true.
@@ -103,40 +87,25 @@
       if (ientyp.eq.2) call init_lundff
       if (ientyp.eq.3) call init_abgn
+      
 
-
-! ========================================  Add your task down here
+c ========================================  Add your task down here
 
       imin = 1 ! Quasi-Newton
       maxit = 15000 ! maximum number of iterations in minimization
       eps = 1.0d-7 ! requested precision
-!      call minim(imin, maxit, eps)
-!      call outvar(0, ' ')
-!     To do a canonical Monte Carlo simulation uncomment the lines below
-      nequi = 100
-      nsweep = 500
-      nmes = 10
-      temp = 300.0
-      lrand = .true.
-      E = energy()
-      write (logString, *) E, eyel,eyvw,eyhb,eyvr
-      call outpdb(1, "polyrQ.pdb")
-!      Canonical Monte Carlo
-      call init_timer()
-      call start_timer(1)
-      call canon(nequi, nsweep, nmes, temp, lrand)
-      call stop_timer(1)
+      call minim(imin, maxit, eps)
+c     To do a canonical Monte Carlo simulation uncomment the lines below
+!       nequi = 100
+!       nsweep = 50000
+!       nmes = 10
+!       temp = 300.0
+!       lrand = .true.
+c      Canonical Monte Carlo
+!       call canon(nequi, nsweep, nmes, temp, lrand)
 
-      E = 0
-!      call start_timer(1)
-!      do i =1, nsweep
-!         E = E + enyshe_simple()
-!      end do
-!      call stop_timer(1)
-      call evaluate(1)
-      print *,timingData(1)%average, "s.", E
-!      For simulated annealing uncomment the lines below
+c      For simulated annealing uncomment the lines below
 !      tmin = 200.0
 !      tmax = 500.0
 !      call anneal(nequi, nsweep, nmes, tmax, tmin, lrand);
-! ========================================  End of main
+c ========================================  End of main      
        end
Index: main.py
===================================================================
--- main.py	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
+++ main.py	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+# main.py
+#
+# Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+#                      Jan H. Meinke, Sandipan Mohanty
+
+## \mainpage pySMMP: Python bindings to SMMP v. 1.1.
+#    SMMP is a FORTRAN library for simulating proteins. It provides 
+#    minimization routines and various Monte Carlo methods. SMMP uses an all-atom
+#    representation of the protein. It stores the configuration within the 
+#    standard geometry model. In the standard geometry model the internal degrees
+#    of freedom, e.g., the dihedral angles, the bond lengths, etc. are stored and
+#    the cartesian coordinates are calculated on the fly. For more details on 
+#    the model SMMP uses and the functions it provides see the manual (manual.ps).
+#   
+#    pySMMP builds on SMMP. It provides python bindings to the functions and 
+#    global variables, but it uses classes to represent the Proteins and 
+#    algorithms. 
+#    
+#    \section sec_tutorial A Tutorial: A canonical Monte Carlo simulation of protein A
+#
+#    The basic setup is the same for most simulations. This tutorial takes you
+#    step by step to a running simulation. First we need to import the library
+#    \code 
+#         import smmp
+#     \endcode
+#    This makes the smmp routines available to the Python interpreter. Next we
+#    create the universe by initializing a universe.Universe object by first 
+#    importing the universe package and then setting the object:
+#    \code
+#        import universe
+#        myUniverse = universe.Universe(T=300)  
+#    \endcode
+#    This initializes the smmp library as well. We also set the initial 
+#    temperature of the universe to 300K. The Universe object initializes the 
+#    SMMP library and keeps track of global parameters, e.g, the temperature T.
+#    After you created a Universe, you can initialize a Protein. Proteins can
+#    be read from a sequence and a variable file or from a PDB file.
+#    \code
+#        import protein
+#        
+#        protA = protein.Protein("1bdd.seq", "1bdd.var")
+#        myUniverse.add(protA)
+#    \endcode
+#    Adding the protein to myUniverse makes the universe aware of it.
+#    Now you are ready to run a simulation. You can also querry the protein for 
+#    various properties, e.g., 
+#    \code
+#        print protA.rgyr()
+#    \endcode
+#    prints the radius of gyration of the protein.
+#    A canonical Monte Carlo algorithm is available in the algorithms package.
+#    \code
+#        import algorithms
+#        myMC = algorithms.CanonicalMonteCarlo(myUniverse, 1000, 10000)
+#    \endcode
+#    This sets up a simulation with 1000 steps for equilibration and a default 
+#    length of 10000 sweeps.
+#    The quickest way to run the simulation is by calling the run method of the 
+#    algorithm object myMC to do the entire Monte Carlo run.
+#    \code
+#        myMC.run()
+#    \endcode
+
+import sys, time
+from optparse import OptionParser
+from protein import *
+from universe import *
+from algorithms import CanonicalMonteCarlo
+
+if __name__ == "__main__":
+# Set up command line options    
+    usage = "usage: %prog [options] seq-filename"
+    parser = OptionParser(usage = usage, version="%prog 20050805")
+    parser.add_option("-v", "--variables", dest="varFileName",
+                  help="read amino-acid conformation from FILE", metavar="FILE")
+    parser.add_option("--equi", type="int", dest="nequi", default=100,
+                  help="number of sweeps for equilibration", metavar="n")
+    parser.add_option("--sweeps", type="int", dest="sweeps", default=10000,
+                  help="number of sweeps for annealing", metavar="n")
+    parser.add_option("--mes", type="int", dest="mes", default=10,
+                  help="number of sweeps between measurements", metavar="n")
+    parser.add_option("--Tmax", type="float", dest="tmax", default=1000,
+                  help="maximum temperature for annealing", metavar="T")
+    parser.add_option("--Tmin",  type="float", dest="tmin", default=100, 
+                  help="maximum temperature for annealing",metavar="T")
+
+    (options, args) = parser.parse_args()
+    if len(args) < 1:
+        parser.print_help()
+        sys.exit()
+    seqFileName = args[0]
+    
+# Start simulation setup.    
+    myUniv = Universe(T=300, st=0)   
+    p1 = Protein(seqFileName, options.varFileName)
+    p1.setOrigin((0, 0, 0), (0, 0, 0))
+    myUniv.add(p1)
+    T = 300.0
+    smmp.outpdb(1, "start.pdb")
+    print "E of starting configuration.", myUniv.energy()
+    ts = time.time()
+    smmp.minim(1, options.sweeps, 1.0E-12)
+
+    smmp.outpdb(1, "equi.pdb")
+    
+    t1 = time.clock()
+    print myUniv.energy(), myUniv.rgyr(), myUniv.helix(), p1.hbond(), (t1-ts)
+    p1.saveVariables("final.var")
+    smmp.outpdb(0, "final.pdb")
+    te = time.time()
+    print "The calculation took %ss." % (te - ts)
+ 
+    
Index: main_bgl_p.f
===================================================================
--- main_bgl_p.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ main_bgl_p.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,17 +1,17 @@
-!     **************************************************************
-!     
-!     This file contains the   main (PARALLEL TEMPERING  JOBS ONLY,
-!     FOR SINGULAR PROCESSOR JOBS USE main)
-!     
-!     This file contains also the subroutine: p_init_molecule
-!     
-!     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
-!     
-!     CALLS init_energy,p_init_molecule,partem_p
-!     
-!     **************************************************************
+c     **************************************************************
+c     
+c     This file contains the   main (PARALLEL TEMPERING  JOBS ONLY,
+C     FOR SINGULAR PROCESSOR JOBS USE main)
+C     
+C     This file contains also the subroutine: p_init_molecule
+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     CALLS init_energy,p_init_molecule,partem_p
+C     
+c     **************************************************************
       program pmain
 
@@ -28,20 +28,20 @@
       logical newsta
 
-!c    Number of replicas 
+cc    Number of replicas 
       integer num_replica
-!c    Number of processors per replica
+cc    Number of processors per replica
       integer num_ppr
-!c    Range of processor for crating communicators
+cc    Range of processor for crating communicators
       integer proc_range(3)
-!c    Array of MPI groups
+cc    Array of MPI groups
       integer group(MAX_REPLICA), group_partem
-!c    Array of MPI communicators
+cc    Array of MPI communicators
       integer comm(MAX_REPLICA), partem_comm
-!c    Array of nodes acting as masters for the energy calculation.
+cc    Array of nodes acting as masters for the energy calculation.
       integer ranks(MAX_REPLICA)
-!c    Configuration switch
+cc    Configuration switch
       integer switch
       integer rep_id
-!     set number of replicas
+c     set number of replicas
       double precision eols(MAX_REPLICA)
       integer ndims, nldims, log2ppr, color
@@ -53,9 +53,9 @@
 
 
-!     MPI stuff, and random number generator initialisation
+c     MPI stuff, and random number generator initialisation
 
       call mpi_init(ierr)
 !       call pmi_cart_comm_create(comm_cart,ierr)
-      write (logString, *) "Initialized MPI. Now setting up communicators." 
+      write(*,*) "Initialized MPI. Now setting up communicators." 
       call flush(6)
       ndims = 4
@@ -81,5 +81,5 @@
       call MPI_Cart_GET(comm_cart, ndims, dims, periods, coords, ierr)
 
-      write (logString, *) ndims, dims, periods, coords
+      write(*,*) ndims, dims, periods, coords
       call flush(6)
 !       call VTSetup()
@@ -88,18 +88,18 @@
       call sgrnd(seed)          ! Initialize the random number generator
 
-!     =================================================== Energy setup
+c     =================================================== Energy setup
       libdir='SMMP/'      
-!     Directory for SMMP libraries
-
-!     The switch in the following line is now not used.
+c     Directory for SMMP libraries
+
+c     The switch in the following line is now not used.
       flex=.false.              ! .true. for Flex  / .false. for ECEPP
 
-!     Choose energy type with the following switch instead ...
+c     Choose energy type with the following switch instead ...
       ientyp = 0
-!     0  => ECEPP2 or ECEPP3 depending on the value of sh2
-!     1  => FLEX 
-!     2  => Lund force field
-!     3  => ECEPP with Abagyan corrections
-!     
+c     0  => ECEPP2 or ECEPP3 depending on the value of sh2
+c     1  => FLEX 
+c     2  => Lund force field
+c     3  => ECEPP with Abagyan corrections
+c     
 
       sh2=.false.               ! .true. for ECEPP/2; .false. for ECEPP3
@@ -114,9 +114,9 @@
       call init_energy(libdir)
 
-!     calculate CPU time using MPI_Wtime()
+c     calculate CPU time using MPI_Wtime()
       startwtime = MPI_Wtime()
 
 
-!     ================================================= Structure setup
+c     ================================================= Structure setup
       grpn = 'nh2'              ! N-terminal group
       grpc = 'cooh'             ! C-terminal group
@@ -153,16 +153,16 @@
       ntlml = 0
 
-! Decide if and when to use BGS, and initialize Lund data structures 
+c Decide if and when to use BGS, and initialize Lund data structures 
       bgsprob=0.6    ! Prob for BGS, given that it is possible
-! upchswitch= 0 => No BGS 1 => BGS with probability bgsprob 
-! 2 => temperature dependent choice 
+c upchswitch= 0 => No BGS 1 => BGS with probability bgsprob 
+c 2 => temperature dependent choice 
       upchswitch=1
       rndord=.true.
       if (ientyp.eq.2) call init_lundff
-!     =================================================================
-!     Distribute nodes to parallel tempering tasks
-!     I assume that the number of nodes available is an integer 
-!     multiple n of the number of replicas. Each replica then gets n
-!     processors to do its energy calculation.
+c     =================================================================
+c     Distribute nodes to parallel tempering tasks
+c     I assume that the number of nodes available is an integer 
+c     multiple n of the number of replicas. Each replica then gets n
+c     processors to do its energy calculation.
       num_ppr = num_proc / num_replica
 
@@ -192,5 +192,5 @@
      &      + (coords(3)/ldims(3))*nblock(1)*nblock(2)
 
-      write (logString, *) myrank, color, ldims, nblock
+      write(*,*) myrank, color, ldims, nblock
 
       call mpi_comm_split(comm_cart,color,myrank,local_comm,ierr)
@@ -206,6 +206,6 @@
 !      call mpi_comm_group(mpi_comm_world,  group_world, error)
 
-!     The current version doesn't require a separate variable j. I
-!     could just use i * num_ppr but this way it's more flexible.
+c     The current version doesn't require a separate variable j. I
+c     could just use i * num_ppr but this way it's more flexible.
 !       j = 0
 !       do i = 1, num_replica 
@@ -216,5 +216,5 @@
 !          call mpi_group_range_incl(group_world, 1, proc_range, group(i)
 !      &                              ,error)
-!          write (logString, *) "Assigning rank ", j, proc_range, 
+!          write (*,*) "Assigning rank ", j, proc_range, 
 !      &               "to group", group(i)
 !          call flush(6)
@@ -227,5 +227,5 @@
 !              my_mpi_comm = comm(i)
 !              rep_id = i - 1
-!              write (logString, *) rep_id, "has comm", my_mpi_comm
+!              write (*,*) rep_id, "has comm", my_mpi_comm
 !              call flush(6)
 !          endif
@@ -233,5 +233,5 @@
 ! 
 ! c     Setup the communicator used for parallel tempering
-!       write (logString, *) "PTGroup=", ranks(:num_replica)
+!       write (*,*) "PTGroup=", ranks(:num_replica)
 !       call flush(6)
 !       call mpi_group_incl(group_world, num_replica, ranks, group_partem,
@@ -241,5 +241,5 @@
 ! 
 !       if (partem_comm.ne.MPI_COMM_NULL) then
-!          write (logString, *) partem_comm,myrank, "is master for ", rep_id, "."
+!          write (*,*) partem_comm,myrank, "is master for ", rep_id, "."
 !       endif
 
@@ -247,9 +247,9 @@
       call mpi_comm_size(my_mpi_comm,no,ierr)
       rep_id = color
-      write (logString, *) "My new rank is ", myrank, "of", no
+      write (*,*) "My new rank is ", myrank, "of", no
       call flush(6)
       if (myrank.eq.0) then 
          color = 1
-         write (logString, *) 'My rank and color:', myrank, color
+         write (*,*) 'My rank and color:', myrank, color
          call flush(6)
       else 
@@ -258,5 +258,5 @@
       call mpi_comm_split(comm_cart,color,0,partem_comm,ierr)
 
-!       write (logString, *) "Finalizing MPI."
+!       write(*,*) "Finalizing MPI."
 !       call flush(6)
 !       CALL mpi_finalize(ierr)
@@ -277,7 +277,7 @@
       nml = 1
 
-!     RRRRRRRRRRMMMMMMMMMMMMSSSSSSSSSSDDDDDDDDDDDDD
+c     RRRRRRRRRRMMMMMMMMMMMMSSSSSSSSSSDDDDDDDDDDDDD
       call rmsinit(nml,ref_pdb)
-!     RRRRRRRRRRMMMMMMMMMMMMSSSSSSSSSSDDDDDDDDDDDDD
+c     RRRRRRRRRRMMMMMMMMMMMMSSSSSSSSSSDDDDDDDDDDDDD
 
 !     READ  REFERENCE CONTACT MAP
@@ -294,6 +294,6 @@
       end do
 
-!     ========================================  start of parallel tempering run
-      write (logString, *) "There are ", no,
+c     ========================================  start of parallel tempering run
+      write (*,*) "There are ", no,
      &            " processors available for ",rep_id
       call flush(6)
@@ -303,11 +303,11 @@
       call partem_p(num_replica, nequi, nswp, nmes, nsave, newsta,
      &              switch, rep_id, partem_comm)
-!     ========================================  end of parallel tempering run
-!     calculate CPU time using MPI_Wtime()
+c     ========================================  end of parallel tempering run
+c     calculate CPU time using MPI_Wtime()
       endwtime = MPI_Wtime()
 
 
       if(my_pt_rank.eq.0) then
-         write (logString, *) "time for simulation using ", num_proc,
+         write(*,*) "time for simulation using ", num_proc,
      &        " processors =",  endwtime - startwtime, " seconds"
          call flush(6)
@@ -319,5 +319,5 @@
       enddo
 
-!     ========================================  End of main
+c     ========================================  End of main
       CALL mpi_finalize(ierr)
 
Index: main_p.f
===================================================================
--- main_p.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ main_p.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,17 +1,17 @@
-!     **************************************************************
-!
-!     This file contains the   main (PARALLEL TEMPERING  JOBS ONLY,
-!     FOR SINGULAR PROCESSOR JOBS USE main)
-!
-!     This file contains also the subroutine: p_init_molecule
-!
-!     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
-!
-!     CALLS init_energy,p_init_molecule,partem_p
-!
-!     **************************************************************
+c     **************************************************************
+c     
+c     This file contains the   main (PARALLEL TEMPERING  JOBS ONLY,
+C     FOR SINGULAR PROCESSOR JOBS USE main)
+C     
+C     This file contains also the subroutine: p_init_molecule
+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     CALLS init_energy,p_init_molecule,partem_p
+C     
+c     **************************************************************
       program pmain
 
@@ -21,9 +21,4 @@
       include 'mpif.h'
 
-      double precision startwtime, group_world, error, endwtime
-
-      integer ierr, num_proc, iabin, nequi, nswp, nmes, nsave, ifrm, j
-      integer i, nml, nresi, my_pt_rank, ncalls, nacalls
-
       character*80 libdir
       character*80 in_fil,ou_fil,filebase, varfile
@@ -33,20 +28,20 @@
       logical newsta
 
-!c    Number of replicas
+cc    Number of replicas 
       integer num_replica
-!c    Number of processors per replica
+cc    Number of processors per replica
       integer num_ppr
-!c    Range of processor for crating communicators
+cc    Range of processor for crating communicators
       integer proc_range(3)
-!c    Array of MPI groups
+cc    Array of MPI groups
       integer group(MAX_REPLICA), group_partem
-!c    Array of MPI communicators
+cc    Array of MPI communicators
       integer comm(MAX_REPLICA), partem_comm
-!c    Array of nodes acting as masters for the energy calculation.
+cc    Array of nodes acting as masters for the energy calculation.
       integer ranks(MAX_REPLICA)
-!c    Configuration switch
+cc    Configuration switch
       integer switch
       integer rep_id
-!     set number of replicas
+c     set number of replicas
       double precision eols(MAX_REPLICA)
 
@@ -55,5 +50,5 @@
 
 
-!     MPI stuff, and random number generator initialisation
+c     MPI stuff, and random number generator initialisation
 
       call mpi_init(ierr)
@@ -66,18 +61,18 @@
       call sgrnd(seed)          ! Initialize the random number generator
 
-!     =================================================== Energy setup
-      libdir='SMMP/'
-!     Directory for SMMP libraries
-
-!     The switch in the following line is now not used.
+c     =================================================== Energy setup
+      libdir='SMMP/'      
+c     Directory for SMMP libraries
+
+c     The switch in the following line is now not used.
       flex=.false.              ! .true. for Flex  / .false. for ECEPP
 
-!     Choose energy type with the following switch instead ...
+c     Choose energy type with the following switch instead ...
       ientyp = 0
-!     0  => ECEPP2 or ECEPP3 depending on the value of sh2
-!     1  => FLEX
-!     2  => Lund force field
-!     3  => ECEPP with Abagyan corrections
-!
+c     0  => ECEPP2 or ECEPP3 depending on the value of sh2
+c     1  => FLEX 
+c     2  => Lund force field
+c     3  => ECEPP with Abagyan corrections
+c     
 
       sh2=.false.               ! .true. for ECEPP/2; .false. for ECEPP3
@@ -92,9 +87,9 @@
       call init_energy(libdir)
 
-!     calculate CPU time using MPI_Wtime()
+c     calculate CPU time using MPI_Wtime()
       startwtime = MPI_Wtime()
 
 
-!     ================================================= Structure setup
+c     ================================================= Structure setup
       grpn = 'nh2'              ! N-terminal group
       grpc = 'cooh'             ! C-terminal group
@@ -111,39 +106,40 @@
                             !   temperatures must have at least as many
                             !   entries
-      nequi=10              ! Number of MC sweeps before measurements
-                            !   and replica exchanges are started
+      nequi=10              ! Number of MC sweeps before measurements 
+                            !   and replica exchanges are started 
       nswp=500000           ! Number of sweeps
       nmes=10               ! Interval for measurements and replica exchange
       nsave=1000            ! Not used at the moment
-
-      switch = -1           ! How should the configuration be
+                    
+      switch = -1           ! How should the configuration be   
                             !   initialized?
-                            ! -1 stretched chain
+                            ! -1 stretched chain 
                             !  0 don't do anything
                             !  1 initialize each angle to a random value
-
+      
       ifrm=0
       ntlml = 0
 
-! Decide if and when to use BGS, and initialize Lund data structures
+c Decide if and when to use BGS, and initialize Lund data structures 
       bgsprob=0.6    ! Prob for BGS, given that it is possible
-! upchswitch= 0 => No BGS 1 => BGS with probability bgsprob
-! 2 => temperature dependent choice
+c upchswitch= 0 => No BGS 1 => BGS with probability bgsprob 
+c 2 => temperature dependent choice 
       upchswitch=1
       rndord=.true.
-!     =================================================================
-!     Distribute nodes to parallel tempering tasks
-!     I assume that the number of nodes available is an integer
-!     multiple n of the number of replicas. Each replica then gets n
-!     processors to do its energy calculation.
+      if (ientyp.eq.2) call init_lundff
+c     =================================================================
+c     Distribute nodes to parallel tempering tasks
+c     I assume that the number of nodes available is an integer 
+c     multiple n of the number of replicas. Each replica then gets n
+c     processors to do its energy calculation.
       num_ppr = num_proc / num_replica
 
       call mpi_comm_group(mpi_comm_world,  group_world, error)
 
-!     The current version doesn't require a separate variable j. I
-!     could just use i * num_ppr but this way it's more flexible.
+c     The current version doesn't require a separate variable j. I
+c     could just use i * num_ppr but this way it's more flexible.
       j = 0
-      do i = 1, num_replica
-         ranks(i) = j
+      do i = 1, num_replica 
+         ranks(i) = j 
          proc_range(1) = j
          proc_range(2) = j + num_ppr - 1
@@ -151,5 +147,5 @@
          call mpi_group_range_incl(group_world, 1, proc_range, group(i)
      &                              ,error)
-         write (logString, *) "Assigning rank ", j, proc_range,
+         write (*,*) "Assigning rank ", j, proc_range, 
      &               "to group", group(i)
          call flush(6)
@@ -162,20 +158,19 @@
              my_mpi_comm = comm(i)
              rep_id = i - 1
-             write (logString, *) rep_id, "has comm", my_mpi_comm
+             write (*,*) rep_id, "has comm", my_mpi_comm
              call flush(6)
          endif
       enddo
 
-!     Setup the communicator used for parallel tempering
-      write (logString, *) "PTGroup=", ranks(:num_replica)
+c     Setup the communicator used for parallel tempering
+      write (*,*) "PTGroup=", ranks(:num_replica)
       call flush(6)
       call mpi_group_incl(group_world, num_replica, ranks, group_partem,
      &                    error)
-      call mpi_comm_create(mpi_comm_world, group_partem, partem_comm,
+      call mpi_comm_create(mpi_comm_world, group_partem, partem_comm, 
      &                     error)
 
       if (partem_comm.ne.MPI_COMM_NULL) then
-         write (logString, *) partem_comm,myrank, "is master for ", 
-     &      rep_id, "."
+         write (*,*) partem_comm,myrank, "is master for ", rep_id, "."
       endif
 
@@ -183,5 +178,5 @@
       call mpi_comm_size(my_mpi_comm,no,ierr)
 
-      write (logString, *) "My new rank is ", myrank, "of", no
+      write (*,*) "My new rank is ", myrank, "of", no
       call flush(6)
 ! = Done setting up communicators =====================================
@@ -190,20 +185,16 @@
          varfile = 'EXAMPLES/1bdd.var'
          call init_molecule(iabin, grpn, grpc,in_fil,varfile)
-      else
+      else 
          filebase = "conf_0000.var"
          call init_molecule(iabin, grpn, grpc,in_fil,
      &        fileNameMP(filebase, 6, 9, rep_id + 1))
       endif
-      call init_lund
-!     Must call init_lundff *after* molecule has been loaded.
-      if (ientyp.eq.2) call init_lundff
       if (ientyp.eq.3) call init_abgn
 
       nml = 1
 
-
-!     RRRRRRRRRRMMMMMMMMMMMMSSSSSSSSSSDDDDDDDDDDDDD
+c     RRRRRRRRRRMMMMMMMMMMMMSSSSSSSSSSDDDDDDDDDDDDD
       call rmsinit(nml,'EXAMPLES/1bdd.pdb')
-!     RRRRRRRRRRMMMMMMMMMMMMSSSSSSSSSSDDDDDDDDDDDDD
+c     RRRRRRRRRRMMMMMMMMMMMMSSSSSSSSSSDDDDDDDDDDDDD
 
 !     READ  REFERENCE CONTACT MAP
@@ -220,20 +211,20 @@
       end do
 
-!     ========================================  start of parallel tempering run
-      write (logString, *) "There are ", no,
+c     ========================================  start of parallel tempering run
+      write (*,*) "There are ", no,
      &            " processors available for ",rep_id
       call flush(6)
       nml = 1
       call distributeWorkLoad(no, nml)
-
+      
       call partem_p(num_replica, nequi, nswp, nmes, nsave, newsta,
      &              switch, rep_id, partem_comm)
-!     ========================================  end of parallel tempering run
-!     calculate CPU time using MPI_Wtime()
+c     ========================================  end of parallel tempering run
+c     calculate CPU time using MPI_Wtime()
       endwtime = MPI_Wtime()
 
 
       if(my_pt_rank.eq.0) then
-         write (logString, *) "time for simulation using ", num_proc,
+         write(*,*) "time for simulation using ", num_proc,
      &        " processors =",  endwtime - startwtime, " seconds"
          call flush(6)
@@ -245,5 +236,5 @@
       enddo
 
-!     ========================================  End of main
+c     ========================================  End of main
       CALL mpi_finalize(ierr)
 
Index: metropolis.f
===================================================================
--- metropolis.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ metropolis.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,29 +1,23 @@
-! **************************************************************
-!
-! This file contains the subroutines:  metropolis
-!
-! 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:  metropolis
+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 **************************************************************
 
 
       subroutine metropolis(eol1,acz,dummy)
-!
-! SUBROUTINE FOR METROPOLIS UPDATE OF CONFIGURATIONS
-!
-! CALLS: energy,addang,grnd,dummy (function provided as argument)
-!
+C
+C SUBROUTINE FOR METROPOLIS UPDATE OF CONFIGURATIONS
+C
+C CALLS: energy,addang,grnd,dummy (function provided as argument)
+C
       include 'INCL.H'
       include 'INCP.H'
       include 'incl_lund.h'
-      
-      double precision eol, energy, grnd, dv, addang, enw, delta, dummy
-      double precision rd, ex, acz, eol1
-
-      integer nsw, iupstate, iupt, ivar, jv, iml, i, ncalls, nacalls
-
       external dummy
 !      common/bet/beta
@@ -31,11 +25,11 @@
       integer updtch1, updtch2,bgs
       double precision vrol(mxvr), gbol
-!f2py intent(in, out) eol
-!f2py intent(in, out) acz
+cf2py intent(in, out) eol
+cf2py intent(in, out) acz
       eol = energy()
-!     external rand
+c     external rand
       do nsw=1,nvr
-! Loop over dihedrals
-!
+c Loop over dihedrals
+c
          iupstate=0
          iupt=1
@@ -60,16 +54,16 @@
             iupstate=bgs(eol,dummy)
          else
-!           Simple twist of 
-!           Get Proposal configuration
+c           Simple twist of 
+c           Get Proposal configuration
             vrol=vlvr!(jv)  
             dv=axvr(jv)*(grnd()-0.5)
             vlvr(jv)=addang(vrol(jv),dv)
-!
-!           Get dummy of proposal configuration
-!
+c
+c           Get dummy of proposal configuration
+c
             enw = energy()
-!
+c
             delta =  dummy(enw) - dummy(eol)
-!           ___________________________ check acceptance criteria
+c           ___________________________ check acceptance criteria
             if (delta.le.0.0d0) then
                eol=enw  
@@ -87,9 +81,14 @@
             endif
          endif
+         enw1=energy()
+!          if (enw1.ne.eol) then
+!             write (*,*) 'metropolis: variable, enw1,eol,acptd',
+!      #           ivar,enw1,eol,acptd,(enw1-eol),enw
+!          endif
          acz=acz+iupstate*1.0
          call accanalyze(iupt,iupstate)
       end do
 
-! Updates on relative position of different molecules when there are many      
+c Updates on relative position of different molecules when there are many      
       if (ntlml.gt.1) then
          do iml=1, ntlml
@@ -105,13 +104,13 @@
                   endif
                endif
-!     
-!              Get dummy of proposal configuration
-!     
+c     
+c              Get dummy of proposal configuration
+c     
                enw = energy()
-!
+c
                delta =  dummy(enw) - dummy(eol)
-!     
-!              ____________________________ check acceptance criteria
-!     
+c     
+c              ____________________________ check acceptance criteria
+c     
                if (delta.le.0.0d0) then
                   eol=enw
@@ -139,13 +138,13 @@
                   gbpr(i, iml) = (grnd()-0.5) * pi2
                endif
-!     
-!              Get dummy of proposal configuration
-!     
+c     
+c              Get dummy of proposal configuration
+c     
                enw = energy()
-!     
+c     
                delta =  dummy(enw) - dummy(eol)
-!     
-!              ____________________________ check acceptance criteria
-!     
+c     
+c              ____________________________ check acceptance criteria
+c     
                if (delta.le.0.0d0) then
                   eol=enw
@@ -167,23 +166,21 @@
          enddo
       endif
-!     
-!     Re-calculate energy
-!     
+c     
+c     Re-calculate energy
+c     
       enw = energy()
       if(abs(eol-enw).gt.0.000001)  then
-         write (logString, *) 'metropolis: eol,enw,difference:', eol, 
-     &      enw, eol-enw
+         write(*,*) 'metropolis: eol,enw,difference:', eol, enw, eol-enw
          if (eol.lt.100000) then 
             stop 'metropolis: eol and enw difference unacceptable'
          endif
       endif
-!     
+c     
       eol1 = eol
       return
-!     
+c     
       end
       
       subroutine accanalyze(iuptype,iupdstate)
-      integer ncalls, nacalls, iupdstate, iuptype
       common/updstats/ncalls(5),nacalls(5)
       ncalls(5)=ncalls(5)+1
@@ -210,5 +207,4 @@
       integer iiii
       double precision bbbb,curprob, grnd,up2bmax,up2bmin
-
       common/updtparam/up2bmax,up2bmin
       curprob=(bbbb-up2bmin)/(up2bmax-up2bmin)
@@ -220,5 +216,4 @@
       end
       block data updtchs
-      integer ncalls, nacalls
       double precision up2bmax, up2bmin
       common/updtparam/up2bmax,up2bmin
Index: mincjg.f
===================================================================
--- mincjg.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ mincjg.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,62 +1,56 @@
-! **************************************************************
-!
-! This file contains the subroutines: mincjg
-!
-! 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: mincjg
+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 ********************************************************************
       subroutine mincjg(n,mxn,x,f,g,acur,d,xa,ga,dt,yt,gt,maxfun,nfun)
 
-! ....................................................................
-!
-!  Conjugate Gradient Minimizer
-!
-!  INPUT:   X,F,G - variables, value of FUNC, gradient at START/
-!           ACUR - convergence is assumed if ACUR > SUM ( G(I)**2 )
-!           MAXFUN - maximum overall number of function calls
-!
-!  OUTPUT:  X,F,G - variables, value of FUNC, gradient at MINIMUM
-!           NFUN  - overall number of function calls used
-!
-!  ARRAYS:  D,XA,GA,YT,DT,GT - dimension N
-!
-!  CALLS:   MOVE - calculate function & its gradients for current X
-!
-!  PARAMETERS:  AMF    - rough estimate of first reduction in F, used
-!                        to guess initial step of 1st line search
-!               MXFCON - see 'ier=4'
-!               MAXLIN -
-!
-!  DIAGNOSTICS (ier)
-!
-!           = 0: minimization completed successfully
-!           = 1: number of steps reached MAXFUN
-!           = 2: line search was abandoned
-!           = 3: search direction is uphill
-!           = 4: two consecutive line searches failed to reduce F
-! ....................................................................
-
-      double precision amf, tol, eps, gsqrd, fmin, f, t, g, ga, d, xa, x
-      double precision gsq2, gnew, dfpr, stmin, fuit, gdit, gt, gdmi
-      double precision sbound, stepch, step, wo, sum, fch, acur, ddspln
-      double precision gspln, beta, gama, yt, dt, gamden, di
-
-      integer mxfcon, maxlin, mxn, ier, iter, iterfm, iterrs, nfun
-      integer nfopt, i, n, nfbeg, iretry, maxfun
+c ....................................................................
+c
+c  Conjugate Gradient Minimizer
+c
+c  INPUT:   X,F,G - variables, value of FUNC, gradient at START/
+c           ACUR - convergence is assumed if ACUR > SUM ( G(I)**2 )
+c           MAXFUN - maximum overall number of function calls
+c
+c  OUTPUT:  X,F,G - variables, value of FUNC, gradient at MINIMUM
+c           NFUN  - overall number of function calls used
+c
+c  ARRAYS:  D,XA,GA,YT,DT,GT - dimension N
+c
+c  CALLS:   MOVE - calculate function & its gradients for current X
+c
+c  PARAMETERS:  AMF    - rough estimate of first reduction in F, used
+c                        to guess initial step of 1st line search
+c               MXFCON - see 'ier=4'
+c               MAXLIN -
+c
+c  DIAGNOSTICS (ier)
+c
+c           = 0: minimization completed successfully
+c           = 1: number of steps reached MAXFUN
+c           = 2: line search was abandoned
+c           = 3: search direction is uphill
+c           = 4: two consecutive line searches failed to reduce F
+c ....................................................................
+
+      implicit real*8 (a-h,o-z)
+      implicit integer*4 (i-n)
 
       parameter (AMF = 10.d0,
-     &           MXFCON = 2,
-     &           MAXLIN = 5,
-     &           TOL = 1.d-7,  ! controls 'stepch'
-     &           EPS = .7d0)
+     #           MXFCON = 2,
+     #           MAXLIN = 5,
+     #           TOL = 1.d-7,  ! controls 'stepch'
+     #           EPS = .7d0)
 
       dimension x(mxn),g(mxn),
-     &          d(mxn),xa(mxn),ga(mxn),dt(mxn),yt(mxn),gt(mxn)
-
-      character(255) logString
-      
+     #          d(mxn),xa(mxn),ga(mxn),dt(mxn),yt(mxn),gt(mxn)
+
+
       ier = 0
       iter = 0
@@ -94,5 +88,5 @@
 
       if ( gdit .ge. 0.d0 ) then
-        write (logString, *) ' mincjg>  search direction is uphill'
+        write(*,*) ' mincjg>  search direction is uphill'
         ier = 3
         goto 6
@@ -108,5 +102,5 @@
 
     2 step = stmin + stepch
-      wo = 0.d0
+      wo = 0.d0 
 
       do i=1,n
@@ -160,9 +154,8 @@
 
         if ( nfun .gt. (nfbeg + 1) .or.
-     &       abs(gdmi/gdit) .gt. EPS ) then
+     #       abs(gdmi/gdit) .gt. EPS ) then
 
           ier=2
-          write (logString, *) 
-     &       ' mincjg>  too small step in search direction'
+          write(*,*) ' mincjg>  too small step in search direction'
         endif
 
@@ -189,5 +182,5 @@
 
       if ( fch .ne. 0.d0 )  ddspln = ddspln + (wo + wo) / stepch
-
+ 
       if ( gdmi .eq. 0.d0 )  goto 6
 
@@ -212,5 +205,5 @@
 
       if ( (gdmi * gspln) .lt. 0.d0 )  stepch = stepch * gdmi /
-     &                                          (gdmi - gspln)
+     #                                          (gdmi - gspln)
 
       goto 2
@@ -232,6 +225,5 @@
       if ( iter .ge. (iterfm + MXFCON) ) then
         ier = 4
-        write (logString, *) 
-     &    ' mincjg>  line search failed to reduce function'
+        write(*,*) ' mincjg>  line search failed to reduce function'
         return
       endif
@@ -250,5 +242,5 @@
 
         if (iterrs .ne. 0 .and. (iter - iterrs) .lt. (n-1) .and.
-     &      abs(sum) .lt. gsq2 ) then
+     #      abs(sum) .lt. gsq2 ) then
 
           gama = 0.d0
@@ -307,5 +299,5 @@
       call move(nfun,n,f,x,g)
 
-      write (logString, *) ' mincjg> ier = ',ier
+      write(*,*) ' mincjg> ier = ',ier
 
       return
Index: minim.f
===================================================================
--- minim.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ minim.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,49 +1,34 @@
-! **************************************************************
-!
-! This file contains the subroutines: minim,move
-!
-! 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: minim,move
+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 **************************************************************
 
 
       subroutine minim(imin, maxit, eps)
 
-! ......................................................................
-! PURPOSE: Use minimizers
-!
-!          imin = 1:  use Quasi-Newton
-!          imin = 2:  use Conjugated Gradients
-!
-!          @param maxit maximum number of iterations 
-!          @param eps acceptance criterium
-!Institute
-! CALLS: difang,energy,gradient, mincjg,minqsn, nursvr
-! ......................................................................
+c ......................................................................
+c PURPOSE: Use minimizers
+c
+c          imin = 1:  use Quasi-Newton
+c          imin = 2:  use Conjugated Gradients
+c
+c          @param maxit maximum number of iterations 
+c          @param eps acceptance criterium
+cInstitute
+c CALLS: difang,energy,gradient, mincjg,minqsn, nursvr
+c ......................................................................
 
       include 'INCL.H'
-!f2py intent(in) imin
-!f2py intent(in) maxit
-!f2py intent(in) eps
-      integer msvmx
-
-      integer imin
-
-      integer maxit
-      
-      integer nursvr
-      double precision energy, difang
-            
-      integer ngbvr, msv, i, j, mxop, n6, n3, n, n1, n2, n5, n4
-      integer ntlvr, nop, nv
-      
-      double precision eps, acc, esm, gdey2, gbpro, gdvr, gdrg2, scl
-      double precision vlvrn, w, vlvro, vr      
-      
+cf2py intent(in) imin
+cf2py intent(in) maxit
+cf2py intent(in) eps
       parameter (msvmx=mxvr*(mxvr+5)/(2*(2*mxvr+1)),   
-     &            msv  = 50 )                             
+     #            msv  = 50 )                             
 
       dimension w(mxvr*(mxvr+13)/2)
@@ -51,5 +36,5 @@
       dimension vlvrn(mxvr),vlvro(mxvr),gdvr(mxvr),scl(mxvr)
 
-! --------------------------- new
+c --------------------------- new
       dimension gbpro(6,mxml)
 
@@ -58,33 +43,33 @@
 
       if (msv.gt.msvmx) then
-        write (logString, '(a,i5)') ' minreg> parameter MSV > ',msvmx
+        write (*,'(a,i5)') ' minreg> parameter MSV > ',msvmx
         stop
       endif
 
-! ----------------------- energy & gradient
+c ----------------------- energy & gradient
 
       call gradient()
 
-      write (logString, '(/,a,/)') ' Energy BEFORE minimization:' 
+      write(*,'(/,a,/)') ' Energy BEFORE minimization:' 
 
       if (ireg.eq.0) then
 
-        write (logString, '(a,e12.5,/,3(a,e11.4),/,2(a,e11.4),/)') 
-     &    ' Total: ', eysm,
-     &    '   Coulomb: ',eyel,' Lennard-Jones: ',eyvw,' HB: ',eyhb,
-     &    '   Variables: ',eyvr,'  Solvatation: ',eysl
+        write (*,'(a,e12.5,/,3(a,e11.4),/,2(a,e11.4),/)') ' Total: ',
+     #    eysm,
+     #    '   Coulomb: ',eyel,' Lennard-Jones: ',eyvw,' HB: ',eyhb,
+     #    '   Variables: ',eyvr,'  Solvatation: ',eysl
 
        else
 
 
-        write (logString, '(a,e12.5,/,3(a,e11.4),/,3(a,e11.4),/)') 
-     &    ' Total: ', wtey*eysm + wtrg*eyrg,
-     &    '   Coulomb: ',eyel,' Lennard-Jones: ',eyvw,' HB: ',eyhb,
-     &    '   Variables: ',eyvr,'  Solvatation: ',eysl,
-     &    ' Regularization: ',eyrg
+        write (*,'(a,e12.5,/,3(a,e11.4),/,3(a,e11.4),/)') ' Total: ',
+     #    wtey*eysm + wtrg*eyrg,
+     #    '   Coulomb: ',eyel,' Lennard-Jones: ',eyvw,' HB: ',eyhb,
+     #    '   Variables: ',eyvr,'  Solvatation: ',eysl,
+     #    ' Regularization: ',eyrg
 
        endif
 
-! --------------------------------------- variables
+c --------------------------------------- variables
 
       ntlvr=ivrml1(ntlml)+nvrml(ntlml)-1
@@ -144,11 +129,11 @@
         enddo
 
-!        if (abs(wtrg-1.d0).gt.1.d-4.and.abs(wtey-1.d0).gt.1.d-4) then
-!          gdey2 = max(acc,gdey2)
-!          gdrg2 = max(acc,gdrg2)
-!          wtrg = wtrg * sqrt(gdey2/gdrg2)
-!          write (logString, *)  ' -->    Wt_energy = ',wtey,'  Wt_regul. = ',wtrg
-!          write (logString, *)  '  '
-!        endif
+c        if (abs(wtrg-1.d0).gt.1.d-4.and.abs(wtey-1.d0).gt.1.d-4) then
+c          gdey2 = max(acc,gdey2)
+c          gdrg2 = max(acc,gdrg2)
+c          wtrg = wtrg * sqrt(gdey2/gdrg2)
+c          write(*,*)  ' -->    Wt_energy = ',wtey,'  Wt_regul. = ',wtrg
+c          write(*,*)  '  '
+c        endif
 
         esm=wtey*eysm+wtrg*eyrg
@@ -167,5 +152,5 @@
 
         call minqsn(n,mxvr,vlvrn,esm,gdvr,scl,acc,w,w(n1),w(n2),
-     &              w(n3),w(n4),w(n5),w(n6),mxop,nop)
+     #              w(n3),w(n4),w(n5),w(n6),mxop,nop)
 
       elseif (imin.eq.2) then ! Conjugated Gradients
@@ -178,5 +163,5 @@
 
         call mincjg(n,mxvr,vlvrn,esm,gdvr,acc,w,w(n1),w(n2),  ! no 'scl'
-     &              w(n3),w(n4),w(n5),mxop,nop)
+     #              w(n3),w(n4),w(n5),mxop,nop)
 
       endif
@@ -184,12 +169,12 @@
 
       if (nop.lt.mxop) then
-        write (logString, '(a)') ' ---- CONVERGENCE ----'
+        write (*,'(a)') ' ---- CONVERGENCE ----'
       else
-        write (logString, '(a)')  '---- STEP LIMIT ----'
-      endif
-
-
-      write (logString, '(/,2a,/)') ' Final energies ',
-     & '__________________________________________________'
+        write (*,'(a)')  '---- STEP LIMIT ----'
+      endif
+
+
+      write (*,'(/,2a,/)') ' Final energies ',
+     # '__________________________________________________'
 
       eysm = energy()
@@ -197,19 +182,19 @@
       if (ireg.eq.0) then
 
-        write (logString, '(a,e12.5,/,3(a,e11.4),/,2(a,e11.4))') 
-     &  ' Total: ',eysm,'   Coulomb: ',eyel,' Lennard-Jones: ',eyvw,
-     &  ' HB: ',eyhb, '   Variables: ',eyvr,'  Solvatation: ',eysl
+        write (*,'(a,e12.5,/,3(a,e11.4),/,2(a,e11.4))') ' Total: ',eysm,
+     #  '   Coulomb: ',eyel,' Lennard-Jones: ',eyvw,' HB: ',eyhb,
+     #  '   Variables: ',eyvr,'  Solvatation: ',eysl
 
       else
 
-        write (logString, '(a,e12.5,/,3(a,e11.4),/,3(a,e11.4))') 
-     &  ' Total: ', wtey*eysm + wtrg*eyrg,
-     &  '   Coulomb: ',eyel,' Lennard-Jones: ',eyvw,' HB: ',eyhb,
-     &  '   Variables: ',eyvr,'  Solvatation: ',eysl,
-     &  ' Regularization: ',eyrg
-
-      endif
-
-      write (logString, '(/,a,/)') ' Variables _________________'
+        write (*,'(a,e12.5,/,3(a,e11.4),/,3(a,e11.4))') ' Total: ',
+     #      wtey*eysm + wtrg*eyrg,
+     #  '   Coulomb: ',eyel,' Lennard-Jones: ',eyvw,' HB: ',eyhb,
+     #  '   Variables: ',eyvr,'  Solvatation: ',eysl,
+     #  ' Regularization: ',eyrg
+
+      endif
+
+      write (*,'(/,a,/)') ' Variables _________________'
 
       nv = 0
@@ -221,6 +206,6 @@
           if (abs(vr).gt.pi) vr=vr-sign(pi2,vr)
 
-          write (logString, '(1x,a,1x,i4,f8.1,a,f5.1,a)') nmvr(i),
-     &        nursvr(i), vr*crd,'    (',abs(difang(vr,vlvro(i)))*crd,')'
+          write (*,'(1x,a,1x,i4,f8.1,a,f5.1,a)') nmvr(i),nursvr(i),
+     #        vr*crd,'    (',abs(difang(vr,vlvro(i)))*crd,')'
 
           vlvr(i) = vr
@@ -231,13 +216,13 @@
       if (ireg.ne.0) then
 
-        write (logString,'(/,a,/)') ' Global Variables ___________'
+        write (*,'(/,a,/)') ' Global Variables ___________'
 
         do i=1,ntlml
-          write (logString, *) ' Molecule #',i,' old          new'
+          write(*,*) ' Molecule #',i,' old          new'
           do j=1,3
-            write (logString, *) gbpro(j,i),' ',gbpr(j,i)
+            write(*,*) gbpro(j,i),' ',gbpr(j,i)
           enddo
           do j=4,6
-            write (logString, *) gbpro(j,i)*crd,' ',gbpr(j,i)*crd
+            write(*,*) gbpro(j,i)*crd,' ',gbpr(j,i)*crd
           enddo
         enddo
@@ -245,14 +230,13 @@
       endif
 
-      write (logString,'(/,2a)') ' Gradient ',
-     & '______________________________________________________________'
-
-      write (logString,'(8(1x,f8.3))') (gdvr(i),i=1,nv)
+      write (*,'(/,2a)') ' Gradient ',
+     # '______________________________________________________________'
+
+      write (*,'(8(1x,f8.3))') (gdvr(i),i=1,nv)
 
       if (ireg.ne.0) then
 
-        write (logString, *) 
-     &             ' -------------- global variables ------------'
-        write (logString, '(6(1x,f8.3))') (gdvr(i+nv),i=1,ngbvr)
+        write (*,*) ' -------------- global variables ------------'
+        write (*,'(6(1x,f8.3))') (gdvr(i+nv),i=1,ngbvr)
 
       endif
@@ -260,28 +244,15 @@
       return
       end
-! ********************************************
+c ********************************************
       subroutine move(nop,nvr1,esm,vlvrn,gdvr)
-!
-! CALLS: gradient
-!
+c
+c CALLS: gradient
+c
       include 'INCL.H'
-      integer ngbvr
-
-      integer nop
-
-      integer nvr1
-
-      double precision esm
-
-      double precision vlvrn
-
-      double precision gdvr, gdsmey, gdsmrg
-
-      integer i, ii, j, ntlvr, n
-      
+
       dimension vlvrn(mxvr),gdvr(mxvr)
 
 
-! ------------------------ compile & new variables
+c ------------------------ compile & new variables
 
       ntlvr=ivrml1(ntlml)+nvrml(ntlml)-1
@@ -307,5 +278,5 @@
       endif
 
-! -------------------------- new minimz. gradient
+c -------------------------- new minimz. gradient
 
       call gradient()
@@ -337,6 +308,6 @@
         esm=eysm
 
-        write (logString, '(a,i5,a,2(e13.6,a))') ' Step ',nop,
-     &                    ': energy ', esm, '  (',gdsmey,' )'
+        write (*,'(a,i5,a,2(e13.6,a))') ' Step ',nop,': energy ',esm
+     #                                 ,'  (',gdsmey,' )'
 
       else
@@ -356,6 +327,6 @@
         esm=wtey*eysm+wtrg*eyrg
 
-        write (logString, '(a,i5,a,3(e13.6,a))') ' Step ',nop,
-     &             ': energy ',esm,'  (',gdsmey,',',gdsmrg,' )'
+        write (*,'(a,i5,a,3(e13.6,a))') ' Step ',nop,': energy ',esm
+     #                                 ,'  (',gdsmey,',',gdsmrg,' )'
 
       endif
Index: minqsn.f
===================================================================
--- minqsn.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ minqsn.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,86 +1,77 @@
-! **************************************************************
-!
-! This file contains the subroutines: minqsn,mc11a,mc11e
-!
-! 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: minqsn,mc11a,mc11e
+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 **************************************************************
 
       subroutine minqsn(n,mxn,x,f,g,scal,acur,h,d,w,xa,ga,xb,gb,maxfun,
-     &                  nfun)
-
-! .............................................................
-!  PURPOSE: Quasi-Newton minimizer
-!
-!           Unconstrained local minimization of function FUNC
-!           vs. N variables by quasi-Newton method using BFGS-
-!           formula to update hessian matrix; approximate line
-!           searches performed using cubic extra-/interpolation
-!           [see Gill P.E., Murray W., Wright M.H., Practical
-!            Optimization, Ch. 2.2.5.7, 4.3.2.1 ff.,4.4.2.2.,
-!            4.5.2.1]
-!
-!  INPUT:   X,F,G - variables, value of FUNC, gradient at START
-!           SCAL  - factors to reduce(increase) initial step &
-!                   its lower bound for line searches, diagonal
-!                   elements of initial hessian matrix
-!           MXN - maximal overall number of function calls
-!
-!  OUTPUT:  X,F,G - variables, value of FUNC, gradient at MINIMUM
-!           NFUN  - overall number of function calls used
-!  
-!  ARRAYS:  H - approximate hessian matrix in symmetric storage
-!               (dimension N(N+1)/2)
-!           W,D,XA,XB,GA,GB - dimension N
-!
-!  CALLS:   MOVE - external to calculate function for current X
-!                  and its gradients
-!           MC11E- solve system H*D=-G for search direction D, where
-!                  H is given in Cholesky-factorization
-!           MC11A- update H using BFGS formula, factorizise new H
-!                  according to Cholesky (modified to maintain its
-!                  positive definiteness)
-!
-!  PARAMETERS:
-!  
-!  EPS1 - checks reduction of FUNC during line search
-!         ( 0.0001 <= EPS1 < 0.5 )
-!  EPS2 - controls accuracy of line search (reduce to increase
-!         accuracy; EPS1 < EPS2 <= 0.9 )
-!  ACUR - fractional precision for determination of variables
-!         (should not be smaller than sqrt of machine accuracy)
-!  TINY - prevent division by zero during cubic extrapolation
-! .............................................................
-
-      implicit none
-
-      double precision eps1, eps2, tiny, zero, dff, c, g, scal, h, fa, f
-      double precision xa, x, ga, d, w, dga, di, fmin, gmin, stmin
-      double precision stepub, steplb, acur, step, xb, fb, gb, gl1, gl2
-      double precision si, dgb, sig
-
-      integer izero, ione, mxn, nfun, itr, i, n, n1, i1, j, isfv, maxfun
-      integer ir
-
-      character(255) logString
-      
+     #                  nfun)
+
+c .............................................................
+c  PURPOSE: Quasi-Newton minimizer
+c
+c           Unconstrained local minimization of function FUNC
+c           vs. N variables by quasi-Newton method using BFGS-
+c           formula to update hessian matrix; approximate line
+c           searches performed using cubic extra-/interpolation
+c           [see Gill P.E., Murray W., Wright M.H., Practical
+c            Optimization, Ch. 2.2.5.7, 4.3.2.1 ff.,4.4.2.2.,
+c            4.5.2.1]
+c
+c  INPUT:   X,F,G - variables, value of FUNC, gradient at START
+c           SCAL  - factors to reduce(increase) initial step &
+c                   its lower bound for line searches, diagonal
+c                   elements of initial hessian matrix
+c           MXN - maximal overall number of function calls
+c
+c  OUTPUT:  X,F,G - variables, value of FUNC, gradient at MINIMUM
+c           NFUN  - overall number of function calls used
+c  
+c  ARRAYS:  H - approximate hessian matrix in symmetric storage
+c               (dimension N(N+1)/2)
+c           W,D,XA,XB,GA,GB - dimension N
+c
+c  CALLS:   MOVE - external to calculate function for current X
+c                  and its gradients
+c           MC11E- solve system H*D=-G for search direction D, where
+c                  H is given in Cholesky-factorization
+c           MC11A- update H using BFGS formula, factorizise new H
+c                  according to Cholesky (modified to maintain its
+c                  positive definiteness)
+c
+c  PARAMETERS:
+c  
+c  EPS1 - checks reduction of FUNC during line search
+c         ( 0.0001 <= EPS1 < 0.5 )
+c  EPS2 - controls accuracy of line search (reduce to increase
+c         accuracy; EPS1 < EPS2 <= 0.9 )
+c  ACUR - fractional precision for determination of variables
+c         (should not be smaller than sqrt of machine accuracy)
+c  TINY - prevent division by zero during cubic extrapolation
+c .............................................................
+
+      implicit real*8 (a-h,o-z)
+      implicit integer*4 (i-n)
+
       parameter ( eps1=0.1d0,
-     &            eps2=0.7d0,
-     &            tiny=1.d-32,
-
-     &            zero=0.d0,
-     &            izero=0,
-     &            ione=1 )
+     #            eps2=0.7d0,
+     #            tiny=1.d-32,
+
+     #            zero=0.d0,
+     #            izero=0,
+     #            ione=1 )
 
       dimension x(mxn),g(mxn),scal(mxn),h(mxn*(mxn+1)/2),d(mxn),w(mxn),
-     &          xa(mxn),ga(mxn),xb(mxn),gb(mxn)
+     #          xa(mxn),ga(mxn),xb(mxn),gb(mxn)
 
       nfun=0
       itr=0
       dff=0.
-! _______________ hessian to a diagonal matrix depending on scale
+c _______________ hessian to a diagonal matrix depending on scale
       c=0.
       do i=1,n
@@ -111,5 +102,5 @@
     2 itr=itr+1    ! Start New Line-search from A
 
-! ______________ search direction of the iteration
+c ______________ search direction of the iteration
       do i=1,n
         d(i)=-ga(i)
@@ -135,5 +126,5 @@
       steplb=acur*c       ! lower bound on step
 
-! ________________________ initial step of the line search
+c ________________________ initial step of the line search
       if (dff.gt.0.) then
         step=min(1.d0,(dff+dff)/(-dga))
@@ -143,5 +134,5 @@
 
     3 if (nfun.ge.maxfun) then
-!c        write (logString, *) ' minfor> exceeded max. number of function calls'
+cc        write (*,*) ' minfor> exceeded max. number of function calls'
         return
       endif
@@ -168,5 +159,5 @@
           if (gl2.ge.gl1) goto 4
         endif
-! ______________ store function value if it is smallest so far
+c ______________ store function value if it is smallest so far
         f=fb
         do i=1,n
@@ -191,5 +182,5 @@
         stepub=stepub-step      ! new upper bound on step
 
-! _______________________________ next step by extrapolation
+c _______________________________ next step by extrapolation
         if (stepub.gt.0.) then
           step=.5*stepub
@@ -225,6 +216,5 @@
             goto 2
           else               ! rank of new matrix is deficient
-            write (logString, *) 
-     &       ' minfor> rank of hessian < number of variables'
+            write (*,*) ' minfor> rank of hessian < number of variables'
             return
           endif
@@ -254,14 +244,11 @@
       return
       end
-! ***********************************************
+c ***********************************************
       subroutine mc11a(a,n,mxn,z,sig,w,ir,mk,eps)
-!
-! CALLS: none
-!
-      implicit none
-
-      double precision sig, ti, w, z, a, v, eps, tim, al, r, b, gm, y
-
-      integer mxn, n, ir, np, ij, mk, i, j, mm
+c
+c CALLS: none
+c
+      implicit real*8 (a-h,o-z)
+      implicit integer*4 (i-n)
 
       dimension a(mxn*(mxn+1)/2),z(mxn),w(mxn)
@@ -381,13 +368,11 @@
       return
       end
-! ************************************
+c ************************************
       subroutine mc11e(a,n,mxn,z,w,ir)
-!
-! CALLS: none
-!
-      implicit none
-      double precision w, z, v, a
-
-      integer mxn, ir, n, i, ij, i1, j, np, nip, ii, ip
+c
+c CALLS: none
+c
+      implicit real*8 (a-h,o-z)
+      implicit integer*4 (i-n)
 
       dimension a(mxn*(mxn+1)/2),z(mxn),w(mxn)
Index: mklist.f
===================================================================
--- mklist.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ mklist.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,38 +1,32 @@
-! **************************************************************
-!
-! This file contains the subroutines: mklist,quench
-!
-! 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: mklist,quench
+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 **************************************************************
 
       subroutine mklist(nml)
 
-! ......................................................................
-! PURPOSE: Compile interaction lists ('1-4' according to Scheraga)
-!
-! CALLS: quench
-! ......................................................................
-! TODO: Calculate van-der-Waals regions over all molecules.
+c ......................................................................
+c PURPOSE: Compile interaction lists ('1-4' according to Scheraga)
+c
+c CALLS: quench
+c ......................................................................
+c TODO: Calculate van-der-Waals regions over all molecules.
       include 'INCL.H'
-      integer nml
-
-      integer mxh, mx2, l1st1, l1st2, l2nd1, l2nd2, l1i, l2i
+
       parameter (mxh=50,         ! max. # of atom regions
-     &           mx2=50)
+     #           mx2=50)
 
       logical ovlp,quench
 
       dimension l1st1(mxh),l1st2(mxh),l2nd1(mxh),l2nd2(mxh)
-     &         ,l1i(mxbd),l2i(mx2)
-
-      integer ia, i, i1s, i2s, ibd, ib, ifivr, ifiat, ilaat, im, ilavr,
-     &        iob, io, ioiob, iow, it, is, iv, jbd, j, n1i, n14, n1st,
-     &        n2nd, n2i, ntlms, nvw
-
-! _______________________ indices of 1st vdw-region/14-partner for 'nml'
+     #         ,l1i(mxbd),l2i(mx2)
+
+c _______________________ indices of 1st vdw-region/14-partner for 'nml'
       if (nml.eq.1) then
         ivwml1(1)=1
@@ -45,6 +39,6 @@
       ntlms=nmsml(nml)
       if (ntlms.eq.0) then
-        write (logString, '(a,i4)')
-     &           ' mklist> No mov. sets defined in molecule #',nml
+        write (*,'(a,i4)')
+     #           ' mklist> No mov. sets defined in molecule #',nml
         nvwml(nml)=0
         n14ml(nml)=0
@@ -54,13 +48,13 @@
       nvw=ivwml1(nml)-1     ! # of vdw-regions we have so far
       n14=i14ml1(nml)-1     ! # of 14-partners      -"-
-! First atom in molecule
+c First atom in molecule
       ifiat=iatrs1(irsml1(nml))
-! Last atom in molecule
+c Last atom in molecule
       ilaat=iatrs2(irsml2(nml))
-! First variable in molecule
+c First variable in molecule
       ifivr=ivrml1(nml)
-! Last variable in molecule
+c Last variable in molecule
       ilavr=ifivr+nvrml(nml)-1
-! ____________________________ initialize: 1st vdw-region & 14-partner per atom 
+c ____________________________ initialize: 1st vdw-region & 14-partner per atom 
       do i=ifiat,ilaat
         ivwat1(i)=0         !!!  for some atoms ...
@@ -80,9 +74,9 @@
         if ((i2s-i1s+1).gt.0) then
 
-! ____________ exclude mov.sets of var. 'iv' from 1ST list of interact.partn.
+c ____________ exclude mov.sets of var. 'iv' from 1ST list of interact.partn.
           do is=i1s,i2s
             ovlp=quench(latms1(is),latms2(is),n1st,mxh,l1st1,l1st2)
           enddo
-! _______________________________ intitialize 2ND list with current 1ST list
+c _______________________________ intitialize 2ND list with current 1ST list
           do i=1,n1st
             l2nd1(i)=l1st1(i)
@@ -90,5 +84,5 @@
           enddo
           n2nd=n1st
-! _________________________________ exclude 'ib' of var. 'iv' from 2ND list
+c _________________________________ exclude 'ib' of var. 'iv' from 2ND list
           ib=iowat(iatvr(iv))
           ovlp=quench(ib,ib,n2nd,mxh,l2nd1,l2nd2)
@@ -100,14 +94,13 @@
             ovlp=quench(iob,iob,n2nd,mxh,l2nd1,l2nd2) ! & in 2ND list
 
-! _____ atoms branching from 'iob': into GENERAL list of 1-4 partners
+c _____ atoms branching from 'iob': into GENERAL list of 1-4 partners
             do i=1,nbdat(iob)
               ibd=ibdat(i,iob)
               if (ibd.ne.ib.and.iowat(ibd).eq.iob.and.
-     &            quench(ibd,ibd,n2nd,mxh,l2nd1,l2nd2) ) then
+     #            quench(ibd,ibd,n2nd,mxh,l2nd1,l2nd2) ) then
                 n2i=n2i+1
                 if (n2i.gt.mx2) then
-                  write(logString, '(a,i3,2a)')  ' mklist> Molecule # ',
-     &                nml,
-     &                ': too many atoms bound to ',nmat(iob)
+                  write (*,'(a,i3,2a)')  ' mklist> Molecule # ',nml,
+     #                ': too many atoms bound to ',nmat(iob)
                   stop
                 endif
@@ -115,6 +108,6 @@
               endif
             enddo  ! ... branches of 'iob'
-! ____________________________ check for further '1-4' partners
-!                              connected to branches 'l2i'
+c ____________________________ check for further '1-4' partners
+c                              connected to branches 'l2i'
             do i=1,n2i
               ia=l2i(i)
@@ -123,10 +116,9 @@
                 do j=latms1(im),latms2(im)
                   if (ia.ne.j.and.
-     &                quench(j,j,n2nd,mxh,l2nd1,l2nd2) ) then
+     #                quench(j,j,n2nd,mxh,l2nd1,l2nd2) ) then
                     n2i=n2i+1
                     if (n2i.gt.mx2) then
-                      write (logString, '(a,i3,a)')  
-     &                         ' mklist> Molecule # '
-     &                         ,nml,': too many atoms in list L2I'
+                      write (*,'(a,i3,a)')  ' mklist> Molecule # '
+     #                         ,nml,': too many atoms in list L2I'
                       stop
                     endif
@@ -137,5 +129,5 @@
             enddo
 
-! ____ If 'iow(iob)' exists and in 2ND list: into GENERAL list of 1-4 partners
+c ____ If 'iow(iob)' exists and in 2ND list: into GENERAL list of 1-4 partners
             ioiob=iowat(iob)    !  existence of iow( iow(base) )
             if (ioiob.gt.0) then
@@ -143,6 +135,6 @@
                 n2i=n2i+1
                 if (n2i.gt.mx2) then
-                  write (logString, '(a,i3,2a)')  ' mklist> Molecule # '
-     &             ,nml,': too many atoms bound to ',nmat(iob)
+                  write (*,'(a,i3,2a)')  ' mklist> Molecule # '
+     #             ,nml,': too many atoms bound to ',nmat(iob)
                   stop
                 endif
@@ -158,29 +150,27 @@
           endif
 
-! ______ Atoms bound to 'ib' & in 2ND list(=are NOT in m.s of 'iv'):
-!                    exclude from 2ND list & put in list 'l1i'
+c ______ Atoms bound to 'ib' & in 2ND list(=are NOT in m.s of 'iv'):
+c                    exclude from 2ND list & put in list 'l1i'
           n1i=0
           do i=1,nbdat(ib)
             ibd=ibdat(i,ib)
             if (iowat(ibd).eq.ib.and.
-     &        quench(ibd,ibd,n2nd,mxh,l2nd1,l2nd2) ) then
+     #        quench(ibd,ibd,n2nd,mxh,l2nd1,l2nd2) ) then
               n1i=n1i+1
               if (n1i.gt.mxbd) then
-                write (logString, '(a,i3,2a)')  ' mklist> Molecule # ',
-     &              nml,
-     &             ': too many atoms bound to ',nmat(ib)
+                write (*,'(a,i3,2a)')  ' mklist> Molecule # ',nml,
+     #             ': too many atoms bound to ',nmat(ib)
                 stop
               endif
               l1i(n1i)=ibd
-! _______ add atoms branching from 'l1i'-atoms to GENERAL list 1-4 partners
+c _______ add atoms branching from 'l1i'-atoms to GENERAL list 1-4 partners
               do j=1,nbdat(ibd)
                 jbd=ibdat(j,ibd)
                 if (iowat(jbd).eq.ibd.and.
-     &              quench(jbd,jbd,n2nd,mxh,l2nd1,l2nd2) ) then
+     #              quench(jbd,jbd,n2nd,mxh,l2nd1,l2nd2) ) then
                   n2i=n2i+1
                   if (n2i.gt.mx2) then
-                    write (logString, '(a,i3,2a)')  
-     &                 ' mklist> Molecule # ',nml,
-     &                 ': too many atoms bound to branches of ',nmat(ib)
+                    write (*,'(a,i3,2a)')  ' mklist> Molecule # ',nml,
+     #              ': too many atoms bound to branches of ',nmat(ib)
                     stop
                   endif
@@ -190,6 +180,6 @@
             endif
           enddo
-! _____________________________ check for further '1-4' partners
-!                               belonging to moving set of base 'ib'
+c _____________________________ check for further '1-4' partners
+c                               belonging to moving set of base 'ib'
           im=ixmsat(ib)
           if (im.gt.0) then
@@ -198,7 +188,6 @@
                 n2i=n2i+1
                 if (n2i.gt.mx2) then
-                  write (logString, '(a,i3,a)')  ' mklist> Molecule # ',
-     &               nml,
-     &               ': too many atoms n list L2I '
+                  write (*,'(a,i3,a)')  ' mklist> Molecule # ',nml,
+     #            ': too many atoms n list L2I '
                   stop
                 endif
@@ -210,9 +199,8 @@
           do is=i1s,i2s
             do i=latms1(is),latms2(is)  ! ============= atoms in m.s of 'iv'
-! ________________________________________ Current 2ND list -> VdW-interact.
+c ________________________________________ Current 2ND list -> VdW-interact.
               if ((nvw+n2nd).gt.mxvw) then
-                write (logString, '(a,i4,a,i5)') ' mklist> Molecule # ',
-     &            nml,
-     &            ': Number of vdw-domains > ',mxvw
+                write (*,'(a,i4,a,i5)') ' mklist> Molecule # ',nml,
+     #            ': Number of vdw-domains > ',mxvw
                 stop
               endif
@@ -225,5 +213,5 @@
                 lvwat2(nvw)=l2nd2(j)
               enddo  ! ... vdW-domains
-! _________________________________________ General list of 1-4 partners
+c _________________________________________ General list of 1-4 partners
               if ((n14+n2i).gt.mx14) goto 1
               i14at1(i)=n14+1
@@ -233,6 +221,6 @@
                 l14at(n14)=l2i(j)
               enddo
-! __________________________________ Special cases of 1-4 interactions
-!                                    (list l1i, atoms iob,ib)
+c __________________________________ Special cases of 1-4 interactions
+c                                    (list l1i, atoms iob,ib)
               iow=iowat(i)
               if (iow.ne.ib) then
@@ -265,5 +253,5 @@
       nvwml(nml)=nvw-ivwml1(nml)+1
       n14ml(nml)=n14-i14ml1(nml)+1
-! _________________________________ some cleaning up
+c _________________________________ some cleaning up
       do i=ifiat,ilaat
         if (ivwat1(i).le.0) then
@@ -277,46 +265,45 @@
       enddo
 
-! ____________________________________________ Summary
-!      do i=ifiat,ilaat
-!        write (logString, '(3a,i5,a)') ' ######## atom ',nmat(i),'(',i,')'
-!        iv1=ivwat1(i)
-!        iv2=ivwat2(i)
-!        if (iv1.le.iv2) then
-!          write (logString, '(a)') ' ---> vdW :'
-!          do j=iv1,iv2
-!            write (logString, '(i5,a,i5)') lvwat1(j),'-',lvwat2(j)
-!          enddo
-!        endif
-!        i41=i14at1(i)
-!        i42=i14at2(i)
-!        if (i41.le.i42) then
-!          write (logString, '(a)') ' ---> 1-4 :'
-!          write (logString, '(10i5)') (l14at(j),j=i41,i42)
-!        endif
-!      enddo
+c ____________________________________________ Summary
+c      do i=ifiat,ilaat
+c        write (*,'(3a,i5,a)') ' ######## atom ',nmat(i),'(',i,')'
+c        iv1=ivwat1(i)
+c        iv2=ivwat2(i)
+c        if (iv1.le.iv2) then
+c          write(*,'(a)') ' ---> vdW :'
+c          do j=iv1,iv2
+c            write (*,'(i5,a,i5)') lvwat1(j),'-',lvwat2(j)
+c          enddo
+c        endif
+c        i41=i14at1(i)
+c        i42=i14at2(i)
+c        if (i41.le.i42) then
+c          write(*,'(a)') ' ---> 1-4 :'
+c          write(*,'(10i5)') (l14at(j),j=i41,i42)
+c        endif
+c      enddo
 
       return
 
-    1 write (logString, '(a,i4,a,i5)') ' mklist> Molecule # ',nml,
-     &                     ': Number of 1-4 interactions > ',mx14
+    1 write (*,'(a,i4,a,i5)') ' mklist> Molecule # ',nml,
+     #                     ': Number of 1-4 interactions > ',mx14
       stop
       end
-! *********************************************
+c *********************************************
       logical function quench(i1,i2,n,mx,l1,l2)
 
-! ....................................................
-! PURPOSE:  Correct size/number (n) of index ranges
-!           given by lists 'l1' & 'l2' in order to
-!           EXCLUDE overlaps with range 'i1-i2'
-!
-!           quench = true, if any overlap was obtained
-!
-! CALLS: none
-!
-! ....................................................
-
-      implicit none
-      integer mx, j, n, j1, l1, j2, l2, i1, i2, ja, k
-      character(255) logString
+c ....................................................
+c PURPOSE:  Correct size/number (n) of index ranges
+c           given by lists 'l1' & 'l2' in order to
+c           EXCLUDE overlaps with range 'i1-i2'
+c
+c           quench = true, if any overlap was obtained
+c
+c CALLS: none
+c
+c ....................................................
+
+      implicit integer*4 (i-n)
+
       dimension l1(mx),l2(mx)
 
@@ -340,5 +327,5 @@
               n=n+1
               if (n.gt.mx) then
-                write (logString, '(a)') ' quench> too many sets'
+                write (*,'(a)') ' quench> too many sets'
                 stop
               endif
Index: mulcan_par.f
===================================================================
--- mulcan_par.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ mulcan_par.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -5,6 +5,6 @@
 ! 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 Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+c                      Jan H. Meinke, Sandipan Mohanty
 !
 ! **************************************************************
@@ -83,6 +83,6 @@
 !
       eol = energy()
-      write (logString, '(a,e12.5,/)')  'Energy of start configuration: ',eol
-      write (logString, *)
+      write (*,'(a,e12.5,/)')  'Energy of start configuration: ',eol
+      write(*,*)
 
       call outpdb(1, 'start.pdb')
@@ -100,5 +100,5 @@
        muold = int(min(xmax,max(xmin,eol/ebin+sign(0.5d0,eol))))
        ihist(muold) = ihist(muold) + 1
-       write (logString, *) nsw, eol, acz
+       write (*,*) nsw, eol, acz
 !
 ! ITERATE MULTICANONICAL WEIGHTS EVERY NUP SWEEPS 
@@ -143,13 +143,13 @@
 ! FINAL OUTPUT:
       acz = acz/dble(nsw*nvr)
-      write (logString, *) 'last energy',eol
-      write (logString, *) 'aczeptance rate:',acz
+      write(*,*) 'last energy',eol
+      write(*,*) 'aczeptance rate:',acz
 !
 ! OUTPUT OF FINAL HISTOGRAM
 !
-      write (logString, *) 'Histogram:'
+      write(*,*) 'Histogram:'
       do i=kmin,kmax
        if(xhist(i).gt.0.0d0) then
-        write (logString, *) i,xhist(i)
+        write(*,*) i,xhist(i)
        end if
       end do
Index: mulcan_par_mod.f90
===================================================================
--- mulcan_par_mod.f90	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ mulcan_par_mod.f90	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -44,7 +44,5 @@
       real*8, intent(in) :: binWidth, temp
       logical,  intent(in) :: l_iter
-      
-      double precision :: grnd, addang, eol, energy
-      
+
       integer :: i,j
       integer :: iv,nsw,muold
@@ -103,6 +101,6 @@
 
       eol = energy()
-      write (logString, '(a,e12.5,/)')  'Energy of start configuration: ',eol
-      write (logString, *)
+      write (*,'(a,e12.5,/)')  'Energy of start configuration: ',eol
+      write(*,*)
 
       call outpdb(1, 'start.pdb')
@@ -158,11 +156,11 @@
 ! Final output
       acz = acz/dble(nsw*nvr)
-      write (logString, *) 'last energy',eol
-      write (logString, *) 'acceptance rate:',acz
-
-      write (logString, *) 'Histogram:'
+      write(*,*) 'last energy',eol
+      write(*,*) 'acceptance rate:',acz
+
+      write(*,*) 'Histogram:'
       do i=kmin,kmax
        if(xhist(i).gt.0.0d0) then
-        write (logString, *) i,xhist(i)
+        write(*,*) i,xhist(i)
        end if
       end do
@@ -216,8 +214,5 @@
       real*8, allocatable :: xhist(:),g1(:),ent(:)
       integer, allocatable :: ihist(:)
-      
-      double precision :: eol_old, x, grnd, addang, eol, energy, dham
-
-      integer :: nresi, nswm, nhy, nhx
+
       integer :: i,j
       integer :: iv,nsw,muold
@@ -244,5 +239,5 @@
 ! File with contact map of reference configuration
 ! FIXME: This must go. Reference structure needs to be read in main()
-      open(9,file='1vp.ref')
+      open(9,file='enkefa.ref')
 ! File with multicanonical parameter
       open(10,file='muca.d')
@@ -266,5 +261,5 @@
        end do
       end do
-      write (logString, *) 'Number of contacts in reference conformation:',nci
+      write(*,*) 'Number of contacts in reference conformation:',nci
 
 ! Read in fields with multicanonical parameter
@@ -282,5 +277,5 @@
         vlvr(iv) = x
        end do
-       write (logString, *) 'Last iteration, energy:',nswm,eol_old
+       write(*,*) 'Last iteration, energy:',nswm,eol_old
       else
 ! _________________________________ random start
@@ -294,13 +289,13 @@
 
       eol = energy()
-      write (logString, '(e12.5,/)')  eol
+      write (*,'(e12.5,/)')  eol
       call contacts(nhy,nhx,dham)
-      write (logString, *) 'Number of contacts in start configuration:',nhy
-      write (logString, *) 'Number of native contacts in start configuration:',   &
+      write(*,*) 'Number of contacts in start configuration:',nhy
+      write(*,*) 'Number of native contacts in start configuration:',   &
      &            nhx
       do i=1,nresi
-       write (logString, '(62I1)') (ijcont(i,j), j=1,nresi)
-      end do
-      write (logString, *)
+       write(*,'(62I1)') (ijcont(i,j), j=1,nresi)
+      end do
+      write(*,*)
 
 
@@ -355,11 +350,11 @@
 
       acz = acz/dble(nsw*nvr)
-      write (logString, *) 'last energy',eol
-      write (logString, *) 'acceptance rate:',acz
+      write(*,*) 'last energy',eol
+      write(*,*) 'acceptance rate:',acz
 
 ! WRITE DOWN (UN-REWEIGHTED) HISTOGRAM OF MULTICANONICAL SIMULATION
       do i=kmin,kmax
        if(xhist(i).gt.0.0d0) then
-        write (logString, *) i,xhist(i)
+        write(*,*) i,xhist(i)
        end if
       end do
Index: mulcan_sim.f
===================================================================
--- mulcan_sim.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ mulcan_sim.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,24 +1,24 @@
-! **************************************************************
-!
-! This file contains the subroutines: mulcan_sim,muca_weight2
-!
-! 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: mulcan_sim,muca_weight2
+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 **************************************************************
 
       subroutine  mulcan_sim
-!
-! PURPOSE: PERFORM A MULTICANONICAL SIMULATION
-! REQUIRES AS INPUT THE MULTICANONICAL PARAMETER AS CALCULATED
-! BY THE SUBROUTINE mulcan_par
-!
-! CALLS: addang, contacts,energy,metropolis
-!
+C
+C PURPOSE: PERFORM A MULTICANONICAL SIMULATION
+C REQUIRES AS INPUT THE MULTICANONICAL PARAMETER AS CALCULATED
+C BY THE SUBROUTINE mulcan_par
+C
+c CALLS: addang, contacts,energy,metropolis
+c
       include 'INCL.H'
 
-!     external rand
+c     external rand
       external muca_weight2
 
@@ -29,15 +29,15 @@
       parameter(nsweep=100000,nequi=100)
       Parameter(nsave=1000,nmes=10)
-!
-!     restart: .true. =  restart of simulation
-!              .false. = start of simulation with random configuration
-!     kmin,kmax: Range of multicanonical parameter
-!     ebin:      bin size for multicanonical parameter
-!     nequi: Number of sweeps for equilibrisation
-!     nsweep:  Number of sweeps for simulation run
-!     nsave:  Number of sweeps after which actual configuration is saved
-!             for re-starts
-!     nmes: Number of sweeps between measurments
-!
+C
+C     restart: .true. =  restart of simulation
+C              .false. = start of simulation with random configuration
+C     kmin,kmax: Range of multicanonical parameter
+C     ebin:      bin size for multicanonical parameter
+C     nequi: Number of sweeps for equilibrisation
+C     nsweep:  Number of sweeps for simulation run
+C     nsave:  Number of sweeps after which actual configuration is saved
+C             for re-starts
+C     nmes: Number of sweeps between measurments
+C
 
       dimension xhist(kmin:kmax),ihist(kmin:kmax)
@@ -45,11 +45,11 @@
 
  
-! FILE with last conformation (for re-starts)
+C FILE with last conformation (for re-starts)
       open(8,file='EXAMPLES/start.d')
-! File with contact map of reference configuration
+C File with contact map of reference configuration
       open(9,file='EXAMPLES/enkefa.ref')
-! File with multicanonical parameter
+C File with multicanonical parameter
       open(10,file='EXAMPLES/muca.d')
-! Result file: Time series of certain quantities
+C Result file: Time series of certain quantities
       open(11, file='EXAMPLES/time.d')
 
@@ -60,7 +60,7 @@
 
       nresi=irsml2(1)-irsml1(1) + 1
-!     nresi:  Number of residues
-
-! READ  REFERENCE CONTACT MAP
+c     nresi:  Number of residues
+
+C READ  REFERENCE CONTACT MAP
       nci = 0
       do i=1,nresi
@@ -72,11 +72,11 @@
        end do
       end do
-      write (logString, *) 'Number of contacts in reference conformation:',nci
-
-! READ IN FIELDS WITH MULTICANONICAL PARAMETER
+      write(*,*) 'Number of contacts in reference conformation:',nci
+
+C READ IN FIELDS WITH MULTICANONICAL PARAMETER
       Do j=kmin,kmax
        read(10,*) i,b(i),alpha(i)
       end do
-!
+C
 
       if(restart) then
@@ -88,7 +88,7 @@
         vlvr(iv) = x
        end do
-       write (logString, *) 'Last iteration, energy:',nswm,eol_old
+       write(*,*) 'Last iteration, energy:',nswm,eol_old
       else
-! _________________________________ random start
+c _________________________________ random start
        do i=1,nvr
         iv=idvr(i)  ! provides index of non-fixed variable
@@ -98,20 +98,20 @@
        enddo
       end if
-!
+c
       eol = energy()
-      write (logString, '(e12.5,/)')  eol
+      write (*,'(e12.5,/)')  eol
       call contacts(nhy,nhx,dham)
-      write (logString, *) 'Number of contacts in start configuration:',nhy
-      write (logString, *) 'Number of native contacts in start configuration:',
+      write(*,*) 'Number of contacts in start configuration:',nhy
+      write(*,*) 'Number of native contacts in start configuration:',
      &            nhx
       do i=1,nresi
-       write (logString, '(62I1)') (ijcont(i,j), j=1,nresi)
-      end do
-      write (logString, *)
-!
+       write(*,'(62I1)') (ijcont(i,j), j=1,nresi)
+      end do
+      write(*,*)
+C
 
       
       if(.not.restart) then
-! =====================Equilibrization by  Metropolis
+c =====================Equilibrization by  Metropolis
        do nsw=1,nequi
         call metropolis(eol,acz,muca_weight2)
@@ -123,15 +123,15 @@
       end if
 
-!======================Simulation
+C======================Simulation
       acz = 0.0d0
-! LOOP OVER SWEEPS
+C LOOP OVER SWEEPS
       do nsw=nswm,nsweep
-!
-! METROPOLIS UPDATE
+C
+C METROPOLIS UPDATE
        call metropolis(eol,acz,muca_weight2)
        muold = min(kmax,max(kmin,int(eol/ebin+sign(0.5d0,eol))))
        ihist(muold) = ihist(muold) + 1
-!
-!  SAVE ACTUAL CONFORMATIONS FOR RE-STARTS:
+C
+C  SAVE ACTUAL CONFORMATIONS FOR RE-STARTS:
        if(mod(nsw,nsave).eq.0) then
         rewind 8
@@ -143,36 +143,36 @@
         end do
        end if
-! Measurements after NMES sweeps
+C Measurements after NMES sweeps
        if(mod(nsw,nmes).eq.0) then
-! Take a histogram of energy
+C Take a histogram of energy
         do i=kmin,kmax
          xhist(i) = xhist(i) + ihist(i)
          ihist(i) = 0
         end do
-! Calculate contacts in actual configuartion and compare with reference
-! configuration
-!       call contacts(nhx,nhy,dham)
-! nhx : Number of contcats in actual conformation
-! nhy : Number of contacts which are identical in actual and reference 
-!       configuration
-! dham:  Hamming distance between actual and reference configuration      
-!
+c Calculate contacts in actual configuartion and compare with reference
+C configuration
+c       call contacts(nhx,nhy,dham)
+C nhx : Number of contcats in actual conformation
+C nhy : Number of contacts which are identical in actual and reference 
+C       configuration
+C dham:  Hamming distance between actual and reference configuration      
+C
         write(11,'(i7,f12.2,2i8,f12.4)')  nsw,eol,nhx,nhy,dham
        end if
       end do
-! END OF SIMULATION
-
-! FINAL OUTPUT:
+C END OF SIMULATION
+
+C FINAL OUTPUT:
       acz = acz/dble(nsw*nvr)
-      write (logString, *) 'last energy',eol
-      write (logString, *) 'aczeptance rate:',acz
-
-! WRITE DOWN (UN-REWEIGHTED) HISTOGRAM OF MULTICANONICAL SIMULATION
+      write(*,*) 'last energy',eol
+      write(*,*) 'aczeptance rate:',acz
+
+C WRITE DOWN (UN-REWEIGHTED) HISTOGRAM OF MULTICANONICAL SIMULATION
       do i=kmin,kmax
        if(xhist(i).gt.0.0d0) then
-        write (logString, *) i,xhist(i)
+        write(*,*) i,xhist(i)
        end if
       end do
-! =====================
+c =====================
       close(8)
       close(9)
@@ -183,5 +183,5 @@
       end
 
-! ************************************************************
+c ************************************************************
       real*8 function muca_weight2(x)
 
Index: nursvr.f
===================================================================
--- nursvr.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ nursvr.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,23 +1,21 @@
-!**************************************************************
-!
-! This file contains the subroutines: nursvr, nursat
-!
-! 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: nursvr, nursat
+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 **************************************************************
       integer*4 function nursvr(ivr)
 
-! ...........................................................
-!  PURPOSE: defines index of residue for given variable 'ivr'
-!
-!  CALLS: none
-!
-! ...........................................................
+c ...........................................................
+c  PURPOSE: defines index of residue for given variable 'ivr'
+c
+c  CALLS: none
+c
+c ...........................................................
       include 'INCL.H'
-
-      integer i, ifirs, ivr, j
 
       do i=ntlml,1,-1
@@ -33,20 +31,17 @@
       enddo
 
-      write (logString, '(a,i5)') ' nursvr > Cannot find variable # '
-     &   ,ivr
+      write (*,'(a,i5)') ' nursvr > Cannot find variable # ',ivr
       stop
 
       end
 
-! **********************************
+c **********************************
       integer*4 function nursat(iat)
 
-! .......................................................
-!  PURPOSE: defines index of residue for given atom 'iat'
-! .......................................................
+c .......................................................
+c  PURPOSE: defines index of residue for given atom 'iat'
+c .......................................................
 
       include 'INCL.H'
-
-      integer i, ifirs, ilars, iat, j
 
       do i=1,ntlml
@@ -71,5 +66,5 @@
       enddo
 
-      write (logString, '(a,i5)') ' nursat > Cannot find atom # ',iat
+      write (*,'(a,i5)') ' nursat > Cannot find atom # ',iat
       stop
 
Index: opeflx.f
===================================================================
--- opeflx.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ opeflx.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,53 +1,34 @@
-! **************************************************************
-!
-! This file contains the subroutines: opeflx,gdtflx
-!
-! 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: opeflx,gdtflx
+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 **************************************************************
 
       subroutine opeflx(nml)
 
-! ......................................................................
-! PURPOSE: Calculate internal energy for FLEX dataset and its partial
-!          derivatives vs. variables using recursive algorithm from:
-!          Noguti T, Go N, J Phys Soc (Japan) v52 3685-3690 1984; Abe H,
-!          Braun W, Noguti T, Go N, Comp Chem v8 239-247 1984; Mazur A K,
-!          Abagyan R A, J Biomol Struct Dyn v6 815-832, which I modified
-!          for atomic forces instead of simple derivatives (see Lavery R,
-!          Sklenar H, Zakrzewska K, Pullman B, J Biomol Struct Dyn v3
-!          989-1014 1986)
-!
-! CALLS:   gdtflx
-! ......................................................................
+c ......................................................................
+c PURPOSE: Calculate internal energy for FLEX dataset and its partial
+c          derivatives vs. variables using recursive algorithm from:
+c          Noguti T, Go N, J Phys Soc (Japan) v52 3685-3690 1984; Abe H,
+c          Braun W, Noguti T, Go N, Comp Chem v8 239-247 1984; Mazur A K,
+c          Abagyan R A, J Biomol Struct Dyn v6 815-832, which I modified
+c          for atomic forces instead of simple derivatives (see Lavery R,
+c          Sklenar H, Zakrzewska K, Pullman B, J Biomol Struct Dyn v3
+c          989-1014 1986)
+c
+c CALLS:   gdtflx
+c ......................................................................
 
       include 'INCL.H'
 
-      integer nml
-      
-      double precision enyflx
-      
-      integer ims, i1a, i14, i1, i, i1s, i2s, i2, i2a, j, io, ifivr
-      integer iad, ia, ib, ic, ilavr, ijhb, iowh, it, ity, iv, ivw, jty
-      integer jowh, lad, ntlvr
-      double precision cqi,c, ep, e0, deyds, cqiqj, eynw, eyol, deel
-      double precision ex, cth, dhb, deyrp, eel, eyds, ey, eyrp, ez
-      double precision fvr, hhb, gda, gdn, vrn, p, py, px, pz, yfiv
-      
-      double precision rij6, rij12, rij, rij2, sr, sr2, vr, xti
-      double precision xb, xj, xfriv, xfiv, xfi, xfji, xij, xi, xsr
-      double precision yb, yfi, yfji, yfriv, yi, yij, yj, zfi, yti
-      double precision zb, zfiv, zfji, zfriv, zij, zi, zj, zti, del
-  
-      
-      double precision xfat, yfat, zfat, xtat, ytat, ztat, xfvr, yfvr
-      double precision zfvr, xfrvr, yfrvr, zfrvr
       dimension xfat(mxat),yfat(mxat),zfat(mxat),
-     &          xtat(mxat),ytat(mxat),ztat(mxat),
-     &          xfvr(mxvr),yfvr(mxvr),zfvr(mxvr),
-     &          xfrvr(mxvr),yfrvr(mxvr),zfrvr(mxvr)
+     #          xtat(mxat),ytat(mxat),ztat(mxat),
+     #          xfvr(mxvr),yfvr(mxvr),zfvr(mxvr),
+     #          xfrvr(mxvr),yfrvr(mxvr),zfrvr(mxvr)
 
 
@@ -60,6 +41,6 @@
       ntlvr=nvrml(nml)
       if (ntlvr.eq.0) then
-        write (logString, '(a,i4)')
-     &           ' opeflx> No variables defined in molecule #',nml
+        write (*,'(a,i4)')
+     #           ' opeflx> No variables defined in molecule #',nml
         return
       endif
@@ -136,5 +117,5 @@
         endif
 
-! ============================================ Energies & Atomic forces
+c ============================================ Energies & Atomic forces
 
         xfiv=0.d0
@@ -268,5 +249,5 @@
                     yfji=yfji+ dhb*py+ hhb*yij
                     zfji=zfji+ dhb*pz+ hhb*zij
-! __________________________________________________ No Hydrogen Bond
+c __________________________________________________ No Hydrogen Bond
                   else
                     eyvw=eyvw+eyrp-eyds
@@ -384,5 +365,5 @@
                   yfji=yfji+ dhb*py+ hhb*yij
                   zfji=zfji+ dhb*pz+ hhb*zij
-! __________________________________________________ No Hydrogen Bond
+c __________________________________________________ No Hydrogen Bond
                 else
                   eyvw=eyvw+eyrp-eyds
@@ -443,6 +424,6 @@
 
           gdeyvr(iv)= (ey*zb-ez*yb)*xfiv+(ez*xb-ex*zb)*yfiv+
-     &                (ex*yb-ey*xb)*zfiv
-     &               +ex*xfriv+ey*yfriv+ez*zfriv -fvr
+     #                (ex*yb-ey*xb)*zfiv
+     #               +ex*xfriv+ey*yfriv+ez*zfriv -fvr
 
         elseif (it.eq.1) then         ! b.length
@@ -460,27 +441,22 @@
       return
       end
-! *****************************
+c *****************************
       subroutine gdtflx(nml,iv)
 
-! .....................................................................
-! PURPOSE: calculate partial derivative of internal energy for molecule
-!          'nml' vs. variable 'iv' NUMERICALLY and compare with
-!          its value obtained analytically
-!
-! CALLS:  setvar, enyflx
-! .....................................................................
+c .....................................................................
+c PURPOSE: calculate partial derivative of internal energy for molecule
+c          'nml' vs. variable 'iv' NUMERICALLY and compare with
+c          its value obtained analytically
+c
+c CALLS:  setvar, enyflx
+c .....................................................................
 
       include 'INCL.H'
 
-      integer nml, iv, it, i
-      double precision enyflx
-      
-      double precision del
       parameter (del=1.d-7)
 
-      double precision eynw, eyol, gda, gdn, ovr, vlvrx
       dimension vlvrx(mxvr)
 
-! ____________________________ get & save values of variables
+c ____________________________ get & save values of variables
       do i=1,ivrml1(ntlml)+nvrml(ntlml)-1
         it=ityvr(i)  ! type
@@ -504,8 +480,8 @@
       gda=gdeyvr(iv)         ! analytical der.
 
-      write (logString, '(1x,2a,2(e12.6,a))') nmvr(iv),': ',gda,' (',
-     &       abs(gda-gdn),')'
-
-! _________________________ restore
+      write (*,'(1x,2a,2(e12.6,a))') nmvr(iv),': ',gda,' (',
+     #       abs(gda-gdn),')'
+
+c _________________________ restore
       vlvrx(iv)=ovr
       call setvar(nml,vlvrx)
Index: opereg.f
===================================================================
--- opereg.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ opereg.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,51 +1,42 @@
-! **************************************************************
-!
-! This file contains the subroutines: opereg,gdtgbl,gdtreg
-!
-! 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: opereg,gdtgbl,gdtreg
+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 **************************************************************
 
       subroutine opereg(nml)
 
-! .......................................................................
-! PURPOSE: calculate regul. energy & it's partial derivatives
-!          for molecule 'nml' vs. variables 'iv'
-!
-!  NB: if the unit axis for an internal variable coincides with a
-!      global axis (i.e. for torsion or bond length variation round
-!      or along 'xrfax', respectively, and bd. angle var. round
-!      'zrfax'): VdW & 14 interaction partners of moving set atoms
-!      should be used for calculation, instead of the mov. sets,
-!      with opposite sign.
-!
-!      Example: By the the way the molecule-fixed system is set up,
-!               changes in Phi_1 affect atomic positions BEFORE the
-!               N-C^alpha bond relatively to the space-fixed system,
-!               not the moving set of Phi_1.
-!
-! CALLS:    gdtgbl, gdtreg
-! ......................................................................
+c .......................................................................
+c PURPOSE: calculate regul. energy & it's partial derivatives
+c          for molecule 'nml' vs. variables 'iv'
+c
+c  NB: if the unit axis for an internal variable coincides with a
+c      global axis (i.e. for torsion or bond length variation round
+c      or along 'xrfax', respectively, and bd. angle var. round
+c      'zrfax'): VdW & 14 interaction partners of moving set atoms
+c      should be used for calculation, instead of the mov. sets,
+c      with opposite sign.
+c
+c      Example: By the the way the molecule-fixed system is set up,
+c               changes in Phi_1 affect atomic positions BEFORE the
+c               N-C^alpha bond relatively to the space-fixed system,
+c               not the moving set of Phi_1.
+c
+c CALLS:    gdtgbl, gdtreg
+c ......................................................................
 
       include 'INCL.H'
       include 'INCP.H'
 
-      double precision xfvr, yfvr, zfvr, xfrvr, yfrvr, zfrvr, x1, y1, z1
-      double precision a, sa, ca, xk, yk, zk, xi, yi, zi, xji, yji, zji
-      double precision dx, dy, dz, x, y, z, xfat, yfat, zfat, xfrat
-      double precision yfrat, zfrat, xb, yb, zb, ex, ey, ez, xfiv, yfiv
-      double precision zfiv, xfriv, yfriv, zfriv
-
-      integer ntlvr, nml, ix2, ifivr, ilavr, i, ii, j, i1s, i1a, io, iv
-      integer it, ia, ib, i2s, ims, i1, i2, i2a, iad, lad, ivw, i14
-
       dimension xfat(mxat),yfat(mxat),zfat(mxat),
-     &          xfrat(mxat),yfrat(mxat),zfrat(mxat),
-
-     &          xfvr(mxvr),yfvr(mxvr),zfvr(mxvr),
-     &          xfrvr(mxvr),yfrvr(mxvr),zfrvr(mxvr)
+     #          xfrat(mxat),yfrat(mxat),zfrat(mxat),
+
+     #          xfvr(mxvr),yfvr(mxvr),zfvr(mxvr),
+     #          xfrvr(mxvr),yfrvr(mxvr),zfrvr(mxvr)
 
       logical   lnb
@@ -54,6 +45,6 @@
       ntlvr=nvrml(nml)
       if (ntlvr.eq.0) then
-        write (logString, '(a,i4)')
-     &           ' opereg> No variables defined in molecule #',nml
+        write (*,'(a,i4)')
+     #           ' opereg> No variables defined in molecule #',nml
         return
       endif
@@ -64,5 +55,5 @@
       ilavr=ifivr+ntlvr-1       ! last var. of 'nml'
 
-! --------------------------- initializations
+c --------------------------- initializations
       do i=ifivr,ilavr
         gdeyrg(i)=0.d0
@@ -109,5 +100,5 @@
 
           eyrg = eyrg + xji**2 + yji**2 + zji**2  ! The regularization energy is just
-                                                  ! the sum over the atom distances
+                                                  ! the sum over the atom distances 
                                                   ! squared.
 
@@ -116,5 +107,5 @@
           dz = 2.d0 * zji
 
-! =============================================== global pars.
+c =============================================== global pars.
 
           gdeygb(ii+1) = gdeygb(ii+1) - dx   ! d(E_ij) / d(x_i)
@@ -122,5 +113,5 @@
           gdeygb(ii+3) = gdeygb(ii+3) - dz   ! d(E_ij) / d(z_i)
 
-! -------------------------- r = r_i - r_1
+c -------------------------- r = r_i - r_1
           x = xi - x1
           y = yi - y1
@@ -132,7 +123,7 @@
 
           gdeygb(ii+6) = gdeygb(ii+6) +dx*(zk*y-yk*z)+dy*(xk*z-zk*x)  !  d(E_ij) / d(g)
-     &                                +dz*(yk*x-xk*y)
-
-! =============================================== for internal vars.
+     #                                +dz*(yk*x-xk*y)
+
+c =============================================== for internal vars.
 
           xfat(i) = dx
@@ -173,5 +164,5 @@
         zb=zat(ib)
 
-! ---------------------------------------- axis for var.
+c ---------------------------------------- axis for var.
 
         if (it.eq.3) then      ! torsion
@@ -288,6 +279,6 @@
 
           gdeyrg(iv)= (ey*zb-ez*yb)*xfiv+(ez*xb-ex*zb)*yfiv+
-     &                (ex*yb-ey*xb)*zfiv
-     &               +ex*xfriv+ey*yfriv+ez*zfriv
+     #                (ex*yb-ey*xb)*zfiv
+     #               +ex*xfriv+ey*yfriv+ez*zfriv
 
         elseif (it.eq.1) then         ! b.length
@@ -303,17 +294,13 @@
       return
       end
-! **************************
+c **************************
       subroutine gdtgbl(nml)
-!
-! CALLS: bldmol,enyreg
-!
-! -------------------------- gradtest for 'gbpr'
+C
+C CALLS: bldmol,enyreg
+c
+c -------------------------- gradtest for 'gbpr'
 
       include 'INCL.H'
 
-      double precision del, pro, gdn, enyreg
-
-      integer ii, nml, i
-
       parameter (del=1.d-7)
 
@@ -323,5 +310,5 @@
       do i = 1,6
 
-! ----------------------------- modify
+c ----------------------------- modify
         pro = gbpr(i,nml)
         gbpr(i,nml) = pro+del
@@ -330,7 +317,7 @@
         gdn = ( enyreg(nml) - eyrg ) / del
 
-        write (logString, *) ' Gb. var #',(ii+i),': ',gdeygb(ii+i),gdn,
-     &                                   abs(gdn-gdeygb(ii+i))
-! ----------------------------- restore
+        write (*,*) ' Gb. var #',(ii+i),': ',gdeygb(ii+i),gdn,
+     #                                   abs(gdn-gdeygb(ii+i))
+c ----------------------------- restore
         gbpr(i,nml) = pro
         call bldmol(nml)
@@ -340,26 +327,22 @@
       return
       end
-! *****************************
+c *****************************
       subroutine gdtreg(nml,iv)
 
-! .................................................................
-! PURPOSE: calculate partial derivative of reg. energy for molecule
-!          'nml' vs. variable 'iv' NUMERICALLY and compare with
-!          its value obtained analytically
-!
-! CALLS:  setvar, enyreg
-! .................................................................
+c .................................................................
+c PURPOSE: calculate partial derivative of reg. energy for molecule
+c          'nml' vs. variable 'iv' NUMERICALLY and compare with
+c          its value obtained analytically
+c
+c CALLS:  setvar, enyreg
+c .................................................................
 
       include 'INCL.H'
 
-      double precision del, vlvrx, ovr, eynw, enyreg, gdn, gda
-
-      integer i, it, iv, nml
-
       parameter (del=1.d-6)
 
       dimension vlvrx(mxvr)
 
-! ____________________________ get & save values of variables
+c ____________________________ get & save values of variables
       do i=1,ivrml1(ntlml)+nvrml(ntlml)-1
         it=ityvr(i)  ! type
@@ -382,8 +365,8 @@
       gda=gdeyrg(iv)         ! analytical der.
 
-      write (logString, '(1x,2a,2(e12.6,a))') nmvr(iv),': ',gda,' (',
-     &       abs(gda-gdn),')'
-
-! _________________________ restore vars
+      write (*,'(1x,2a,2(e12.6,a))') nmvr(iv),': ',gda,' (',
+     #       abs(gda-gdn),')'
+
+c _________________________ restore vars
       vlvrx(iv)=ovr
       call setvar(nml,vlvrx)
Index: opeshe.f
===================================================================
--- opeshe.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ opeshe.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,44 +1,33 @@
-! **************************************************************
-!
-! This file contains the subroutines: opeshe,gdtshe
-!
-! 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: opeshe,gdtshe
+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 **************************************************************
 
       subroutine opeshe(nml)
 
-! ......................................................................
-! PURPOSE: Calculate internal energy for ECEPP/3 dataset and its partial
-!          derivatives vs. variables using recursive algorithm from:
-!          Noguti T, Go N, J Phys Soc (Japan) v52 3685-3690 1984; Abe H,
-!          Braun W, Noguti T, Go N, Comp Chem v8 239-247 1984; Mazur A K,
-!          Abagyan R A, J Biomol Struct Dyn v6 815-832, which I modified
-!          for atomic forces instead of simple derivatives (see Lavery R,
-!          Sklenar H, Zakrzewska K, Pullman B, J Biomol Struct Dyn v3
-!          989-1014 1986)
-!
-! CALLS:   gdtshe 
-! ......................................................................
+c ......................................................................
+c PURPOSE: Calculate internal energy for ECEPP/3 dataset and its partial
+c          derivatives vs. variables using recursive algorithm from:
+c          Noguti T, Go N, J Phys Soc (Japan) v52 3685-3690 1984; Abe H,
+c          Braun W, Noguti T, Go N, Comp Chem v8 239-247 1984; Mazur A K,
+c          Abagyan R A, J Biomol Struct Dyn v6 815-832, which I modified
+c          for atomic forces instead of simple derivatives (see Lavery R,
+c          Sklenar H, Zakrzewska K, Pullman B, J Biomol Struct Dyn v3
+c          989-1014 1986)
+c
+c CALLS:   gdtshe 
+c ......................................................................
 
       include 'INCL.H'
-      
-      double precision eyds, c, cqi, e0, deel, eel, ep, ex, ey, eyrp, xb
-      double precision rij2, ez, fvr, rij, rij6, rij4, sr, sr2, vr, vrn
-      double precision xfat, xi, xfrvr, xfiv, xfi, xfji, xfriv, xfvr
-      double precision yfji, xsr, xij, yb, yfi, yfat, yfiv, zfriv, yi
-      double precision yfvr, yfriv, yfrvr, yij, zfat, zb, zfi, zfji
-      double precision zfiv, zfvr, zfrvr, zi, zij, del
-
-      integer nml, i, i2, i1, i1a, i14, i1s, i2s, i2a, iad, ia, ib, ic
-      integer ifivr, ilavr, ims, io, ity, it, iv, ivw, lad, j, jty
-      integer ntlvr
 
       dimension xfat(mxat),yfat(mxat),zfat(mxat),
-     &          xfvr(mxvr),yfvr(mxvr),zfvr(mxvr),
-     &          xfrvr(mxvr),yfrvr(mxvr),zfrvr(mxvr)
+     #          xfvr(mxvr),yfvr(mxvr),zfvr(mxvr),
+     #          xfrvr(mxvr),yfrvr(mxvr),zfrvr(mxvr)
 
 
@@ -51,6 +40,6 @@
       ntlvr=nvrml(nml)
       if (ntlvr.eq.0) then
-        write (logString, '(a,i4)')
-     &           ' opeshe> No variables defined in molecule #',nml
+        write (*,'(a,i4)')
+     #           ' opeshe> No variables defined in molecule #',nml
         return
       endif
@@ -127,5 +116,5 @@
         endif
 
-! ============================================ Energies & Atomic forces
+c ============================================ Energies & Atomic forces
 
         xfiv=0.d0
@@ -314,6 +303,6 @@
 
           gdeyvr(iv)= (ey*zb-ez*yb)*xfiv+(ez*xb-ex*zb)*yfiv+
-     &                (ex*yb-ey*xb)*zfiv
-     &               +ex*xfriv+ey*yfriv+ez*zfriv -fvr
+     #                (ex*yb-ey*xb)*zfiv
+     #               +ex*xfriv+ey*yfriv+ez*zfriv -fvr
 
         elseif (it.eq.1) then         ! b.length
@@ -331,29 +320,22 @@
       return
       end
-! *****************************
+c *****************************
       subroutine gdtshe(nml,iv)
 
-! .....................................................................
-! PURPOSE: calculate partial derivative of internal energy for molecule
-!          'nml' vs. variable 'iv' NUMERICALLY and compare with
-!          its value obtained analytically
-!
-! CALLS:  setvar, enyshe
-! .....................................................................
+c .....................................................................
+c PURPOSE: calculate partial derivative of internal energy for molecule
+c          'nml' vs. variable 'iv' NUMERICALLY and compare with
+c          its value obtained analytically
+c
+c CALLS:  setvar, enyshe
+c .....................................................................
 
       include 'INCL.H'
-      
-      integer nml
-
-      double precision del, eynw, eyol, gda, gdn, ovr, vlvrx
-      double precision enyshe
-
-      integer iv, i, it
-      
+
       parameter (del=1.d-7)
 
       dimension vlvrx(mxvr)
 
-! ____________________________ get & save values of variables
+c ____________________________ get & save values of variables
       do i=1,ivrml1(ntlml)+nvrml(ntlml)-1
         it=ityvr(i)  ! type
@@ -377,8 +359,8 @@
       gda=gdeyvr(iv)         ! analytical der.
 
-      write (logString, '(1x,2a,2(e12.6,a))') nmvr(iv),': ',gda,' (',
-     &       abs(gda-gdn),')'
-
-! _________________________ restore
+      write (*,'(1x,2a,2(e12.6,a))') nmvr(iv),': ',gda,' (',
+     #       abs(gda-gdn),')'
+
+c _________________________ restore
       vlvrx(iv)=ovr
       call setvar(nml,vlvrx)
Index: opesol.f
===================================================================
--- opesol.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ opesol.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,48 +1,41 @@
-! **************************************************************
-!
-! This file contains the subroutines:  opesol,gdtsol
-!
-! 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:  opesol,gdtsol
+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 **************************************************************
 
       subroutine opesol(nml)
 
-! ......................................................................
-! PURPOSE:  derivatives of solvatation energy vs. internal variables for
-!           molecule 'nml'
-!
-!  NB: if the unit axis for an internal variable coincides with a
-!      global axis (i.e. for torsion or bond length variation round
-!      or along 'xrfax', respectively, and bd. angle var. round
-!      'zrfax'): VdW & 14 interaction partners of moving set atoms
-!      should be used for calculation, instead of the mov. sets,
-!      with opposite sign.
-!
-!      Example: By the the way the molecule-fixed system is set up,
-!               changes in Phi_1 affect atomic positions BEFORE the
-!               N-C^alpha bond relatively to the space-fixed system,
-!               not the moving set of Phi_1.
-!
-! CALLS:    esolan, gdtsol
-! ......................................................................
+c ......................................................................
+c PURPOSE:  derivatives of solvatation energy vs. internal variables for
+c           molecule 'nml'
+c
+c  NB: if the unit axis for an internal variable coincides with a
+c      global axis (i.e. for torsion or bond length variation round
+c      or along 'xrfax', respectively, and bd. angle var. round
+c      'zrfax'): VdW & 14 interaction partners of moving set atoms
+c      should be used for calculation, instead of the mov. sets,
+c      with opposite sign.
+c
+c      Example: By the the way the molecule-fixed system is set up,
+c               changes in Phi_1 affect atomic positions BEFORE the
+c               N-C^alpha bond relatively to the space-fixed system,
+c               not the moving set of Phi_1.
+c
+c CALLS:    esolan, gdtsol
+c ......................................................................
 
       include 'INCL.H'
-      double precision xfvr, yfvr, zfvr, xfrvr, yfrvr, zfrvr, esolan, dx
-      double precision dy, dz, xfat, yfat, zfat, xi, yi, zi, xfrat
-      double precision yfrat, zfrat, xb, yb, zb, ex, ey, ez, xfiv, yfiv
-      double precision zfiv, xfriv, yfriv, zfriv
-
-      integer ntlvr, nml, ix2, ifivr, ilavr, i, i1s, i1a, io, iv, it, ia
-      integer ib, i2s, ims, i1, i2, i2a, iad, lad, ivw, j, i14
 
       dimension xfat(mxat),yfat(mxat),zfat(mxat),
-     &          xfrat(mxat),yfrat(mxat),zfrat(mxat),
-
-     &          xfvr(mxvr),yfvr(mxvr),zfvr(mxvr),
-     &          xfrvr(mxvr),yfrvr(mxvr),zfrvr(mxvr)
+     #          xfrat(mxat),yfrat(mxat),zfrat(mxat),
+
+     #          xfvr(mxvr),yfvr(mxvr),zfvr(mxvr),
+     #          xfrvr(mxvr),yfrvr(mxvr),zfrvr(mxvr)
 
       logical   lnb
@@ -51,6 +44,6 @@
       ntlvr=nvrml(nml)
       if (ntlvr.eq.0) then
-        write (logString, '(a,i4)')
-     &           ' opesol> No variables defined in molecule #',nml
+        write (*,'(a,i4)')
+     #           ' opesol> No variables defined in molecule #',nml
         return
       endif
@@ -73,5 +66,5 @@
       eysl = esolan(nml)
 
-! -------------------------------------------------- f & g for atoms
+c -------------------------------------------------- f & g for atoms
 
       do i=iatrs1(irsml1(nml)),iatrs2(irsml2(nml))
@@ -224,6 +217,6 @@
 
           gdeysl(iv)= (ey*zb-ez*yb)*xfiv+(ez*xb-ex*zb)*yfiv+
-     &                 (ex*yb-ey*xb)*zfiv
-     &                +ex*xfriv+ey*yfriv+ez*zfriv
+     #                 (ex*yb-ey*xb)*zfiv
+     #                +ex*xfriv+ey*yfriv+ez*zfriv
 
         elseif (it.eq.1) then         ! b.length
@@ -239,22 +232,17 @@
       return
       end
-! *****************************
+c *****************************
       subroutine gdtsol(nml,iv)
 
-! .....................................................................
-! PURPOSE: calculate partial derivative of solvation energy for molecule
-!          'nml' vs. variable 'iv' NUMERICALLY and compare with
-!          its value obtained analytically
-!
-! CALLS:  setvar, esolan
-! .....................................................................
+c .....................................................................
+c PURPOSE: calculate partial derivative of solvation energy for molecule
+c          'nml' vs. variable 'iv' NUMERICALLY and compare with
+c          its value obtained analytically
+c
+c CALLS:  setvar, esolan
+c .....................................................................
 
       include 'INCL.H'
 
-      double precision del, vlvrx, ovr, eynw, esolan, gda, gdn
-
-      integer i, it, iv, nml
-
-
       parameter (del=1.d-6)
 
@@ -262,5 +250,5 @@
 
 
-! ____________________________ get & save values of variables
+c ____________________________ get & save values of variables
       do i=1,ivrml1(ntlml)+nvrml(ntlml)-1
         it=ityvr(i)  ! type
@@ -283,8 +271,8 @@
       gdn=(eynw-eysl)/del    ! numerical derivative
 
-      write (logString, '(1x,2a,2(e12.6,a))') nmvr(iv),': ',gda,' (',
-     &       abs(gda-gdn),')'
-
-! _________________________ restore vars
+      write (*,'(1x,2a,2(e12.6,a))') nmvr(iv),': ',gda,' (',
+     #       abs(gda-gdn),')'
+
+c _________________________ restore vars
       vlvrx(iv)=ovr
 
Index: outpdb.f
===================================================================
--- outpdb.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ outpdb.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,32 +1,27 @@
-! **************************************************************
-!
-! This file contains the subroutines: outpdb
-!
-! 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: outpdb
+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 **************************************************************
 
       subroutine outpdb(nml,fileName)
 
-! ..............................................
-!  PURPOSE:  write coordinates of molecule 'nml'
-!            in PDB-format (with specialities for hydrogens)
-!
-!  INPUT:    nml - number of molecule
-!
-!            npdb - unit of output-file
-!
-!  CALLS:    toupst,iendst
-! ..............................................
+c ..............................................
+c  PURPOSE:  write coordinates of molecule 'nml'
+c            in PDB-format (with specialities for hydrogens)
+c
+c  INPUT:    nml - number of molecule
+c
+c            npdb - unit of output-file
+c
+c  CALLS:    toupst,iendst
+c ..............................................
 
       include 'INCL.H'
-
-      double precision occ, bva
-
-      integer i0, i9, nml, im1, im2, ibegst, iout, iat, iml, irs, ifirs
-      integer ifiat, nrs, i, j, iendst, nfi, ibd, jj, nbd
 
       dimension ibd(4)
@@ -43,5 +38,5 @@
 
       if (nml.lt.0.or.nml.gt.ntlml) then
-        write (logString, *) ' outpdb>  No such molecule #',nml,' !'
+        write(*,*) ' outpdb>  No such molecule #',nml,' !'
         return
       elseif (nml.gt.0) then
@@ -95,5 +90,5 @@
               j = iendst(atnm)
               if (ichar(atnm(j:j)).ge.i0.and.
-     &            ichar(atnm(j:j)).le.i9) then
+     #            ichar(atnm(j:j)).le.i9) then
                 atnm(1:1)=atnm(j:j)
                 atnm(j:j)=' '
@@ -104,8 +99,8 @@
             call toupst(atnm)
             call toupst(res)
-
+ 
             linout = ' '
             write (linout,1) linty,iat,atnm,res(1:3),chid,irs,cdin,
-     &                       xat(i),yat(i),zat(i),occ,bva
+     #                       xat(i),yat(i),zat(i),occ,bva
             write(iout,'(a80)') linout
 
@@ -120,6 +115,6 @@
       enddo  ! molecules
 
-! ______________________________________ connectivity
-!                                        ( only bonds i-j with i<j)
+c ______________________________________ connectivity
+c                                        ( only bonds i-j with i<j)
 
       do iml = im1,im2
@@ -175,5 +170,5 @@
       write (linout,'(a3)') 'END'
       write(iout,'(a80)') linout
-
+      
       close(iout)
 
Index: outvar.f
===================================================================
--- outvar.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ outvar.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -4,15 +4,15 @@
 !
 ! Copyright 2005       Frank Eisenmenger, U.H.E. Hansmann,
-!                      Shura Hayryan, Chin-Ku
-! Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-!                      Jan H. Meinke, Sandipan Mohanty
+!                      Shura Hayryan, Chin-Ku 
+c Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+c                      Jan H. Meinke, Sandipan Mohanty
 !
 ! **************************************************************
-
+ 
       subroutine outvar(nml,fileName)
-
+  
 !--------------------------------------------------------------------
-!       Output of variables of the current protein conformation
-!-
+!       Output of variables of the current protein conformation 
+!- 
 !       nml != 0       :     molecule index
 !       nml  = 0       :     all molecules
@@ -25,10 +25,8 @@
       include 'INCL.H'
 
-      integer nml, ibegst, iout
-
       character*(*) fileName
 
       if (nml.lt.0.or.nml.gt.ntlml) then
-        write (logString, *) ' outvar>  No such molecule #',nml,' !'
+        write(*,*) ' outvar>  No such molecule #',nml,' !'
         return
       endif
@@ -52,10 +50,8 @@
       include 'INCL.H'
 
-      integer nml, im1, im2, iml, i, iout, ibegst, ifivr, is, nursvr, it
-
       character mlfd*7,strg(6)*17
 
       if (nml.lt.0.or.nml.gt.ntlml) then
-        write (logString, *) ' outvbs>  No such molecule #',nml,' !'
+        write(*,*) ' outvbs>  No such molecule #',nml,' !'
         return
       elseif (nml.gt.0) then
@@ -74,9 +70,9 @@
 
         if ( gbpr(1,iml).ne.zero
-     &   .or.gbpr(2,iml).ne.zero
-     &   .or.gbpr(3,iml).ne.zero
-     &   .or.gbpr(4,iml).ne.zero
-     &   .or.gbpr(5,iml).ne.zero
-     &   .or.gbpr(6,iml).ne.zero ) then
+     #   .or.gbpr(2,iml).ne.zero
+     #   .or.gbpr(3,iml).ne.zero
+     #   .or.gbpr(4,iml).ne.zero
+     #   .or.gbpr(5,iml).ne.zero
+     #   .or.gbpr(6,iml).ne.zero ) then
 
           do i = 1,3
@@ -88,6 +84,6 @@
 
           write(iout,'(1x,2a,1x,12a)')
-     &    '@ ',mlfd,(strg(i)(ibegst(strg(i)):),',',i=1,5),
-     &    strg(6)(ibegst(strg(6)):)
+     #    '@ ',mlfd,(strg(i)(ibegst(strg(i)):),',',i=1,5),
+     #    strg(6)(ibegst(strg(6)):)
 
         endif
@@ -101,5 +97,5 @@
 
             write(iout,'(3x,a,i3,1x,a,1x,a,1x,a,1x,f10.3)')
-     &        mlfd,(nursvr(i)-is),':',nmvr(i),':',vlvr(i)*crd
+     #        mlfd,(nursvr(i)-is),':',nmvr(i),':',vlvr(i)*crd
           else
 
@@ -109,6 +105,6 @@
 
               write(iout,'(3x,a,i3,1x,a,1x,a,1x,a,1x,f10.3,1x,a)')
-     &          mlfd,(nursvr(i)-is),':',nmvr(i),':',vlvr(i)*crd
-     &          ,' &'
+     #          mlfd,(nursvr(i)-is),':',nmvr(i),':',vlvr(i)*crd
+     #          ,' &'
             endif
 
Index: partem_p.f
===================================================================
--- partem_p.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ partem_p.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,28 +1,28 @@
-!**************************************************************
-!     
-! This file contains the subroutines: partem_p 
-! USE WITH main_p, NOT WITH main!!!!!!
-!     
-! 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
-!     
-!     **************************************************************
-
-!>
-!!     PURPOSE: SIMULATION OF PROTEINS BY PARALLEL TEMPERING ALGORITHM
-!!     ON PARALLEL COMPUTERS USING MPI
-!!
-!!     switch: Choses the starting configuration:
-!!     -1 - stretched configuration
-!!     0 - don't change anything
-!!     1 - random start configuration
-!!
-!!     CALLS:  addang,contacts,energy,hbond,helix,iendst,metropolis,
-!!     outvar,(rand),rgyr
-!<
+c**************************************************************
+c     
+c This file contains the subroutines: partem_p 
+C USE WITH main_p, NOT WITH main!!!!!!
+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     **************************************************************
+
       subroutine  partem_p(num_rep, nequi, nswp, nmes, nsave, newsta,
      &                     switch, rep_id, partem_comm)
+C     
+C     PURPOSE: SIMULATION OF PROTEINS BY PARALLEL TEMPERING ALGORITHM 
+C     ON PARALLEL COMPUTERS USING MPI
+C     
+C     switch: Choses the starting configuration:
+C     -1 - stretched configuration
+C     0 - don't change anything
+C     1 - random start configuration
+C     
+c     CALLS:  addang,contacts,energy,hbond,helix,iendst,metropolis,
+c     outvar,(rand),rgyr
+C     
       include 'INCL.H'
       include 'INCP.H'
@@ -31,50 +31,41 @@
       logical newsta
       integer switch, partem_comm, rep_id, nsave
-!     external rand
+c     external rand
       external can_weight
 
-!     nequi:  number of Monte Carlo sweeps for thermalization
-!     nswp:   number of Monte Carlo sweeps
-!     nmes:   number of Monte Carlo sweeps between measurments
-!     newsta: .true. for new simulations, .false. for re-start
-      double precision temp, eavm, sph, geavm, gsph, dv, grnd, vr
-      double precision addang, dummy, eol, energy, acz, rmsv, rmsdfun
-      double precision rgy, ee, tmhb, dham, swp, wij, rd, e_final
-
-      integer ifrrm, nmes, nswp, num_rep, i, j, nresi, iold, inode
-      integer intem, iv, jold, idum1, idum2, idum3
-      integer ierr, nsw, nequi
-      integer nml, nhel, mhel, nbet, mbet, mhb, imhb, nctot, ncnat
-      integer k1, k, nu, no1, in, jn
-      
+C     nequi:  number of Monte Carlo sweeps for thermalization
+C     nswp:   number of Monte Carlo sweeps
+C     nmes:   number of Monte Carlo sweeps between measurments
+C     newsta: .true. for new simulations, .false. for re-start
+
       dimension  eavm(MAX_PROC),sph(MAX_PROC),intem(MAX_PROC),
      &     inode(MAX_PROC), geavm(MAX_PROC), gsph(MAX_PROC)
       double precision    pbe(MAX_PROC),yol(MAX_PROC),acy(MAX_PROC),
      &     acy1(MAX_PROC),acx1(MAX_PROC),
-     &     rgyrp(MAX_PROC),rmsdp(MAX_PROC), eol0,acz0
+     &     rgyrp(MAX_PROC),rmsdp(MAX_PROC), eol0,rgyp,acz0
       
       double precision    e_min, e_minp(MAX_PROC), e_minpt(MAX_PROC)
       integer   h_max, h_maxp(MAX_PROC)
-!     Order of replica exchange
+c     Order of replica exchange
       integer   odd
 !     Counter to keep random number generators in sync
       integer randomCount
       
-!     Collect partial energies. Only the root writes to disk. We have to
-!     collect the information from the different replicas and provide 
-!     arrays to store them.
-!     eyslr    storage array for solvent energy
-!     eyelp     -      "        - coulomb energy
-!     eyvwp     -      "        - van-der-Waals energy
-!     eyhbp     -      "        - hydrogen bonding energy
-!     eysmi    -      "        - intermolecular interaction energy
-!     eyabp     -      "        - Abagyan correction term
+c     Collect partial energies. Only the root writes to disk. We have to
+c     collect the information from the different replicas and provide 
+c     arrays to store them.
+c     eyslr    storage array for solvent energy
+c     eyelp     -      "        - coulomb energy
+c     eyvwp     -      "        - van-der-Waals energy
+c     eyhbp     -      "        - hydrogen bonding energy
+c     eysmi    -      "        - intermolecular interaction energy
+c     eyabp     -      "        - Abagyan correction term
       double precision eyslr(MAX_PROC)
       double precision eyelp(MAX_PROC),eyvwp(MAX_PROC),eyhbp(MAX_PROC), 
      &     eyvrp(MAX_PROC),eysmip(MAX_PROC), eyabp(MAX_PROC)
-!     Collect information about accessible surface and van-der-Waals volume
-!     asap      storage array for solvent accessible surface
-!     vdvolp     storage array for van-der-Waals volume
-      double precision asa_p(MAX_PROC), vdvolp(MAX_PROC)
+c     Collect information about accessible surface and van-der-Waals volume
+c     asap      storage array for solvent accessible surface
+c     vdvolp     storage array for van-der-Waals volume
+      double precision asap(MAX_PROC), vdvolp(MAX_PROC)
 
       integer nhelp(MAX_PROC),nbetp(MAX_PROC), mhbp(MAX_PROC),
@@ -82,11 +73,11 @@
       integer imhbp(MAX_PROC)
       character*80 filebase, fileNameMP, tbase0,tbase1
-!     frame     frame number for writing configurations
-!     trackID   configuration that should be tracked and written out
-!     dir          direction in random walk
-!     -1 - visited highest temperature last
-!     1 - visited lowest temperature last
-!     0 - haven't visited the boundaries yet.
-!     dirp      storage array for directions.
+c     frame     frame number for writing configurations
+c     trackID   configuration that should be tracked and written out
+c     dir          direction in random walk
+c     -1 - visited highest temperature last
+c     1 - visited lowest temperature last
+c     0 - haven't visited the boundaries yet.
+c     dirp      storage array for directions.
       integer frame, trackID, dir
       integer dirp(MAX_PROC)
@@ -95,23 +86,23 @@
       trackID = 1
       odd = 1
-      write (logString, *) 'Starting parallel tempering.'
-      write (logString, *) 'parameters, ',switch,newsta,nmes,nswp,nmes,
+      write (*,*) 'Starting parallel tempering.'
+      write (*,*) 'parameters, ',switch,newsta,nmes,nswp,nmes,
      &            rep_id, num_rep, partem_comm, myrank
       call flush(6)
-!     
-!     
-!     File with temperatures 
+C     
+c     
+C     File with temperatures 
       open(11,file='temperatures',status='old')
-!     File with reference conformation
+C     File with reference conformation
       tbase0='trj_00000'
       open(18,file=fileNameMP(tbase0,5,9,rep_id),status='unknown')
       if (rep_id.eq.0.and.myrank.eq.0) then
-!     File with time series of simulation
+c     File with time series of simulation
          open(14,file='ts.d',status='unknown')
-!     Track weights
-!      open(16, file='weights.dat', status='unknown')
+c     Track weights
+c      open(16, file='weights.dat', status='unknown')
       endif
       
-!     READ IN TEMPERATURES
+C     READ IN TEMPERATURES
       do i=1,num_rep
          read(11,*) j,temp
@@ -120,8 +111,8 @@
       close(11)
 
-!     nresi:  number of residues
+c     nresi:  number of residues
       nresi=irsml2(1)-irsml1(1)+1
-!     
-!     Initialize variables
+C     
+C     Initialize variables
       do i=1,num_rep      
          acx1(i) = 0.0d0
@@ -141,5 +132,5 @@
       dir = dirp(rep_id + 1)
 
-!     _________________________________ Initialize Variables
+c     _________________________________ Initialize Variables
       if(newsta) then
          iold=0
@@ -148,5 +139,5 @@
             intem(i) = i
          end do
-!     _________________________________ initialize starting configuration
+c     _________________________________ initialize starting configuration
          if (switch.ne.0) then
             do i=1,nvr
@@ -167,5 +158,5 @@
             do i=1,num_rep
                read(13,*) j,inode(i),intem(i),yol(i),e_minp(i),h_maxp(i)
-               write (logString, *) "par_R.in:",i,j
+               write (*,*) "par_R.in:",i,j
             end do
             jold=(iold/nmes)*num_rep
@@ -178,5 +169,5 @@
      &              ,idum1, idum2, idum3, e_min
      &              ,dummy, dummy
-               write (logString, *) i
+               write (*,*) i
                call flush(6)
             end do
@@ -187,44 +178,43 @@
          CALL MPI_BCAST(INODE,num_rep,MPI_INTEGER,0,MPI_COMM_WORLD,IERR)
          CALL MPI_BCAST(YOL,num_rep,MPI_DOUBLE_PRECISION,0,
-     &        MPI_COMM_WORLD,IERR)
+     #        MPI_COMM_WORLD,IERR)
          CALL MPI_BCAST(E_MINP, num_rep, MPI_DOUBLE_PRECISION, 0, 
-     &        MPI_COMM_WORLD, IERR)
+     #        MPI_COMM_WORLD, IERR)
          CALL MPI_BCAST(h_maxp,num_rep,MPI_INTEGER,0,MPI_COMM_WORLD,
-     &        IERR)
+     $        IERR)
       end if
       
       BETA = pbe(inode(rep_id+1))
-      e_min = e_minp(rep_id+1)
-      h_max = h_maxp(rep_id+1)
-      write (logString, *) "E_min=",e_min," for ", rep_id + 1 
+      e_min = e_minp(inode(rep_id+1))
+      h_max = h_maxp(inode(rep_id+1))
+      write (*,*) "E_min=",e_min," for ", intem(rep_id + 1) 
       eol=energy()
       if(.not.newsta.and.abs(yol(rep_id + 1) - eol).gt.0.1) then
-         write (logString, *) rep_id, ' Warning: yol(rep_id).ne.eol:'
-         write (logString, *) rep_id, yol(rep_id + 1), eol
+         write(*,*) rep_id, ' Warning: yol(rep_id).ne.eol:'
+         write(*,*) rep_id, yol(rep_id + 1), eol
       endif
-!     Start of simulation
-      write (logString, *) '[',rep_id, myrank, beta, partem_comm,
+C     Start of simulation
+      write (*,*) '[',rep_id, myrank, beta, partem_comm,
      &            '] Energy before equilibration:', eol
-!     =====================Equilibration by canonical Metropolis
+c     =====================Equilibration by canonical Metropolis
       do nsw=1,nequi
          call metropolis(eol,acz,can_weight)
       end do
       CALL MPI_BARRIER(MPI_COMM_WORLD,IERR)
-      write (logString, *) '[',rep_id,'] Energy after equilibration:', 
-     &   eol
+      write (*,*) '[',rep_id,'] Energy after equilibration:', eol
       call flush(6)
-!     
-!======================Multiple Markov Chains
+C     
+C======================Multiple Markov Chains
       acz = 0
       do nsw=1,nswp
-!------------First ordinary Metropolis 
+c------------First ordinary Metropolis 
          call metropolis(eol,acz,can_weight)
          iold = iold + 1	
          eol0 = eol
          if (myrank.eq.0.and.rep_id.eq.0) then
-            write (logString, *) "Finished sweep", nsw
+            write (*,*) "Finished sweep", nsw
             call flush(6)
          endif
-         if(mod(iold,nmes).eq.0.and.myrank.eq.0) then
+         if(mod(iold,nmes).eq.0) then
             if ((rep_id + 1).eq.trackID.and.myrank.eq.0) then
                frame = iold /nmes
@@ -233,15 +223,15 @@
             endif
             acz0 = acz
-!     Evaluate RMSD
+c     Evaluate RMSD
             nml = 1
             rmsv = rmsdfun(nml,irsml1(nml),irsml2(nml),ixatp,xatp,yatp, &
      &             zatp,0)
-!            print *,myrank,'received RMSD,energy ',rmsv,eyab,beta
-!     Measure global radius of gyration
+c            print *,myrank,'received RMSD,energy ',rmsv,eyab,beta
+C     Measure global radius of gyration
             call rgyr(0,rgy,ee)  
             rgyp = rgy
-!     Measure Helicity and Sheetness
+C     Measure Helicity and Sheetness
             call helix(nhel,mhel,nbet,mbet)
-!     Measure Number of hydrogen bonds
+C     Measure Number of hydrogen bonds
             mhb = 0
             do i = 1, ntlml
@@ -250,41 +240,41 @@
             enddo
             call interhbond(imhb) 
-!     Measure total number of contacts (NCTOT) and number of
-!     native contacts (NCNAT)
+C     Measure total number of contacts (NCTOT) and number of
+C     native contacts (NCNAT)
             call contacts(nctot,ncnat,dham)
-!     Add tracking of lowest energy configuration
+c     Add tracking of lowest energy configuration
             if (eol.lt.e_min) then
-!     Write out configuration
+c     Write out configuration
                i=rep_id+1
                j=inode(i)
                e_min = eol
                filebase = "c_emin_0000.pdb"
-               call outpdb(0, fileNameMP(filebase, 8, 11, i))
+               call outpdb(0, fileNameMP(filebase, 8, 11, j))
                filebase = "c_emin_0000.var"
-               call outvar(0, fileNameMP(filebase, 8, 11, i))
+               call outvar(0, fileNameMP(filebase, 8, 11, j))
                filebase = "c_emin_0000.dat"
-               open(15, file=fileNameMP(filebase, 8, 11, i),
+               open(15, file=fileNameMP(filebase, 8, 11, j),
      &              status="unknown")
 !     write(15,'(i8,2i4,f6.2,2f8.2,5i8)') iold,i,j,pbe(i), 
-               write(15,*) iold,j,i,beta, 
+               write(15,*) iold,i,j,pbe(i), 
      &              eol, eyab, eysl, eyel, eyvw, eyhb, eyvr, eysmi,asa,
      &              vdvol, rgy, nhel, nbet, mhb, imhb, nctot,ncnat
                close(15)
             endif
-!     Add tracking of configuration with larges hydrogen contents.
+c     Add tracking of configuration with larges hydrogen contents.
             if ((mhb + imhb).gt.h_max) then
-!     Write out configuration
+c     Write out configuration
                i = rep_id + 1
                j = inode(i)
                h_max = mhb + imhb
                filebase = "c_hmax_0000.pdb"
-               call outpdb(0,fileNameMP(filebase,8,11,i))
+               call outpdb(0,fileNameMP(filebase,8,11,j))
                filebase = "c_hmax_0000.var"
-               call outvar(0,fileNameMP(filebase,8,11,i))
+               call outvar(0,fileNameMP(filebase,8,11,j))
                filebase = "c_hmax_0000.dat"
-               open(15, file=fileNameMP(filebase, 8, 11, i),
+               open(15, file=fileNameMP(filebase, 8, 11, j),
      &              status="unknown")
 !     write(15,'(i8,2i4,f6.2,2f8.2,5i8)') iold,i,j,pbe(i), 
-               write(15,*) iold,j,i,beta, 
+               write(15,*) iold,i,j,pbe(i), 
      &              eol, eyab, eysl, eyel, eyvw, eyhb, eyvr, eysmi,asa,
      &              vdvol, rgy, nhel, nbet, mhb, imhb, nctot,ncnat
@@ -292,15 +282,15 @@
             endif
 
-!     
-!--------------------Gather measurement data
+C     
+C--------------------Gather measurement data
 ! I only use the master node of each replica for data collection. The
 ! variable partem_comm provides the appropriate communicator.
             if (partem_comm.ne.MPI_COMM_NULL) then
                CALL MPI_GATHER(rmsv,1,MPI_DOUBLE_PRECISION,rmsdp,1,
-     &              MPI_DOUBLE_PRECISION, 0,partem_comm,IERR)
+     #              MPI_DOUBLE_PRECISION, 0,partem_comm,IERR)
                CALL MPI_GATHER(eyab,1,MPI_DOUBLE_PRECISION,eyabp,1,
-     &              MPI_DOUBLE_PRECISION, 0,partem_comm,IERR)
+     #              MPI_DOUBLE_PRECISION, 0,partem_comm,IERR)
                CALL MPI_GATHER(RGYP,1,MPI_DOUBLE_PRECISION,RGYRP,1,
-     &              MPI_DOUBLE_PRECISION, 0,partem_comm,IERR)
+     #              MPI_DOUBLE_PRECISION, 0,partem_comm,IERR)
                CALL MPI_GATHER(NHEL,1,MPI_INTEGER,NHELP,1,MPI_INTEGER,
      &              0,partem_comm,IERR)
@@ -335,5 +325,5 @@
                CALL MPI_GATHER(eysmi,1,MPI_DOUBLE_PRECISION,eysmip,1,
      &              MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
-               CALL MPI_GATHER(asa,1,MPI_DOUBLE_PRECISION,asa_p,1,
+               CALL MPI_GATHER(asa,1,MPI_DOUBLE_PRECISION,asap,1,
      &              MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
                CALL MPI_GATHER(vdvol,1,MPI_DOUBLE_PRECISION,vdvolp,1,
@@ -345,10 +335,10 @@
 !     &                0,MPI_COMM_WORLD, IERR)                
 
-!     Write trajectory
+c     Write trajectory
                write (18,*) '@@@',iold,inode(rep_id+1)
                call outvbs(0,18)
                write (18,*) '###'
 !                call flush(18)
-!     Write current configuration
+c     Write current configuration
                if ((mod(iold, nsave).eq.0)) then
                   filebase = "conf_0000.var"
@@ -359,17 +349,19 @@
             if(rep_id.eq.0.and.myrank.eq.0) then
                randomCount = 0
-!  Update acceptance, temperature wise average of E and E^2 used to calculate
-!  specific heat. 
+c  Update acceptance, temperature wise average of E and E^2 used to calculate
+c  specific heat. 
                do i=1,num_rep
                   j=intem(i)
                   acy(i)=0.0
-!  Above: contents of acy1 are added to acy(i) a few lines down. 
-!  acy1(intem(i)) contains information received from the node at temperature
-!  i, on how many updates have been accepted in node intem(i). Since acz
-!  is not reset to 0 every cycle, acy(i) must be set to 0 here. Else, there 
-!  will be serious double counting and the values of acceptance printed 
-!  will be simply wrong.
+c  Above: contents of acy1 are added to acy(i) a few lines down. 
+c  acy1(intem(i)) contains information received from the node at temperature
+c  i, on how many updates have been accepted in node intem(i). Since acz
+c  is not reset to 0 every cycle, acy(i) must be set to 0 here. Else, there 
+c  will be serious double counting and the values of acceptance printed 
+c  will be simply wrong.
+                  e_minpt(i)=e_minp(intem(i))
                end do
                do i=1, num_rep
+                  e_minp(i) = e_minpt(i)
                   j=intem(i)
                   acy(i)=acy(i)+acy1(j)
@@ -379,16 +371,16 @@
 
 
-!     Write measurements to the time series file ts.d
+C     Write measurements to the time series file ts.d
                do i=1,num_rep
                   j=intem(i)
                      write(14,*) iold,i,j,pbe(i), dirp(j),
      &                 yol(j),eyslr(j), eyelp(j), eyvwp(j), eyhbp(j), 
-     &                    eyvrp(j),eysmip(j), asa_p(j), vdvolp(j),
+     &                    eyvrp(j),eysmip(j), asap(j), vdvolp(j),
      &                    rgyrp(j),nhelp(j),nbetp(j),mhbp(j),
-     &                 imhbp(j), nctotp(j),ncnatp(j), e_minp(j), 
+     &                 imhbp(j), nctotp(j),ncnatp(j), e_minp(i), 
      &                 eyabp(j),rmsdp(j)
 !                      call flush(14)
                end do
-!     Write the current parallel tempering information into par_R.in
+c     Write the current parallel tempering information into par_R.in
 !               timeLeft = llwrem(2) ! Time left till hard limit
 !               if ((mod(iold, nsave).eq.0).or.(timeLeft.lt.minTimeLeft)
@@ -401,6 +393,6 @@
      &                    h_maxp(i)
                   end do
-!     -------------------------- Various statistics of current run
-!               swp=nswp-nequi
+C     -------------------------- Various statistics of current run
+c               swp=nswp-nequi
                   swp=nsw
                   write(13,*) 'Acceptance rate for change of chains:'
@@ -408,7 +400,7 @@
                      temp=1.0d0/pbe(k1)/0.00198773
                      write(13,*) temp, acx1(k1)*2.0d0*nmes/swp 
-!  Above: it's the acceptance rate of exchange of replicas. Since a 
-!  replica exchange is attempted only once every nmes sweeps, the 
-!  rate should be normalized with (nmes/swp).
+c  Above: it's the acceptance rate of exchange of replicas. Since a 
+c  replica exchange is attempted only once every nmes sweeps, the 
+c  rate should be normalized with (nmes/swp).
                   end do 
                   write(13,*)
@@ -419,12 +411,12 @@
                      geavm(k1) = nmes*eavm(k1)/swp
                      gsph(k1)  = (nmes*sph(k1)/swp-geavm(k1)**2)
-     &                    *beta*beta/nresi
+     #                    *beta*beta/nresi
                      write(13,'(a,2f9.2,i4,f12.3)') 
      &                    'Temperature, Node,local acceptance rate:',
      &                    beta,temp,k,acy(k1)/dble(nsw*nvr)
-!  Above: Changed (nswp-nequi) in the denominator of acceptance as 
-!  acceptance values are initialized to 0 after equilibration cycles are
-!  finished. Note also that since this is being written in the middle of
-!  the simulation, it is normalized to nsw instead of nswp.
+c  Above: Changed (nswp-nequi) in the denominator of acceptance as 
+c  acceptance values are initialized to 0 after equilibration cycles are
+c  finished. Note also that since this is being written in the middle of
+c  the simulation, it is normalized to nsw instead of nswp.
                      write(13,'(a,3f12.2)') 
      &                    'Last Energy, Average Energy, Spec. Heat:', 
@@ -439,10 +431,10 @@
                end if
 
-!--------------------Parallel Tempering  update
-!     Swap with right neighbor (odd, even)            
+C--------------------Parallel Tempering  update
+c     Swap with right neighbor (odd, even)            
                if(odd.eq.1) then
                   nu=1
                   no1 = num_rep-1
-!     Swap with left neighbor (even, odd)
+c     Swap with left neighbor (even, odd)
                else
                   nu = 2
@@ -451,5 +443,5 @@
                do i=nu,no1,2
                   j=i+1
-!     Periodic bc for swaps
+c     Periodic bc for swaps
                   if(i.eq.num_rep) j=1
                   in=intem(i)
@@ -457,17 +449,17 @@
                   wij=exp(-pbe(i)*yol(jn)-pbe(j)*yol(in)
      &                 +pbe(i)*yol(in)+pbe(j)*yol(jn))
-! The random number generator is getting out of sync here, because
-!        the swap is only done on node 0!
+c The random number generator is getting out of sync here, because
+c        the swap is only done on node 0!
 ! Keep track of number of random numbers used.
                   rd=grnd()
                   randomCount = randomCount + 1
-!                  write (16,*) '>', iold, i,j
-!     &            ,pbe(i),yol(in), pbe(j), yol(jn), wij, rd
+c                  write (16,*) '>', iold, i,j
+c     &            ,pbe(i),yol(in), pbe(j), yol(jn), wij, rd
                   if(wij.ge.rd) then
-! Next line: Replica exchange only happens after equilibration, 
-! which takes place outside this loop over nsw. So, I think nsw.gt.nequi
-! is irrelevant for the calculation of acceptance of replica exchanges.
-! /Sandipan
-!                     if(nsw.gt.nequi) 
+c Next line: Replica exchange only happens after equilibration, 
+c which takes place outside this loop over nsw. So, I think nsw.gt.nequi
+c is irrelevant for the calculation of acceptance of replica exchanges.
+c /Sandipan
+c                     if(nsw.gt.nequi) 
                      acx1(i) = acx1(i)+1
                      intem(i) = jn
@@ -477,27 +469,31 @@
                   end if
                end do
-!     ---------------- End Loop over nodes which creates a new temperature
-!     map for all nodes, at the node with rank 0. 
-!     
+c     ---------------- End Loop over nodes which creates a new temperature
+c     map for all nodes, at the node with rank 0. 
+c     
                odd = 1 - odd
             end if
-!     End of "if (myrank.eq.0) ...". The block above includes PT update and 
-!     writing of observables into the time series file etc. 
+c     End of "if (myrank.eq.0) ...". The block above includes PT update and 
+c     writing of observables into the time series file etc. 
            
-!     Below: Communicate new temperature-node map to all nodes
+c     Below: Communicate new temperature-node map to all nodes
             CALL MPI_BCAST(INTEM,num_rep,MPI_INTEGER,0,MPI_COMM_WORLD,
      &           IERR)
             CALL MPI_BCAST(INODE,num_rep,MPI_INTEGER,0,MPI_COMM_WORLD,
      &           IERR)
-! Synchronize random number generators for replica 0
+         CALL MPI_BCAST(E_MINP,num_rep,MPI_DOUBLE_PRECISION,0,
+     &           MPI_COMM_WORLD,IERR)
+            CALL MPI_BCAST(H_MAXP,num_rep,MPI_INTEGER,0,MPI_COMM_WORLD,
+     &           IERR)
+c Synchronize random number generators for replica 0
             if (rep_id.eq.0) then
                CALL MPI_BCAST(randomCount,1,MPI_INTEGER,0,my_mpi_comm,
      &                IERR)
                if (myrank.ne.0) then
-!                  write (logString, *) '[', myrank,'] Missed', randomCount, 
+!                  write (*,*) '[', myrank,'] Missed', randomCount, 
 !     &                            'random numbers.'
                   do i = 1, randomCount
                      rd = grnd()
-!                     write (logString, *) '[', myrank,'] rd=', rd
+!                     write (*,*) '[', myrank,'] rd=', rd
                   enddo
                endif
@@ -505,14 +501,16 @@
 
             BETA=PBE(INODE(rep_id+1))
+            e_min = e_minp(inode(rep_id+1))
+            h_max = h_maxp(inode(rep_id+1))
             if (INODE(rep_id + 1).eq.1) dir = 1
             if (INODE(rep_id + 1).eq.num_rep) dir = -1
 
          endif
-!        End of "if (mod(iold,nmes).eq.0) ..."
+c        End of "if (mod(iold,nmes).eq.0) ..."
       end do
-!-----------End Loop over sweeps
-!     
-!     OUTPUT:
-!--------------------For Re-starts:
+c-----------End Loop over sweeps
+c     
+C     OUTPUT:
+C--------------------For Re-starts:
       nu = rep_id + 1
       filebase = "conf_0000.var"
@@ -520,5 +518,5 @@
       e_final=energy()
       if (partem_comm.ne.MPI_COMM_NULL) then
-         write (logString, *) rep_id, ' E_final', e_final
+         write (*,*) rep_id, ' E_final', e_final
       endif
       eol0 = eol
@@ -526,7 +524,7 @@
       if (partem_comm.ne.MPI_COMM_NULL) then
          CALL MPI_GATHER(EOL0,1,MPI_DOUBLE_PRECISION,YOL,1,
-     &        MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
+     #        MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
          CALL MPI_GATHER(acz0,1,MPI_DOUBLE_PRECISION,acy1,1,
-     &     MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
+     #     MPI_DOUBLE_PRECISION,0,partem_comm,IERR)
       endif
       
@@ -538,5 +536,5 @@
             write(13,*) i,inode(i),intem(i),yol(i),e_minp(i),h_maxp(i)
          end do
-!     -------------------------- Various statistics of current run
+C     -------------------------- Various statistics of current run
          swp=nswp
          write(13,*) 'Acceptance rate for change of chains:'
@@ -561,9 +559,9 @@
          end do
          close(13)
-!         close(16)
+c         close(16)
       end if
       close(18)
 
-!     =====================
+c     =====================
       CALL MPI_BARRIER(MPI_COMM_WORLD,IERR)
 
Index: partem_s.f
===================================================================
--- partem_s.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ partem_s.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -4,11 +4,11 @@
 !
 ! 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
+!                      Shura Hayryan, Chin-Ku 
+c Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+c                      Jan H. Meinke, Sandipan Mohanty
 !
 !
 ! **************************************************************
-
+      
       subroutine partem_s(num_rep, nequi, nswp, nmes, nsave, newsta,
      &                     switch)
@@ -20,11 +20,4 @@
 !
       include 'INCL.H'
-      
-      double precision gasc, dv, grnd, vr, addang, energ, energy, acz
-      double precision ee, rgy, temp0, delta, ra
-
-      integer i, j, nml, k, nstart, iv, nsw, iswitch, k1, num_rep1, nu
-      integer in, jn
-
       external can_weight
 ! TODO Store global coordinates in pgbpr
@@ -51,5 +44,5 @@
 !     ipoi:   Points to replica ipoi(k) which is currently
 !             at inverse temperature pbe(k)
-!     eol:    energy of each replica
+!     eol:    energy of each replica 
 !     acc:    accepatance rate of each replica
 !
@@ -62,5 +55,5 @@
       allocate(temp(num_rep), pbe(num_rep), eol(num_rep))
       allocate(acc(num_rep), ipoi(num_rep))
-
+      
       if (.not.(allocated(coor_G).and.allocated(temp)
      &          .and. allocated(pbe).and. allocated(eol)
@@ -84,5 +77,5 @@
          ipoi(i) = 0
       end do
-
+        
 
 !     READ IN TEMPERATURES
@@ -97,5 +90,5 @@
 
       open(13,file='time.d',status='unknown')
-
+      
       if(.not.newsta) then
 ! READ START Values
@@ -129,7 +122,7 @@
                   pgbpr(j, nml, i) = gbpr(j, nml)
                end do
-            end do
-         end do
-
+            end do            
+         end do
+      
 !      Equilibrization for each replica (No replica exchange move)
          do k=1,num_rep
@@ -148,6 +141,6 @@
                CALL METROPOLIS(energ,acz,can_weight)
             end do
-            write (logString, *) 
-     &         'Start energy after equilibration for replica:',k, energ
+            write(*,*) 'Start energy after equilibration for replica:', 
+     &                 k, energ
             do i=1,nvr
                iv = idvr(i)
@@ -162,5 +155,5 @@
          end do
       end if
-
+            
 ! Now begins the simulation with Multiple Markov Chains
       iswitch = 1
@@ -183,5 +176,5 @@
             end do
             CALL METROPOLIS(energ,acz,can_weight)
-!
+! 
             if(mod(nsw,nmes).eq.0) then
 ! Measure and store here all quantities you want to analyse later
@@ -202,5 +195,5 @@
                end do
             end do
-
+        
             eol(k) = energ
             acc(k) = acz
@@ -221,5 +214,5 @@
             j=i+1
             if(i.eq.num_rep) j=1
-            in=ipoi(i)
+            in=ipoi(i)      
             jn=ipoi(j)
             delta=-pbe(i)*eol(jn)-pbe(j)*eol(in)
Index: pdbread.f
===================================================================
--- pdbread.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ pdbread.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,36 +1,35 @@
-! **************************************************************
-!
-! This file contains the subroutines: pdbread,pdbvars,atixpdb,getpar
-!
-! 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: pdbread,pdbvars,atixpdb,getpar
+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 **************************************************************
 
       subroutine pdbread(pdbfil,ier)
 
-! ....................................................
-! PURPOSE: read protein atom coordinates from 'pdbfil'
-!          (no Hydrogens, only ATOM records)
-!
-! RETURNS: 0 = no errors / 1 = error
-!
-! CALLS: iopfil,iendst
-! ......................................................
+c ....................................................
+c PURPOSE: read protein atom coordinates from 'pdbfil'
+c          (no Hydrogens, only ATOM records)
+c
+c RETURNS: 0 = no errors / 1 = error
+c
+c CALLS: iopfil,iendst
+c ......................................................
+
+      implicit real*8 (a-h,o-z)
+      implicit integer*4 (i-n)
 
       include 'INCP.H'
-      
-      double precision cor
-
-      integer ier, l, iendst, lunpdb, io, iopfil, iat, i
-
-! -------------------------- input
+
+c -------------------------- input
       character*(*) pdbfil
-! -------------------------- local
+c -------------------------- local
       dimension cor(3)
       character atm*4,rsn*3,rsno*3,chn,chno,
-     &          rsid*5,rsido*5,line*132, logString*255
+     #          rsid*5,rsido*5,line*132
 
       natp=0
@@ -48,6 +47,6 @@
         lunpdb = 99
       else
-        write (logString, '(a)')
-     &    ' pdbread> empty file name to read pdb-structure'
+        write (*,'(a)') 
+     #    ' pdbread> empty file name to read pdb-structure'
 
         return
@@ -57,7 +56,7 @@
 
       if (io.le.0) then
-        write (logString, '(a,/,a)')
-     &  ' pdbread> ERROR opening file to read pdb-structure: ',
-     &  pdbfil(1:iendst(pdbfil))
+        write (*,'(a,/,a)') 
+     #  ' pdbread> ERROR opening file to read pdb-structure: ',
+     #  pdbfil(1:iendst(pdbfil))
 
         return
@@ -70,8 +69,8 @@
 
       if ( line(17:17).ne.' ' )  then
-        write (logString, '(a,/,a,/,a,/,2a)')
-     &  ' pdbread> found alternate atom location: ',
-     &  '                !',
-     &  line(:l),' in file: ',pdbfil(1:iendst(pdbfil))
+        write (*,'(a,/,a,/,a,/,2a)') 
+     #  ' pdbread> found alternate atom location: ',
+     #  '                !',
+     #  line(:l),' in file: ',pdbfil(1:iendst(pdbfil))
 
         close(lunpdb)
@@ -86,7 +85,7 @@
 
       if ((natp+1).gt.MXATP) then
-        write (logString, '(a,i5,a,/,a)')
-     &  ' pdbread>  >MXATP (',MXATP,') ATOM lines in PDB file ',
-     &  pdbfil(1:iendst(pdbfil))
+        write (*,'(a,i5,a,/,a)') 
+     #  ' pdbread>  >MXATP (',MXATP,') ATOM lines in PDB file ',
+     #  pdbfil(1:iendst(pdbfil))
 
         close(lunpdb)
@@ -97,7 +96,7 @@
 
         if ((nchp+1).gt.MXCHP) then
-          write (logString, '(a,i3,a,/,a)')
-     &    ' pdbread>  >MXCHP (',MXCHP,') chains in PDB file ',
-     &    pdbfil(1:iendst(pdbfil))
+          write (*,'(a,i3,a,/,a)') 
+     #    ' pdbread>  >MXCHP (',MXCHP,') chains in PDB file ',
+     #    pdbfil(1:iendst(pdbfil))
 
           close(lunpdb)
@@ -106,7 +105,7 @@
 
         if ((nrsp+1).gt.MXRSP) then
-          write (logString, '(a,i3,a,/,a)')
-     &    ' pdbread>  >MXRSP (',MXRSP,') residues in PDB file ',
-     &    pdbfil(1:iendst(pdbfil))
+          write (*,'(a,i3,a,/,a)') 
+     #    ' pdbread>  >MXRSP (',MXRSP,') residues in PDB file ',
+     #    pdbfil(1:iendst(pdbfil))
 
           close(lunpdb)
@@ -141,7 +140,7 @@
 
         if ((nrsp+1).gt.MXRSP) then
-          write (logString, '(a,i3,a,/,a)')
-     &    ' pdbread>  >MXRSP (',MXRSP,') residues in PDB file ',
-     &    pdbfil(1:iendst(pdbfil))
+          write (*,'(a,i3,a,/,a)') 
+     #    ' pdbread>  >MXRSP (',MXRSP,') residues in PDB file ',
+     #    pdbfil(1:iendst(pdbfil))
 
           close(lunpdb)
@@ -172,8 +171,8 @@
       goto 1
 
-    2 write (logString, '(a,/,a,/,2a)')
-     &  ' pdbread> ERROR reading ATOM line ',
-     &  line(:l),
-     &  ' from file ',pdbfil(1:iendst(pdbfil))
+    2 write (*,'(a,/,a,/,2a)') 
+     #  ' pdbread> ERROR reading ATOM line ',
+     #  line(:l),
+     #  ' from file ',pdbfil(1:iendst(pdbfil))
 
       close(lunpdb)
@@ -195,7 +194,7 @@
       else
 
-        write (logString, '(a,/,a)')
-     &  ' pdbread> NO atom coordinates selected from file ',
-     &  pdbfil(1:iendst(pdbfil))
+        write (*,'(a,/,a)') 
+     #  ' pdbread> NO atom coordinates selected from file ',
+     #  pdbfil(1:iendst(pdbfil))
 
       endif
@@ -206,31 +205,26 @@
 
       end
-! **************************************************************
+c **************************************************************
 
       subroutine pdbvars()
 
-! --------------------------------------------------------------------
-! PURPOSE: sequence,indices for selected atoms (data in INCP.H)
-!          & torsions from PDB to be used to build SMMP structure
-!
-!          ixatp(i,)
-!          = indices for SMMP atoms pointing to PDB atoms
-!            (=0, if atom not selected)
-!
-! --------------------------------- ref. point & axes
-!         ixrfpt(3,),rfpt(3,),xrfax(3,),yrfax(3,),zrfax(3,)
-!
-! CALLS:  tolost,getmol,bldmol,addend,atixpdb,setmvs,mklist,
-!         dihedr,fnd3ba,setsys,getpar,setvar,rmsdopt
-! --------------------------------------------------------------------
+c --------------------------------------------------------------------
+c PURPOSE: sequence,indices for selected atoms (data in INCP.H)
+c          & torsions from PDB to be used to build SMMP structure
+c
+c          ixatp(i,)
+c          = indices for SMMP atoms pointing to PDB atoms
+c            (=0, if atom not selected)
+c
+c --------------------------------- ref. point & axes
+c         ixrfpt(3,),rfpt(3,),xrfax(3,),yrfax(3,),zrfax(3,)
+c
+c CALLS:  tolost,getmol,bldmol,addend,atixpdb,setmvs,mklist,
+c         dihedr,fnd3ba,setsys,getpar,setvar,rmsdopt
+c --------------------------------------------------------------------
 
       include 'INCL.H'
       include 'INCP.H'
 
-      double precision dihedr, rm, av1, av2, rmsd, h, x, y, z
-
-      integer nml, nrs, nc, irb, ire, irs, i, ii, it, i1, i2, i3, i4, j1
-      integer j2, j3, j4, inew, j, ix
-
       character res*3
       dimension rm(3,3),av1(3),av2(3),h(3)
@@ -242,20 +236,20 @@
       do nc=1,nchp  ! PDB chains
 
-! =============================== SMMP molecule
+c =============================== SMMP molecule
         nml=nml+1
         if (nml.gt.mxml) then
-          write (logString, '(a,i4,2a)')' pdbvars> NUMBER of chains > '
-     &                          ,mxml,' in ',' ?'
+          write(*,'(a,i4,2a)')' pdbvars> NUMBER of chains > '
+     #                          ,mxml,' in ',' ?'
           stop
         endif
         ntlml=nml
-! ----------------------------- 'nmml' = ChainID
+c ----------------------------- 'nmml' = ChainID
         nmml(nml)=chnp(nc)
 
-! ======================================== get sequence
+c ======================================== get sequence
 
         irb=nrs+1
         ire=nrs+nchrsp(nc)
-! ----------------------------- # of 1st & last residue
+c ----------------------------- # of 1st & last residue
         irsml1(nml)=irb
         irsml2(nml)=ire
@@ -266,6 +260,6 @@
 
           if (nrs.gt.mxrs) then
-            write (logString, '(a,i4,2a)') 
-     &         ' pdbvars> NUMBER of residues > ', mxrs, ' in ',' ?'
+            write(*,'(a,i4,2a)') ' pdbvars> NUMBER of residues > '
+     #                       ,mxrs,' in ',' ?'
             stop
           endif
@@ -277,10 +271,10 @@
 
           if (.not.flex.and.irs.eq.irb.and.seq(nrs)(1:3).eq.'pro')
-     &      seq(nrs)='pron'  ! only ECEPP/3
+     #      seq(nrs)='pron'  ! only ECEPP/3
 
         enddo ! residues
 
-! ======================== get initial coords. for molecule 'nml'
-!                          with library values for deg. of freedom
+c ======================== get initial coords. for molecule 'nml'
+c                          with library values for deg. of freedom
 
         call getmol(nml)   ! assemble res. data from libraries
@@ -295,9 +289,9 @@
         call atixpdb(nml)  ! get 'ixatp'
 
-! -------------------------- 'load' SMMP variable information
+c -------------------------- 'load' SMMP variable information
         call setmvs(nml)   ! moving sets
         call mklist(nml)   ! interaction lists
 
-! ================================= get variables for 'nml'
+c ================================= get variables for 'nml'
 
         ii=ivrml1(nml)
@@ -362,11 +356,11 @@
         nvr = ivrml1(ntlml)+nvrml(ntlml)-1
 
-! ================================= global parameters for 'nml'
-
-! +++++++++++
+c ================================= global parameters for 'nml'
+
+c +++++++++++
        inew=0
 
        if (inew.eq.1) then
-! ++++++++++++++++++++++++
+c ++++++++++++++++++++++++
 
         call setvar(nml,vlvr)
@@ -375,6 +369,6 @@
         call rmsdopt(nml,1,nrs,ixatp,xatp,yatp,zatp,0,rm,av1,av2,rmsd)
 
-! ---------------------------- retrieve ref. coords.
-!                     & transform acc. to opt. rmsd
+c ---------------------------- retrieve ref. coords.
+c                     & transform acc. to opt. rmsd
         do i=1,3
           ii=ixrfpt(i,nml)
@@ -402,7 +396,7 @@
         call bldmol(nml)  ! finally build SMMP molecule
 
-! ++++++++++++++++
+c ++++++++++++++++
        else  ! old
-! ++++++++++++++++
+c ++++++++++++++++
 
         call fnd3ba(nml,i1,i2,i3)  ! three 1st bb atoms in SMMP (e.g. n,ca,c')
@@ -412,5 +406,5 @@
         ixrfpt(3,nml)=i3
 
-! -------------------------------- retrieve ref. coords.
+c -------------------------------- retrieve ref. coords.
         do i=1,3
           ii=ixrfpt(i,nml)
@@ -421,6 +415,6 @@
             zat(ii)=zatp(ix)
           else
-            write (logString, '(3a)') ' pdbvars> missing PDB atom ',
-     &         nmat(ii), ' is ref. point for SMMP - cannot proceed !'
+            write(*,'(3a)') ' pdbvars> missing PDB atom ',nmat(ii),
+     #       ' is ref. point for SMMP - cannot proceed !'
           endif
         enddo
@@ -432,10 +426,10 @@
         call rmsdopt(nml,1,nrs,ixatp,xatp,yatp,zatp,0,rm,av1,av2,rmsd)
 
-! ++++++++++
+c ++++++++++
        endif
-! ++++++++++
-
-       write (logString, *) ' '
-       write (logString, *) ' Initial RMSD ',rmsd
+c ++++++++++
+
+       write(*,*) ' '
+       write(*,*) ' Initial RMSD ',rmsd
 
       enddo ! chains(molecules)
@@ -443,19 +437,17 @@
       return
       end
-! ***************************
+c ***************************
       subroutine atixpdb(nml)
 
-! --------------------------------------------------------------------
-! PURPOSE: get ixatp - pointer of each SMMP atom to corresponding atom
-!                      of reference structure loaded in 'INCP.H'
-!                      (=0 if no corr. atom in ref. str.)
-!
-! CALLS:   toupst
-! --------------------------------------------------------------------
+c --------------------------------------------------------------------
+c PURPOSE: get ixatp - pointer of each SMMP atom to corresponding atom
+c                      of reference structure loaded in 'INCP.H'
+c                      (=0 if no corr. atom in ref. str.)
+c
+c CALLS:   toupst
+c --------------------------------------------------------------------
 
       include 'INCL.H'
       include 'INCP.H'
-
-      integer irs, nml, i1, i2, iat, ix, i
 
       character*4 atm
@@ -484,7 +476,7 @@
               endif
             enddo
-
-!            write (logString, '(8a)') ' pdbvars> ',atm,' not found in '
-!     #       ,chnp(nc),' ',rsidp(irs),' ',rsnmp(irs)
+               
+c            write(*,'(8a)') ' pdbvars> ',atm,' not found in '
+c     #       ,chnp(nc),' ',rsidp(irs),' ',rsnmp(irs)
 
           endif
@@ -492,32 +484,27 @@
     1     ixatp(iat)=ix
 
-        enddo   ! SMMP atoms of 'irs'
+        enddo   ! SMMP atoms of 'irs' 
       enddo   ! residues
 
       return
       end
-! **************************
+c **************************
       subroutine getpar(nml)
 
       include 'INCL.H'
 
-      double precision tol, h1, h2, h3, x1, x2, x3, d, z1, z2, z3, y1
-      double precision y2, y3, yp1, yp2
-
-      integer i1, nml, i2, i3, i
-
       parameter (TOL = 1.d-12)
 
-! Obtain molecule-fixed system (J,K,L) for 1st 3 bb-atoms,
-! -> determine global parameters: shifts dX,dY,dZ
-! & angles alpha,beta,gamma [rad], put into 'gbpr'
-!
-! CALLS: none
-!
+c Obtain molecule-fixed system (J,K,L) for 1st 3 bb-atoms,
+c -> determine global parameters: shifts dX,dY,dZ
+c & angles alpha,beta,gamma [rad], put into 'gbpr'
+c 
+c CALLS: none
+c
 
       i1=ixrfpt(1,nml)  ! from 'INCL.H'
       i2=ixrfpt(2,nml)
       i3=ixrfpt(3,nml)
-! -------------------------------------- Shifts
+c -------------------------------------- Shifts
       gbpr(1,nml) = xat(i1)
       gbpr(2,nml) = yat(i1)
@@ -527,5 +514,5 @@
         gbpr(i,nml) = 0.d0
       enddo
-! --------------------------------- J
+c --------------------------------- J
       h1=xat(i2)
       h2=yat(i2)
@@ -541,5 +528,5 @@
       x2=x2/d
       x3=x3/d
-! --------------------------------- L
+c --------------------------------- L
       h1=xat(i3)-h1
       h2=yat(i3)-h2
@@ -556,12 +543,12 @@
       z3=z3/d
 
-! ---------------------------------- K
+c ---------------------------------- K
       y1=z2*x3-z3*x2
       y2=z3*x1-z1*x3
       y3=z1*x2-z2*x1
-
+      
       if ( ( 1.d0 - abs(y3) ) .gt. TOL )  then       ! ============ |beta| < PI/2
 
-! ----------------------------------------------- Y'
+c ----------------------------------------------- Y'
         d = sqrt( y1 * y1 + y2 * y2 )
         yp1= y1 / d
Index: protein.py
===================================================================
--- protein.py	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
+++ protein.py	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -0,0 +1,289 @@
+#!/usr/bin/env python
+# protein.py
+#
+# Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+#                      Jan H. Meinke, Sandipan Mohanty
+#
+import sys
+import smmp
+from math import *
+
+crd = 57.2957795130823
+
+def nursvr(ivr):
+    res = 0
+    for i in range(smmp.mol_i.ntlml - 1, -1, -1):
+        ifirs = smmp.mol_i.irsml1[i] - 1
+        if ivr + 1 > smmp.res_i.ivrrs1[ifirs] and smmp.mol_i.nvrml[i] > 0:
+            for j in range(smmp.mol_i.irsml2[i] - 1, ifirs - 1, -1):
+                if ivr + 1 > smmp.res_i.ivrrs1[j]  and smmp.res_i.nvrrs[j] > 0:
+                    res = j + 1
+                    return res
+    return res
+
+## Provides read-only access to SMMP's atoms. Usually, you won't initialize
+#  an Atom directly since you need to know the internal array index of the
+#  Atom in SMMP. You can get a list of all the Atoms in a Protein by using 
+#  protein.Protein.getAtoms().
+#  Various properties are accessible. See the functions' documentations for
+#  details.
+class Atom:
+    """Atoms are the basic chemical units."""
+    #TODO: insert namespace
+    
+    ## Initialize the atom with its ID. The ID is the array index of the atom
+    #  in SMMP. 
+    #       @param id index of atom in SMMP
+    def __init__(self, id):
+        self.__id = id
+    
+    def position(self):
+        """Cartesian coordinates of this atom."""
+        res = (smmp.atm_r.xat[self.__id], smmp.atm_r.yat[self.__id], smmp.atm_r.zat[self.__id])
+        return res
+    
+    def charge(self):
+        """Partial charge of this atom."""
+        return smmp.atm_r.cgat[self.__id]
+    
+    def radius(self):
+        """Van-der-Waals Radius of this atom."""
+        return smmp.solvent.rvdw[self.__id]
+        
+    def name(self):
+        return ''.join([smmp.atm_c.nmat[i][self.__id] for i in range(0,4)]).strip()
+        
+    def __str__(self):
+        return "%s at (%s, %s, %s)" % (self.name(), self.position()[0],  self.position()[1], self.position()[2])
+
+## Amino acids bound within a protein are often called residues. Strictly
+#  speaking the residue is the part that's connected to the Calpha and not part
+#  of the backbone, but we'll include the backbone atoms as well. Just like Atoms
+# Residues reference the corresponding data in SMMP and are not independent. 
+class Residue:
+    """An amino acid within a Protein."""
+    
+    ## Initialize the residue with the corresponding index in SMMP.
+    #  @param id index of residue in SMMP
+    def __init__(self, id):
+        self.__id = id
+
+    def atoms(self):
+        """Returns the list of atoms belonging to this residue."""
+        first = smmp.res_i.iatrs1[self.__id]
+        last = smmp.res_i.iatrs2[self.__id]
+        res = [Atom(i) for i in range(first - 1, last - 1)]
+        return res
+    
+        
+## Proteins are constructed from a sequence file and a configuration file or 
+#  read from a PDB file.
+class Protein:
+    """A protein is a polypeptide made of the 20 naturally occuring amino 
+    acids.
+    """
+    
+    def __init__(self, seq, var=' '):
+        """The structure of the protein is read in from a file. 
+        Pass the name of a textfile with a sequence string and--optionally--the name of a
+        variable file that describes the conformation. Or give the name of pdb
+        file---it must end with 'pdb'---that contains both information."""
+        
+        grpn = 'nh2'
+        grpc = 'cooh'
+        prevID = smmp.mol_i.ntlml - 1
+        if seq[-3:].lower() == 'pdb':
+            if smmp.mol_i.ntlml:
+                print "Sorry, but I can only read the first protein from a pdb file." 
+                raise ValueError
+            smmp.init_molecule(0, grpn, grpc, seq)
+        else:
+            smmp.init_molecule(1, grpn, grpc, seq, var)
+        self.__id = smmp.mol_i.ntlml - 1
+        if self.__id - prevID > 1:
+            print "Sorry, I don't know how to deal with multiple proteins in one sequence file, yet."
+            raise NotImplementedError
+    
+    def setOrigin(self, x, a):
+        """Sets the position of the N terminal of the protein in the global 
+        coordinate system and the orientation of the protein. Expects two 
+        tuples. The first contains the coordinates of the first atom (x, y,
+        and z) and the second contains three angles.
+        """
+        #TODO: Implement type checking
+        smmp.mol_r.gbpr[0][self.__id] = x[0]
+        smmp.mol_r.gbpr[1][self.__id] = x[1]
+        smmp.mol_r.gbpr[2][self.__id] = x[2]
+        smmp.mol_r.gbpr[3][self.__id] = a[0]
+        smmp.mol_r.gbpr[4][self.__id] = a[1]
+        smmp.mol_r.gbpr[5][self.__id] = a[2]
+
+    def origin(self):
+        r = [smmp.mol_r.gbpr[i][self.__id] for i in range(0, 3)]
+        a = [smmp.mol_r.gbpr[i][self.__id] for i in range(3, 6)]
+        return r, a
+    
+    def getDihedral(self, angle, residue):
+        try:
+            res = int(residue)
+            idx = res
+        except ValueError:
+            res = residue.split()
+            res[0] = res[0].lower()
+            res[1] = int(res[1])
+            idx = self.findResidue(res[0], res[1])
+        varIdx = ''
+        for i in range(smmp.res_i.ivrrs1[idx], smmp.res_i.ivrrs1[idx] + smmp.res_i.nvrrs[idx]):
+            varName = ''.join(list([str(smmp.var_c.nmvr[j][i]) for j in range(0, 3)]))
+            if varName == angle:
+                varIdx = i
+                break
+        if varIdx:
+            return smmp.var_r.vlvr[varIdx] * crd
+        raise KeyError, '%s not found for %s.' % (angle, residue)
+    
+    ## Residues are given by their 3-letter abbreviation and their index. 
+    #  For example, findResidue('gly', 5) returns the index of the fifth occurence
+    #  of glycine in the protein. If the residue is not found an exception is raised.
+    #
+    #  @param name 3-letter abbreviation of the residue
+    #  @param idx index of occurence of the amino acid given in name.
+    
+    def findResidue(self, name, idx = 1):
+        """Find the idxth residue of type name and return the index."""
+        res = ''.join(self.residues()).lower()
+        name = name.lower()
+        j = 0
+        try:
+            for i in range(0, idx):
+                k = res.index(name, j)
+                j = j + k
+        except:
+            raise KeyError, "%s%s not found." % (name, idx)
+        if j >=len(res):
+            raise KeyError, "%s%s not found." % (name, idx)
+        return j / 3
+        
+    def atoms(self):
+        """Returns the list of atoms belonging to this protein."""
+        first = smmp.res_i.iatrs1[smmp.mol_i.irsml1[self.__id] - 1]
+        last = smmp.res_i.iatrs2[smmp.mol_i.irsml2[self.__id] - 1]
+        res = [Atom(i) for i in range(first - 1, last - 1)]
+        return res
+    
+    def residues(self):
+        """Returns a list of the amino acids in this protein."""
+        seq = [str(c[0]) for c in smmp.res_c.seq]
+        first = smmp.mol_i.irsml1[self.__id]- 1
+        last = smmp.mol_i.irsml2[self.__id] - 1
+        return ''.join(seq).split()[first:last]
+        
+    def id(self):
+        return self.__id
+        
+    def strand(self):
+        """Returns the number of residues in a beta-strand-like configuration."""
+        maxDev = 30.0
+        phiSheet = -150.0
+        psiSheet = 150.0
+        strandCount = 0
+        ifivr = smmp.mol_i.ivrml1[self.__id]
+        i = 0
+        iv = smmp.var_i.idvr[i]
+        while iv < ifivr:
+            i += 1
+            iv = smmp.var_i.idvr[i]
+        for j in range(i, ifivr + smmp.mol_i.nvrml[self.__id]):
+            iv = smmp.var_i.idvr[j] - 1
+            name =''. join([str(smmp.var_c.nmvr[iv * 3 + k][0]) for k in range(0,3)])
+            if name == 'phi':
+                phi = smmp.var_r.vlvr[iv] * crd
+                psi = smmp.var_r.vlvr[smmp.var_i.idvr[j+1] - 1] * crd
+                if abs(phi - phiSheet) < maxDev and abs(psi - psiSheet) < maxDev:
+                    strandCount += 1
+        return strandCount
+    
+    def directionVector(self):
+        """Calculates the normalized end-to-end vector for this molecule. 
+        The first and last c_alpha carbon is used as reference."""
+        atoms = self.atoms()
+        beginning = []
+        for a in atoms:
+            if a.name().strip() == 'ca':
+                if beginning:
+                    end = a.position()
+                else:
+                    beginning = a.position()
+        res = [end[i] - beginning[i] for i in range(0,3)] 
+        sum = sqrt(reduce(lambda x, y: x + y ** 2, res))
+        res = map(lambda x: x / sum, res)
+        return res
+        
+    def contacts(self):
+        """Returns a triplet containing the total number of contacts, the number
+        of native contacts, and the hemming distance. The latter two quantities 
+        are only meaningful if a reference structure has been defined.
+        """
+        return smmp.contacts()
+
+    def hbond(self):
+        return smmp.hbond(self.__id + 1, 0)
+        
+    def energy(self):
+        return smmp.energy()
+    
+    def rgyr(self):
+        return smmp.rgyr(self.__id + 1) 
+    
+    def rmsdfun(self):
+        return smmp.rmsdfun()
+        
+    def savePDB(self, file=""):
+       """Write the current configuration to file using PDB formatting."""
+       smmp.outpdb(self.__id, file)
+       
+    def saveVariables(self, file=""):
+        """Output the current conformation in the variable format. The output 
+        can be read in again and used to restart/continue a simulation.
+        
+        @param file if empty write to standard out
+        """
+        # Same functionality as smmp.outvar(self.__id + 1, 0)
+        if not file:
+            out = sys.stdout
+        else:
+            out = open(file, 'w')
+        for i in range(smmp.mol_i.ivrml1[self.__id] - 1 , smmp.mol_i.ivrml1[self.__id] + smmp.mol_i.nvrml[self.__id] - 1):
+            if not smmp.var_l.fxvr[i]:
+                name = ''.join([str(smmp.var_c.nmvr[i * 3 + j][0]) for j in range(0,3)])
+                print >>out, nursvr(i), ':', name, ':', smmp.var_r.vlvr[i] * crd
+            else:
+                it=smmp.var_i.ityvr[i]
+                if it == 3:
+                    print >>out, nursvr(i), ':', name, ':', smmp.var_r.vlvr[i] * crd, ' &'
+        
+    def zimmer(self):
+        first = smmp.mol_i.irsml1[self.__id][0] - 1
+        last = smmp.mol_i.irsml2[self.__id][0] - 1
+        nrs = smmp.mol_i.irsml2[smmp.mol_i.ntlml - 1][0] - 1
+        smmp.zimmer(last)
+        return smmp.zimme.zimm[first:last]
+
+    def __len__(self):
+        return smmp.mol_i.irsml2[self.__id]  - smmp.mol_i.irsml1[self.__id]
+
+
+if __name__ == "__main__":
+    libdir = 'SMMP/'
+
+    smmp.epar_l.flex = 0
+    smmp.epar_l.sh2 = 0
+    smmp.epar_l.epsd = 0
+    smmp.epar_l.tesgrd = 0
+    smmp.isolty.itysol = 0
+    smmp.init_energy(libdir)
+    
+    p1 = Protein('EXAMPLES/1bdd.pdb')
+    for i in p1.atoms():
+        print i
+    print p1.getDihedral('phi', 11)
Index: smmp/ParallelTempering.py
===================================================================
--- pysmmp/ParallelTempering.py	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,117 +1,0 @@
-#!/usr/bin/env python
-
-#import smmp
-import sys, copy,  random,  math,  numpy as np
-
-from mpi4py import MPI 
-#from algorithms import CanonicalMonteCarlo
-
-class ParallelTempering(object):
-    """Parallel tempering is a generalized Monte Carlo algorithm. A set of
-    replica is simulated at different temperatures. Each replica performs a 
-    canoncial Monte Carlo simulation. After a given number of sweeps, an exchange
-    is attempted between neighboring replicas.
-    """
-    
-    def __init__(self, T,  myUniverse):
-        """Initialize ParallelTempering with a set of tempertures T.
-        """
-        self.kB = 1.98773e-3
-        
-        self._T = copy.deepcopy(T)
-        self._numberOfReplica = len(T)
-
-        # Calculate the number of processors available per replica
-        numberOfProcessors = MPI.COMM_WORLD.Get_size()
-        numberOfProcessorsPerReplica = numberOfProcessors // self._numberOfReplica
-        numberOfProcessors = numberOfProcessorsPerReplica * self._numberOfReplica
-        self._myReplica = MPI.COMM_WORLD.Get_rank() // numberOfProcessorsPerReplica
-
-        # Create the replica internal communicators for the energy function
-        groupWorld = MPI.COMM_WORLD.Get_group()
-        group = [MPI.Group.Range_incl(groupWorld, [[i * numberOfProcessorsPerReplica, (i + 1) * numberOfProcessorsPerReplica - 1, 1], ]) for i in xrange(self._numberOfReplica)]
-        comm = [MPI.COMM_WORLD.Create(g) for g in group]
-        
-        # Create the communicator needed to exchange information about replica
-        ptGroup = MPI.Group.Incl(groupWorld, range(0, numberOfProcessors, numberOfProcessorsPerReplica))
-        self._ptComm = MPI.COMM_WORLD.Create(ptGroup)
-        
-        self._localMaster = self._ptComm != MPI.COMM_NULL
-        if self._localMaster:
-            self._myPTRank = self._ptComm.Get_rank()
-            
-        self._oddCycle = False
-        
-        
-    def exchange(self):
-        """Collect temperatures and energies from all replicas, determine neighbor and do replica exchange move.
-        
-        The exchange step is the heart of parallel tempering. The probability of exchange between two 
-        temperatures i and j is given by P_{ij} = \Delta \beta \Delta E, where \beta = 1/k_B T.
-        """
-        if self._localMaster:
-#            energies = ptComm.allgather(self._myUniverse.energy())
-            myE = [250,  255,  75,  125, 120, 185][self._myReplica]
-            myT = [420,  370,  250,  275,  300,  330][self._myReplica]
-            energies = self._ptComm.allgather(myE)
-#            temperatures = ptComm.allgather(self._myUniverse.temperature())
-            temperatures = self._ptComm.allgather(myT)
-            
-            temperatureRank = zip(temperatures,  np.arange(self._numberOfReplica))
-            temperatureRank.sort()
-            
-            if (self._myPTRank % 2):
-                if self._oddCycle:
-                    rank0 = self._myPTRank
-                else:
-                    rank0 = self._myPTRank - 1
-                
-                rank1 = (rank0 + 1) % self._ptComm.Get_size()
-                
-                self._oddCycle = not self._oddCycle
-                
-                E0 = energies[temperatureRank[rank0][1]]
-                E1 = energies[temperatureRank[rank1][1]]
-                T0 = self._T[rank0]
-                T1 = self._T[rank1]
-                beta0 = 1.0 / (T0 * self.kB)
-                beta1 = 1.0 / (T1 * self.kB)
-                
-                P = math.exp((beta0 - beta1) * (E0 - E1))
-                print self._myPTRank,  P
-                
-                if P >= random.random(): # accept exchange
-                    rank = self._ptComm.allgather(np.array([temperatureRank[rank1][1],  temperatureRank[rank0][1]]))
-                else:
-                    rank = self._ptComm.allgather(np.array([temperatureRank[rank0][1],  temperatureRank[rank1][1]]))
-            else:
-                random.random() # Do one random number to stay in sync with the other processes for the same replica.
-                rank = self._ptComm.allgather(np.array([-1,  -1]))
-
-            rank = np.array(rank[1::2]).flatten()
-            print(rank)
-            rankTemperature = zip(rank,  self._T)
-            rankTemperature.sort()
-            print self._myPTRank,  rankTemperature[self._myReplica][1]
-#            self._myUniverse.setTemperature(rankTemperature[self._myReplica][1])
-        else:
-            random.random() # Do one random number to stay in sync with the master process for the same replica.
-            
-
-            
- 
-if __name__ == "__main__":
-    
-    n = int(sys.argv[1])
-    T = [250,  275,  300,  330,  370,  420]
-    
-    myPT = ParallelTempering(T,  [])
-    myPT.exchange()
-    myPT.exchange()
-
-
-        
-        
-        
-
-         
Index: smmp/algorithms.py
===================================================================
--- pysmmp/algorithms.py	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,91 +1,0 @@
-# algorithms.py
-#
-# Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-#                      Jan H. Meinke, Sandipan Mohanty
-#
-import copy
-import random
-import smmp_p as smmp
-from math import *
-from universe import *
-from protein import *
-
-class CanonicalMonteCarlo(object):
-    """An implementation of a canonical Monte Carlo run using Metropolis weights.
-    After a Monte-Carlo sweep over all internal variables, this implementation 
-    calculates the interactions between all Protein s in the Universe
-    """
-    
-    def __init__(self, myUniverse, nequi, sweeps, weight =  lambda x : x * smmp.bet.beta):
-        self.__defSweeps = sweeps
-        self.__defEqui = nequi
-        self.__univ = myUniverse
-        self.__acc = 0
-        self.__performedSweeps = 0
-        self.__minEnergy = myUniverse.energy()
-        self.__l = 0.1
-        self.__minCounter = 0
-        self.__weight = weight
-        
-    ## Fraction of accepted Monte Carlo moves of the total number of attempted moves.
-    #  @pre At least one move must have been performed before this function can be
-    #       called
-    #  @return fraction of accepted moves as a number between 0 and 1.
-    def acceptanceRate(self):
-        return float(self.__acc) / (self.__performedSweeps * smmp.mol_par.nvr)
-    ## The lowest energy ever seen at the end of a Monte Carlo move.
-    #  @return lowest energy seen at the end of a sweep, sweep
-    def minimumEnergy(self):
-        return self.__minEnergy, self.__minCounter
-    ## Number of sweeps performed so far
-    def performedSweeps(self):
-        return self.__performedSweeps
-        
-    def run(self):
-        """A complete Monte Carlo run including initial equilibration."""
-        self.sweeps(self.__defSweeps)
-        
-    def equilibrate(self):
-        """Do nequi sweeps to eqilibrate the system."""
-        self.sweeps(self.__defEqui)
-        
-    def sweeps(self, n):
-        """Perform n sweeps."""
-        for i in range(0, n):
-            self.sweep()
-        
-    def sweep(self):
-        """Performs a single Monte Carlo sweep."""
-        eol = self.__univ.energy()
-        #eol, self.__acc = smmp.metropolis(eol, self.__acc, self.__weight)
-        eol = self.metropolis()
-        self.__performedSweeps += 1
-        if eol < self.__minEnergy:
-            self.__minEnergy = eol
-            self.__minCounter = self.__performedSweeps
-            smmp.outpdb(0, "best.pdb")
-
-    def metropolis(self):
-        """Implementation of the Metropolis algorithm."""
-        eol = self.__univ.energy()
-        # Update the internal degrees of freedom first
-        for i in range(0, smmp.mol_par.nvr):
-            jv = smmp.var_i.idvr[i] - 1
-            vrol = smmp.var_r.vlvr[jv]
-            dv=smmp.var_r.axvr[jv] * (random.random() - 0.5)
-            smmp.var_r.vlvr[jv] = (vrol + dv + pi) % (2 * pi) - pi
-            etrial = self.__univ.energy()
-            dW = self.__weight(etrial) - self.__weight(eol)
-            if dW < 0:
-                eol = etrial
-                self.__acc += 1
-            else:
-                rd =random.random()
-                dW = min(dW, 100)
-                if  exp(-dW) > rd:
-                    eol = etrial
-                    self.__acc +=1
-                else:
-                    smmp.var_r.vlvr[jv] = vrol
-        # Update the global degrees of freedom
-        return eol
Index: smmp/interactionscan.py
===================================================================
--- pysmmp/interactionscan.py	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,100 +1,0 @@
-# -*- coding: utf-8 -*-
-'''
-Created on Aug 31, 2010
-
-@author: Jan H. Meinke
-'''
-
-import smmp_p as smmp
-import numpy as np
-from math import sqrt, cos
-
-def scan():
-    """Iterate through all interaction pairs and return lists of 
-    interaction partners for each type of interaction.
-    
-    This implementation is almost equivalent to the Fortran 
-    implementation in enyshe.f.
-    
-    """
-    cutoff = 32
-    longDistancePartners = {}
-    oneFourPartners = {}
-    
-    EvdW = 0
-    Ec = 0
-    Ehb = 0
-    Etor = 0
-    ifivr = smmp.mol_i.ivrml1[0]
-    ntlvr = smmp.mol_par.nvr
-    i1s = smmp.mol_i.imsml1[0] + smmp.mol_i.nmsml[0]
-    # Loop over variables in reverse order.
-    for iv in smmp.var_i.iorvr[ifivr + ntlvr - 2:ifivr:-1] - 1:
-        ia = smmp.var_i.iatvr[iv] - 1
-        ic = smmp.var_i.iclvr[iv] - 1
-        if smmp.var_i.ityvr[iv] == 3:
-            Etor += smmp.epar_r.e0to[ic] * (1.0 + smmp.epar_r.sgto[ic] *
-                cos(smmp.atm_r.toat[ia] * smmp.epar_r.rnto[ic]))
-            
-        i2s = i1s - 1
-        i1s = smmp.var_i.imsvr1[iv - 1]
-        for i1, i2 in zip(smmp.var_i.latms1[i1s:i2s] - 1, 
-                          smmp.var_i.latms2[i1s:i2s]):
-            for i, ity, cqi, xi, yi, zi, ivw1, ivw2, i141, i142 in zip(
-                    np.arange(i1, i2), smmp.atm_i.ityat[i1:i2], 
-                    smmp.epar_r.conv * smmp.atm_r.cgat[i1:i2],
-                    smmp.atm_r.xat[i1:i2], 
-                    smmp.atm_r.yat[i1:i2], smmp.atm_r.zat[i1:i2], 
-                    smmp.eny_i.ivwat1[i1:i2] - 1, smmp.eny_i.ivwat2[i1:i2],
-                    smmp.eny_i.i14at1[i1:i2] - 1,smmp.eny_i.i14at1[i1:i2]):
-                longDistancePartners[i] = []
-                oneFourPartners[i] = []
-                for j, jty, xij, yij, zij, cqj in zip(np.arange(ivw1, ivw2), 
-                        smmp.atm_i.ityat[ivw1:ivw2],
-                        smmp.atm_r.xat[ivw1:ivw2] - xi, 
-                        smmp.atm_r.yat[ivw1:ivw2] - yi,
-                        smmp.atm_r.zat[ivw1:ivw2] - zi,
-                        smmp.atm_r.cgat[ivw1:ivw2]):
-                    if abs(i - j) < cutoff:
-                        longDistancePartners[i].append(j)
-                    rij2 = xij * xij + yij * yij + zij * zij
-                    rij4 = rij2 * rij2
-                    rij6 = rij4 * rij2
-                    rij = sqrt(rij2)
-                    Ec += cqi * cqj / rij
-                    if smmp.epar_i.ihbty[ity, jty]:
-                        Ehb += smmp.epar_r.ahb[ity, jty] / (rij6 * rij6) -\
-                            smmp.epar_r.chb[ity, jty] / (rij6 * rij4)
-                    else:
-                        EvdW += smmp.epar_r.aij[ity, jty] / (rij6 * rij6) -\
-                            smmp.epar_r.cij[ity, jty] / rij
-                
-                for j in smmp.eny_i.l14at[i141:i142]:
-                    jty = smmp.atm_i.ityat[j]
-                    xij = smmp.atm_r.xat[j] - xi
-                    yij = smmp.atm_r.xat[j] - yi
-                    zij = smmp.atm_r.xat[j] - zi
-                    rij2 = xij * xij + yij * yij + zij * zij
-                    rij4 = rij2 * rij2
-                    rij6 = rij4 * rij2
-                    rij = sqrt(rij2)
-                    Ec += cqi * cqj / rij
-                    if smmp.epar_i.ihbty[ity, jty]:
-                        Ehb += smmp.epar_r.ahb[ity, jty] / (rij6 * rij6) -\
-                            smmp.epar_r.chb[ity, jty] / (rij6 * rij4)
-                        longDistancePartners[i].append(j)
-                    else:
-                        oneFourPartners[i].append(j)
-                        EvdW += smmp.epar_r.a14[ity, jty] / (rij6 * rij6) -\
-                           smmp.epar_r.cij[ity, jty] / rij
-                           
-                if not longDistancePartners[i]:
-                    del(longDistancePartners[i])
-                if not oneFourPartners[i]:
-                    del(oneFourPartners[i])
-
-                    
-    print EvdW + Ec + Ehb + Etor, EvdW, Ec, Ehb, Etor
-    
-    return longDistancePartners, oneFourPartners
-                 
Index: smmp/main.py
===================================================================
--- pysmmp/main.py	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,114 +1,0 @@
-#!/usr/bin/env python
-# main.py
-#
-# Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-#                      Jan H. Meinke, Sandipan Mohanty
-
-## \mainpage pySMMP: Python bindings to SMMP v. 1.1.
-#    SMMP is a FORTRAN library for simulating proteins. It provides 
-#    minimization routines and various Monte Carlo methods. SMMP uses an all-atom
-#    representation of the protein. It stores the configuration within the 
-#    standard geometry model. In the standard geometry model the internal degrees
-#    of freedom, e.g., the dihedral angles, the bond lengths, etc. are stored and
-#    the cartesian coordinates are calculated on the fly. For more details on 
-#    the model SMMP uses and the functions it provides see the manual (manual.ps).
-#   
-#    pySMMP builds on SMMP. It provides python bindings to the functions and 
-#    global variables, but it uses classes to represent the Proteins and 
-#    algorithms. 
-#    
-#    \section sec_tutorial A Tutorial: A canonical Monte Carlo simulation of protein A
-#
-#    The basic setup is the same for most simulations. This tutorial takes you
-#    step by step to a running simulation. First we need to import the library
-#    \code 
-#         import smmp
-#     \endcode
-#    This makes the smmp routines available to the Python interpreter. Next we
-#    create the universe by initializing a universe.Universe object by first 
-#    importing the universe package and then setting the object:
-#    \code
-#        import universe
-#        myUniverse = universe.Universe(T=300)  
-#    \endcode
-#    This initializes the smmp library as well. We also set the initial 
-#    temperature of the universe to 300K. The Universe object initializes the 
-#    SMMP library and keeps track of global parameters, e.g, the temperature T.
-#    After you created a Universe, you can initialize a Protein. Proteins can
-#    be read from a sequence and a variable file or from a PDB file.
-#    \code
-#        import protein
-#        
-#        protA = protein.Protein("1bdd.seq", "1bdd.var")
-#        myUniverse.add(protA)
-#    \endcode
-#    Adding the protein to myUniverse makes the universe aware of it.
-#    Now you are ready to run a simulation. You can also querry the protein for 
-#    various properties, e.g., 
-#    \code
-#        print protA.rgyr()
-#    \endcode
-#    prints the radius of gyration of the protein.
-#    A canonical Monte Carlo algorithm is available in the algorithms package.
-#    \code
-#        import algorithms
-#        myMC = algorithms.CanonicalMonteCarlo(myUniverse, 1000, 10000)
-#    \endcode
-#    This sets up a simulation with 1000 steps for equilibration and a default 
-#    length of 10000 sweeps.
-#    The quickest way to run the simulation is by calling the run method of the 
-#    algorithm object myMC to do the entire Monte Carlo run.
-#    \code
-#        myMC.run()
-#    \endcode
-
-import sys, time
-from optparse import OptionParser
-from protein import *
-from universe import *
-from algorithms import CanonicalMonteCarlo
-
-if __name__ == "__main__":
-# Set up command line options    
-    usage = "usage: %prog [options] seq-filename"
-    parser = OptionParser(usage = usage, version="%prog 20050805")
-    parser.add_option("-v", "--variables", dest="varFileName",
-                  help="read amino-acid conformation from FILE", metavar="FILE")
-    parser.add_option("--equi", type="int", dest="nequi", default=100,
-                  help="number of sweeps for equilibration", metavar="n")
-    parser.add_option("--sweeps", type="int", dest="sweeps", default=10000,
-                  help="number of sweeps for annealing", metavar="n")
-    parser.add_option("--mes", type="int", dest="mes", default=10,
-                  help="number of sweeps between measurements", metavar="n")
-    parser.add_option("--Tmax", type="float", dest="tmax", default=1000,
-                  help="maximum temperature for annealing", metavar="T")
-    parser.add_option("--Tmin",  type="float", dest="tmin", default=100, 
-                  help="maximum temperature for annealing",metavar="T")
-
-    (options, args) = parser.parse_args()
-    if len(args) < 1:
-        parser.print_help()
-        sys.exit()
-    seqFileName = args[0]
-    
-# Start simulation setup.    
-    myUniv = Universe(T=300, st=0)   
-    p1 = Protein(seqFileName, options.varFileName)
-    p1.setOrigin((0, 0, 0), (0, 0, 0))
-    myUniv.add(p1)
-    T = 300.0
-    smmp.outpdb(1, "start.pdb")
-    print "E of starting configuration.", myUniv.energy()
-    ts = time.time()
-    smmp.minim(1, options.sweeps, 1.0E-12)
-
-    smmp.outpdb(1, "equi.pdb")
-    
-    t1 = time.clock()
-    print myUniv.energy(), myUniv.rgyr(), myUniv.helix(), p1.hbond(), (t1-ts)
-    p1.saveVariables("final.var")
-    smmp.outpdb(0, "final.pdb")
-    te = time.time()
-    print "The calculation took %ss." % (te - ts)
- 
-    
Index: smmp/pPySMMP.py
===================================================================
--- pysmmp/pPySMMP.py	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,40 +1,0 @@
-# -*- coding: utf-8 -*-
-import smmp_p as smmp
-import mpi4py
-import mpi4py.MPI
-import time, random
-from universe import *
-from protein import *
-from algorithms import *
-
-smmp.paral.my_mpi_comm = mpi4py.MPI.COMM_WORLD.py2f()
-smmp.paral.myrank = mpi4py.MPI.COMM_WORLD.Get_rank()
-numberOfTasks = mpi4py.MPI.COMM_WORLD.Get_size()
-smmp.paral.no = numberOfTasks
-#smmp.init_energy("SMMP/")
-#smmp.init_molecule(1,'nh3+','coo-',seqfile='EXAMPLES/1bdd.seq',varfile='EXAMPLES/1bdd.var')
-myU = Universe(st=1)
-myP = Protein('EXAMPLES/1bdd.seq', 'EXAMPLES/1bdd.var')
-myU.add(myP)
-smmp.distributeworkload(numberOfTasks,1)
-E = myU.energy()
-if smmp.paral.myrank == 0:
-    print "The starting energy is %s." % E
-
-random.seed(82364)
-#myMC = CanonicalMonteCarlo(myU, 20, 20)
-
-t0 = time.time()
-for i in xrange(1000):
-    myU.energy()
-
-#myMC.run()
-t1 = time.time()
-E = myU.energy()
-if smmp.paral.myrank == 0:
-#    Emin = myMC.minimumEnergy()
-    print "The final energy is: %f. Calculated in %fs" % (E, (t1 -t0))
-#    print "The minimum energy found was %.2f at sweep %s." % Emin
-    
-print random.random()
-
Index: smmp/protein.py
===================================================================
--- pysmmp/protein.py	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,290 +1,0 @@
-#!/usr/bin/env python
-# protein.py
-#
-# Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-#                      Jan H. Meinke, Sandipan Mohanty
-#
-import sys
-import numpy as np
-import smmp_p as smmp
-from math import *
-
-crd = 57.2957795130823
-
-def nursvr(ivr):
-    res = 0
-    for i in range(smmp.mol_i.ntlml - 1, -1, -1):
-        ifirs = smmp.mol_i.irsml1[i] - 1
-        if ivr + 1 > smmp.res_i.ivrrs1[ifirs] and smmp.mol_i.nvrml[i] > 0:
-            for j in range(smmp.mol_i.irsml2[i] - 1, ifirs - 1, -1):
-                if ivr + 1 > smmp.res_i.ivrrs1[j]  and smmp.res_i.nvrrs[j] > 0:
-                    res = j + 1
-                    return res
-    return res
-
-## Provides read-only access to SMMP's atoms. Usually, you won't initialize
-#  an Atom directly since you need to know the internal array index of the
-#  Atom in SMMP. You can get a list of all the Atoms in a Protein by using 
-#  protein.Protein.getAtoms().
-#  Various properties are accessible. See the functions' documentations for
-#  details.
-class Atom:
-    """Atoms are the basic chemical units."""
-    #TODO: insert namespace
-    
-    ## Initialize the atom with its ID. The ID is the array index of the atom
-    #  in SMMP. 
-    #       @param id index of atom in SMMP
-    def __init__(self, id):
-        self.__id = id
-    
-    def position(self):
-        """Cartesian coordinates of this atom."""
-        res = (smmp.atm_r.xat[self.__id], smmp.atm_r.yat[self.__id], smmp.atm_r.zat[self.__id])
-        return res
-    
-    def charge(self):
-        """Partial charge of this atom."""
-        return smmp.atm_r.cgat[self.__id]
-    
-    def radius(self):
-        """Van-der-Waals Radius of this atom."""
-        return smmp.solvent.rvdw[self.__id]
-        
-    def name(self):
-        return ''.join(smmp.atm_c.nmat[:,0].reshape([-1,4])[self.__id]).strip()
-        
-    def __str__(self):
-        return "%s at (%s, %s, %s)" % (self.name(), self.position()[0],  self.position()[1], self.position()[2])
-
-## Amino acids bound within a protein are often called residues. Strictly
-#  speaking the residue is the part that's connected to the Calpha and not part
-#  of the backbone, but we'll include the backbone atoms as well. Just like Atoms
-# Residues reference the corresponding data in SMMP and are not independent. 
-class Residue:
-    """An amino acid within a Protein."""
-    
-    ## Initialize the residue with the corresponding index in SMMP.
-    #  @param id index of residue in SMMP
-    def __init__(self, id):
-        self.__id = id
-
-    def atoms(self):
-        """Returns the list of atoms belonging to this residue."""
-        first = smmp.res_i.iatrs1[self.__id]
-        last = smmp.res_i.iatrs2[self.__id]
-        res = [Atom(i) for i in range(first - 1, last - 1)]
-        return res
-    
-        
-## Proteins are constructed from a sequence file and a configuration file or 
-#  read from a PDB file.
-class Protein:
-    """A protein is a polypeptide made of the 20 naturally occuring amino 
-    acids.
-    """
-    
-    def __init__(self, seq, var=' '):
-        """The structure of the protein is read in from a file. 
-        Pass the name of a textfile with a sequence string and--optionally--the name of a
-        variable file that describes the conformation. Or give the name of pdb
-        file---it must end with 'pdb'---that contains both information."""
-        
-        grpn = 'nh2'
-        grpc = 'cooh'
-        prevID = smmp.mol_i.ntlml - 1
-        if seq[-3:].lower() == 'pdb':
-            if smmp.mol_i.ntlml:
-                print "Sorry, but I can only read the first protein from a pdb file." 
-                raise ValueError
-            smmp.init_molecule(0, grpn, grpc, seq)
-        else:
-            smmp.init_molecule(1, grpn, grpc, seq, var)
-        self.__id = smmp.mol_i.ntlml - 1
-        if self.__id - prevID > 1:
-            print "Sorry, I don't know how to deal with multiple proteins in one sequence file, yet."
-            raise NotImplementedError
-    
-    def setOrigin(self, x, a):
-        """Sets the position of the N terminal of the protein in the global 
-        coordinate system and the orientation of the protein. Expects two 
-        tuples. The first contains the coordinates of the first atom (x, y,
-        and z) and the second contains three angles.
-        """
-        #TODO: Implement type checking
-        smmp.mol_r.gbpr[0][self.__id] = x[0]
-        smmp.mol_r.gbpr[1][self.__id] = x[1]
-        smmp.mol_r.gbpr[2][self.__id] = x[2]
-        smmp.mol_r.gbpr[3][self.__id] = a[0]
-        smmp.mol_r.gbpr[4][self.__id] = a[1]
-        smmp.mol_r.gbpr[5][self.__id] = a[2]
-
-    def origin(self):
-        r = [smmp.mol_r.gbpr[i][self.__id] for i in range(0, 3)]
-        a = [smmp.mol_r.gbpr[i][self.__id] for i in range(3, 6)]
-        return r, a
-    
-    def getDihedral(self, angle, residue):
-        try:
-            res = int(residue)
-            idx = res
-        except ValueError:
-            res = residue.split()
-            res[0] = res[0].lower()
-            res[1] = int(res[1])
-            idx = self.findResidue(res[0], res[1])
-        varIdx = ''
-        for i in range(smmp.res_i.ivrrs1[idx], smmp.res_i.ivrrs1[idx] + smmp.res_i.nvrrs[idx]):
-            varName = ''.join(list([str(smmp.var_c.nmvr[j][i]) for j in range(0, 3)]))
-            if varName == angle:
-                varIdx = i
-                break
-        if varIdx:
-            return smmp.var_r.vlvr[varIdx] * crd
-        raise KeyError, '%s not found for %s.' % (angle, residue)
-    
-    ## Residues are given by their 3-letter abbreviation and their index. 
-    #  For example, findResidue('gly', 5) returns the index of the fifth occurence
-    #  of glycine in the protein. If the residue is not found an exception is raised.
-    #
-    #  @param name 3-letter abbreviation of the residue
-    #  @param idx index of occurence of the amino acid given in name.
-    
-    def findResidue(self, name, idx = 1):
-        """Find the idxth residue of type name and return the index."""
-        res = ''.join(self.residues()).lower()
-        name = name.lower()
-        j = 0
-        try:
-            for i in range(0, idx):
-                k = res.index(name, j)
-                j = j + k
-        except:
-            raise KeyError, "%s%s not found." % (name, idx)
-        if j >=len(res):
-            raise KeyError, "%s%s not found." % (name, idx)
-        return j / 3
-        
-    def atoms(self):
-        """Returns the list of atoms belonging to this protein."""
-        first = smmp.res_i.iatrs1[smmp.mol_i.irsml1[self.__id] - 1]
-        last = smmp.res_i.iatrs2[smmp.mol_i.irsml2[self.__id] - 1]
-        res = [Atom(i) for i in range(first - 1, last - 1)]
-        return res
-    
-    def residues(self):
-        """Returns a list of the amino acids in this protein."""
-        seq = [''.join(l) for l in np.array([str(c[0]) for c in smmp.res_c.seq]).reshape([-1, 4])]
-        first = smmp.mol_i.irsml1[self.__id]- 1
-        last = smmp.mol_i.irsml2[self.__id] - 1
-        return seq[first:last]
-        
-    def id(self):
-        return self.__id
-        
-    def strand(self):
-        """Returns the number of residues in a beta-strand-like configuration."""
-        maxDev = 30.0
-        phiSheet = -150.0
-        psiSheet = 150.0
-        strandCount = 0
-        ifivr = smmp.mol_i.ivrml1[self.__id]
-        i = 0
-        iv = smmp.var_i.idvr[i]
-        while iv < ifivr:
-            i += 1
-            iv = smmp.var_i.idvr[i]
-        for j in range(i, ifivr + smmp.mol_i.nvrml[self.__id]):
-            iv = smmp.var_i.idvr[j] - 1
-            name =''. join([str(smmp.var_c.nmvr[iv * 3 + k][0]) for k in range(0,3)])
-            if name == 'phi':
-                phi = smmp.var_r.vlvr[iv] * crd
-                psi = smmp.var_r.vlvr[smmp.var_i.idvr[j+1] - 1] * crd
-                if abs(phi - phiSheet) < maxDev and abs(psi - psiSheet) < maxDev:
-                    strandCount += 1
-        return strandCount
-    
-    def directionVector(self):
-        """Calculates the normalized end-to-end vector for this molecule. 
-        The first and last c_alpha carbon is used as reference."""
-        atoms = self.atoms()
-        beginning = []
-        for a in atoms:
-            if a.name().strip() == 'ca':
-                if beginning:
-                    end = a.position()
-                else:
-                    beginning = a.position()
-        res = [end[i] - beginning[i] for i in range(0,3)] 
-        sum = sqrt(reduce(lambda x, y: x + y ** 2, res))
-        res = map(lambda x: x / sum, res)
-        return res
-        
-    def contacts(self):
-        """Returns a triplet containing the total number of contacts, the number
-        of native contacts, and the hemming distance. The latter two quantities 
-        are only meaningful if a reference structure has been defined.
-        """
-        return smmp.contacts()
-
-    def hbond(self):
-        return smmp.hbond(self.__id + 1, 0)
-        
-    def energy(self):
-        return smmp.energy()
-    
-    def rgyr(self):
-        return smmp.rgyr(self.__id + 1) 
-    
-    def rmsdfun(self):
-        return smmp.rmsdfun()
-        
-    def savePDB(self, file=""):
-       """Write the current configuration to file using PDB formatting."""
-       smmp.outpdb(self.__id, file)
-       
-    def saveVariables(self, file=""):
-        """Output the current conformation in the variable format. The output 
-        can be read in again and used to restart/continue a simulation.
-        
-        @param file if empty write to standard out
-        """
-        # Same functionality as smmp.outvar(self.__id + 1, 0)
-        if not file:
-            out = sys.stdout
-        else:
-            out = open(file, 'w')
-        for i in range(smmp.mol_i.ivrml1[self.__id] - 1 , smmp.mol_i.ivrml1[self.__id] + smmp.mol_i.nvrml[self.__id] - 1):
-            if not smmp.var_l.fxvr[i]:
-                name = ''.join([str(smmp.var_c.nmvr[i * 3 + j][0]) for j in range(0,3)])
-                print >>out, nursvr(i), ':', name, ':', smmp.var_r.vlvr[i] * crd
-            else:
-                it=smmp.var_i.ityvr[i]
-                if it == 3:
-                    print >>out, nursvr(i), ':', name, ':', smmp.var_r.vlvr[i] * crd, ' &'
-        
-    def zimmer(self):
-        first = smmp.mol_i.irsml1[self.__id] - 1
-        last = smmp.mol_i.irsml2[self.__id]
-        nrs = smmp.mol_i.irsml2[smmp.mol_i.ntlml - 1] - 1
-        smmp.zimmer(last)
-        return smmp.zimme.zimm[first:last]
-
-    def __len__(self):
-        return smmp.mol_i.irsml2[self.__id]  - smmp.mol_i.irsml1[self.__id] + 1
-
-
-if __name__ == "__main__":
-    libdir = 'SMMP/'
-
-    smmp.epar_l.flex = 0
-    smmp.epar_l.sh2 = 0
-    smmp.epar_l.epsd = 0
-    smmp.epar_l.tesgrd = 0
-    smmp.isolty.itysol = 0
-    smmp.init_energy(libdir)
-    
-    p1 = Protein('EXAMPLES/1bdd.pdb')
-    for i in p1.atoms():
-        print i
-    print p1.getDihedral('phi', 11)
Index: smmp/universe.py
===================================================================
--- pysmmp/universe.py	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,116 +1,0 @@
-# universe.py
-#
-# Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
-#                      Jan H. Meinke, Sandipan Mohanty
-#
-import smmp_p as smmp
-from math import *
-
-class Universe:
-    """Describes the environment of the simulation. Including the temperature,
-    the solvent, and the force field. This class keeps track of all the 
-    molecules.
-    """
-    
-    def __init__(self, T = 300, ff = 'ecepp3', st = 1, libdir = 'SMMP/'):
-        self.setTemperature(T)
-        if ff == 'ecepp3':
-            smmp.epar_l.flex = 0
-            smmp.epar_l.sh2 = 0
-            smmp.epar_l.epsd = 0
-            smmp.epar_l.ientyp=0
-        elif ff == 'ecepp2':
-            smmp.epar_l.flex = 0
-            smmp.epar_l.sh2 = 1
-            smmp.epar_l.epsd = 0
-            smmp.epar_l.ientyp=0
-        elif ff == 'flex':
-            smmp.epar_l.flex = 1
-            smmp.epar_l.sh2 = 0
-            smmp.epar_l.epsd = 0
-            smmp.epar_l.ientyp=0
-        smmp.epar_l.tesgrd = 0
-        smmp.isolty.itysol = st
-        smmp.init_energy(libdir)
-        self.__objects = []
-        self.__boxSize = 10
-        smmp.updchois.upchswitch = 0
-        smmp.updchois.rndord = 0
-        smmp.updchois.bgsprob = 0
-        
-    def add(self, m):
-        self.__objects.append(m)
-        
-    def energy(self):
-        """Return the total energy of this universe."""
-        return smmp.energy()
-    
-    def rgyr(self):
-        """Radius of gyration of the entire system."""
-        return smmp.rgyr(0)[0]
-        
-    def endToEnd(self):
-        return smmp.rgyr(0)[1]
-        
-    def hbond(self):
-        """Returns the total number of hydrogen bonds in the system"""
-        mhb = 0
-        for i in self.__objects:
-            mhb = mhb + i.hbond()
-        mhb = mhb + smmp.interhbond()
-        return mhb
-    
-    def helix(self):
-        return smmp.helix()
-    
-    def sheet(self):
-        """Checks if we have any parallel or antiparallel beta-sheets in the
-        system.
-        """
-        minStrandContent = 2
-        minHydrogenBonds = 3
-        res = []
-        for i in range(0, len(self.__objects)):
-            if self.__objects[i].strand() >= minStrandContent:
-                for j in range(i, len(self.__objects)):
-                    if smmp.h_bond.mmhb[self.__objects[i].id()][self.__objects[j].id()] >= minHydrogenBonds:
-                        if self.__objects[j].strand() >= minStrandContent:
-                            print "Found a candidate for a sheet between %s and %s." % (i, j)
-                            dir1 = self.__objects[i].directionVector()
-                            dir2 = self.__objects[j].directionVector()
-                            sum = 0
-                            for k in range(0, 3):
-                                sum += dir1[k] * dir2[k]
-                            if sum > 0.7:
-                                res.append([i, j, 1])
-                            elif sum < -0.7:
-                                res.append([i, j, -1])
-        return res 
-    
-    def temperature(self):
-        """Returns the current temperature of this Universe."""
-        return 1.0 / ( smmp.bet.beta * 1.98773e-3 )
-    ## @brief Sets the temperature value of this Universe.
-    #  Be aware that SMMP is not thread save. Changing the temperature may
-    #  lead to strange behavior in the current sweep.
-    #  @pre T > 0
-    #
-    #  @param T temperature in Kelvin.
-    def setTemperature(self, T):
-        if T> 0:
-            smmp.bet.beta = 1.0 / ( T * 1.98773e-3 )
-        
-    def boxSize(self):
-        return self.__boxSize
-
-    def objects(self):
-        """Returns the list of interacting things in the universe."""
-        res = self.__objects
-        return res
-        
-    def save(self):
-        """Saves the state of this Universe."""
-        pass
-
-if __name__ == '__main__':
-    u=Universe()
Index: redseq.f
===================================================================
--- redseq.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ redseq.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,46 +1,42 @@
-!**************************************************************
-!
-! This file contains the subroutines: redseq
-!
-! 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: redseq
+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 **************************************************************
 
 
       subroutine redseq
 
-! ............................................................
-! PURPOSE: read 'lunseq' 'seqfil', extract names of molecules,
-!          sequences
-!
-! Molecules are separated by lines containing char. '#',
-!           a name for the molecule may follow '#' on this line
-! Residue   names can be of 1-4 characters to be separated by ' '
-!
-! Returns: ntlml,nmml,irsml1,irsml2,seq
-!
-! CALLS:   ibegst,iendst,iopfil,tolost
-! ............................................................
+c ............................................................
+c PURPOSE: read 'lunseq' 'seqfil', extract names of molecules,
+c          sequences
+c
+c Molecules are separated by lines containing char. '#',
+c           a name for the molecule may follow '#' on this line
+c Residue   names can be of 1-4 characters to be separated by ' '
+c
+c Returns: ntlml,nmml,irsml1,irsml2,seq
+c
+c CALLS:   ibegst,iendst,iopfil,tolost
+c ............................................................
 
       include 'INCL.H'
 
-      ! Function definitions
-      integer iofil, iendst, ibegst, iopfil
-
       character blnk,res*4,line*132,hlin*132
-      integer i, i1, i2, ifirs, ie, id, ib, ic, ii, l, lg, nln, nrs
       data blnk/' '/
 
       if (iopfil(lunseq,seqfil,'old','formatted').le.izero) then
-        write (logString, '(a,/,a,i3,2a)') 
-     &    ' redseq> ERROR opening sequence file:',
-     &      ' LUN=',lunseq,' FILE=',seqfil(1:iendst(seqfil))
+        write (*,'(a,/,a,i3,2a)') 
+     #    ' redseq> ERROR opening sequence file:',
+     #      ' LUN=',lunseq,' FILE=',seqfil(1:iendst(seqfil))
         stop
       endif
 
-!      ntlml=0
+c      ntlml=0
       if (ntlml.gt.0) then
         nrs = irsml2(ntlml)
@@ -60,5 +56,5 @@
         if (ic.gt.0) then  ! found '#'
 
-! ____________________________________ new molecule
+c ____________________________________ new molecule
 
           if (ntlml.gt.0) then   ! check previous molecule
@@ -67,6 +63,6 @@
 
             if ((nrs-irsml1(ntlml)+1).eq.0) then
-              write (logString, '(2a)') ' redseq> IGNORE molecule: ',
-     &                        nmml(ntlml)(1:iendst(nmml(ntlml)))
+              write(*,'(2a)') ' redseq> IGNORE molecule: ',
+     #                        nmml(ntlml)(1:iendst(nmml(ntlml)))
               ntlml=ntlml-1
             endif
@@ -74,7 +70,6 @@
           ntlml=ntlml+1
           if (ntlml.gt.mxml) then
-            write (logString, '(a,i4,2a)') 
-     &                          ' redseq> NUMBER of molecules > '
-     &                          ,mxml,' in ',seqfil(1:iendst(seqfil))
+            write(*,'(a,i4,2a)')' redseq> NUMBER of molecules > '
+     #                          ,mxml,' in ',seqfil(1:iendst(seqfil))
             close(lunseq)
             stop
@@ -85,5 +80,5 @@
 
           if (ic.le.lg) then
-! ___________________________________ extract name of molecule
+c ___________________________________ extract name of molecule
 
             hlin=blnk
@@ -104,5 +99,5 @@
         else  ! no '#'
 
-! _________________________________________ sequence
+c _________________________________________ sequence
 
           ib=ibegst(line)
@@ -115,5 +110,5 @@
 
           ie=iendst(line)
-! ___________________________________ extract names of residues
+c ___________________________________ extract names of residues
     2     id=index(line(ib:ie),blnk)-1   ! find next separator
           if (id.gt.0) then
@@ -125,7 +120,7 @@
 
           if (id.gt.4) then
-            write (logString, '(4a)') ' redseq> INVALID residue NAME >',
-     &                       line(ib:ii),'< in ',
-     &      seqfil(1:iendst(seqfil))
+            write (*,'(4a)') ' redseq> INVALID residue NAME >',
+     #                       line(ib:ii),'< in ',
+     #      seqfil(1:iendst(seqfil))
             close(lunseq)
             stop
@@ -134,7 +129,6 @@
             nrs=nrs+1
             if (nrs.gt.mxrs) then
-              write (logString, '(a,i4,2a)') 
-     &                       ' redseq> NUMBER of residues > '
-     &                       ,mxrs,' in ',seqfil(1:iendst(seqfil))
+              write(*,'(a,i4,2a)') ' redseq> NUMBER of residues > '
+     #                       ,mxrs,' in ',seqfil(1:iendst(seqfil))
               close(lunseq)
               stop
@@ -161,9 +155,9 @@
 
     3 close(lunseq)
-! ___________________________________ output
+c ___________________________________ output
 
       if (nrs.eq.0) then
-        write (logString, '(2a)') ' redseq> no residues found in ',
-     &                   seqfil(1:iendst(seqfil))
+        write (*,'(2a)') ' redseq> no residues found in ',
+     #                   seqfil(1:iendst(seqfil))
         stop
       else
@@ -181,11 +175,10 @@
           if (i.eq.ntlml) then   ! Check last molecule
             if ((nrs-ifirs+1).eq.0) then
-              write (logString, '(2a)') ' redseq> IGNORE molecule '
-     &                        ,nmml(ntlml)(1:iendst(nmml(ntlml)))
+              write(*,'(2a)') ' redseq> IGNORE molecule '
+     #                        ,nmml(ntlml)(1:iendst(nmml(ntlml)))
               ntlml=ntlml-1
               if (ntlml.eq.0) then
-                write (logString, '(2a)') 
-     &             ' redseq> no residues found in ',
-     &             seqfil(1:iendst(seqfil))
+                write (*,'(2a)') ' redseq> no residues found in ',
+     #          seqfil(1:iendst(seqfil))
                 stop
               endif
@@ -195,8 +188,8 @@
           endif
 
-!          write (logString, '(/,a,i4,2a)') ' redseq> ',irsml2(i)-irsml1(i)+1,
-!     &           ' residue(s) in molecule: ',
-!     &           nmml(i)(1:iendst(nmml(i)))
-!          write (logString, '(15(1x,a))') (seq(j),j=irsml1(i),irsml2(i))
+cc          write (*,'(/,a,i4,2a)') ' redseq> ',irsml2(i)-irsml1(i)+1,
+cc     #           ' residue(s) in molecule: ',
+cc     #           nmml(i)(1:iendst(nmml(i)))
+cc          write (*,'(15(1x,a))') (seq(j),j=irsml1(i),irsml2(i))
 
         enddo
@@ -204,8 +197,8 @@
       endif
       return
-! _______________________________________________ error
-
-    4 write (logString, '(a,i4,2a)') ' redseq> ERROR reading line No. ',nln,
-     & ' in ',seqfil(1:iendst(seqfil))
+c _______________________________________________ error
+
+    4 write (*,'(a,i4,2a)') ' redseq> ERROR reading line No. ',nln,
+     #' in ',seqfil(1:iendst(seqfil))
       close(lunseq)
       stop
Index: redstr.f
===================================================================
--- redstr.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ redstr.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,41 +1,37 @@
-!**************************************************************
-!
-! This file contains the subroutines: extstr,ibegst,iendst,
-!                                     iredin,iredrl,iopfil,
-!                                     tolost,toupst
-!
-! 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: extstr,ibegst,iendst,
+c                                     iredin,iredrl,iopfil,
+c                                     tolost,toupst
+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 **************************************************************
 
 
       subroutine extstr(spr,ib,ie,str,strn,l)
 
-! ..........................................................
-! PURPOSE:  Extract substring preceeding separator 'spr'
-!           from 'str' searching from position 'ib' up to
-!           position 'ie' and put it into 'strn(1:l)'.
-!           'ib' is shifted to position following 'spr' or
-!           to 'ie+1', if 'spr' is not found
-!
-!          ! 'spr' should not be blank
-!
-! CALLS: ibegst,iendst
-! ..........................................................
-      integer ib, ie, l
-      integer ln, is, ibegst, j, iendst
+c ..........................................................
+c PURPOSE:  Extract substring preceeding separator 'spr'
+c           from 'str' searching from position 'ib' up to
+c           position 'ie' and put it into 'strn(1:l)'.
+c           'ib' is shifted to position following 'spr' or
+c           to 'ie+1', if 'spr' is not found
+c
+c          ! 'spr' should not be blank
+c
+c CALLS: ibegst,iendst
+c ..........................................................
+
+      implicit integer*4 (i-n)
 
       character spr,blnk,str*(*),strn*(*)
-      character*255 logString
-      
       data blnk/' '/
-      
-      integer i, ic, ish, ii
 
       if (spr.eq.blnk) then
-        write (logString, *) ' extstr> Separator should not be blank'
+        write (*,*) ' extstr> Separator should not be blank'
         stop
       endif
@@ -68,5 +64,5 @@
         l=0
         strn=blnk
-! ____________________________ make string in 'strn' left justified
+c ____________________________ make string in 'strn' left justified
       elseif (i.gt.1) then
         j=iendst(strn)
@@ -79,22 +75,21 @@
 
       return
-! ______________________________________________________________ Error
-    1 write (logString, '(a)') 
-     &   ' extstr> Substring to be extracted is too long !'
+c ______________________________________________________________ Error
+    1 write (*,'(a)') ' extstr> Substring to be extracted is too long !'
       stop
 
       end
-! **********************************
+c **********************************
       integer*4 function ibegst(str)
 
-! .............................................................
-! PURPOSE: returns position of 1st non-blank character in 'str'
-!
-! CALLS: none
-!
-! .............................................................
-
-      implicit none
-      integer i
+c .............................................................
+c PURPOSE: returns position of 1st non-blank character in 'str'
+c
+c CALLS: none
+c
+c .............................................................
+
+      implicit integer*4 (i-n)
+
       character blnk,str*(*)
       data blnk/' '/
@@ -111,16 +106,16 @@
       return
       end
-! **********************************
+c **********************************
       integer*4 function iendst(str)
 
-! ..............................................................
-! PURPOSE: returns position of last non-blank character in 'str'
-!
-! CALLS: none
-!
-! ..............................................................
-
-      implicit none
-      integer i
+c ..............................................................
+c PURPOSE: returns position of last non-blank character in 'str'
+c
+c CALLS: none
+c
+c ..............................................................
+
+      implicit integer*4 (i-n)
+
       character blnk,str*(*)
       data blnk/' '/
@@ -137,19 +132,19 @@
       return
       end
-! **************************************
+c **************************************
       integer*4 function iredin(line,in)
 
-! ..........................................
-! PURPOSE: Read integer*4 value 'in' from 'line'
-!          with format 'i9'
-!
-!          iredin=0 : error status
-!          iredin=1 : success
-!
-! CALLS: ibegst,iendst
-! ..........................................
-
-      implicit none
-      integer mxd, ib, ibegst, ie, iendst, il, i0, i9, i, ii, in
+c ..........................................
+c PURPOSE: Read integer*4 value 'in' from 'line'
+c          with format 'i9'
+c
+c          iredin=0 : error status
+c          iredin=1 : success
+c
+c CALLS: ibegst,iendst
+c ..........................................
+
+      implicit integer*4 (i-n)
+
       parameter (mxd=9)                 ! max. # of digits
 
@@ -177,22 +172,22 @@
     1 return
       end
-! *************************************
+c *************************************
       integer*4 function iredrl(line,r)
 
-! ..........................................
-! PURPOSE: Read real*8 value 'r' from 'line'
-!          with format 'd17.6'
-!
-!          iredrl=0 : error status
-!          iredrl=1 : success
-!
-! CALLS: ibegst,iendst
-! ..........................................
-
-      implicit none
-      integer mxd, mxap, mxip, ib, ibegst, ie, iendst, il, ip, ibp
+c ..........................................
+c PURPOSE: Read real*8 value 'r' from 'line'
+c          with format 'd17.6'
+c
+c          iredrl=0 : error status
+c          iredrl=1 : success
+c
+c CALLS: ibegst,iendst
+c ..........................................
+
+      implicit integer*4 (i-n)
+
       parameter (mxd =17,   ! max. # of digits
-     &           mxap= 6,   ! max. # of digits after period
-     &           mxip=mxd-mxap)
+     #           mxap= 6,   ! max. # of digits after period
+     #           mxip=mxd-mxap)
  
       real*8 r
@@ -227,20 +222,17 @@
     1 return
       end
-! **************************
+c **************************
       subroutine tolost(str)
 
-! ..........................................
-!  PURPOSE:  converts 'string' to lower-case
-!  INPUT:    str - string to be converted
-!  CALLS:    ibegst,iendst
-! ..........................................
+c ..........................................
+c  PURPOSE:  converts 'string' to lower-case
+c  INPUT:    str - string to be converted
+c  CALLS:    ibegst,iendst
+c ..........................................
 
       include 'INCL.H'
 
       character*(*) str
-      
-      integer ibegst, iendst
-      
-      integer i, ic, ii, ish
+
       ii=ibegst(str)
       if (ii.gt.0) then
@@ -254,20 +246,16 @@
       return
       end
-! **************************
+c **************************
       subroutine toupst(str)
 
-! ..........................................
-!  PURPOSE:  converts 'string' to upper-case
-!  INPUT:    str - string to be converted
-!  CALLS:    ibegst,iendst
-! ..........................................
+c ..........................................
+c  PURPOSE:  converts 'string' to upper-case
+c  INPUT:    str - string to be converted
+c  CALLS:    ibegst,iendst
+c ..........................................
 
       include 'INCL.H'
 
       character str*(*)
-      
-      integer iendst, ibegst
-      
-      integer i, ii, ic, ish
 
       ii=ibegst(str)
@@ -282,19 +270,19 @@
       return
       end
-! *****************************************************
+c *****************************************************
       integer*4 function iopfil(lun,filnam,stat,format)
 
-! ........................................................
-! PURPOSE: open 'lun' with 'filnam' 'stat' 'format'
-!
-!          returns: 1 = file successful opened
-!                   0 = error during open of existing file
-!                  -1 = file does not exist
-!
-! CALLS: ibegst
-! ........................................................
-
-      integer lun
-      integer i, ibegst, j, k
+c ........................................................
+c PURPOSE: open 'lun' with 'filnam' 'stat' 'format'
+c
+c          returns: 1 = file successful opened
+c                   0 = error during open of existing file
+c                  -1 = file does not exist
+c
+c CALLS: ibegst
+c ........................................................
+
+      implicit integer*4 (i-n)
+
       logical exs
       character*(*) filnam,stat,format
@@ -311,5 +299,5 @@
             if (j.gt.0.and.k.gt.0) then
               open(lun,file=filnam(i:),status=stat(j:),
-     &             form=format(k:),err=1)
+     #             form=format(k:),err=1)
               iopfil=1
             endif
Index: redvar.f
===================================================================
--- redvar.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ redvar.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,119 +1,111 @@
-!**************************************************************
-!
-! This file contains the subroutines: redvar
-!
-! 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: redvar
+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 **************************************************************
 
 
       subroutine redvar
 
-! ...................................................................
-!
-! PURPOSE: Read global parameters for molecules from lines
-!
-!          +--------------------------------------------------+
-!          |@ molecule no. : six floats separated by commas   |
-!          +--------------------------------------------------+
-!
-!          NB: 1) if omit field with molecule no. assume: nml=1
-!              2) last 3 float are angles in deg.
-!
-!          Read and interpret file to SET and FIX internal variables
-!          by commands:
-!
-!          +-----------------------------------------+
-!          |  molecule : residue : variable : value  |
-!          +-----------------------------------------+
-!
-!        * Lines containing '&' assign FIXED variable(s), they will
-!          not be varied during subsequent minimization etc.
-!
-!        * Empty LINES or lines containing '#' are ignored
-!        * Several commands on same line must be separated by ';'
-!        * Empty COMMANDS, i.e. ' : : ' are ignored
-!        * All spaces are not significant and are therefore ignored
-!
-!        * A command consists of up to 4 (maxfld) fields, separated
-!          by ':'
-!
-!        - last field     : value for VARIABLE (REAL)
-!                           ! should never be empty
-!        - 1st before last: name(s) (CHAR) or index(ices) of VARIABLE(S)
-!        - 2nd before last: name(s) or index(ices) of RESIDUE(S)
-!        - 3rd before last: name or number(ices) of MOLECULE(S)
-!
-!        * molecules, residues, variables can be identified, either by,
-!          INDICES (zones 'n1-n2' possible) or NAMES
-!
-!        * several identifiers in a field can be separated by ','
-!
-!        * INDICES: for residues  - refer to numbering within molecule
-!                 : for variables - refer to numbering within residue
-!        * ZONES:   '-n2' indicates '1-n2'
-!                   'n1-' indicates 'n1-(all)'
-!        * NAMES or their ends can be indicated by wild-card '*'
-!                are case-sensitive
-!
-!        Example:  phi:-65; psi:-45  >set all phi=-65, all psi=-45
-!                  om*: 180 &  >set all omg, omt ... to 180 & fix them
-!                  5 : x* : -60  >set all xi-angles of residue 5 to 60
-!
-! CALLS: setvar,extstr,iendst,ibegst,iopfil,iredin,iredrl
-! ......................................................................
+c ...................................................................
+c
+c PURPOSE: Read global parameters for molecules from lines
+c
+c          +--------------------------------------------------+
+c          |@ molecule no. : six floats separated by commas   |
+c          +--------------------------------------------------+
+c
+c          NB: 1) if omit field with molecule no. assume: nml=1
+c              2) last 3 float are angles in deg.
+c
+c          Read and interpret file to SET and FIX internal variables
+c          by commands:
+c
+c          +-----------------------------------------+
+c          |  molecule : residue : variable : value  |
+c          +-----------------------------------------+
+c
+c        * Lines containing '&' assign FIXED variable(s), they will
+c          not be varied during subsequent minimization etc.
+c
+c        * Empty LINES or lines containing '#' are ignored
+c        * Several commands on same line must be separated by ';'
+c        * Empty COMMANDS, i.e. ' : : ' are ignored
+c        * All spaces are not significant and are therefore ignored
+c
+c        * A command consists of up to 4 (maxfld) fields, separated
+c          by ':'
+c
+c        - last field     : value for VARIABLE (REAL)
+c                           ! should never be empty
+c        - 1st before last: name(s) (CHAR) or index(ices) of VARIABLE(S)
+c        - 2nd before last: name(s) or index(ices) of RESIDUE(S)
+c        - 3rd before last: name or number(ices) of MOLECULE(S)
+c
+c        * molecules, residues, variables can be identified, either by,
+c          INDICES (zones 'n1-n2' possible) or NAMES
+c
+c        * several identifiers in a field can be separated by ','
+c
+c        * INDICES: for residues  - refer to numbering within molecule
+c                 : for variables - refer to numbering within residue
+c        * ZONES:   '-n2' indicates '1-n2'
+c                   'n1-' indicates 'n1-(all)'
+c        * NAMES or their ends can be indicated by wild-card '*'
+c                are case-sensitive
+c
+c        Example:  phi:-65; psi:-45  >set all phi=-65, all psi=-45
+c                  om*: 180 &  >set all omg, omt ... to 180 & fix them
+c                  5 : x* : -60  >set all xi-angles of residue 5 to 60
+c
+c CALLS: setvar,extstr,iendst,ibegst,iopfil,iredin,iredrl
+c ......................................................................
 
 
       include 'INCL.H'
 
-!     functions
-      integer iopfil, iendst, iredin, iredrl, ibegst
-! maxfld: max. # of fields in one command
-! maxide: max. # of identifiers in a field
-! maxcmd: max. # of commands to be interpreted
-! ilrg:   a large integer
-
-      integer maxfld, maxide, maxcmd, ilrg, ifdend, icb, i, ib, ibz
-      integer ife, ifb, ide, id, ice, ie, ieh, ieh1, iez, ihz, ifx, ifld
-      integer ile, ii, ihy, ilb, iml, it, in ,io, inum, kbz, iv, ity, jb
-      integer j, k, l, kez, kk, kv, lez, lbz,ll, ll1, ll2, n, nfi, ncmd
-      integer nfld, nide, nml, ntlvr
-      double precision vlvrx, rn, vr, val
+c maxfld: max. # of fields in one command
+c maxide: max. # of identifiers in a field
+c maxcmd: max. # of commands to be interpreted
+c ilrg:   a large integer
+
       parameter (maxfld=4,
-     &           maxide=30,
-     &           maxcmd=5000,
-     &           ilrg=1000000)
+     #           maxide=30,
+     #           maxcmd=5000,
+     #           ilrg=1000000)
 
       character spcm,spfd,spcc,sphy,cmt,wdc,sfix,blnk, sglp,
-     &          line*132,lincmd*132,linfld(maxfld)*132,linide*132,
-     &          linh*132,strg(6)*17
+     #          line*132,lincmd*132,linfld(maxfld)*132,linide*132,
+     #          linh*132,strg(6)*17
       dimension ifdend(maxfld),vlvrx(mxvr),rn(6)
       logical fix,did,exa,forml(mxml),forrs(mxrs),forvr(mxvr),
-     &        stvr(mxvr)
+     #        stvr(mxvr)
       data spcm/';'/,spfd/':'/,spcc/','/,sphy/'-'/,cmt/'#'/,wdc/'*'/,
-     &     sfix/'&'/,blnk/' '/, sglp/'@'/
-
-
-! ___________________________________ Checks
+     #     sfix/'&'/,blnk/' '/, sglp/'@'/
+
+
+c ___________________________________ Checks
       ntlvr=ivrml1(ntlml)+nvrml(ntlml)-1
       if (ntlvr.eq.0) then
-        write(logString,*)'redvar> No variables defined in molecule(s)'
+        write (*,*) ' redvar> No variables defined in molecule(s)'
         return
       endif
-! ___________________________________ Initialize
+c ___________________________________ Initialize
 
       io=iopfil(lunvar,varfil,'old','formatted')
       if (io.eq.0) then
-        write (logString, '(a,/,a,i3,2a)') 
-     &    ' redvar> ERROR opening file to set variables:',
-     &    ' LUN=',lunvar,' FILE=',varfil(1:iendst(varfil))
+        write (*,'(a,/,a,i3,2a)') 
+     #    ' redvar> ERROR opening file to set variables:',
+     #    ' LUN=',lunvar,' FILE=',varfil(1:iendst(varfil))
         stop
       elseif (io.eq.-1) then
         return
       endif
-! ___________________________________ Initialization
+c ___________________________________ Initialization
       do i=1,ntlml
         forml(i)=.true.
@@ -136,5 +128,5 @@
           vr=blat(iatvr(i))
         else
-          write(logString,*) 'redvar>  unknown variable type: ',it,' !'
+          write(*,*) 'redvar>  unknown variable type: ',it,' !'
           stop
         endif
@@ -146,8 +138,8 @@
     1 read (lunvar,'(a)',end=2) line
       ile=iendst(line)
-! _________________________________ ! ignore empty and commentary lines
+c _________________________________ ! ignore empty and commentary lines
       if (ile.gt.0.and.index(line(1:ile),cmt).le.0) then
 
-! _________________________________________ Global variables
+c _________________________________________ Global variables
         ilb = index(line(1:ile),sglp)+1
         if (ilb.ge.2) then
@@ -158,9 +150,8 @@
 
             if (iredin(lincmd,nml).le.0.or.
-     &          nml.le.0.or.nml.gt.ntlml) then
-              write (logString, *) 
-     &                 'redvar> ','Incorrect molecule number >',
-     &                    lincmd(1:l),'<  Must be in range [1,',
-     &                    ntlml,'] !'
+     #          nml.le.0.or.nml.gt.ntlml) then
+              write (*,*) 'redvar> ','Incorrect molecule number >',
+     #                    lincmd(1:l),'<  Must be in range [1,',
+     #                    ntlml,'] !'
               close(lunvar)
               stop
@@ -188,9 +179,9 @@
           if (iredrl(linh,rn(6)).le.0) goto 105
 
-! ---------------------------------------- check global angles
+c ---------------------------------------- check global angles
           if (  abs(rn(4)).gt.(1.8d2+1d-6)
-     &     .or. abs(rn(5)).gt.(9d1+1d-6) 
-     &     .or. abs(rn(6)).gt.(1.8d2+1d-6)
-     &    ) goto 106
+     #     .or. abs(rn(5)).gt.(9d1+1d-6) 
+     #     .or. abs(rn(6)).gt.(1.8d2+1d-6)
+     #    ) goto 106
            
           do i = 1,3
@@ -230,5 +221,5 @@
             endif
 
-! _________________________________________ Extract Command Fields
+c _________________________________________ Extract Command Fields
             nfld=0
             icb=1
@@ -244,5 +235,5 @@
 
             enddo
-! _______________________________ Interpret Command Fields (except last)
+c _______________________________ Interpret Command Fields (except last)
             do i=1,nfld-1
               ii=i
@@ -264,5 +255,5 @@
                 enddo
               endif
-! __________________________________ Identifiers in field
+c __________________________________ Identifiers in field
               nide=0
               ifb=1
@@ -308,8 +299,8 @@
                       if (ifld.eq.3) then        !  Mol.
 
-! ################### impossible # (inum) of molecule
+c ################### impossible # (inum) of molecule
 
                         if (inum.le.0.or.inum.gt.ntlml) then
-                          write (logString, *) ' # 1: ',inum
+                          write (*,*) ' # 1: ',inum
                           goto 104
                         endif
@@ -322,8 +313,8 @@
                             k=inum+nfi-1
 
-! ################### impossible # of residue (inum) in molecule
+c ################### impossible # of residue (inum) in molecule
 
                             if (k.lt.nfi.or.k.gt.irsml2(j)) then
-                              write (logString, *) ' # 2: ',inum
+                              write (*,*) ' # 2: ',inum
                               goto 104
                             endif 
@@ -340,9 +331,9 @@
                                 l=inum+nfi-1
 
-! ################### impossible # of variable (inum) in residue
+c ################### impossible # of variable (inum) in residue
 
                                 if (l.lt.nfi.or.
-     &                              l.gt.nfi+nvrrs(k)-1) then
-                                  write (logString, *) ' # 3: ',inum
+     #                              l.gt.nfi+nvrrs(k)-1) then
+                                  write (*,*) ' # 3: ',inum
                                   goto 104
                                 endif
@@ -373,7 +364,7 @@
                             linh(1:ieh1)=nmml(j)(ib:ieh)
                             if (((exa.and.ieh1.eq.id).or.
-     &                         (.not.exa.and.ieh1.ge.id)).and.
-     &                         linh(1:id).eq.linide(1:id))
-     &                         forml(j)=.true.
+     #                         (.not.exa.and.ieh1.ge.id)).and.
+     #                         linh(1:id).eq.linide(1:id))
+     #                         forml(j)=.true.
                           endif
                         enddo        
@@ -389,7 +380,7 @@
                                 linh(1:ieh1)=seq(k)(ib:ieh)
                                 if (((exa.and.ieh1.eq.id).or.
-     &                             (.not.exa.and.ieh1.ge.id))
-     &                          .and.linh(1:id).eq.linide(1:id))
-     &                            forrs(k)=.true.
+     #                             (.not.exa.and.ieh1.ge.id))
+     #                          .and.linh(1:id).eq.linide(1:id))
+     #                            forrs(k)=.true.
                               endif
                             enddo
@@ -410,7 +401,7 @@
                                     linh(1:ieh1)=nmvr(l)(ib:ieh)
                                     if (((exa.and.ieh1.eq.id)
-     &                         .or.(.not.exa.and.ieh1.ge.id))
-     &                          .and.linh(1:id).eq.linide(1:id))
-     &                              forvr(l)=.true.
+     #                         .or.(.not.exa.and.ieh1.ge.id))
+     #                          .and.linh(1:id).eq.linide(1:id))
+     #                              forvr(l)=.true.
                                   endif
                                 enddo
@@ -425,8 +416,8 @@
                   else                                       ! ___ Zone
 
-! ################### impossible zone '-' (without integer)
+c ################### impossible zone '-' (without integer)
 
                     if (ide.eq.1.and.ihy.eq.ide) then
-                      write (logString, *) ' # 4: ',ide
+                      write (*,*) ' # 4: ',ide
                       goto 104
                     endif
@@ -438,9 +429,9 @@
                       linh=linide(1:ihy-1)
 
-! ################### impossible (to read) integer before '-'
+c ################### impossible (to read) integer before '-'
 
                       if (iredin(linh,ibz).le.0.or.ibz.le.0)
-     &                  then
-                        write (logString, *) ' # 5 '
+     #                  then
+                        write (*,*) ' # 5 '
                         goto 104
                       endif
@@ -453,9 +444,9 @@
                       linh=linide(ihy+1:ide)
 
-! ################### impossible (to read) integer after '-'
+c ################### impossible (to read) integer after '-'
 
                       if (iredin(linh,iez).le.0.or.iez.le.0.or.
-     &                  iez.lt.ibz) then
-                        write (logString, *) ' # 6 '
+     #                  iez.lt.ibz) then
+                        write (*,*) ' # 6 '
                         goto 104
                       endif
@@ -511,5 +502,5 @@
             enddo  ! ... Fields (excl. value)
 
-! _____________________________________________________ Execute Command
+c _____________________________________________________ Execute Command
 
             if (iredrl(linfld(nfld),val).gt.izero) then  ! Read Value
@@ -525,13 +516,13 @@
                 endif
               enddo
-              if (.not.did) write (logString, '(3a)')
-     &          ' redvar> No variables affected by command >',
-     &          lincmd(1:ice),'<'
+              if (.not.did) write (*,'(3a)')
+     #          ' redvar> No variables affected by command >',
+     #          lincmd(1:ice),'<'
             else
 
               ll1=ibegst(linfld(nfld))
               ll2=iendst(linfld(nfld))
-              write (logString, *) 'll1,ll2, linfld(nfld): ',ll1,ll2,
-     &           '>',linfld(nfld)(ll1:ll2),'<'
+              write (*,*) 'll1,ll2, linfld(nfld): ',ll1,ll2,
+     #           '>',linfld(nfld)(ll1:ll2),'<'
 
               goto 102
@@ -544,5 +535,5 @@
 
     2 close(lunvar)
-! __________________________ Summary
+c __________________________ Summary
       iv=0
       do i=1,ntlml
@@ -560,8 +551,7 @@
              enddo
 
-             write (logString, '(3a,/,1x,5(a,2x),a)') ' redvar> ',
-     &                               nmml(i)(1:ie),
-     &                                    ' with global parameters:',
-     &                              (strg(k)(ibegst(strg(k)):),k=1,6)
+             write (*,'(3a,/,1x,5(a,2x),a)') ' redvar> ',nmml(i)(1:ie),
+     #                                    ' with global parameters:',
+     #                              (strg(k)(ibegst(strg(k)):),k=1,6)
              call setvar(i,vlvrx)
              goto 3
@@ -581,15 +571,15 @@
                 did=.true.
                 if (fxvr(iv)) then
-                  write(logString,'(3a,i4,1x,4a,f10.3,a)') ' redvar> ',
-     &                nmml(i)(1:ie),': residue ',j-jb,seq(j),
-     &                ': ',nmvr(iv),' set ',vlvrx(iv),'   Fixed'
+                  write (*,'(3a,i4,1x,4a,f10.3,a)') ' redvar> ',
+     #                nmml(i)(1:ie),': residue ',j-jb,seq(j),
+     #                ': ',nmvr(iv),' set ',vlvrx(iv),'   Fixed'
                 else
-                  write (logString, '(3a,i4,1x,4a,f10.3)') ' redvar> ',
-     &                nmml(i)(1:ie),': residue ',j-jb,seq(j),
-     &                ': ',nmvr(iv),' set ',vlvrx(iv)
+                  write (*,'(3a,i4,1x,4a,f10.3)') ' redvar> ',
+     #                nmml(i)(1:ie),': residue ',j-jb,seq(j),
+     #                ': ',nmvr(iv),' set ',vlvrx(iv)
                 endif
                 ity=ityvr(iv)
                 if (ity.eq.3.or.ity.eq.2)
-     &            vlvrx(iv)=vlvrx(iv)*cdr             ! angles
+     #            vlvrx(iv)=vlvrx(iv)*cdr             ! angles
                   
               else
@@ -599,11 +589,11 @@
           enddo
           if (did) then
-            if (in.gt.0) write (logString, '(3a,i5,a)')
-     &        ' redvar> Molecule ',nmml(i)(1:ie),': ',in,
-     &        ' variable(s) remain unchanged'
+            if (in.gt.0) write (*,'(3a,i5,a)')
+     #        ' redvar> Molecule ',nmml(i)(1:ie),': ',in,
+     #        ' variable(s) remain unchanged'
             call setvar(iml,vlvrx)
           else
-            write (logString, '(3a)') ' redvar> Molecule ',
-     &        nmml(i)(1:ie),': No internal variables changed'
+            write (*,'(3a)') ' redvar> Molecule ',
+     #        nmml(i)(1:ie),': No internal variables changed'
           endif
         endif
@@ -611,36 +601,33 @@
 
       return
-! ____________________________________________________________ Errors
-  100 write (logString, '(3a)') ' redvar> Cannot interpret command >',
-     &                 lincmd(1:ice),'<'
+c ____________________________________________________________ Errors
+  100 write (*,'(3a)') ' redvar> Cannot interpret command >',
+     #                 lincmd(1:ice),'<'
       close(lunvar)
       stop
-  101 write (logString, '(a,i5,a)') ' redvar> Command number ',ncmd,
-     &       ' reached'
+  101 write (*,'(a,i5,a)') ' redvar> Command number ',ncmd,' reached'
       close(lunvar)
       stop
-  102 write (logString, '(3a)') ' redvar> Cannot read value from >',
-     &                   lincmd(1:ice),'<'
+  102 write (*,'(3a)') ' redvar> Cannot read value from >',
+     #                   lincmd(1:ice),'<'
       close(lunvar)
       stop
-  103 write (logString, '(a,i3,3a)') ' redvar> Cannot read >',maxide,
-     &         ' identifiers from >',linfld(ii)(1:ife),'<'
+  103 write (*,'(a,i3,3a)') ' redvar> Cannot read >',maxide,
+     #         ' identifiers from >',linfld(ii)(1:ife),'<'
       close(lunvar)
       stop
-  104 write (logString, '(5a)') ' redvar> Error in identifier >',
-     &            linide(1:ide),'< of command >',lincmd(1:ice),'<'
+  104 write (*,'(5a)') ' redvar> Error in identifier >',
+     #            linide(1:ide),'< of command >',lincmd(1:ice),'<'
       close(lunvar)
       stop
-  105 write (logString, '(a,/,a,/,2a,/)') 
-     &                           ' redvar> line with global paramters:',
-     &                           line(1:ile),' must contain 6 floating',
-     &                           ' point numbers separated by commas !'
+  105 write (*,'(a,/,a,/,2a,/)') ' redvar> line with global paramters:',
+     #                           line(1:ile),' must contain 6 floating',
+     #                           ' point numbers separated by commas !'
       close(lunvar)
       stop
 
-  106 write (logString, '(a,/,a,/,2a,/)') 
-     &                           ' redvar> line with global paramters:',
-     &                           line(1:ile),' angles must be inside ',
-     &'ranges [-180,180], [-90,90], and [-180,180] Deg., respectively !'
+  106 write (*,'(a,/,a,/,2a,/)') ' redvar> line with global paramters:',
+     #                           line(1:ile),' angles must be inside ',
+     #'ranges [-180,180], [-90,90], and [-180,180] Deg., respectively !'
       close(lunvar)
       stop
Index: regul.f
===================================================================
--- regul.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ regul.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,38 +1,34 @@
-!**************************************************************
-!
-! This file contains the subroutines: regul
-!
-! 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: regul
+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 **************************************************************
 
-
+      
       subroutine regul(nml, iter, nsteps, acc)
 
-! ----------------------------------------------------------
-! PURPOSE: regularization of PDB-structure into SMMP geometry
-!
-!          @param nml molecule to be regularized
-!          @param iter number of iterations during regularization
-!          @param nsteps maximum number of steps in minimization
-!          @param acc acceptance criterium for minimization
-!
-! CALLS:   minim, cnteny, outvar,rmsdopt
-! ----------------------------------------------------------
+c ----------------------------------------------------------
+c PURPOSE: regularization of PDB-structure into SMMP geometry
+c
+c          @param nml molecule to be regularized
+c          @param iter number of iterations during regularization
+c          @param nsteps maximum number of steps in minimization
+c          @param acc acceptance criterium for minimization
+c
+c CALLS:   minim, cnteny, outvar,rmsdopt
+c ----------------------------------------------------------
 
       include 'INCL.H'
       include 'INCP.H'
-
-!f2py intent(in) nml
-!f2py intent(in) iter
-!f2py intent(in) nsteps
-!f2py intent(in) acc
-
-      double precision acc, rm, av1, av2, rmsd, dn
-
-      integer nsteps, nml, nrs, i, n, iter, it
+      
+cf2py intent(in) nml
+cf2py intent(in) iter
+cf2py intent(in) nsteps
+cf2py intent(in) acc
 
       dimension rm(3,3),av1(3),av2(3)
@@ -44,25 +40,25 @@
       wtey = 0.d0
 
-      write (logString, '(/,a,2(a,f4.2),/)')
-     &  ' ====================== Regularization only',
-     &  '   Wt(energy) = ',wtey,'  Wt(regul.) = ',wtrg
+      write(*,'(/,a,2(a,f4.2),/)')
+     #  ' ====================== Regularization only',
+     #  '   Wt(energy) = ',wtey,'  Wt(regul.) = ',wtrg
 
-      call minim(2, nsteps, acc)
+      call minim(1, nsteps, acc)
 
-      write (logString, *) ' '
-      write (logString, *) ' -------- contacts after 1st regularization'
-      write (logString, *) ' '
+      write(*,*) ' '
+      write(*,*) ' ---------- contacts after 1st regularization'
+      write(*,*) ' '
       call cnteny(nml)
-      write (logString, *) ' '
+      write(*,*) ' '
 
       nrs = irsml2(nml)-irsml1(nml)+1
       call rmsdopt(nml,1,nrs,ixatp,xatp,yatp,zatp,0,rm,av1,av2,rmsd)
 
-      write (logString, *) ' RMSD = ',rmsd
+      write(*,*) ' RMSD = ',rmsd
 
-! --------------------------------------- fix vars. defined in PDB
+c --------------------------------------- fix vars. defined in PDB
 
 
-      do i = ivrml1(nml),nvrml(nml)
+      do i = ivrml1(nml),nvrml(nml) 
         fxvro(i) = fxvr(i)  ! save
         if (isrfvr(i)) fxvr(i) = .true.  ! fix vars. defined in ref.str.
@@ -70,16 +66,16 @@
       ireg = 0
 
-      write (logString, '(/,a,2(a,f4.2),/)')
-     &  ' ====================== Internal Energy for Hydrogens only',
-     &  '   Wt(energy) = ',wtey,'  Wt(regul.) = ',wtrg
+      write(*,'(/,a,2(a,f4.2),/)')
+     #  ' ====================== Internal Energy for Hydrogens only',
+     #  '   Wt(energy) = ',wtey,'  Wt(regul.) = ',wtrg
 
       call minim(1, nsteps, acc)
 
-      write (logString, *) ' '
-      write (logString, *) ' -------- contacs after Emin. for hydrogens'
-      write (logString, *) ' '
+      write(*,*) ' '
+      write(*,*) ' ---------- contacs after Emin. for hydrogens'
+      write(*,*) ' '
       call cnteny(nml)
 
-      do i = ivrml1(nml),nvrml(nml)
+      do i = ivrml1(nml),nvrml(nml) 
         fxvr(i) = fxvro(i)  ! restore
       enddo  ! vars.
@@ -90,5 +86,5 @@
       wtey = 0.d0
 
-      n=iter
+      n=iter            
       dn=1.d0/dble(n)
 
@@ -98,7 +94,7 @@
         wtey = 1.d0 - wtrg
 
-        write (logString, '(/,a,i2,2(a,e11.3),/)')
-     &    ' ================ Minimization #',it,
-     &        '   Wt(energy) = ',wtey,'  Wt(regul.) = ',wtrg
+        write(*,'(/,a,i2,2(a,e11.3),/)')
+     #    ' ================ Minimization #',it,
+     #        '   Wt(energy) = ',wtey,'  Wt(regul.) = ',wtrg
 
         call minim(1, nsteps, acc)
@@ -107,19 +103,18 @@
         call rmsdopt(nml,1,nrs,ixatp,xatp,yatp,zatp,0,rm,av1,av2,rmsd)
 
-        write (logString, *) ' '
-        write (logString, *) ' RMSD = ',rmsd
+        write(*,*) ' '
+        write(*,*) ' RMSD = ',rmsd
 
       enddo
 
-      write (logString, *) ' '
-      write (logString, *) ' ------- contacts after full regularization'
-      write (logString, *) ' '
+      write(*,*) ' '
+      write(*,*) ' ---------- contacts after full regularization'
+      write(*,*) ' '
       call cnteny(nml)
 
-!      call outpdb(nml,12)
+c      call outpdb(nml,12)
 
-! Output of dihedral angles of the regularized structure
-      write (logString, *) 
-     &   'Dihedral angles of the regularized structure;'
+c Output of dihedral angles of the regularized structure
+      write(*,*) 'Dihedral angles of the regularized structure;'
       call outvar(nml, 'regd.var')
 
Index: rgyr.f
===================================================================
--- rgyr.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ rgyr.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,38 +1,31 @@
-!**************************************************************
-!
-! This file contains the subroutines: rgyr
-!
-! 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: rgyr
+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 **************************************************************
 
 
-!> CALCULATES THE RADIUS-OF-GYRATION AND THE END-TO-END DISTANCE
-!! FOR A GIVEN PROTEIN CONFORMATION
-!! If nml == 0, calculate the radius of gyration for all molecules
-!!
-!!     rgy  = radius-of-gyration
-!!     ee   = end-to-end distance
-!!
-!! REQUIREMENTS: c_alfa has to be called BEFORE call of this subroutine
-!!
-!! CALLS: NONE
-!<
-	  subroutine rgyr(nml, rgy, ee)
+      subroutine rgyr(nml, rgy, ee)
 
+C CALCULATES THE RADIUS-OF-GYRATION AND THE END-TO-END DISTANCE
+C FOR A GIVEN PROTEIN CONFORMATION
+C If nml == 0, calculate the radius of gyration for all molecules
+C
+C     rgy  = radius-of-gyration
+C     ee   = end-to-end distance
+C
+C REQUIREMENTS: c_alfa has to be called BEFORE call of this subroutine
+C
+C CALLS: NONE
+C
       include 'INCL.H'
-      
-      double precision dn, dnp, dnh, dx, dxp, dy, dyp, dyh, dz, dzp, dzh
-      double precision d2, d2p, d2h, xi, yi, zi, dxh, rg2, rg2p, rg2h
-      double precision rgy, ee
-
-      integer nml, nml1, nml2, nat, i, i1, i2
-
-!f2py intent(in) nml
-!f2py intent(out) rgy
-!f2py intent(out) ee
+cf2py intent(in) nml
+cf2py intent(out) rgy
+cf2py intent(out) ee
       integer typ
       if (nml.eq.0) then
@@ -48,6 +41,6 @@
 
       if (nat.le.0) then
-        write (logString, '(a,i4)')
-     &     ' rgyr> No atoms found for molecule #',nml
+        write (*,'(a,i4)')
+     #     ' rgyr> No atoms found for molecule #',nml
         return 
       endif
@@ -135,5 +128,5 @@
 
       ee = sqrt((xat(i2)-xat(i1))**2+(yat(i2)-yat(i1))**2
-     &         +(zat(i2)-zat(i1))**2)
+     #         +(zat(i2)-zat(i1))**2)
 
       return
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
Index: setmvs.f
===================================================================
--- setmvs.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ setmvs.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,64 +1,56 @@
-!**************************************************************
-!
-! This file contains the subroutines: setmvs,fndbrn
-!
-! 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: setmvs,fndbrn
+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 **************************************************************
 
 
       subroutine setmvs(nml)
 
-! ......................................................................
-! PURPOSE: 1. ORDER variables according to rules:
-!             variables with same base: 1st comes TORSION (can be only
-!               one with this base, since PHASE a. assumed to be FIXED),
-!               after this, for atoms branching from this base:
-!               for a b.angle & b.length with common primary moving
-!               atom=branch atom - b.angle comes 1st
-!
-!             iorvr(i), i=i_fivr_ml,i_lavr_ml -> indices of ordered var.
-!
-!          2. define NON-OVERLAPPING moving sets of atoms in molecule
-!             'nml' related to local variables
-!
-!             nmsml(i_ml) - number of moving sets per molecule
-!             imsvr1(i_vr),imsvr2() - indices of 1st/last m.s for var. 'i_vr'
-!                                     in 'latms1' & 'latms2'
-!             latms1(i_ms),latms2() - range of atoms of i-th m.s
-!
-!          3. define indices of next-following variables for each var.,
-!             which complete its physical moving set ('added' variables)
-!          
-!             nadml(i_ml) - number of 'added' var.s per molecule
-!             iadvr1(i_vr),iadvr2() - indices of 1st/last 'added' var. for
-!                                     var. 'i_vr' in 'ladvr'
-!             ladvr() - indices of 'added' variables
-!
-!          4. define index of corresponding variable for each atom
-!
-! ! routine must be called successively for molecules 1 -> ntlml
-!
-! CALLS: fndbrn, nursvr
-! ......................................................................
+c ......................................................................
+c PURPOSE: 1. ORDER variables according to rules:
+c             variables with same base: 1st comes TORSION (can be only
+c               one with this base, since PHASE a. assumed to be FIXED),
+c               after this, for atoms branching from this base:
+c               for a b.angle & b.length with common primary moving
+c               atom=branch atom - b.angle comes 1st
+c
+c             iorvr(i), i=i_fivr_ml,i_lavr_ml -> indices of ordered var.
+c
+c          2. define NON-OVERLAPPING moving sets of atoms in molecule
+c             'nml' related to local variables
+c
+c             nmsml(i_ml) - number of moving sets per molecule
+c             imsvr1(i_vr),imsvr2() - indices of 1st/last m.s for var. 'i_vr'
+c                                     in 'latms1' & 'latms2'
+c             latms1(i_ms),latms2() - range of atoms of i-th m.s
+c
+c          3. define indices of next-following variables for each var.,
+c             which complete its physical moving set ('added' variables)
+c          
+c             nadml(i_ml) - number of 'added' var.s per molecule
+c             iadvr1(i_vr),iadvr2() - indices of 1st/last 'added' var. for
+c                                     var. 'i_vr' in 'ladvr'
+c             ladvr() - indices of 'added' variables
+c
+c          4. define index of corresponding variable for each atom
+c
+c ! routine must be called successively for molecules 1 -> ntlml
+c
+c CALLS: fndbrn, nursvr
+c ......................................................................
 
       include 'INCL.H'
-!     ID of molecule
-      integer nml
-
-      integer nursvr
 
       logical bb
-      integer mxh, lvw1h, lvw2h, l1h, l2h
+
       parameter (mxh=10)
       dimension lvw1h(mxh),lvw2h(mxh),l1h(mxh),l2h(mxh)
 
-      integer ifivr, i, i1, ia, ib, ic, ifirs, ifiat, ko, ilaat, ii,
-     &        ilars, ilavr, io, ir, irg1, is, it, iv, j, k, j1, jns,
-     &        j2, j1s, ja, jb, jv, jo, l, i2, irg2, n, nad, nms,
-     &        ntlvr
 
       ntlvr=nvrml(nml)
@@ -77,14 +69,14 @@
 
       if (ntlvr.eq.0) then
-        write (logString, '(a,i4)')
-     &           ' setmvs> No variables defined in molecule #',nml
+        write (*,'(a,i4)')
+     #           ' setmvs> No variables defined in molecule #',nml
         nmsml(nml)=0
         nadml(nml)=0
         return
       endif
-! _________________ Take index of primary atom for each variable 
-!                   (i.e. index of atom moved by variable) to
-!                   sort variables, handling variables with same base:
-!                   modify indices to obtain appropriate order
+c _________________ Take index of primary atom for each variable 
+c                   (i.e. index of atom moved by variable) to
+c                   sort variables, handling variables with same base:
+c                   modify indices to obtain appropriate order
 
       ifirs=irsml1(nml)
@@ -116,8 +108,8 @@
         enddo  ! ... Variables
       enddo  ! ... Residues
-! ___________________________________ Sort variables in ascending order
-!                        (i.e. from start of molecule/base of branches)
-! array 'iorvr' gives indices of (1st,2nd, ... ,n-th) variables;
-! as can be found in arrays for variables (example: ityvr(iorvr())
+c ___________________________________ Sort variables in ascending order
+c                        (i.e. from start of molecule/base of branches)
+c array 'iorvr' gives indices of (1st,2nd, ... ,n-th) variables;
+c as can be found in arrays for variables (example: ityvr(iorvr())
       k=ilavr
       l=ifivr+ntlvr/2
@@ -140,10 +132,5 @@
       j=l+l-ii
       do while (j.le.k)
-!         if (j.lt.k.and.iadvr1(iorvr(j)).lt.iadvr1(iorvr(j+1))) j=j+1
-        if (j.lt.k) then
-            if (iadvr1(iorvr(j)).lt.iadvr1(iorvr(j+1))) then
-                j = j + 1
-            end if
-        end if
+        if (j.lt.k.and.iadvr1(iorvr(j)).lt.iadvr1(iorvr(j+1))) j=j+1
         if (n.lt.iadvr1(iorvr(j))) then
           iorvr(i)=iorvr(j)
@@ -156,6 +143,6 @@
       iorvr(i)=io
       goto 1
-! ______________________________ Find non-overlapping ranges of atoms (moving
-!                                sets) for each variable
+c ______________________________ Find non-overlapping ranges of atoms (moving
+c                                sets) for each variable
    2  nms=imsml1(nml)-1
 
@@ -165,5 +152,5 @@
         ia=iatvr(iv)      ! primary mov. atom
         ib=iowat(ia)      ! base
-! __________________________ First, determine complete mov. set for 'iv'
+c __________________________ First, determine complete mov. set for 'iv'
         it=ityvr(iv)
         if (it.eq.3) then       ! torsion
@@ -176,8 +163,8 @@
               if (i1.ne.0) then  ! combine ranges
                 if (j.gt.(i2+1).or.k.lt.(i1-1)) then
-                  write (logString, '(3a,/,2a,i4,a,i3)') 
-     &             ' setmvs> Cannot combine disjunct ranges of atom',
-     &             ' indices for torsion ',nmvr(iv),' in residue ',
-     &             seq(ir),ir,' of molecule # ',nml
+                  write (*,'(3a,/,2a,i4,a,i3)') 
+     #             ' setmvs> Cannot combine disjunct ranges of atom',
+     #             ' indices for torsion ',nmvr(iv),' in residue ',
+     #             seq(ir),ir,' of molecule # ',nml
                   stop
                 else
@@ -198,6 +185,6 @@
 
         if ((nms+1).gt.mxms) then
-          write (logString, '(a,i4,a,i5)') ' setmvs> Molecule # ',nml,
-     &    ': Number of moving sets > ',mxms
+          write (*,'(a,i4,a,i5)') ' setmvs> Molecule # ',nml,
+     #    ': Number of moving sets > ',mxms
           stop
         endif
@@ -206,6 +193,6 @@
         imsvr2(iv)=nms+1  !        & last m.s for var. 'iv'
 
-! ______________ Next, exclude overlaps between mov. set for 'iv' and the
-!                m.s. for 'previous' variables by reducing/splitting those
+c ______________ Next, exclude overlaps between mov. set for 'iv' and the
+c                m.s. for 'previous' variables by reducing/splitting those
 
         do jo=ifivr,io-1  ! prev. variables ...
@@ -231,7 +218,6 @@
                   nms=nms+1
                   if (nms.gt.mxms) then
-                    write (logString, '(a,i4,a,i5)') 
-     &                ' setmvs> Molecule # ',
-     &               nml,': Number of moving sets > ',mxms
+                    write (*,'(a,i4,a,i5)') ' setmvs> Molecule # ',
+     #               nml,': Number of moving sets > ',mxms
                      stop
                   endif
@@ -273,5 +259,5 @@
 
         enddo  ! prev. variables
-! _______________________________ Finally, add moving set for 'iv'
+c _______________________________ Finally, add moving set for 'iv'
         nms=nms+1
         latms1(nms)=i1
@@ -279,5 +265,5 @@
       enddo  ! variables
       nmsml(nml)=nms-imsml1(nml)+1
-! _____________________________ Determine index of moving set for each atom
+c _____________________________ Determine index of moving set for each atom
       do ia=ifiat,ilaat
         ixmsat(ia)=0
@@ -288,7 +274,7 @@
         enddo
       enddo
-! _____________________________ Determine indices of variables which moving
-!                               set sets have to be added (=are related) to
-!                               those of a given variable
+c _____________________________ Determine indices of variables which moving
+c                               set sets have to be added (=are related) to
+c                               those of a given variable
 
       i=iorvr(ifivr)  ! initialize index of CURRENT var.
@@ -314,5 +300,5 @@
           jb=iowat(ja)       ! its base
 
-! _______________ current var. is torsion & shares base with var. 'j'
+c _______________ current var. is torsion & shares base with var. 'j'
           if (it.eq.3.and.jb.eq.ib) then
             do k=n,nad  !  ? has this branch been registered before ?
@@ -321,7 +307,6 @@
             nad=nad+1
             if (nad.gt.mxvr) then
-              write (logString, '(a,i4,a,i5)') ' setmvs> Molecule # ',
-     &                         nml,
-     &                         ': Number of added variables > ',mxvr
+              write (*,'(a,i4,a,i5)') ' setmvs> Molecule # ',nml,
+     #                         ': Number of added variables > ',mxvr
               stop
             endif
@@ -337,7 +322,6 @@
                 nad=nad+1
                 if (nad.gt.mxvr) then
-                  write (logString, '(a,i4,a,i5)') 
-     &                         ' setmvs> Molecule # ',nml,
-     &                         ': Number of added variables > ',mxvr
+                  write (*,'(a,i4,a,i5)') ' setmvs> Molecule # ',nml,
+     #                         ': Number of added variables > ',mxvr
                   stop
                 endif
@@ -352,7 +336,6 @@
               nad=nad+1
               if (nad.gt.mxvr) then
-                write (logString, '(a,i4,a,i5)') ' setmvs> Molecule # ',
-     &                       nml,
-     &                       ': Number of added variables > ',mxvr
+                write (*,'(a,i4,a,i5)') ' setmvs> Molecule # ',nml,
+     #                       ': Number of added variables > ',mxvr
                 stop
               endif
@@ -368,74 +351,69 @@
 
       nadml(nml)=nad-iadml1(nml)+1
-! _____________________________________ Summary
-!      do io=ilavr,ifivr,-1
-!        iv=iorvr(io)
-!        ib=iowat(iatvr(iv))
-!        i1s=imsvr1(iv)
-!        i2s=imsvr2(iv)
-!        if (i1s.le.i2s) then
-!          do i=i1s,i2s
-!            i1=latms1(i)
-!            i2=latms2(i)
-!            if (i.eq.i1s) then
-!              write (logString, '(a,i3,7a,i4,3a,i4,a)') 'res # ',nursvr(iv),
-!     #        ' var: ',nmvr(iv),' base:',nmat(ib),'    atoms= ',
-!     #        nmat(i1),'(',i1,') - ',nmat(i2),'(',i2,')'
-!            else
-!              write (logString, '(39x,2a,i4,3a,i4,a)')
-!     #        nmat(i1),'(',i1,') - ',nmat(i2),'(',i2,')'
-!            endif
-!          enddo
-!        else
-!          write (logString, '(a,i3,5a)') 'res # ',nursvr(iv),
-!     #    ' var: ',nmvr(iv),' base:',nmat(ib),'  No atoms'
-!        endif
-!        i1a=iadvr1(iv)
-!        i2a=iadvr2(iv)
-!        if (i1a.le.i2a) then
-!          write (logString, '(a,30(1x,a))') ' Depending variables:',
-!     #                    (nmvr(ladvr(i)),i=i1a,i2a)
-!        else
-!          write (logString, '(a)') ' No dep. variables'
-!        endif
-!      enddo
-! _____________________________________ Summary - End
+c _____________________________________ Summary
+c      do io=ilavr,ifivr,-1
+c        iv=iorvr(io)
+c        ib=iowat(iatvr(iv))
+c        i1s=imsvr1(iv)
+c        i2s=imsvr2(iv)
+c        if (i1s.le.i2s) then
+c          do i=i1s,i2s
+c            i1=latms1(i)
+c            i2=latms2(i)
+c            if (i.eq.i1s) then
+c              write (*,'(a,i3,7a,i4,3a,i4,a)') 'res # ',nursvr(iv),
+c     #        ' var: ',nmvr(iv),' base:',nmat(ib),'    atoms= ',
+c     #        nmat(i1),'(',i1,') - ',nmat(i2),'(',i2,')'
+c            else
+c              write (*,'(39x,2a,i4,3a,i4,a)')
+c     #        nmat(i1),'(',i1,') - ',nmat(i2),'(',i2,')'
+c            endif
+c          enddo
+c        else
+c          write (*,'(a,i3,5a)') 'res # ',nursvr(iv),
+c     #    ' var: ',nmvr(iv),' base:',nmat(ib),'  No atoms'
+c        endif
+c        i1a=iadvr1(iv)
+c        i2a=iadvr2(iv)
+c        if (i1a.le.i2a) then
+c          write (*,'(a,30(1x,a))') ' Depending variables:',
+c     #                    (nmvr(ladvr(i)),i=i1a,i2a)
+c        else
+c          write (*,'(a)') ' No dep. variables'
+c        endif
+c      enddo
+c _____________________________________ Summary - End
  
       return
 
-    6 write (logString, '(a,i4,/,2(a,i5),a)') 
-     & ' setmvs> Error in atom numbering of molecule # ',nml,
-     & ': atom ranges for variables # ',iv,' and # ',jv,
-     & ' overlap only PARTLY'
+    6 write (*,'(a,i4,/,2(a,i5),a)') 
+     # ' setmvs> Error in atom numbering of molecule # ',nml,
+     # ': atom ranges for variables # ',iv,' and # ',jv,
+     # ' overlap only PARTLY'
       stop
 
       end
-! *******************************************************
+c *******************************************************
       subroutine fndbrn(nml,nrs,ifirg,ilarg,irg1,irg2,bb)
 
-! .........................................................
-! PURPOSE: determine range [ifirg,ilarg] of atom indices
-!          for branch starting from atom 'ifirg' of residue
-!          'nrs' in molecule 'nml'
-! OUTPUT:  BB          - .t. if 'ifirg' is a backbone atom
-!          IRG1 & IRG2 - atom indices of ring-closing bond,
-!                        if 'ifirg' is INSIDE a ring, but NOT
-!                        its 1st atom ( in 'multiple' rings
-!                        only LAST closing bond is given !)
-!
-! CALLS: none
-!
-! .........................................................
+c .........................................................
+c PURPOSE: determine range [ifirg,ilarg] of atom indices
+c          for branch starting from atom 'ifirg' of residue
+c          'nrs' in molecule 'nml'
+c OUTPUT:  BB          - .t. if 'ifirg' is a backbone atom
+c          IRG1 & IRG2 - atom indices of ring-closing bond,
+c                        if 'ifirg' is INSIDE a ring, but NOT
+c                        its 1st atom ( in 'multiple' rings
+c                        only LAST closing bond is given !)
+c
+c CALLS: none
+c
+c .........................................................
 
       include 'INCL.H'
 
-      integer nml, nrs, ifirg, ilarg, irg1, irg2
-                  
       logical bb
-      integer ibd
       dimension ibd(4)
 
-      integer i, ib, ila, ifi, il, ixt, k, j, jb            
-                  
       ilarg=ifirg
 
Index: setvar.f
===================================================================
--- setvar.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ setvar.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,37 +1,28 @@
-!**************************************************************
-!
-! This file contains the subroutines: setvar
-!
-! 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: setvar
+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 **************************************************************
 
       
       subroutine setvar(nml,vlvrx)
 
-! ..............................................................
-! PURPOSE: Reset variables in molecule 'nml' to new values given
-!          in 'vlvrx' and rebuild molecule
-!          
-! ! assure constant PHASE angles for branches from same atom
-!
-! CALLS: bldmol,difang
-! ....................................................
+c ..............................................................
+c PURPOSE: Reset variables in molecule 'nml' to new values given
+c          in 'vlvrx' and rebuild molecule
+c          
+c ! assure constant PHASE angles for branches from same atom
+c
+c CALLS: bldmol,difang
+c ....................................................
 
       include 'INCL.H'
-Cf2py intent(in) nml, vlvrx
-      integer nml
-      double precision vlvrx
+
       dimension vlvrx(mxvr)
-      
-!     functions
-      double precision difang
-
-      integer i, iat,ity, iow, j, jat, i1vr
-      double precision ba, to, tsh
-      
 
       i1vr=ivrml1(nml)
Index: smmp.pyf
===================================================================
--- smmp.pyf	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ smmp.pyf	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -9,15 +9,6 @@
     end interface metropolis_user_interface
 end python module metropolis__user__routines
-
 python module smmp ! in 
     interface  ! in :smmp
-        block data updtchs ! in :smmp:metropolis.f
-            integer optional,dimension(5) :: ncalls=5*0
-            integer optional,dimension(5) :: nacalls=5*0
-            double precision optional :: up2bmax=4.0d0
-            double precision optional :: up2bmin=0.5d0
-            common /updstats/ ncalls,nacalls
-            common /updtparam/ up2bmax,up2bmin
-        end block data updtchs
         subroutine metropolis(eol1,acz,dummy) ! in :smmp:metropolis.f
             use metropolis__user__routines
@@ -280,5 +271,5 @@
             real*8 :: boxsize
             integer :: seed
-            character*100 :: zimm
+            character*mxrs :: zimm
             integer*4 :: itysol
             logical :: isolscl
@@ -379,68 +370,68 @@
         end subroutine metropolis
         function energy() ! in :smmp:energy.f
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -450,33 +441,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -485,94 +476,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -580,31 +571,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             real*8 :: energy
             common /v_sol/ vdvol,asa,asap,asah
@@ -662,70 +653,72 @@
             common /flex_r/ c_f,a_f,chb_f,ahb_f,e0to_f,sgto_f,rnto_f,plt_f,slp_f,cohb_f
         end function energy
-        function enysol(nmol) ! in :smmp:enysol.f
-            integer optional, intent(in):: nmol=0
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+        subroutine minim(imin,maxit,eps) ! in :smmp:minim.f
+            integer*4 intent(in) :: imin
+            integer*4 intent(in) :: maxit
+            real*8 intent(in) :: eps
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -735,33 +728,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -770,94 +763,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -865,603 +858,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
-            real*8 :: enysol
-            common /v_sol/ vdvol,asa,asap,asah
-            common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
-            common /cont_i_j/ ijcont,ind_alf
-            common /sche_l/ do_s,ac_s
-            common /rstr_c/ nmrt,nmvrrt
-            common /mol_par/ nvr
-            common /sol/ coef_sl,rad_vdw
-            common /ressurf/ surfres
-            common /h_bond/ ntyhb,ixtyhb,nutyhb,mmhb
-            common /atm_c/ nmat
-            common /fil_i/ lunlib,lunseq,lunchg,lunvar,lunrst
-            common /refstr/ isrfvr
-            common /rstr_r/ pbrt,vuvrrt,dvvrrt
-            common /atm_i/ ityat,iowat,iyowat,nbdat,ibdat,iybdat,ixmsat
-            common /sche_r/ ehm,atpl,efel,emin,rmin,chb_s,ahb_s,e0to_s,sgto_s,rnto_s,eps_s
-            common /tes/ spoint
-            common /flex_l/ do_f,ac_f
-            common /fil_c/ reslib,seqfil,chgfil,varfil,rstfil
-            common /mol_i/ ntlml,irsml1,irsml2,ivrml1,nvrml,imsml1,nmsml,iadml1,nadml,ixrfpt,ixatp,ireg
-            common /help_r/ blath,baath,toath,cgath
-            common /jref/ iref,nci
-            common /epar_l/ flex,tesgrd,sh2,epsd,ientyp
-            common /rgy/ rgyh,rgyp
-            common /con_i/ idloa,idloz,idupa,idupz
-            common /paral/ myrank,no,my_mpi_comm,workperprocessor
-            common /help_c/ nmath,nmvrh
-            common /help_i/ ityath,iowath,iyowath,nbdath,ibdath,iybdath,ityvrh,iclvrh,iatvrh
-            common /res_c/ seq
-            common /solvent/ rvdw,sigma
-            common /deriv/ gradan
-            common /epar_i/ ihbty
-            common /pnt/ npnt
-            common /mol_c/ nmml
-            common /epar_r/ cij,aij,a14,chb,ahb,e0to,sgto,rnto,esnto,conv,plt,slp,cohb
-            common /res_i/ iatrs1,iatrs2,ixatrs,ivrrs1,nvrrs
-            common /rstr_i/ ntlrt,ntlsu,i1vrrt,i2vrrt,iprtsu,i1rtsu,nrtsu,i1vrsu,i2vrsu,ipvrsu
-            common /mol_r/ rfpt,gbpr,xrfax,yrfax,zrfax
-            common /var_l/ fxvr
-            common /eny_r/ eyel,eyvw,eyhb,eyvr,eysm,eysl,eyrg,eyslh,eyslp,eyab,eysmi,eyhbi,eyeli,eyvwi,gdeyvr,gdeyrg,gdeysl,gdeygb,wtey,wtrg
-            common /var_i/ iatvr,ityvr,iclvr,iorvr,imsvr1,imsvr2,latms1,latms2,iadvr1,iadvr2,ladvr,idvr
-            common /counter/ enysolct
-            common /var_c/ nmvr
-            common /bounds/ boxsize
-            common /commonrandom/ seed
-            common /zimme/ zimm
-            common /isolty/ itysol,isolscl
-            common /abgncor/ rsstrg
-            common /rsnm_c/ rsnmcd,onltcd
-            common /updchois/ rndord,upchswitch,bgsprob
-            common /eny_i/ nvwml,ivwml1,n14ml,i14ml1,ivwat1,ivwat2,i14at1,i14at2,lvwat1,lvwat2,l14at,ixatvw,ixat14
-            common /var_r/ olvlvr,vlvr,axvr
-            common /bet/ beta
-            common /flex_r/ c_f,a_f,chb_f,ahb_f,e0to_f,sgto_f,rnto_f,plt_f,slp_f,cohb_f
-        end function enysol
-        subroutine setvar(nml,vlvrx) ! in :smmp:setvar.f
-            integer intent(in) :: nml
-            double precision dimension(800) :: vlvrx
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
-            logical dimension(18) :: do_s
-            logical dimension(18) :: ac_s
-            character dimension(500,4) :: nmrt
-            character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
-            logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
-            logical dimension(18) :: do_f
-            logical dimension(18) :: ac_f
-            character*80 :: reslib
-            character*80 :: seqfil
-            character*80 :: chgfil
-            character*80 :: varfil
-            character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
-            logical :: flex
-            logical :: tesgrd
-            logical :: sh2
-            logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
-            integer :: myrank
-            integer :: no
-            integer :: my_mpi_comm
-            integer dimension(11,2049) :: workperprocessor
-            character dimension(100,4) :: nmath
-            character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
-            character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
-            character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
-            logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
-            integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
-            integer :: seed
-            character*mxrs :: zimm
-            integer :: itysol
-            logical :: isolscl
-            double precision dimension(100) :: rsstrg
-            character dimension(35,4) :: rsnmcd
-            character dimension(35) :: onltcd
-            logical :: rndord
-            integer :: upchswitch
-            double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
-            common /v_sol/ vdvol,asa,asap,asah
-            common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
-            common /cont_i_j/ ijcont,ind_alf
-            common /sche_l/ do_s,ac_s
-            common /rstr_c/ nmrt,nmvrrt
-            common /mol_par/ nvr
-            common /sol/ coef_sl,rad_vdw
-            common /ressurf/ surfres
-            common /h_bond/ ntyhb,ixtyhb,nutyhb,mmhb
-            common /atm_c/ nmat
-            common /fil_i/ lunlib,lunseq,lunchg,lunvar,lunrst
-            common /refstr/ isrfvr
-            common /rstr_r/ pbrt,vuvrrt,dvvrrt
-            common /atm_i/ ityat,iowat,iyowat,nbdat,ibdat,iybdat,ixmsat
-            common /sche_r/ ehm,atpl,efel,emin,rmin,chb_s,ahb_s,e0to_s,sgto_s,rnto_s,eps_s
-            common /tes/ spoint
-            common /flex_l/ do_f,ac_f
-            common /fil_c/ reslib,seqfil,chgfil,varfil,rstfil
-            common /mol_i/ ntlml,irsml1,irsml2,ivrml1,nvrml,imsml1,nmsml,iadml1,nadml,ixrfpt,ixatp,ireg
-            common /help_r/ blath,baath,toath,cgath
-            common /jref/ iref,nci
-            common /epar_l/ flex,tesgrd,sh2,epsd,ientyp
-            common /rgy/ rgyh,rgyp
-            common /con_i/ idloa,idloz,idupa,idupz
-            common /paral/ myrank,no,my_mpi_comm,workperprocessor
-            common /help_c/ nmath,nmvrh
-            common /help_i/ ityath,iowath,iyowath,nbdath,ibdath,iybdath,ityvrh,iclvrh,iatvrh
-            common /res_c/ seq
-            common /solvent/ rvdw,sigma
-            common /deriv/ gradan
-            common /epar_i/ ihbty
-            common /pnt/ npnt
-            common /mol_c/ nmml
-            common /epar_r/ cij,aij,a14,chb,ahb,e0to,sgto,rnto,esnto,conv,plt,slp,cohb
-            common /res_i/ iatrs1,iatrs2,ixatrs,ivrrs1,nvrrs
-            common /rstr_i/ ntlrt,ntlsu,i1vrrt,i2vrrt,iprtsu,i1rtsu,nrtsu,i1vrsu,i2vrsu,ipvrsu
-            common /mol_r/ rfpt,gbpr,xrfax,yrfax,zrfax
-            common /var_l/ fxvr
-            common /eny_r/ eyel,eyvw,eyhb,eyvr,eysm,eysl,eyrg,eyslh,eyslp,eyab,eysmi,eyhbi,eyeli,eyvwi,gdeyvr,gdeyrg,gdeysl,gdeygb,wtey,wtrg
-            common /var_i/ iatvr,ityvr,iclvr,iorvr,imsvr1,imsvr2,latms1,latms2,iadvr1,iadvr2,ladvr,idvr
-            common /counter/ enysolct
-            common /var_c/ nmvr
-            common /bounds/ boxsize
-            common /commonrandom/ seed
-            common /zimme/ zimm
-            common /isolty/ itysol,isolscl
-            common /abgncor/ rsstrg
-            common /rsnm_c/ rsnmcd,onltcd
-            common /updchois/ rndord,upchswitch,bgsprob
-            common /eny_i/ nvwml,ivwml1,n14ml,i14ml1,ivwat1,ivwat2,i14at1,i14at2,lvwat1,lvwat2,l14at,ixatvw,ixat14
-            common /var_r/ olvlvr,vlvr,axvr
-            common /bet/ beta
-            common /flex_r/ c_f,a_f,chb_f,ahb_f,e0to_f,sgto_f,rnto_f,plt_f,slp_f,cohb_f
-        end subroutine setvar
-        subroutine minim(imin,maxit,eps) ! in :smmp:minim.f
-            integer*4 intent(in) :: imin
-            integer*4 intent(in) :: maxit
-            real*8 :: eps
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
-            logical dimension(18) :: do_s
-            logical dimension(18) :: ac_s
-            character dimension(500,4) :: nmrt
-            character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
-            logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
-            logical dimension(18) :: do_f
-            logical dimension(18) :: ac_f
-            character*80 :: reslib
-            character*80 :: seqfil
-            character*80 :: chgfil
-            character*80 :: varfil
-            character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
-            logical :: flex
-            logical :: tesgrd
-            logical :: sh2
-            logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
-            integer :: myrank
-            integer :: no
-            integer :: my_mpi_comm
-            integer dimension(11,2049) :: workperprocessor
-            character dimension(100,4) :: nmath
-            character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
-            character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
-            character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
-            logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
-            integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
-            integer :: seed
-            character*mxrs :: zimm
-            integer :: itysol
-            logical :: isolscl
-            double precision dimension(100) :: rsstrg
-            character dimension(35,4) :: rsnmcd
-            character dimension(35) :: onltcd
-            logical :: rndord
-            integer :: upchswitch
-            double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -1522,68 +943,68 @@
             integer*4 intent(out) :: nham2
             real*8 intent(out) :: dham
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -1593,33 +1014,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -1628,94 +1049,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -1723,31 +1144,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -1808,68 +1229,68 @@
             integer*4 intent(out) :: mhb
             integer*4 :: ipr
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -1879,33 +1300,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -1914,94 +1335,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -2009,31 +1430,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -2092,68 +1513,68 @@
         subroutine interhbond(mhb) ! in :smmp:hbond.f
             integer*4 intent(out) :: mhb
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -2163,33 +1584,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -2198,94 +1619,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -2293,31 +1714,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -2379,68 +1800,68 @@
             integer*4 intent(out) :: nbet
             integer*4 intent(out) :: mbet
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -2450,33 +1871,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -2485,94 +1906,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -2580,31 +2001,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -2667,69 +2088,69 @@
             double precision intent(in) :: tmax
             double precision intent(in) :: tmin
-            logical optional, intent(in) :: lrand=1
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            logical optional,intent(in) :: lrand=1
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -2739,33 +2160,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -2774,94 +2195,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -2869,31 +2290,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -2954,68 +2375,68 @@
             real*8 intent(out) :: rgy
             real*8 intent(out) :: ee
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -3025,33 +2446,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -3060,94 +2481,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -3155,31 +2576,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -3238,68 +2659,68 @@
         subroutine zimmer(nresi) ! in :smmp:zimmer.f
             integer*4 intent(in) :: nresi
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -3309,33 +2730,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -3344,94 +2765,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -3439,31 +2860,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -3524,70 +2945,70 @@
             integer intent(in) :: nswp
             integer intent(in) :: nmes
-            double precision intent(in):: temp
-            logical optional, intent(in) :: lrand=1
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            double precision intent(in) :: temp
+            logical optional,intent(in) :: lrand=1
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -3597,33 +3018,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -3632,94 +3053,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -3727,31 +3148,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -3809,70 +3230,70 @@
         end subroutine canon
         subroutine outpdb(nml,filename) ! in :smmp:outpdb.f
-            integer*4 intent(in) :: nml
-            character*(*) intent(in) :: filename
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            integer*4 :: nml
+            character*(*) :: filename
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -3882,33 +3303,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -3917,94 +3338,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -4012,31 +3433,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -4102,68 +3523,68 @@
             real*8 dimension(10000) :: zrf
             integer*4 :: isl
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -4173,33 +3594,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -4208,13 +3629,13 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
             integer*4 :: nchp
@@ -4225,91 +3646,91 @@
             integer*4 :: natp
             integer*4 dimension(10000) :: noatp
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
             character dimension(100) :: chnp
             character dimension(1000,3) :: rsnmp
             character dimension(1000,5) :: rsidp
             character dimension(10000,4) :: atnmp
-            integer :: npnt
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
             real*8 dimension(10000) :: xatp
             real*8 dimension(10000) :: yatp
             real*8 dimension(10000) :: zatp
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -4317,31 +3738,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             real*8 :: rmsdfun
             common /v_sol/ vdvol,asa,asap,asah
@@ -4404,68 +3825,68 @@
         subroutine init_energy(libdir) ! in :smmp:init_energy.f
             character*(*) :: libdir
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -4475,33 +3896,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -4510,94 +3931,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -4605,31 +4026,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -4687,68 +4108,68 @@
         end subroutine init_energy
         block data  ! in :smmp:init_energy.f
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical optional,dimension(18) :: do_s=.false.
             logical optional,dimension(18) :: ac_s=.false.
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision optional,dimension(9,18) :: coef_sl=54*0.0
-            double precision optional,dimension(9,18) :: rad_vdw=54*0.
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 optional,dimension(9,18) :: coef_sl=54*0.0
+            real*8 optional,dimension(9,18) :: rad_vdw=54*0.
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision optional :: ehm=362.55d0
-            double precision optional,dimension(18) :: atpl=42.
-            double precision optional,dimension(18) :: efel=85.
-            double precision optional,dimension(18) :: emin=37.
-            double precision optional,dimension(18) :: rmin=292.
-            double precision optional,dimension(4,6) :: chb_s=2624.
-            double precision optional,dimension(4,6) :: ahb_s=5890.
-            double precision optional,dimension(19) :: e0to_s=20.
-            double precision optional,dimension(19) :: sgto_s=-1.
-            double precision optional,dimension(19) :: rnto_s=2.
-            double precision optional :: eps_s=2.d0
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 optional :: ehm=362.55d0
+            real*8 optional,dimension(18) :: atpl=42.
+            real*8 optional,dimension(18) :: efel=85.
+            real*8 optional,dimension(18) :: emin=37.
+            real*8 optional,dimension(18) :: rmin=292.
+            real*8 optional,dimension(4,6) :: chb_s=2624.
+            real*8 optional,dimension(4,6) :: ahb_s=5890.
+            real*8 optional,dimension(19) :: e0to_s=20.
+            real*8 optional,dimension(19) :: sgto_s=-1.
+            real*8 optional,dimension(19) :: rnto_s=2.
+            real*8 optional :: eps_s=2.d0
+            real*8 dimension(2000,3) :: spoint
             logical optional,dimension(18) :: do_f=.false.
             logical optional,dimension(18) :: ac_f=.false.
@@ -4758,33 +4179,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -4793,94 +4214,94 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
-            integer :: npnt
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision optional :: conv=332.d0
-            double precision optional :: plt=78.d0
-            double precision optional :: slp=0.3d0
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 optional :: conv=332.d0
+            real*8 optional :: plt=78.d0
+            real*8 optional :: slp=0.3d0
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -4888,70 +4309,68 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision optional,dimension(18,18) :: c_f=40.
-            double precision optional,dimension(18,18) :: a_f=7.74
-            double precision optional,dimension(4,6) :: chb_f=180.
-            double precision optional,dimension(4,6) :: ahb_f=6600.
-            double precision optional,dimension(19) :: e0to_f=20.
-            double precision optional,dimension(19) :: sgto_f=-1.
-            double precision optional,dimension(19) :: rnto_f=2.
-            double precision optional :: plt_f=78.d0
-            double precision optional :: slp_f=0.16d0
-            double precision optional :: cohb_f=6.d0
-            double precision parameter,optional :: cdr=0.0174532925199
-            integer parameter,optional :: mxvw=10400
-            integer parameter,optional :: mxtyat=18
-            integer parameter,optional :: mxat=2600
-            double precision parameter,optional :: crd=57.2957795131
-            double precision parameter,optional :: zero=0.0
-            integer parameter,optional :: mxtyto=19
-            character*255 parameter,optional :: version='$id: incl.h 335 2007-08-09 09:32:21z meinke $'
-            integer parameter,optional :: mxbd=3
-            integer parameter,optional :: mxrs=100
-            integer parameter,optional :: mxrt=500
-            integer parameter,optional :: mx14=10400
-            integer parameter,optional :: mxtybl=0
-            integer parameter,optional :: mxtyba=0
-            double precision parameter,optional :: pi=3.14159265359
-            integer parameter,optional :: nrsty=35
-            integer parameter,optional :: ione=1
-            integer :: logfileunit
-            integer parameter,optional :: mxinbox=80000
-            integer parameter,optional :: mxhbac=6
-            integer parameter,optional :: mxvrh=100
-            integer parameter,optional :: mxrtsu=4800
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 optional,dimension(18,18) :: c_f=40.
+            real*8 optional,dimension(18,18) :: a_f=7.74
+            real*8 optional,dimension(4,6) :: chb_f=180.
+            real*8 optional,dimension(4,6) :: ahb_f=6600.
+            real*8 optional,dimension(19) :: e0to_f=20.
+            real*8 optional,dimension(19) :: sgto_f=-1.
+            real*8 optional,dimension(19) :: rnto_f=2.
+            real*8 optional :: plt_f=78.d0
+            real*8 optional :: slp_f=0.16d0
+            real*8 optional :: cohb_f=6.d0
+            real*8 parameter,optional :: cdr=0.0174532925199
+            integer*4 parameter,optional :: mxvw=10400
+            integer*4 parameter,optional :: mxtyat=18
+            real*8 parameter,optional :: crd=57.2957795131
+            real*8 parameter,optional :: zero=0.0
+            integer*4 parameter,optional :: mxtyto=19
+            character*255 parameter,optional :: version='$id: incl.h 338 2007-08-09 15:00:18z meinke $'
+            integer*4 parameter,optional :: mxbd=3
+            integer*4 parameter,optional :: mxrs=100
+            integer*4 parameter,optional :: mxrt=500
+            integer*4 parameter,optional :: mx14=10400
+            integer*4 parameter,optional :: mxtybl=0
+            integer*4 parameter,optional :: mxtyba=0
+            real*8 parameter,optional :: pi=3.14159265359
+            integer*4 parameter,optional :: nrsty=35
+            integer*4 parameter,optional :: ione=1
+            integer*4 parameter,optional :: mxinbox=80000
+            integer*4 parameter,optional :: mxhbac=6
+            integer*4 parameter,optional :: mxvrh=100
+            integer*4 parameter,optional :: mxrtsu=4800
+            integer*4 parameter,optional :: mxat=2600
             integer parameter,optional :: max_replica=2048
-            double precision parameter,optional :: rwater=1.4
-            integer parameter,optional :: mxms=2400
-            integer parameter,optional :: mxml=10
-            integer parameter,optional :: mxbox=80000
-            double precision parameter,optional :: one=1.0
-            integer parameter,optional :: mxtysol=9
-            double precision parameter,optional :: pi2=6.28318530718
-            integer parameter,optional :: mxhbdo=4
-            integer parameter,optional :: izero=0
-            integer parameter,optional :: mxpoint=2000
-            integer parameter,optional :: mxtyhb=100
-            integer parameter,optional :: mxath=100
-            integer parameter,optional :: mxvrrt=1000
-            integer :: maxloglevel
-            integer parameter,optional :: mxvr=800
-            double precision parameter,optional :: pi4=12.5663706144
+            real*8 parameter,optional :: rwater=1.4
+            integer*4 parameter,optional :: mxms=2400
+            integer*4 parameter,optional :: mxml=10
+            integer*4 parameter,optional :: mxbox=80000
+            real*8 parameter,optional :: one=1.0
+            integer*4 parameter,optional :: mxtysol=9
+            real*8 parameter,optional :: pi2=6.28318530718
+            integer*4 parameter,optional :: mxhbdo=4
+            integer*4 parameter,optional :: izero=0
+            integer*4 parameter,optional :: mxpoint=2000
+            integer*4 parameter,optional :: mxtyhb=100
+            integer*4 parameter,optional :: mxath=100
+            integer*4 parameter,optional :: mxvrrt=1000
+            integer*4 parameter,optional :: mxvr=800
+            real*8 parameter,optional :: pi4=12.5663706144
             integer parameter,optional :: max_proc=2048
             common /v_sol/ vdvol,asa,asap,asah
@@ -5013,70 +4432,70 @@
             character*4 :: grpn
             character*4 :: grpc
-            character*80 optional, intent(in) :: seqfile=' '
-            character*80 optional, intent(in) :: varfile=' '
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            character*80 optional,intent(in) :: seqfile=' '
+            character*80 optional,intent(in) :: varfile=' '
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -5086,33 +4505,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -5121,13 +4540,13 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
             integer*4 :: nchp
@@ -5138,91 +4557,91 @@
             integer*4 :: natp
             integer*4 dimension(10000) :: noatp
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
             character dimension(100) :: chnp
             character dimension(1000,3) :: rsnmp
             character dimension(1000,5) :: rsidp
             character dimension(10000,4) :: atnmp
-            integer :: npnt
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
             real*8 dimension(10000) :: xatp
             real*8 dimension(10000) :: yatp
             real*8 dimension(10000) :: zatp
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -5230,31 +4649,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -5319,68 +4738,68 @@
             integer*4 intent(in) :: nsteps
             real*8 intent(in) :: acc
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -5390,33 +4809,33 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -5425,13 +4844,13 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
             integer*4 :: nchp
@@ -5442,91 +4861,91 @@
             integer*4 :: natp
             integer*4 dimension(10000) :: noatp
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
             character dimension(100) :: chnp
             character dimension(1000,3) :: rsnmp
             character dimension(1000,5) :: rsidp
             character dimension(10000,4) :: atnmp
-            integer :: npnt
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
             real*8 dimension(10000) :: xatp
             real*8 dimension(10000) :: yatp
             real*8 dimension(10000) :: zatp
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -5534,31 +4953,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -5632,70 +5051,70 @@
         end block data twbloks
         subroutine init_lund ! in :smmp:bgs.f
-            double precision :: vdvol
-            double precision :: asa
-            double precision :: asap
-            double precision :: asah
+            real*8 :: vdvol
+            real*8 :: asa
+            real*8 :: asap
+            real*8 :: asah
             integer :: bgsnvar
             integer dimension(8) :: iph
-            integer dimension(2600) :: cgat
-            double precision dimension(2600) :: xbaat
-            double precision dimension(2600) :: ybaat
-            double precision dimension(2600) :: zbaat
-            double precision dimension(2600) :: baat
-            double precision dimension(2600) :: snbaat
-            double precision dimension(2600) :: csbaat
-            double precision dimension(2600) :: xtoat
-            double precision dimension(2600) :: ytoat
-            double precision dimension(2600) :: ztoat
-            double precision dimension(2600) :: toat
-            double precision dimension(2600) :: sntoat
-            double precision dimension(2600) :: cstoat
-            double precision dimension(2600) :: blat
-            double precision dimension(2602) :: xat
-            double precision dimension(2602) :: yat
-            double precision dimension(2602) :: zat
-            integer dimension(100,100) :: ijcont
-            integer dimension(100) :: ind_alf
+            real*8 dimension(2600) :: cgat
+            real*8 dimension(2600) :: xbaat
+            real*8 dimension(2600) :: ybaat
+            real*8 dimension(2600) :: zbaat
+            real*8 dimension(2600) :: baat
+            real*8 dimension(2600) :: snbaat
+            real*8 dimension(2600) :: csbaat
+            real*8 dimension(2600) :: xtoat
+            real*8 dimension(2600) :: ytoat
+            real*8 dimension(2600) :: ztoat
+            real*8 dimension(2600) :: toat
+            real*8 dimension(2600) :: sntoat
+            real*8 dimension(2600) :: cstoat
+            real*8 dimension(2600) :: blat
+            real*8 dimension(2602) :: xat
+            real*8 dimension(2602) :: yat
+            real*8 dimension(2602) :: zat
+            integer*4 dimension(100,100) :: ijcont
+            integer*4 dimension(100) :: ind_alf
             logical dimension(18) :: do_s
             logical dimension(18) :: ac_s
             character dimension(500,4) :: nmrt
             character dimension(1000,3) :: nmvrrt
-            integer :: nvr
-            double precision dimension(9,18) :: coef_sl
-            double precision dimension(9,18) :: rad_vdw
-            double precision dimension(100) :: surfres
-            integer :: ntyhb
-            integer dimension(100) :: ixtyhb
-            integer dimension(100) :: nutyhb
-            integer dimension(10,10) :: mmhb
-            character dimension(2600,4) :: nmat
-            integer :: lunlib
-            integer :: lunseq
-            integer :: lunchg
-            integer :: lunvar
-            integer :: lunrst
+            integer*4 :: nvr
+            real*8 dimension(9,18) :: coef_sl
+            real*8 dimension(9,18) :: rad_vdw
+            real*8 dimension(100) :: surfres
+            integer*4 :: ntyhb
+            integer*4 dimension(100) :: ixtyhb
+            integer*4 dimension(100) :: nutyhb
+            integer*4 dimension(10,10) :: mmhb
+            character dimension(4,2600) :: nmat
+            integer*4 :: lunlib
+            integer*4 :: lunseq
+            integer*4 :: lunchg
+            integer*4 :: lunvar
+            integer*4 :: lunrst
             logical dimension(800) :: isrfvr
-            double precision dimension(500) :: pbrt
-            double precision dimension(1000) :: vuvrrt
-            double precision dimension(1000) :: dvvrrt
-            integer dimension(2600) :: ityat
-            integer dimension(2600) :: iowat
-            integer dimension(2600) :: iyowat
-            integer dimension(2600) :: nbdat
-            integer dimension(3,2600) :: ibdat
-            integer dimension(3,2600) :: iybdat
-            integer dimension(2600) :: ixmsat
-            double precision :: ehm
-            double precision dimension(18) :: atpl
-            double precision dimension(18) :: efel
-            double precision dimension(18) :: emin
-            double precision dimension(18) :: rmin
-            double precision dimension(4,6) :: chb_s
-            double precision dimension(4,6) :: ahb_s
-            double precision dimension(19) :: e0to_s
-            double precision dimension(19) :: sgto_s
-            double precision dimension(19) :: rnto_s
-            double precision :: eps_s
-            double precision dimension(2000,3) :: spoint
+            real*8 dimension(500) :: pbrt
+            real*8 dimension(1000) :: vuvrrt
+            real*8 dimension(1000) :: dvvrrt
+            integer*4 dimension(2600) :: ityat
+            integer*4 dimension(2600) :: iowat
+            integer*4 dimension(2600) :: iyowat
+            integer*4 dimension(2600) :: nbdat
+            integer*4 dimension(3,2600) :: ibdat
+            integer*4 dimension(3,2600) :: iybdat
+            integer*4 dimension(2600) :: ixmsat
+            real*8 :: ehm
+            real*8 dimension(18) :: atpl
+            real*8 dimension(18) :: efel
+            real*8 dimension(18) :: emin
+            real*8 dimension(18) :: rmin
+            real*8 dimension(4,6) :: chb_s
+            real*8 dimension(4,6) :: ahb_s
+            real*8 dimension(19) :: e0to_s
+            real*8 dimension(19) :: sgto_s
+            real*8 dimension(19) :: rnto_s
+            real*8 :: eps_s
+            real*8 dimension(2000,3) :: spoint
             logical dimension(18) :: do_f
             logical dimension(18) :: ac_f
@@ -5705,37 +5124,37 @@
             character*80 :: varfil
             character*80 :: rstfil
-            integer :: ntlml
-            integer dimension(10) :: irsml1
-            integer dimension(10) :: irsml2
-            integer dimension(10) :: ivrml1
-            integer dimension(10) :: nvrml
-            integer dimension(10) :: imsml1
-            integer dimension(10) :: nmsml
-            integer dimension(10) :: iadml1
-            integer dimension(10) :: nadml
-            integer dimension(3,10) :: ixrfpt
-            integer dimension(2600) :: ixatp
-            integer :: ireg
-            double precision dimension(100) :: blath
-            double precision dimension(100) :: baath
-            double precision dimension(100) :: toath
-            double precision dimension(100) :: cgath
-            integer dimension(100,100) :: iref
-            integer :: nci
+            integer*4 :: ntlml
+            integer*4 dimension(10) :: irsml1
+            integer*4 dimension(10) :: irsml2
+            integer*4 dimension(10) :: ivrml1
+            integer*4 dimension(10) :: nvrml
+            integer*4 dimension(10) :: imsml1
+            integer*4 dimension(10) :: nmsml
+            integer*4 dimension(10) :: iadml1
+            integer*4 dimension(10) :: nadml
+            integer*4 dimension(3,10) :: ixrfpt
+            integer*4 dimension(2600) :: ixatp
+            integer*4 :: ireg
+            real*8 dimension(100) :: blath
+            real*8 dimension(100) :: baath
+            real*8 dimension(100) :: toath
+            real*8 dimension(100) :: cgath
+            integer*4 dimension(100,100) :: iref
+            integer*4 :: nci
             logical :: flex
             logical :: tesgrd
             logical :: sh2
             logical :: epsd
-            integer :: ientyp
-            double precision :: rgyh
-            double precision :: rgyp
+            integer*4 :: ientyp
+            real*8 :: rgyh
+            real*8 :: rgyp
             double precision :: abgs
             double precision :: bbgs
             double precision dimension(8) :: dph
             integer dimension(100) :: bgsvar
-            integer :: idloa
-            integer :: idloz
-            integer :: idupa
-            integer :: idupz
+            integer*4 :: idloa
+            integer*4 :: idloz
+            integer*4 :: idupa
+            integer*4 :: idupz
             integer :: myrank
             integer :: no
@@ -5744,18 +5163,18 @@
             character dimension(100,4) :: nmath
             character dimension(100,3) :: nmvrh
-            integer dimension(100) :: ityath
-            integer dimension(100) :: iowath
-            integer dimension(100) :: iyowath
-            integer dimension(100) :: nbdath
-            integer dimension(3,100) :: ibdath
-            integer dimension(3,100) :: iybdath
-            integer dimension(100) :: ityvrh
-            integer dimension(100) :: iclvrh
-            integer dimension(100) :: iatvrh
+            integer*4 dimension(100) :: ityath
+            integer*4 dimension(100) :: iowath
+            integer*4 dimension(100) :: iyowath
+            integer*4 dimension(100) :: nbdath
+            integer*4 dimension(3,100) :: ibdath
+            integer*4 dimension(3,100) :: iybdath
+            integer*4 dimension(100) :: ityvrh
+            integer*4 dimension(100) :: iclvrh
+            integer*4 dimension(100) :: iatvrh
             character dimension(100,4) :: seq
-            double precision dimension(2600) :: rvdw
-            double precision dimension(2600) :: sigma
-            double precision dimension(2600,3) :: gradan
-            integer dimension(18,18) :: ihbty
+            real*8 dimension(2600) :: rvdw
+            real*8 dimension(2600) :: sigma
+            real*8 dimension(2600,3) :: gradan
+            integer*4 dimension(18,18) :: ihbty
             double precision :: kbias
             double precision :: epshb1
@@ -5774,9 +5193,9 @@
             integer*4 dimension(100,6) :: ihpat
             integer*4 dimension(100) :: nhpat
-            double precision dimension(3 * nhptyp) :: hpstrg
+            double precision dimension(3 * 3) :: hpstrg
             double precision :: exvk
             double precision :: exvcut
             double precision :: exvcut2
-            integer*4 dimension(mxconr + 41,2600) :: matcon
+            integer*4 dimension(40 + 41,2600) :: matcon
             double precision dimension(18) :: sigsa
             double precision dimension(18,18) :: sig2lcp
@@ -5793,39 +5212,39 @@
             double precision dimension(18,18) :: asaexv
             double precision dimension(18,18) :: bsaexv
-            integer :: npnt
+            integer*4 :: npnt
             character dimension(10,80) :: nmml
-            double precision dimension(18,18) :: cij
-            double precision dimension(18,18) :: aij
-            double precision dimension(18,18) :: a14
-            double precision dimension(18,18) :: chb
-            double precision dimension(18,18) :: ahb
-            double precision dimension(19) :: e0to
-            double precision dimension(19) :: sgto
-            double precision dimension(19) :: rnto
-            double precision dimension(19) :: esnto
-            double precision :: conv
-            double precision :: plt
-            double precision :: slp
-            double precision :: cohb
-            integer dimension(100) :: iatrs1
-            integer dimension(100) :: iatrs2
-            integer dimension(100) :: ixatrs
-            integer dimension(100) :: ivrrs1
-            integer dimension(100) :: nvrrs
-            integer :: ntlrt
-            integer :: ntlsu
-            integer dimension(500) :: i1vrrt
-            integer dimension(500) :: i2vrrt
-            integer dimension(4800) :: iprtsu
-            integer dimension(800) :: i1rtsu
-            integer dimension(800) :: nrtsu
-            integer dimension(800) :: i1vrsu
-            integer dimension(800) :: i2vrsu
-            integer dimension(800) :: ipvrsu
-            double precision dimension(3,10) :: rfpt
-            double precision dimension(6,10) :: gbpr
-            double precision dimension(3,10) :: xrfax
-            double precision dimension(3,10) :: yrfax
-            double precision dimension(3,10) :: zrfax
+            real*8 dimension(18,18) :: cij
+            real*8 dimension(18,18) :: aij
+            real*8 dimension(18,18) :: a14
+            real*8 dimension(18,18) :: chb
+            real*8 dimension(18,18) :: ahb
+            real*8 dimension(19) :: e0to
+            real*8 dimension(19) :: sgto
+            real*8 dimension(19) :: rnto
+            real*8 dimension(19) :: esnto
+            real*8 :: conv
+            real*8 :: plt
+            real*8 :: slp
+            real*8 :: cohb
+            integer*4 dimension(100) :: iatrs1
+            integer*4 dimension(100) :: iatrs2
+            integer*4 dimension(100) :: ixatrs
+            integer*4 dimension(100) :: ivrrs1
+            integer*4 dimension(100) :: nvrrs
+            integer*4 :: ntlrt
+            integer*4 :: ntlsu
+            integer*4 dimension(500) :: i1vrrt
+            integer*4 dimension(500) :: i2vrrt
+            integer*4 dimension(4800) :: iprtsu
+            integer*4 dimension(800) :: i1rtsu
+            integer*4 dimension(800) :: nrtsu
+            integer*4 dimension(800) :: i1vrsu
+            integer*4 dimension(800) :: i2vrsu
+            integer*4 dimension(800) :: ipvrsu
+            real*8 dimension(3,10) :: rfpt
+            real*8 dimension(6,10) :: gbpr
+            real*8 dimension(3,10) :: xrfax
+            real*8 dimension(3,10) :: yrfax
+            real*8 dimension(3,10) :: zrfax
             integer*4 dimension(100) :: in
             integer*4 dimension(100) :: ica
@@ -5835,44 +5254,44 @@
             integer*4 dimension(100) :: ipsi
             logical dimension(800) :: fxvr
-            double precision :: eyel
-            double precision :: eyvw
-            double precision :: eyhb
-            double precision :: eyvr
-            double precision :: eysm
-            double precision :: eysl
-            double precision :: eyrg
-            double precision :: eyslh
-            double precision :: eyslp
-            double precision :: eyab
-            double precision :: eysmi
-            double precision :: eyhbi
-            double precision :: eyeli
-            double precision :: eyvwi
-            double precision dimension(800) :: gdeyvr
-            double precision dimension(800) :: gdeyrg
-            double precision dimension(800) :: gdeysl
-            double precision dimension(60) :: gdeygb
-            double precision :: wtey
-            double precision :: wtrg
-            integer dimension(800) :: iatvr
-            integer dimension(800) :: ityvr
-            integer dimension(800) :: iclvr
-            integer dimension(800) :: iorvr
-            integer dimension(800) :: imsvr1
-            integer dimension(800) :: imsvr2
-            integer dimension(2400) :: latms1
-            integer dimension(2400) :: latms2
-            integer dimension(800) :: iadvr1
-            integer dimension(800) :: iadvr2
-            integer dimension(800) :: ladvr
-            integer dimension(800) :: idvr
+            real*8 :: eyel
+            real*8 :: eyvw
+            real*8 :: eyhb
+            real*8 :: eyvr
+            real*8 :: eysm
+            real*8 :: eysl
+            real*8 :: eyrg
+            real*8 :: eyslh
+            real*8 :: eyslp
+            real*8 :: eyab
+            real*8 :: eysmi
+            real*8 :: eyhbi
+            real*8 :: eyeli
+            real*8 :: eyvwi
+            real*8 dimension(800) :: gdeyvr
+            real*8 dimension(800) :: gdeyrg
+            real*8 dimension(800) :: gdeysl
+            real*8 dimension(60) :: gdeygb
+            real*8 :: wtey
+            real*8 :: wtrg
+            integer*4 dimension(800) :: iatvr
+            integer*4 dimension(800) :: ityvr
+            integer*4 dimension(800) :: iclvr
+            integer*4 dimension(800) :: iorvr
+            integer*4 dimension(800) :: imsvr1
+            integer*4 dimension(800) :: imsvr2
+            integer*4 dimension(2400) :: latms1
+            integer*4 dimension(2400) :: latms2
+            integer*4 dimension(800) :: iadvr1
+            integer*4 dimension(800) :: iadvr2
+            integer*4 dimension(800) :: ladvr
+            integer*4 dimension(800) :: idvr
             integer :: enysolct
-            character dimension(800,3) :: nmvr
-            double precision :: boxsize
+            character dimension(3,800) :: nmvr
+            real*8 :: boxsize
             integer :: seed
             character*mxrs :: zimm
-            integer :: itysol
+            integer*4 :: itysol
             logical :: isolscl
-            double precision dimension(100) :: rsstrg
+            real*8 dimension(100) :: rsstrg
             character dimension(35,4) :: rsnmcd
             character dimension(35) :: onltcd
@@ -5880,31 +5299,31 @@
             integer :: upchswitch
             double precision :: bgsprob
-            integer dimension(10) :: nvwml
-            integer dimension(10) :: ivwml1
-            integer dimension(10) :: n14ml
-            integer dimension(10) :: i14ml1
-            integer dimension(2600) :: ivwat1
-            integer dimension(2600) :: ivwat2
-            integer dimension(2600) :: i14at1
-            integer dimension(2600) :: i14at2
-            integer dimension(10400) :: lvwat1
-            integer dimension(10400) :: lvwat2
-            integer dimension(10400) :: l14at
-            integer dimension(10400) :: ixatvw
-            integer dimension(10400) :: ixat14
-            double precision dimension(800) :: olvlvr
-            double precision dimension(800) :: vlvr
-            double precision dimension(800) :: axvr
-            double precision :: beta
-            double precision dimension(18,18) :: c_f
-            double precision dimension(18,18) :: a_f
-            double precision dimension(4,6) :: chb_f
-            double precision dimension(4,6) :: ahb_f
-            double precision dimension(19) :: e0to_f
-            double precision dimension(19) :: sgto_f
-            double precision dimension(19) :: rnto_f
-            double precision :: plt_f
-            double precision :: slp_f
-            double precision :: cohb_f
+            integer*4 dimension(10) :: nvwml
+            integer*4 dimension(10) :: ivwml1
+            integer*4 dimension(10) :: n14ml
+            integer*4 dimension(10) :: i14ml1
+            integer*4 dimension(2600) :: ivwat1
+            integer*4 dimension(2600) :: ivwat2
+            integer*4 dimension(2600) :: i14at1
+            integer*4 dimension(2600) :: i14at2
+            integer*4 dimension(10400) :: lvwat1
+            integer*4 dimension(10400) :: lvwat2
+            integer*4 dimension(10400) :: l14at
+            integer*4 dimension(10400) :: ixatvw
+            integer*4 dimension(10400) :: ixat14
+            real*8 dimension(800) :: olvlvr
+            real*8 dimension(800) :: vlvr
+            real*8 dimension(800) :: axvr
+            real*8 :: beta
+            real*8 dimension(18,18) :: c_f
+            real*8 dimension(18,18) :: a_f
+            real*8 dimension(4,6) :: chb_f
+            real*8 dimension(4,6) :: ahb_f
+            real*8 dimension(19) :: e0to_f
+            real*8 dimension(19) :: sgto_f
+            real*8 dimension(19) :: rnto_f
+            real*8 :: plt_f
+            real*8 :: slp_f
+            real*8 :: cohb_f
             common /v_sol/ vdvol,asa,asap,asah
             common /bgs_i/ bgsnvar,iph
@@ -5980,68 +5399,68 @@
                 real*8 intent(in) :: binwidth
                 logical intent(in) :: l_iter
-                double precision :: vdvol
-                double precision :: asa
-                double precision :: asap
-                double precision :: asah
-                integer dimension(2600) :: cgat
-                double precision dimension(2600) :: xbaat
-                double precision dimension(2600) :: ybaat
-                double precision dimension(2600) :: zbaat
-                double precision dimension(2600) :: baat
-                double precision dimension(2600) :: snbaat
-                double precision dimension(2600) :: csbaat
-                double precision dimension(2600) :: xtoat
-                double precision dimension(2600) :: ytoat
-                double precision dimension(2600) :: ztoat
-                double precision dimension(2600) :: toat
-                double precision dimension(2600) :: sntoat
-                double precision dimension(2600) :: cstoat
-                double precision dimension(2600) :: blat
-                double precision dimension(2602) :: xat
-                double precision dimension(2602) :: yat
-                double precision dimension(2602) :: zat
-                integer dimension(100,100) :: ijcont
-                integer dimension(100) :: ind_alf
+                real*8 :: vdvol
+                real*8 :: asa
+                real*8 :: asap
+                real*8 :: asah
+                real*8 dimension(2600) :: cgat
+                real*8 dimension(2600) :: xbaat
+                real*8 dimension(2600) :: ybaat
+                real*8 dimension(2600) :: zbaat
+                real*8 dimension(2600) :: baat
+                real*8 dimension(2600) :: snbaat
+                real*8 dimension(2600) :: csbaat
+                real*8 dimension(2600) :: xtoat
+                real*8 dimension(2600) :: ytoat
+                real*8 dimension(2600) :: ztoat
+                real*8 dimension(2600) :: toat
+                real*8 dimension(2600) :: sntoat
+                real*8 dimension(2600) :: cstoat
+                real*8 dimension(2600) :: blat
+                real*8 dimension(2602) :: xat
+                real*8 dimension(2602) :: yat
+                real*8 dimension(2602) :: zat
+                integer*4 dimension(100,100) :: ijcont
+                integer*4 dimension(100) :: ind_alf
                 logical dimension(18) :: do_s
                 logical dimension(18) :: ac_s
                 character dimension(500,4) :: nmrt
                 character dimension(1000,3) :: nmvrrt
-                integer :: nvr
-                double precision dimension(9,18) :: coef_sl
-                double precision dimension(9,18) :: rad_vdw
-                double precision dimension(100) :: surfres
-                integer :: ntyhb
-                integer dimension(100) :: ixtyhb
-                integer dimension(100) :: nutyhb
-                integer dimension(10,10) :: mmhb
-                character dimension(2600,4) :: nmat
-                integer :: lunlib
-                integer :: lunseq
-                integer :: lunchg
-                integer :: lunvar
-                integer :: lunrst
+                integer*4 :: nvr
+                real*8 dimension(9,18) :: coef_sl
+                real*8 dimension(9,18) :: rad_vdw
+                real*8 dimension(100) :: surfres
+                integer*4 :: ntyhb
+                integer*4 dimension(100) :: ixtyhb
+                integer*4 dimension(100) :: nutyhb
+                integer*4 dimension(10,10) :: mmhb
+                character dimension(4,2600) :: nmat
+                integer*4 :: lunlib
+                integer*4 :: lunseq
+                integer*4 :: lunchg
+                integer*4 :: lunvar
+                integer*4 :: lunrst
                 logical dimension(800) :: isrfvr
-                double precision dimension(500) :: pbrt
-                double precision dimension(1000) :: vuvrrt
-                double precision dimension(1000) :: dvvrrt
-                integer dimension(2600) :: ityat
-                integer dimension(2600) :: iowat
-                integer dimension(2600) :: iyowat
-                integer dimension(2600) :: nbdat
-                integer dimension(3,2600) :: ibdat
-                integer dimension(3,2600) :: iybdat
-                integer dimension(2600) :: ixmsat
-                double precision :: ehm
-                double precision dimension(18) :: atpl
-                double precision dimension(18) :: efel
-                double precision dimension(18) :: emin
-                double precision dimension(18) :: rmin
-                double precision dimension(4,6) :: chb_s
-                double precision dimension(4,6) :: ahb_s
-                double precision dimension(19) :: e0to_s
-                double precision dimension(19) :: sgto_s
-                double precision dimension(19) :: rnto_s
-                double precision :: eps_s
-                double precision dimension(2000,3) :: spoint
+                real*8 dimension(500) :: pbrt
+                real*8 dimension(1000) :: vuvrrt
+                real*8 dimension(1000) :: dvvrrt
+                integer*4 dimension(2600) :: ityat
+                integer*4 dimension(2600) :: iowat
+                integer*4 dimension(2600) :: iyowat
+                integer*4 dimension(2600) :: nbdat
+                integer*4 dimension(3,2600) :: ibdat
+                integer*4 dimension(3,2600) :: iybdat
+                integer*4 dimension(2600) :: ixmsat
+                real*8 :: ehm
+                real*8 dimension(18) :: atpl
+                real*8 dimension(18) :: efel
+                real*8 dimension(18) :: emin
+                real*8 dimension(18) :: rmin
+                real*8 dimension(4,6) :: chb_s
+                real*8 dimension(4,6) :: ahb_s
+                real*8 dimension(19) :: e0to_s
+                real*8 dimension(19) :: sgto_s
+                real*8 dimension(19) :: rnto_s
+                real*8 :: eps_s
+                real*8 dimension(2000,3) :: spoint
                 logical dimension(18) :: do_f
                 logical dimension(18) :: ac_f
@@ -6051,33 +5470,33 @@
                 character*80 :: varfil
                 character*80 :: rstfil
-                integer :: ntlml
-                integer dimension(10) :: irsml1
-                integer dimension(10) :: irsml2
-                integer dimension(10) :: ivrml1
-                integer dimension(10) :: nvrml
-                integer dimension(10) :: imsml1
-                integer dimension(10) :: nmsml
-                integer dimension(10) :: iadml1
-                integer dimension(10) :: nadml
-                integer dimension(3,10) :: ixrfpt
-                integer dimension(2600) :: ixatp
-                integer :: ireg
-                double precision dimension(100) :: blath
-                double precision dimension(100) :: baath
-                double precision dimension(100) :: toath
-                double precision dimension(100) :: cgath
-                integer dimension(100,100) :: iref
-                integer :: nci
+                integer*4 :: ntlml
+                integer*4 dimension(10) :: irsml1
+                integer*4 dimension(10) :: irsml2
+                integer*4 dimension(10) :: ivrml1
+                integer*4 dimension(10) :: nvrml
+                integer*4 dimension(10) :: imsml1
+                integer*4 dimension(10) :: nmsml
+                integer*4 dimension(10) :: iadml1
+                integer*4 dimension(10) :: nadml
+                integer*4 dimension(3,10) :: ixrfpt
+                integer*4 dimension(2600) :: ixatp
+                integer*4 :: ireg
+                real*8 dimension(100) :: blath
+                real*8 dimension(100) :: baath
+                real*8 dimension(100) :: toath
+                real*8 dimension(100) :: cgath
+                integer*4 dimension(100,100) :: iref
+                integer*4 :: nci
                 logical :: flex
                 logical :: tesgrd
                 logical :: sh2
                 logical :: epsd
-                integer :: ientyp
-                double precision :: rgyh
-                double precision :: rgyp
-                integer :: idloa
-                integer :: idloz
-                integer :: idupa
-                integer :: idupz
+                integer*4 :: ientyp
+                real*8 :: rgyh
+                real*8 :: rgyp
+                integer*4 :: idloa
+                integer*4 :: idloz
+                integer*4 :: idupa
+                integer*4 :: idupz
                 integer :: myrank
                 integer :: no
@@ -6086,94 +5505,94 @@
                 character dimension(100,4) :: nmath
                 character dimension(100,3) :: nmvrh
-                integer dimension(100) :: ityath
-                integer dimension(100) :: iowath
-                integer dimension(100) :: iyowath
-                integer dimension(100) :: nbdath
-                integer dimension(3,100) :: ibdath
-                integer dimension(3,100) :: iybdath
-                integer dimension(100) :: ityvrh
-                integer dimension(100) :: iclvrh
-                integer dimension(100) :: iatvrh
+                integer*4 dimension(100) :: ityath
+                integer*4 dimension(100) :: iowath
+                integer*4 dimension(100) :: iyowath
+                integer*4 dimension(100) :: nbdath
+                integer*4 dimension(3,100) :: ibdath
+                integer*4 dimension(3,100) :: iybdath
+                integer*4 dimension(100) :: ityvrh
+                integer*4 dimension(100) :: iclvrh
+                integer*4 dimension(100) :: iatvrh
                 character dimension(100,4) :: seq
-                double precision dimension(2600) :: rvdw
-                double precision dimension(2600) :: sigma
-                double precision dimension(2600,3) :: gradan
-                integer dimension(18,18) :: ihbty
-                integer :: npnt
+                real*8 dimension(2600) :: rvdw
+                real*8 dimension(2600) :: sigma
+                real*8 dimension(2600,3) :: gradan
+                integer*4 dimension(18,18) :: ihbty
+                integer*4 :: npnt
                 character dimension(10,80) :: nmml
-                double precision dimension(18,18) :: cij
-                double precision dimension(18,18) :: aij
-                double precision dimension(18,18) :: a14
-                double precision dimension(18,18) :: chb
-                double precision dimension(18,18) :: ahb
-                double precision dimension(19) :: e0to
-                double precision dimension(19) :: sgto
-                double precision dimension(19) :: rnto
-                double precision dimension(19) :: esnto
-                double precision :: conv
-                double precision :: plt
-                double precision :: slp
-                double precision :: cohb
-                integer dimension(100) :: iatrs1
-                integer dimension(100) :: iatrs2
-                integer dimension(100) :: ixatrs
-                integer dimension(100) :: ivrrs1
-                integer dimension(100) :: nvrrs
-                integer :: ntlrt
-                integer :: ntlsu
-                integer dimension(500) :: i1vrrt
-                integer dimension(500) :: i2vrrt
-                integer dimension(4800) :: iprtsu
-                integer dimension(800) :: i1rtsu
-                integer dimension(800) :: nrtsu
-                integer dimension(800) :: i1vrsu
-                integer dimension(800) :: i2vrsu
-                integer dimension(800) :: ipvrsu
-                double precision dimension(3,10) :: rfpt
-                double precision dimension(6,10) :: gbpr
-                double precision dimension(3,10) :: xrfax
-                double precision dimension(3,10) :: yrfax
-                double precision dimension(3,10) :: zrfax
+                real*8 dimension(18,18) :: cij
+                real*8 dimension(18,18) :: aij
+                real*8 dimension(18,18) :: a14
+                real*8 dimension(18,18) :: chb
+                real*8 dimension(18,18) :: ahb
+                real*8 dimension(19) :: e0to
+                real*8 dimension(19) :: sgto
+                real*8 dimension(19) :: rnto
+                real*8 dimension(19) :: esnto
+                real*8 :: conv
+                real*8 :: plt
+                real*8 :: slp
+                real*8 :: cohb
+                integer*4 dimension(100) :: iatrs1
+                integer*4 dimension(100) :: iatrs2
+                integer*4 dimension(100) :: ixatrs
+                integer*4 dimension(100) :: ivrrs1
+                integer*4 dimension(100) :: nvrrs
+                integer*4 :: ntlrt
+                integer*4 :: ntlsu
+                integer*4 dimension(500) :: i1vrrt
+                integer*4 dimension(500) :: i2vrrt
+                integer*4 dimension(4800) :: iprtsu
+                integer*4 dimension(800) :: i1rtsu
+                integer*4 dimension(800) :: nrtsu
+                integer*4 dimension(800) :: i1vrsu
+                integer*4 dimension(800) :: i2vrsu
+                integer*4 dimension(800) :: ipvrsu
+                real*8 dimension(3,10) :: rfpt
+                real*8 dimension(6,10) :: gbpr
+                real*8 dimension(3,10) :: xrfax
+                real*8 dimension(3,10) :: yrfax
+                real*8 dimension(3,10) :: zrfax
                 logical dimension(800) :: fxvr
-                double precision :: eyel
-                double precision :: eyvw
-                double precision :: eyhb
-                double precision :: eyvr
-                double precision :: eysm
-                double precision :: eysl
-                double precision :: eyrg
-                double precision :: eyslh
-                double precision :: eyslp
-                double precision :: eyab
-                double precision :: eysmi
-                double precision :: eyhbi
-                double precision :: eyeli
-                double precision :: eyvwi
-                double precision dimension(800) :: gdeyvr
-                double precision dimension(800) :: gdeyrg
-                double precision dimension(800) :: gdeysl
-                double precision dimension(60) :: gdeygb
-                double precision :: wtey
-                double precision :: wtrg
-                integer dimension(800) :: iatvr
-                integer dimension(800) :: ityvr
-                integer dimension(800) :: iclvr
-                integer dimension(800) :: iorvr
-                integer dimension(800) :: imsvr1
-                integer dimension(800) :: imsvr2
-                integer dimension(2400) :: latms1
-                integer dimension(2400) :: latms2
-                integer dimension(800) :: iadvr1
-                integer dimension(800) :: iadvr2
-                integer dimension(800) :: ladvr
-                integer dimension(800) :: idvr
+                real*8 :: eyel
+                real*8 :: eyvw
+                real*8 :: eyhb
+                real*8 :: eyvr
+                real*8 :: eysm
+                real*8 :: eysl
+                real*8 :: eyrg
+                real*8 :: eyslh
+                real*8 :: eyslp
+                real*8 :: eyab
+                real*8 :: eysmi
+                real*8 :: eyhbi
+                real*8 :: eyeli
+                real*8 :: eyvwi
+                real*8 dimension(800) :: gdeyvr
+                real*8 dimension(800) :: gdeyrg
+                real*8 dimension(800) :: gdeysl
+                real*8 dimension(60) :: gdeygb
+                real*8 :: wtey
+                real*8 :: wtrg
+                integer*4 dimension(800) :: iatvr
+                integer*4 dimension(800) :: ityvr
+                integer*4 dimension(800) :: iclvr
+                integer*4 dimension(800) :: iorvr
+                integer*4 dimension(800) :: imsvr1
+                integer*4 dimension(800) :: imsvr2
+                integer*4 dimension(2400) :: latms1
+                integer*4 dimension(2400) :: latms2
+                integer*4 dimension(800) :: iadvr1
+                integer*4 dimension(800) :: iadvr2
+                integer*4 dimension(800) :: ladvr
+                integer*4 dimension(800) :: idvr
                 integer :: enysolct
-                character dimension(800,3) :: nmvr
-                double precision :: boxsize
+                character dimension(3,800) :: nmvr
+                real*8 :: boxsize
                 integer :: seed
                 character*mxrs :: zimm
-                integer :: itysol
+                integer*4 :: itysol
                 logical :: isolscl
-                double precision dimension(100) :: rsstrg
+                real*8 dimension(100) :: rsstrg
                 character dimension(35,4) :: rsnmcd
                 character dimension(35) :: onltcd
@@ -6181,31 +5600,31 @@
                 integer :: upchswitch
                 double precision :: bgsprob
-                integer dimension(10) :: nvwml
-                integer dimension(10) :: ivwml1
-                integer dimension(10) :: n14ml
-                integer dimension(10) :: i14ml1
-                integer dimension(2600) :: ivwat1
-                integer dimension(2600) :: ivwat2
-                integer dimension(2600) :: i14at1
-                integer dimension(2600) :: i14at2
-                integer dimension(10400) :: lvwat1
-                integer dimension(10400) :: lvwat2
-                integer dimension(10400) :: l14at
-                integer dimension(10400) :: ixatvw
-                integer dimension(10400) :: ixat14
-                double precision dimension(800) :: olvlvr
-                double precision dimension(800) :: vlvr
-                double precision dimension(800) :: axvr
-                double precision :: beta
-                double precision dimension(18,18) :: c_f
-                double precision dimension(18,18) :: a_f
-                double precision dimension(4,6) :: chb_f
-                double precision dimension(4,6) :: ahb_f
-                double precision dimension(19) :: e0to_f
-                double precision dimension(19) :: sgto_f
-                double precision dimension(19) :: rnto_f
-                double precision :: plt_f
-                double precision :: slp_f
-                double precision :: cohb_f
+                integer*4 dimension(10) :: nvwml
+                integer*4 dimension(10) :: ivwml1
+                integer*4 dimension(10) :: n14ml
+                integer*4 dimension(10) :: i14ml1
+                integer*4 dimension(2600) :: ivwat1
+                integer*4 dimension(2600) :: ivwat2
+                integer*4 dimension(2600) :: i14at1
+                integer*4 dimension(2600) :: i14at2
+                integer*4 dimension(10400) :: lvwat1
+                integer*4 dimension(10400) :: lvwat2
+                integer*4 dimension(10400) :: l14at
+                integer*4 dimension(10400) :: ixatvw
+                integer*4 dimension(10400) :: ixat14
+                real*8 dimension(800) :: olvlvr
+                real*8 dimension(800) :: vlvr
+                real*8 dimension(800) :: axvr
+                real*8 :: beta
+                real*8 dimension(18,18) :: c_f
+                real*8 dimension(18,18) :: a_f
+                real*8 dimension(4,6) :: chb_f
+                real*8 dimension(4,6) :: ahb_f
+                real*8 dimension(19) :: e0to_f
+                real*8 dimension(19) :: sgto_f
+                real*8 dimension(19) :: rnto_f
+                real*8 :: plt_f
+                real*8 :: slp_f
+                real*8 :: cohb_f
                 common /v_sol/ vdvol,asa,asap,asah
                 common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -6271,68 +5690,68 @@
                 real*8 intent(in) :: binwidth
                 logical intent(in) :: restart
-                double precision :: vdvol
-                double precision :: asa
-                double precision :: asap
-                double precision :: asah
-                integer dimension(2600) :: cgat
-                double precision dimension(2600) :: xbaat
-                double precision dimension(2600) :: ybaat
-                double precision dimension(2600) :: zbaat
-                double precision dimension(2600) :: baat
-                double precision dimension(2600) :: snbaat
-                double precision dimension(2600) :: csbaat
-                double precision dimension(2600) :: xtoat
-                double precision dimension(2600) :: ytoat
-                double precision dimension(2600) :: ztoat
-                double precision dimension(2600) :: toat
-                double precision dimension(2600) :: sntoat
-                double precision dimension(2600) :: cstoat
-                double precision dimension(2600) :: blat
-                double precision dimension(2602) :: xat
-                double precision dimension(2602) :: yat
-                double precision dimension(2602) :: zat
-                integer dimension(100,100) :: ijcont
-                integer dimension(100) :: ind_alf
+                real*8 :: vdvol
+                real*8 :: asa
+                real*8 :: asap
+                real*8 :: asah
+                real*8 dimension(2600) :: cgat
+                real*8 dimension(2600) :: xbaat
+                real*8 dimension(2600) :: ybaat
+                real*8 dimension(2600) :: zbaat
+                real*8 dimension(2600) :: baat
+                real*8 dimension(2600) :: snbaat
+                real*8 dimension(2600) :: csbaat
+                real*8 dimension(2600) :: xtoat
+                real*8 dimension(2600) :: ytoat
+                real*8 dimension(2600) :: ztoat
+                real*8 dimension(2600) :: toat
+                real*8 dimension(2600) :: sntoat
+                real*8 dimension(2600) :: cstoat
+                real*8 dimension(2600) :: blat
+                real*8 dimension(2602) :: xat
+                real*8 dimension(2602) :: yat
+                real*8 dimension(2602) :: zat
+                integer*4 dimension(100,100) :: ijcont
+                integer*4 dimension(100) :: ind_alf
                 logical dimension(18) :: do_s
                 logical dimension(18) :: ac_s
                 character dimension(500,4) :: nmrt
                 character dimension(1000,3) :: nmvrrt
-                integer :: nvr
-                double precision dimension(9,18) :: coef_sl
-                double precision dimension(9,18) :: rad_vdw
-                double precision dimension(100) :: surfres
-                integer :: ntyhb
-                integer dimension(100) :: ixtyhb
-                integer dimension(100) :: nutyhb
-                integer dimension(10,10) :: mmhb
-                character dimension(2600,4) :: nmat
-                integer :: lunlib
-                integer :: lunseq
-                integer :: lunchg
-                integer :: lunvar
-                integer :: lunrst
+                integer*4 :: nvr
+                real*8 dimension(9,18) :: coef_sl
+                real*8 dimension(9,18) :: rad_vdw
+                real*8 dimension(100) :: surfres
+                integer*4 :: ntyhb
+                integer*4 dimension(100) :: ixtyhb
+                integer*4 dimension(100) :: nutyhb
+                integer*4 dimension(10,10) :: mmhb
+                character dimension(4,2600) :: nmat
+                integer*4 :: lunlib
+                integer*4 :: lunseq
+                integer*4 :: lunchg
+                integer*4 :: lunvar
+                integer*4 :: lunrst
                 logical dimension(800) :: isrfvr
-                double precision dimension(500) :: pbrt
-                double precision dimension(1000) :: vuvrrt
-                double precision dimension(1000) :: dvvrrt
-                integer dimension(2600) :: ityat
-                integer dimension(2600) :: iowat
-                integer dimension(2600) :: iyowat
-                integer dimension(2600) :: nbdat
-                integer dimension(3,2600) :: ibdat
-                integer dimension(3,2600) :: iybdat
-                integer dimension(2600) :: ixmsat
-                double precision :: ehm
-                double precision dimension(18) :: atpl
-                double precision dimension(18) :: efel
-                double precision dimension(18) :: emin
-                double precision dimension(18) :: rmin
-                double precision dimension(4,6) :: chb_s
-                double precision dimension(4,6) :: ahb_s
-                double precision dimension(19) :: e0to_s
-                double precision dimension(19) :: sgto_s
-                double precision dimension(19) :: rnto_s
-                double precision :: eps_s
-                double precision dimension(2000,3) :: spoint
+                real*8 dimension(500) :: pbrt
+                real*8 dimension(1000) :: vuvrrt
+                real*8 dimension(1000) :: dvvrrt
+                integer*4 dimension(2600) :: ityat
+                integer*4 dimension(2600) :: iowat
+                integer*4 dimension(2600) :: iyowat
+                integer*4 dimension(2600) :: nbdat
+                integer*4 dimension(3,2600) :: ibdat
+                integer*4 dimension(3,2600) :: iybdat
+                integer*4 dimension(2600) :: ixmsat
+                real*8 :: ehm
+                real*8 dimension(18) :: atpl
+                real*8 dimension(18) :: efel
+                real*8 dimension(18) :: emin
+                real*8 dimension(18) :: rmin
+                real*8 dimension(4,6) :: chb_s
+                real*8 dimension(4,6) :: ahb_s
+                real*8 dimension(19) :: e0to_s
+                real*8 dimension(19) :: sgto_s
+                real*8 dimension(19) :: rnto_s
+                real*8 :: eps_s
+                real*8 dimension(2000,3) :: spoint
                 logical dimension(18) :: do_f
                 logical dimension(18) :: ac_f
@@ -6342,33 +5761,33 @@
                 character*80 :: varfil
                 character*80 :: rstfil
-                integer :: ntlml
-                integer dimension(10) :: irsml1
-                integer dimension(10) :: irsml2
-                integer dimension(10) :: ivrml1
-                integer dimension(10) :: nvrml
-                integer dimension(10) :: imsml1
-                integer dimension(10) :: nmsml
-                integer dimension(10) :: iadml1
-                integer dimension(10) :: nadml
-                integer dimension(3,10) :: ixrfpt
-                integer dimension(2600) :: ixatp
-                integer :: ireg
-                double precision dimension(100) :: blath
-                double precision dimension(100) :: baath
-                double precision dimension(100) :: toath
-                double precision dimension(100) :: cgath
-                integer dimension(100,100) :: iref
-                integer :: nci
+                integer*4 :: ntlml
+                integer*4 dimension(10) :: irsml1
+                integer*4 dimension(10) :: irsml2
+                integer*4 dimension(10) :: ivrml1
+                integer*4 dimension(10) :: nvrml
+                integer*4 dimension(10) :: imsml1
+                integer*4 dimension(10) :: nmsml
+                integer*4 dimension(10) :: iadml1
+                integer*4 dimension(10) :: nadml
+                integer*4 dimension(3,10) :: ixrfpt
+                integer*4 dimension(2600) :: ixatp
+                integer*4 :: ireg
+                real*8 dimension(100) :: blath
+                real*8 dimension(100) :: baath
+                real*8 dimension(100) :: toath
+                real*8 dimension(100) :: cgath
+                integer*4 dimension(100,100) :: iref
+                integer*4 :: nci
                 logical :: flex
                 logical :: tesgrd
                 logical :: sh2
                 logical :: epsd
-                integer :: ientyp
-                double precision :: rgyh
-                double precision :: rgyp
-                integer :: idloa
-                integer :: idloz
-                integer :: idupa
-                integer :: idupz
+                integer*4 :: ientyp
+                real*8 :: rgyh
+                real*8 :: rgyp
+                integer*4 :: idloa
+                integer*4 :: idloz
+                integer*4 :: idupa
+                integer*4 :: idupz
                 integer :: myrank
                 integer :: no
@@ -6377,94 +5796,94 @@
                 character dimension(100,4) :: nmath
                 character dimension(100,3) :: nmvrh
-                integer dimension(100) :: ityath
-                integer dimension(100) :: iowath
-                integer dimension(100) :: iyowath
-                integer dimension(100) :: nbdath
-                integer dimension(3,100) :: ibdath
-                integer dimension(3,100) :: iybdath
-                integer dimension(100) :: ityvrh
-                integer dimension(100) :: iclvrh
-                integer dimension(100) :: iatvrh
+                integer*4 dimension(100) :: ityath
+                integer*4 dimension(100) :: iowath
+                integer*4 dimension(100) :: iyowath
+                integer*4 dimension(100) :: nbdath
+                integer*4 dimension(3,100) :: ibdath
+                integer*4 dimension(3,100) :: iybdath
+                integer*4 dimension(100) :: ityvrh
+                integer*4 dimension(100) :: iclvrh
+                integer*4 dimension(100) :: iatvrh
                 character dimension(100,4) :: seq
-                double precision dimension(2600) :: rvdw
-                double precision dimension(2600) :: sigma
-                double precision dimension(2600,3) :: gradan
-                integer dimension(18,18) :: ihbty
-                integer :: npnt
+                real*8 dimension(2600) :: rvdw
+                real*8 dimension(2600) :: sigma
+                real*8 dimension(2600,3) :: gradan
+                integer*4 dimension(18,18) :: ihbty
+                integer*4 :: npnt
                 character dimension(10,80) :: nmml
-                double precision dimension(18,18) :: cij
-                double precision dimension(18,18) :: aij
-                double precision dimension(18,18) :: a14
-                double precision dimension(18,18) :: chb
-                double precision dimension(18,18) :: ahb
-                double precision dimension(19) :: e0to
-                double precision dimension(19) :: sgto
-                double precision dimension(19) :: rnto
-                double precision dimension(19) :: esnto
-                double precision :: conv
-                double precision :: plt
-                double precision :: slp
-                double precision :: cohb
-                integer dimension(100) :: iatrs1
-                integer dimension(100) :: iatrs2
-                integer dimension(100) :: ixatrs
-                integer dimension(100) :: ivrrs1
-                integer dimension(100) :: nvrrs
-                integer :: ntlrt
-                integer :: ntlsu
-                integer dimension(500) :: i1vrrt
-                integer dimension(500) :: i2vrrt
-                integer dimension(4800) :: iprtsu
-                integer dimension(800) :: i1rtsu
-                integer dimension(800) :: nrtsu
-                integer dimension(800) :: i1vrsu
-                integer dimension(800) :: i2vrsu
-                integer dimension(800) :: ipvrsu
-                double precision dimension(3,10) :: rfpt
-                double precision dimension(6,10) :: gbpr
-                double precision dimension(3,10) :: xrfax
-                double precision dimension(3,10) :: yrfax
-                double precision dimension(3,10) :: zrfax
+                real*8 dimension(18,18) :: cij
+                real*8 dimension(18,18) :: aij
+                real*8 dimension(18,18) :: a14
+                real*8 dimension(18,18) :: chb
+                real*8 dimension(18,18) :: ahb
+                real*8 dimension(19) :: e0to
+                real*8 dimension(19) :: sgto
+                real*8 dimension(19) :: rnto
+                real*8 dimension(19) :: esnto
+                real*8 :: conv
+                real*8 :: plt
+                real*8 :: slp
+                real*8 :: cohb
+                integer*4 dimension(100) :: iatrs1
+                integer*4 dimension(100) :: iatrs2
+                integer*4 dimension(100) :: ixatrs
+                integer*4 dimension(100) :: ivrrs1
+                integer*4 dimension(100) :: nvrrs
+                integer*4 :: ntlrt
+                integer*4 :: ntlsu
+                integer*4 dimension(500) :: i1vrrt
+                integer*4 dimension(500) :: i2vrrt
+                integer*4 dimension(4800) :: iprtsu
+                integer*4 dimension(800) :: i1rtsu
+                integer*4 dimension(800) :: nrtsu
+                integer*4 dimension(800) :: i1vrsu
+                integer*4 dimension(800) :: i2vrsu
+                integer*4 dimension(800) :: ipvrsu
+                real*8 dimension(3,10) :: rfpt
+                real*8 dimension(6,10) :: gbpr
+                real*8 dimension(3,10) :: xrfax
+                real*8 dimension(3,10) :: yrfax
+                real*8 dimension(3,10) :: zrfax
                 logical dimension(800) :: fxvr
-                double precision :: eyel
-                double precision :: eyvw
-                double precision :: eyhb
-                double precision :: eyvr
-                double precision :: eysm
-                double precision :: eysl
-                double precision :: eyrg
-                double precision :: eyslh
-                double precision :: eyslp
-                double precision :: eyab
-                double precision :: eysmi
-                double precision :: eyhbi
-                double precision :: eyeli
-                double precision :: eyvwi
-                double precision dimension(800) :: gdeyvr
-                double precision dimension(800) :: gdeyrg
-                double precision dimension(800) :: gdeysl
-                double precision dimension(60) :: gdeygb
-                double precision :: wtey
-                double precision :: wtrg
-                integer dimension(800) :: iatvr
-                integer dimension(800) :: ityvr
-                integer dimension(800) :: iclvr
-                integer dimension(800) :: iorvr
-                integer dimension(800) :: imsvr1
-                integer dimension(800) :: imsvr2
-                integer dimension(2400) :: latms1
-                integer dimension(2400) :: latms2
-                integer dimension(800) :: iadvr1
-                integer dimension(800) :: iadvr2
-                integer dimension(800) :: ladvr
-                integer dimension(800) :: idvr
+                real*8 :: eyel
+                real*8 :: eyvw
+                real*8 :: eyhb
+                real*8 :: eyvr
+                real*8 :: eysm
+                real*8 :: eysl
+                real*8 :: eyrg
+                real*8 :: eyslh
+                real*8 :: eyslp
+                real*8 :: eyab
+                real*8 :: eysmi
+                real*8 :: eyhbi
+                real*8 :: eyeli
+                real*8 :: eyvwi
+                real*8 dimension(800) :: gdeyvr
+                real*8 dimension(800) :: gdeyrg
+                real*8 dimension(800) :: gdeysl
+                real*8 dimension(60) :: gdeygb
+                real*8 :: wtey
+                real*8 :: wtrg
+                integer*4 dimension(800) :: iatvr
+                integer*4 dimension(800) :: ityvr
+                integer*4 dimension(800) :: iclvr
+                integer*4 dimension(800) :: iorvr
+                integer*4 dimension(800) :: imsvr1
+                integer*4 dimension(800) :: imsvr2
+                integer*4 dimension(2400) :: latms1
+                integer*4 dimension(2400) :: latms2
+                integer*4 dimension(800) :: iadvr1
+                integer*4 dimension(800) :: iadvr2
+                integer*4 dimension(800) :: ladvr
+                integer*4 dimension(800) :: idvr
                 integer :: enysolct
-                character dimension(800,3) :: nmvr
-                double precision :: boxsize
+                character dimension(3,800) :: nmvr
+                real*8 :: boxsize
                 integer :: seed
                 character*mxrs :: zimm
-                integer :: itysol
+                integer*4 :: itysol
                 logical :: isolscl
-                double precision dimension(100) :: rsstrg
+                real*8 dimension(100) :: rsstrg
                 character dimension(35,4) :: rsnmcd
                 character dimension(35) :: onltcd
@@ -6472,31 +5891,31 @@
                 integer :: upchswitch
                 double precision :: bgsprob
-                integer dimension(10) :: nvwml
-                integer dimension(10) :: ivwml1
-                integer dimension(10) :: n14ml
-                integer dimension(10) :: i14ml1
-                integer dimension(2600) :: ivwat1
-                integer dimension(2600) :: ivwat2
-                integer dimension(2600) :: i14at1
-                integer dimension(2600) :: i14at2
-                integer dimension(10400) :: lvwat1
-                integer dimension(10400) :: lvwat2
-                integer dimension(10400) :: l14at
-                integer dimension(10400) :: ixatvw
-                integer dimension(10400) :: ixat14
-                double precision dimension(800) :: olvlvr
-                double precision dimension(800) :: vlvr
-                double precision dimension(800) :: axvr
-                double precision :: beta
-                double precision dimension(18,18) :: c_f
-                double precision dimension(18,18) :: a_f
-                double precision dimension(4,6) :: chb_f
-                double precision dimension(4,6) :: ahb_f
-                double precision dimension(19) :: e0to_f
-                double precision dimension(19) :: sgto_f
-                double precision dimension(19) :: rnto_f
-                double precision :: plt_f
-                double precision :: slp_f
-                double precision :: cohb_f
+                integer*4 dimension(10) :: nvwml
+                integer*4 dimension(10) :: ivwml1
+                integer*4 dimension(10) :: n14ml
+                integer*4 dimension(10) :: i14ml1
+                integer*4 dimension(2600) :: ivwat1
+                integer*4 dimension(2600) :: ivwat2
+                integer*4 dimension(2600) :: i14at1
+                integer*4 dimension(2600) :: i14at2
+                integer*4 dimension(10400) :: lvwat1
+                integer*4 dimension(10400) :: lvwat2
+                integer*4 dimension(10400) :: l14at
+                integer*4 dimension(10400) :: ixatvw
+                integer*4 dimension(10400) :: ixat14
+                real*8 dimension(800) :: olvlvr
+                real*8 dimension(800) :: vlvr
+                real*8 dimension(800) :: axvr
+                real*8 :: beta
+                real*8 dimension(18,18) :: c_f
+                real*8 dimension(18,18) :: a_f
+                real*8 dimension(4,6) :: chb_f
+                real*8 dimension(4,6) :: ahb_f
+                real*8 dimension(19) :: e0to_f
+                real*8 dimension(19) :: sgto_f
+                real*8 dimension(19) :: rnto_f
+                real*8 :: plt_f
+                real*8 :: slp_f
+                real*8 :: cohb_f
                 common /v_sol/ vdvol,asa,asap,asah
                 common /atm_r/ cgat,xbaat,ybaat,zbaat,baat,snbaat,csbaat,xtoat,ytoat,ztoat,toat,sntoat,cstoat,blat,xat,yat,zat
@@ -6557,4 +5976,4 @@
 end python module smmp
 
-! This file was auto-generated with f2py (version:2_5585).
+! This file was auto-generated with f2py (version:2_3816).
 ! See http://cens.ioc.ee/projects/f2py2e/
Index: mer.F90
===================================================================
--- timer.F90	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ 	(revision )
@@ -1,143 +1,0 @@
-! timer.f90
-!
-! (c)2007 Jan H. Meinke
-!
-#ifdef BGL
-module rts
-! interface definition of rts_get_timebase, Fortran2003, available in XLF Version 9
-  interface
-    function rts_get_timebase() bind(c)
-      use, intrinsic       :: iso_c_binding
-      integer(c_long_long) :: rts_get_timebase
-    end function rts_get_timebase
-  end interface
-end module rts
-#endif
-
-!! This module contains a minimal set of routines to time sections of code.
-!  It can keep track of several timers at once. Each timer is associated with
-!  an integer ID. Individual timing events are not stored.
-!  
-!  Currently only timerIDs between 1 and 10 are valid.
-module timer
-#ifdef BGL
-    use rts
-    use, intrinsic :: iso_c_binding
-#endif
-    implicit none
-    
-    !! Contains the minimum time ever measured, the maximum time ever measured,
-    !  the average time, the standard deviation, and the number of measurements.
-    type TimingStructure
-        integer :: counter
-#ifdef BGL
-        integer(c_long_long) :: t0, t1
-#else
-        real(kind=8) :: t0, t1
-#endif
-        real(kind=8) :: minTime, maxTime
-        real(kind=8) :: sumOfTimes, sumOfSquares
-        real(kind=8) :: average, sigma
-    end type TimingStructure
-            
-    !! Contains the timing data for all timers.
-    type(TimingStructure), allocatable :: timingData(:)
-            
-    integer :: initialTimerCount = 10
-#ifdef BGL
-    real(kind=8) :: clockspeed = 700.0d6
-#endif
-            
-    contains    
-        !! Initializes timer
-        !  This routine must be called before starting any timer.
-        !  
-        !  @author Jan H. Meinke
-        subroutine init_timer()
-            integer :: i
-            
-            ! Initialize timers
-            allocate (timingData(initialTimerCount))
-!            forall(i = 1:initialTimerCount)
-            do i = 1, initialTimerCount
-                timingData(i) = TimingStructure(0, -1.0, -1.0, -1.0, -1.0, 0.0, &
-                        0.0, -1.0, -1.0)
-!            end forall
-            end do
-        end subroutine init_timer
-    
-        !! Start a new measurement. 
-        !
-        !  @param id ID of the timer
-        !
-        !  @author Jan H. Meinke
-        subroutine start_timer(id)
-            integer, intent(in) :: id
-            timingData(id)%t0 = getCurrentTime()
-        end subroutine start_timer
-                
-        !! Take a measurement and stop the timer with ID id
-        !
-        !  @param id ID of the timer
-        !
-        !  @author Jan H. Meinke
-        subroutine stop_timer(id)
-            integer, intent(in) :: id
-            real(kind=8) :: dt
-                    
-            timingData(id)%t1 = getCurrentTime()
-#ifdef BGL
-            dt = (timingData(id)%t1 - timingData(id)%t0) / clockspeed
-#else 
-            dt = (timingData(id)%t1 - timingData(id)%t0)
-#endif
-            timingData(id)%counter = timingData(id)%counter + 1
-            timingData(id)%maxTime = max(dt, timingData(id)%maxTime)
-            if (timingData(id)%minTime > 0) then
-                timingData(id)%minTime = min(dt, timingData(id)%minTime)
-            else 
-                timingData(id)%minTime = dt
-            end if
-            timingData(id)%sumOfTimes = timingData(id)%sumOfTimes + dt
-            timingData(id)%sumOfSquares = timingData(id)%sumOfSquares + dt ** 2
-                    
-        end subroutine stop_timer
-              
-        subroutine evaluate(id)
-            integer, intent(in) :: id
-            if (timingData(id)%counter > 0) then
-                timingData(id)%average = timingData(id)%sumOfTimes / timingData(id)%counter
-            end if
-            if (timingData(id)%counter > 1) then
-!                write (*,*) timingData(id)%average, timingData(id)%sumOfSquares,&
-!                        timingData(id)%counter
-                timingData(id)%sigma = sqrt((abs(timingData(id)%average ** 2 &
-                        - timingData(id)%sumOfSquares / timingData(id)%counter)) &
-                        / (timingData(id)%counter - 1))
-            end if
-        end subroutine evaluate
-        
-        !! Wrapper around the timing function used.
-        !  If we are using MPI, we can use MPI_WTime, otherwise we use cpu_time(time)
-#ifdef BGL
-        integer(c_long_long) function getCurrentTime()
-            integer(c_long_long) :: time
-            time = rts_get_timebase()
-            getCurrentTime = time
-        end function getCurrentTime
-#elif MPI
-        real(kind=8) function getCurrentTime()
-            real(kind=8) :: time
-            include 'mpif.h'
-            time = MPI_Wtime()
-            getCurrentTime = time
-        end function getCurrentTime
-#else
-        real(kind=8) function getCurrentTime()
-            real(kind=8) :: time
-            call cpu_time(time)
-            getCurrentTime = time
-        end function getCurrentTime
-#endif 
-        
-end module timer
Index: twister.f
===================================================================
--- twister.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ twister.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -47,5 +47,5 @@
 * May 03, 2000
 *
-* compile with: f90 -i32 -dp -o mt19937 mt19937.f
+* compile with: f90 -i32 -dp -o mt19937 mt19937.f 
 * Changes:
 *    Do not use UMASK as parameter due to restrictions of CF90
@@ -55,5 +55,5 @@
 *
 *    Now the T3E produces the same random number as a RS6000 running AIX
-*
+*      
 * from other programs sgrnd() must be called with integer*4
 *
@@ -64,9 +64,5 @@
       subroutine sgrnd(seed)
 *
-      integer seed, tmaskb, tmaskc, tshftu, tshfts, tshftt
-      integer tshftl, y
-
-      integer N, N1, mti, mt, m, mata, lmask, mag01
-      integer kk
+      implicit integer(a-z)
 *
 * Period parameters
@@ -92,5 +88,4 @@
 
       block data twbloks
-      integer n,n1,mt,mti
       parameter(N     =  624)
       parameter(N1    =  N+1)
@@ -104,8 +99,5 @@
       double precision function grnd()
 *
-      integer tmaskb, tmaskc, tshftu, tshfts, tshftt, tshftl, y
-
-      integer n, n1, mti, mt, m, mata, lmask, mag01, kk
-
+      implicit integer(a-z)
 *
 * Period parameters
Index: universe.py
===================================================================
--- universe.py	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
+++ universe.py	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -0,0 +1,113 @@
+# universe.py
+#
+# Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
+#                      Jan H. Meinke, Sandipan Mohanty
+#
+import smmp
+from math import *
+
+class Universe:
+    """Describes the environment of the simulation. Including the temperature,
+    the solvent, and the force field. This class keeps track of all the 
+    molecules.
+    """
+    
+    def __init__(self, T = 300, ff = 'ecepp3', st = 1, libdir = 'SMMP/'):
+        self.setTemperature(T)
+        if ff == 'ecepp3':
+            smmp.epar_l.flex = 0
+            smmp.epar_l.sh2 = 0
+            smmp.epar_l.epsd = 0
+            smmp.epar_l.ientyp=0
+        elif ff == 'ecepp2':
+            smmp.epar_l.flex = 0
+            smmp.epar_l.sh2 = 1
+            smmp.epar_l.epsd = 0
+            smmp.epar_l.ientyp=0
+        elif ff == 'flex':
+            smmp.epar_l.flex = 1
+            smmp.epar_l.sh2 = 0
+            smmp.epar_l.epsd = 0
+            smmp.epar_l.ientyp=0
+        smmp.epar_l.tesgrd = 0
+        smmp.isolty.itysol = st
+        smmp.init_energy(libdir)
+        self.__objects = []
+        self.__boxSize = 10
+        smmp.updchois.upchswitch = 0
+        smmp.updchois.rndord = 0
+        smmp.updchois.bgsprob = 0
+        
+    def add(self, m):
+        self.__objects.append(m)
+        
+    def energy(self):
+        """Return the total energy of this universe."""
+        return smmp.energy()
+    
+    def rgyr(self):
+        """Radius of gyration of the entire system."""
+        return smmp.rgyr(0)[0]
+        
+    def endToEnd(self):
+        return smmp.rgyr(0)[1]
+        
+    def hbond(self):
+        """Returns the total number of hydrogen bonds in the system"""
+        mhb = 0
+        for i in self.__objects:
+            mhb = mhb + i.hbond()
+        mhb = mhb + smmp.interhbond()
+        return mhb
+    
+    def helix(self):
+        return smmp.helix()
+    
+    def sheet(self):
+        """Checks if we have any parallel or antiparallel beta-sheets in the
+        system.
+        """
+        minStrandContent = 2
+        minHydrogenBonds = 3
+        res = []
+        for i in range(0, len(self.__objects)):
+            if self.__objects[i].strand() >= minStrandContent:
+                for j in range(i, len(self.__objects)):
+                    if smmp.h_bond.mmhb[self.__objects[i].id()][self.__objects[j].id()] >= minHydrogenBonds:
+                        if self.__objects[j].strand() >= minStrandContent:
+                            print "Found a candidate for a sheet between %s and %s." % (i, j)
+                            dir1 = self.__objects[i].directionVector()
+                            dir2 = self.__objects[j].directionVector()
+                            sum = 0
+                            for k in range(0, 3):
+                                sum += dir1[k] * dir2[k]
+                            if sum > 0.7:
+                                res.append([i, j, 1])
+                            elif sum < -0.7:
+                                res.append([i, j, -1])
+        return res 
+    
+    def temperature(self):
+        """Returns the current temperature of this Universe."""
+        return 1.0 / ( smmp.bet.beta * 1.98773e-3 )
+    ## @brief Sets the temperature value of this Universe.
+    #  Be aware that SMMP is not thread save. Changing the temperature may
+    #  lead to strange behavior in the current sweep.
+    #  @pre T > 0
+    #
+    #  @param T temperature in Kelvin.
+    def setTemperature(self, T):
+        if T> 0:
+            smmp.bet.beta = 1.0 / ( T * 1.98773e-3 )
+        
+    def boxSize(self):
+        return self.__boxSize
+
+    def objects(self):
+        """Returns the list of interacting things in the universe."""
+        res = self.__objects
+        return res
+        
+    def save(self):
+        """Saves the state of this Universe."""
+        pass
Index: utilities.f
===================================================================
--- utilities.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ utilities.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -7,20 +7,17 @@
 ! *********************************************************************
 
-!> Calculate the best way to distribute the work load across processors.
-!!  It calculates the average number of interactions and then tries to
-!!  assign a number of interactions to each processor that is as close
-!!  as possible to the average. The routine should be called once for
-!!  every molecule in the system.
-!!
-!!  @param num_ppr Number of processors per replica
-!!  @param nml index of molecule or zero.
-!!
-!!  @author Jan H. Meinke
-!<
+!! Calculate the best way to distribute the work load across processors.
+!  It calculates the average number of interactions and then tries to 
+!  assign a number of interactions to each processor that is as close
+!  as possible to the average. The routine should be called once for
+!  every molecule in the system.
+!
+!  @param num_ppr Number of processors per replica
+!  @param nml index of molecule or zero.
+!
+!  @author Jan H. Meinke
       subroutine distributeWorkLoad(num_ppr,nml)
 
       include 'INCL.H'
-
-      integer i1ms, io, iv, i2ms, ms
 
       integer num_ppr, nml
@@ -29,5 +26,5 @@
       integer totalct, irank, itarget
       double precision ipps
-
+      
       if (nml.eq.0) then
          idxOfFirstVariable = ivrml1(1)
@@ -39,5 +36,5 @@
             end do
          end do
-      else
+      else 
          idxOfFirstVariable = ivrml1(nml)
          idxOfLastVariable = ivrml1(nml) + nvrml(nml) - 1
@@ -47,5 +44,5 @@
          end do
       end if
-
+      
       isum = 0
       do io = idxOfLastVariable, idxOfFirstVariable, - 1
@@ -55,10 +52,10 @@
          do ms = i1ms, i2ms
             do at = latms1(ms), latms2(ms)
-               do ivw=ivwat1(at),ivwat2(at)
+               do ivw=ivwat1(at),ivwat2(at)  
                   do j=lvwat1(ivw),lvwat2(ivw)
                      isum = isum + 1
                   end do
                end do
-               do i14=i14at1(at),i14at2(at)
+               do i14=i14at1(at),i14at2(at)   
                   isum = isum + 1
                end do
@@ -67,8 +64,7 @@
       end do
       ipps = isum / num_ppr
-      write (logString, *) "Total number of interactions:", isum
-      write (logString, *) "Average # of interactions per processor", 
-     &   ipps
-
+      write (*,*) "Total number of interactions:", isum
+      write (*,*) "Average # of interactions per processor", ipps
+      
       totalct = 0
       irank = 1
@@ -76,9 +72,9 @@
       if (nml.eq.0) then
          i1ms = imsml1(ntlml)+ nmsml(ntlml)
-      else
+      else 
          i1ms = imsml1(nml)+ nmsml(nml)
       end if
       do io = idxOfLastVariable, idxOfFirstVariable, - 1
-         isum = 0
+         isum = 0 
          iv = iorvr(io)
          i2ms = i1ms - 1
@@ -87,10 +83,10 @@
             do at = latms1(ms), latms2(ms)
                atct = atct + 1
-               do ivw=ivwat1(at),ivwat2(at)
+               do ivw=ivwat1(at),ivwat2(at)  
                   do j=lvwat1(ivw),lvwat2(ivw)
                      isum = isum + 1
                   end do
                end do
-               do i14=i14at1(at),i14at2(at)
+               do i14=i14at1(at),i14at2(at)   
                   isum = isum + 1
                end do
@@ -103,8 +99,8 @@
      &            .lt.abs(totalct + isum - itarget))) then
                workPerProcessor(nml, irank) = io + 1
-!                write (logString, *) io + 1, totalct, itarget
+!                write (*,*) io + 1, totalct, itarget
             else
                workPerProcessor(nml, irank) = io
-!                write (logString, *) io, totalct + isum, itarget
+!                write (*,*) io, totalct + isum, itarget
             end if
             irank = irank + 1
@@ -117,32 +113,32 @@
 
       end subroutine distributeWorkLoad
-
-!>
-!!     The function fileNameMP takes a template of a file name in the
-!!     variable base. The position of the first and last character that
-!!     may be replaced by rank in the string are given in i1 (first) and
-!!     i2 (last).
-!!     The function returns an empty string if the rank would need more
-!!     characters than is allowed by the template.
-!!     For example,
-!!     \code
-!!     rank = 11
-!!     fileName = fileNameMP('base_0000.dat', 6, 9, rank)
-!!     write (logString, *), fileName
-!!     \endcode
-!!     will output base_0011.dat.
-!!
-!!     @param base the base file name, e.g., base_0000.dat.
-!!     @param i1 index of the first character that may be replaced
-!!     @param i2 index of the last character that may be replaced
-!!     @param rank the number that should be inserted into the file name.
-!!
-!!     @return file name for rank
-!<
+      
+c-----------------------------------------------------------------------
+c     The function fileNameMP takes a template of a file name in the
+c     variable base. The position of the first and last character that
+c     may be replaced by rank in the string are given in i1 (first) and
+c     i2 (last).
+c     The function returns an empty string if the rank would need more
+c     characters than is allowed by the template.
+c     For example,
+c     \code
+c     rank = 11
+c     fileName = fileNameMP('base_0000.dat', 6, 9, rank)
+c     write (*,*), fileName
+c     \endcode
+c     will output base_0011.dat.
+c     
+c     @param base the base file name, e.g., base_0000.dat.
+c     @param i1 index of the first character that may be replaced
+c     @param i2 index of the last character that may be replaced
+c     @param rank the number that should be inserted into the file name.
+c     
+c     @return file name for rank
+c-----------------------------------------------------------------------
       character*80 function fileNameMP(base, i1, i2, rank)
 
       character*(*) base
-!     i1, i2: Index of first and last character that can be replaced
-!     rank: rank of node
+c     i1, i2: Index of first and last character that can be replaced
+c     rank: rank of node
       integer i1, i2, rank
 
@@ -154,5 +150,5 @@
       endif
 
-!     TODO: Allow arbitrary rank
+c     TODO: Allow arbitrary rank
 
       if (rank.lt.10) then
@@ -169,33 +165,5 @@
          write(fileNameMP(i2-5:i2), '(i6)') rank
       endif
-      end function fileNameMP
-!     End fileNameMP
+      end function fileNameMP 
+c     End fileNameMP
 
-
-!>
-!!     Add messages to log. This routine takes the log (debugging) mes-
-!!     sages and writes them to the log file if the log level is less or
-!!     equal to the maximum log level given by the global variable
-!!     MAXLOGLEVEL.
-!!
-!!     @author Jan H. Meinke
-!!
-!!     @param loglevel level at which this message should be added to
-!!            the log.
-!!     @param message message to be written to the log.
-!!     @param rank global rank of this node if running an MPI job zero
-!!            otherwise.
-!<
-      subroutine addLogMessage(loglevel, message, rank)
-
-         integer MAXLOGLEVEL, LOGFILEUNIT
-         common /log/MAXLOGLEVEL, LOGFILEUNIT
-
-         integer :: loglevel, rank
-         character(LEN=*) :: message
-
-         if (loglevel <= MAXLOGLEVEL) then
-            write(LOGFILEUNIT, *) message
-         end if
-
-      end subroutine addLogMessage
Index: zimmer.f
===================================================================
--- zimmer.f	(revision 87ddcf7a314d90070d607f0ec7ac0a700b843abc)
+++ zimmer.f	(revision e40e335d8909b50cd784019735fcdb0c28ee19bb)
@@ -1,46 +1,43 @@
-!**************************************************************
-!
-! This file contains the subroutines: zimmer
-!
-! 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
-!
-! CALLS: none
-!
-! **************************************************************
+c**************************************************************
+c
+c This file contains the subroutines: zimmer
+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 CALLS: none
+c
+c **************************************************************
 
       
          subroutine zimmer(nresi) 
 
-! Calculates the Zimmerman-code of a configuration (Zimmerman et. al.
-! Macromolecules, vol. 10 (1977) 1-9.)
-!
-! Note the difference in Notations:
-!    SMMP:                      Zimmerman, et.al.:
-!         A                                       A
-!         B                                       B
-!         C                                       C
-!         D                                       D
-!         E                                       E
-!         F                                       F
-!         G                                       G
-!         H                                       H
-!         a                                       A*
-!         b                                       B*
-!         c                                       C*
-!         d                                       D*
-!         e                                       E*
-!         f                                       F*
-!         g                                       G*
-!         h                                       H*
-!
+C Calculates the Zimmerman-code of a configuration (Zimmerman et. al.
+C Macromolecules, vol. 10 (1977) 1-9.)
+C
+C Note the difference in Notations:
+C    SMMP:                      Zimmerman, et.al.:
+C         A                                       A
+C         B                                       B
+C         C                                       C
+C         D                                       D
+C         E                                       E
+C         F                                       F
+C         G                                       G
+C         H                                       H
+C         a                                       A*
+C         b                                       B*
+C         c                                       C*
+C         d                                       D*
+C         e                                       E*
+C         f                                       F*
+C         g                                       G*
+C         h                                       H*
+C
       include 'INCL.H'
-!f2py intent(in) nresi
+cf2py intent(in) nresi
       character*1 zim
-      double precision xphi, xpsi
-
-      integer j, nresi, i, iv, nres, nursvr
 
      
