Index: enyshe_p.f
===================================================================
--- enyshe_p.f	(revision bd2278d6d1ff11d5a913fabac7fcc16d05c02a33)
+++ enyshe_p.f	(revision 32289cdc085b7eebe6f6df5975767c27f3bf61c7)
@@ -1,8 +1,8 @@
 ! **************************************************************
 !
-! This file contains the subroutines: enyshe 
+! This file contains the subroutines: enyshe
 !
 ! Copyright 2003-2005  Frank Eisenmenger, U.H.E. Hansmann,
-!                      Shura Hayryan, Chin-Ku 
+!                      Shura Hayryan, Chin-Ku
 ! Copyright 2007       Frank Eisenmenger, U.H.E. Hansmann,
 !                      Jan H. Meinke, Sandipan Mohanty
@@ -14,11 +14,11 @@
 
 !     ............................................................................
-!     
+!
 !     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 
+!     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.
@@ -31,4 +31,12 @@
 
 ! 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
+
       if (nml.eq.0) then
          ntlvr = nvr
@@ -36,5 +44,5 @@
          ntlvr=nvrml(nml)
       endif
-      
+
       if (ntlvr.eq.0) then
          write (*,'(a,i4)')
@@ -56,5 +64,5 @@
          ifivr = ivrml1(1)
          i1s = imsml1(ntlml) + nmsml(ntlml)
-      else 
+      else
 !     Index of first variable in molecule.
          ifivr=ivrml1(nml)
@@ -62,5 +70,5 @@
          i1s=imsml1(nml)+nmsml(nml)
       endif
-!     Loop over variables in reverse order     
+!     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.
@@ -72,6 +80,6 @@
       startwtime = MPI_Wtime()
       loopcounter = 0
-!      do io=ifivr+ntlvr-1,ifivr,-1  
-      do io = workPerProcessor(nml, myrank) - 1, 
+!      do io=ifivr+ntlvr-1,ifivr,-1
+      do io = workPerProcessor(nml, myrank) - 1,
      &        workPerProcessor(nml, myrank+1), -1
          if (io.lt.istart) then
@@ -79,25 +87,25 @@
          endif
 !     The array iorvr contains the variables in an "apropriate" order.
-         iv=iorvr(io)       
+         iv=iorvr(io)
 !     Index of the primary moving atom for the variable with index iv
-         ia=iatvr(iv)       
+         ia=iatvr(iv)
 !     Get the type of variable iv (valence length, valence angle, dihedral angle)
-         it=ityvr(iv)       
+         it=ityvr(iv)
 !     Class of variable iv's potential  (Q: What are they)
-         ic=iclvr(iv)       
+         ic=iclvr(iv)
 !     If iv is a dihedral angle ...
-         if (it.eq.3) then      
+         if (it.eq.3) then
 !     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.) 
+            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  
+         elseif (it.eq.2) then
 !     vr is the valence angle of ia
             vr=baat(ia)
 !     else if iv is a valence length...
-         elseif (it.eq.1) then  
+         elseif (it.eq.1) then
 !     vr is the length of the valence bond
             vr=blat(ia)
@@ -108,7 +116,7 @@
          i2s=i1s-1
 !     index of first moving set associated with iv
-         i1s=imsvr1(iv) 
+         i1s=imsvr1(iv)
 !     Loop over all moving sets starting from the one associated with vr to the end.
-         do ims=i1s,i2s  
+         do ims=i1s,i2s
 !     First atom of the current moving set
             i1=latms1(ims)
@@ -116,5 +124,5 @@
             i2=latms2(ims)
 !     Loop over all atoms of the current moving set.
-            do i=i1,i2  
+            do i=i1,i2
 !     Atom class of current atom
                ity=ityat(i)
@@ -126,9 +134,9 @@
                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 
+               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)  
+                  do j=lvwat1(ivw),lvwat2(ivw)
 
                      loopcounter = loopcounter + 1
@@ -163,11 +171,11 @@
                      endif
 
-                  enddo  
-               enddo  
-               
+                  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)   
+               do i14=i14at1(i),i14at2(i)
                   loopcounter = loopcounter + 1
                   j=l14at(i14)
@@ -210,13 +218,13 @@
 
 !     Collect energies from all nodes and sum them up
-      call MPI_ALLREDUCE(teysm, eysmsum, 1, MPI_DOUBLE_PRECISION,  
+      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)
 
