Changeset 32289cd for enylun.f


Ignore:
Timestamp:
11/19/09 11:29:41 (14 years ago)
Author:
baerbaer <baerbaer@…>
Branches:
master
Children:
38d77eb
Parents:
6650a56
Message:

Explicitly declare variables.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/smmp/trunk@33 26dc1dd8-5c4e-0410-9ffe-d298b4865968

File:
1 edited

Legend:

Unmodified
Added
Removed
  • enylun.f

    r6650a56 r32289cd  
    11! *******************************************************************
    22! SMMP version of Anders Irback's force field, to be called the Lund
    3 ! force field. This file contains the function enylun, which in turn 
    4 ! calls all the terms in the energy function. The terms Bias (ebias), 
    5 ! Hydrogen bonds (ehbmm and ehbms), Hydrophobicity (ehp) and the 
    6 ! Excluded volume (eexvol and eloexv) are also implemented in this 
     3! force field. This file contains the function enylun, which in turn
     4! calls all the terms in the energy function. The terms Bias (ebias),
     5! Hydrogen bonds (ehbmm and ehbms), Hydrophobicity (ehp) and the
     6! Excluded volume (eexvol and eloexv) are also implemented in this
    77! file.
    88!
     
    1313      include 'INCL.H'
    1414      include 'incl_lund.h'
     15      integer iat1, iat2
     16
    1517          integer ires,frst,lst,root
    1618          do iat1=iCa(ires)+frst,iCa(ires)+lst
     
    3032      include 'INCL.H'
    3133      include 'incl_lund.h'
     34      double precision eunit, csacc
     35
     36      integer i, j, iml, iat1, iat2, k, iat3, l, iat4, m, iat3p, irs
     37      integer iatoff, iatmrg, ilp, lci
     38
    3239      character mynm*4
    3340      logical prlvr
     
    8390            prlvr=.true.        ! residue i is a proline variant
    8491            print *, 'proline variant ',mynm,i
    85          else 
     92         else
    8693            prlvr=.false.
    87          endif 
    88 
    89          if (mynm.eq.'ala') then 
     94         endif
     95
     96         if (mynm.eq.'ala') then
    9097            nhpat(i)=1
    9198            ihpat(i,1)=iCa(i)+2
     
    193200
    194201!     Initialization of the connections matrix matcon(i,j). The index
    195 !     i runs from -mxconr to +mxconr, and j from 1 to mxat. 
     202!     i runs from -mxconr to +mxconr, and j from 1 to mxat.
    196203!     matcon(i2-i1,i1) = 0, if the distance between atoms i1 and i2 is fixed
    197204!                      = 2, if atoms i1 and i2 are separated by 3 covalent
    198205!                           bonds and their distance can change
    199206!                      = 1, for all other pairs
    200 !     if abs(i2-i1) > mxconr, the atoms are assumed to be separated by 
    201 !     many bonds, and with no restriction on their distances. On a protein 
     207!     if abs(i2-i1) > mxconr, the atoms are assumed to be separated by
     208!     many bonds, and with no restriction on their distances. On a protein
    202209!     molecule made of natural amino acids, atoms with indices separated
    203210!     by more than 35 can not be connected by three covalent bonds.
     
    228235                     do m=1,nbdat(iat2)
    229236                        iat3p=ibdat(m,iat2)
    230                         if (iat3p.ne.iat3) then 
     237                        if (iat3p.ne.iat3) then
    231238                           matcon(iat4-iat3p,iat3p)=2 ! 3 covalent bonds
    232239                           matcon(iat3p-iat4,iat4)=2 !
     
    255262                matcon(iat2-iat1,iat1)=0
    256263                matcon(iat1-iat2,iat2)=0
    257             enddo 
     264            enddo
    258265            matcon(iat1-iCa(irsml1(iml))-1,iCa(irsml1(iml))+1)=2
    259266            matcon(iCa(irsml1(iml))+1-iat1,iat1)=2
     
    266273!     Below: for certain residues, some atoms separated by 3 or more bonds
    267274!     do not change distance. So, the connection matrix term for such pairs
    268 !     should be zero. 
     275!     should be zero.
    269276
    270277         do irs=irsml1(iml),irsml2(iml)
    271278            if (irs.eq.irsml1(iml)) then
    272279               iatoff=1
    273             else 
     280            else
    274281               iatoff=0
    275282            endif
     
    283290            if ((mynm.eq.'pro')) then
    284291               prlvr=.true.     ! residue i is a proline variant
    285             else 
     292            else
    286293               prlvr=.false.
    287             endif 
    288             if ((mynm.eq.'asn')) then 
     294            endif
     295            if ((mynm.eq.'asn')) then
    289296                call set_local_constr(irs,5,9,2)
    290             else if ((mynm.eq.'gln')) then 
     297            else if ((mynm.eq.'gln')) then
    291298                call set_local_constr(irs,8,12,5)
    292299            else if ((mynm.eq.'arg')) then
     
    294301            else if ((mynm.eq.'his')) then
    295302                call set_local_constr(irs,5,12,2)
    296             else if (mynm.eq.'phe') then 
     303            else if (mynm.eq.'phe') then
    297304                call set_local_constr(irs,5,15,2)
    298305            else if (mynm.eq.'tyr') then
     
    308315                call set_local_constr(irs,5,19,2)
    309316            else if (prlvr) then
    310 !           Proline. Many more distances are fixed because of the fixed 
     317!           Proline. Many more distances are fixed because of the fixed
    311318!           phi angle
    312319                call set_local_constr(irs,-3,11,-3)
     
    347354         do iat1=iatrs1(irsml1(iml)),iatrs2(irsml2(iml))
    348355            do iat2=iat1+1,iatrs2(irsml2(iml))
    349                if (iat2-iat1.le.mxconr) then
    350                   if (matcon(iat2-iat1,iat1).eq.2) then
    351                     ilp=ilp+1
    352                     lcp1(ilp)=iat1
    353                     lcp2(ilp)=iat2
    354                   endif
     356               if ((iat2-iat1.le.mxconr).and.
     357     &                 matcon(iat2-iat1,iat1).eq.2) then
     358                  ilp=ilp+1
     359                  lcp1(ilp)=iat1
     360                  lcp2(ilp)=iat2
    355361               endif
    356362            enddo
     
    358364
    359365         ilpnd(iml)=ilp
    360          if (iml.lt.ntlml) then 
     366         if (iml.lt.ntlml) then
    361367            ilpst(iml+1)=ilp+1
    362368         endif
     
    369375         enddo
    370376      enddo
     377
    371378      print *,'finished initializing Lund force field'
    372379      end
     
    374381      integer function ihptype(iaa)
    375382      include 'INCL.H'
     383      integer iaa, ityp
     384
    376385      character mynm*4
    377386      mynm=seq(iaa)
     
    383392     &        .or.(mynm.eq.'met').or.(mynm.eq.'pro')) then
    384393         ityp=2
    385       else if ((mynm.eq.'phe').or.(mynm.eq.'tyr').or.(mynm.eq.'trp')) 
     394      else if ((mynm.eq.'phe').or.(mynm.eq.'tyr').or.(mynm.eq.'trp'))
    386395     &        then
    387396         ityp=3
    388397      endif
    389398      ihptype=ityp
    390       return 
     399      return
    391400      end
    392401
     
    394403      include 'INCL.H'
    395404      include 'incl_lund.h'
     405      double precision q1, q2, et, xij, yij, zij
     406
     407      integer i, iat1, irsd, j, iat2
     408
    396409      dimension q1(2),q2(2)
    397410      data q1/-0.2,0.2/
    398       data q2/0.42,-0.42/ 
     411      data q2/0.42,-0.42/
    399412
    400413      et=0.0
     
    412425      return
    413426      end
    414 !     Evaluates backbone backbone hydrogen bond strength for residues 
     427!     Evaluates backbone backbone hydrogen bond strength for residues
    415428!     i and j, taking the donor from residue i and acceptor from residue j
    416429      real*8 function ehbmmrs(i,j)
    417430      include 'INCL.H'
    418431      include 'incl_lund.h'
     432      double precision rdon2, racc2, evlu
     433
     434      integer i, j
     435
    419436      double precision r2,r4,r6,dx,dy,dz,ca,cb
    420437      integer d1,d2,a1,a2
     
    427444      dz=zat(a1)-zat(d2)
    428445      r2=dx*dx+dy*dy+dz*dz
    429       if (r2.gt.cthb2) then 
     446      if (r2.gt.cthb2) then
    430447!         print *,'hbmm = 0 ',cthb2,r2,a1,a2,d1,d2
    431448!         print *,'a1,a2,d1,d2,r2 = ',a1,a2,d1,d2,r2,sighb2,cthb
     
    464481      include 'INCL.H'
    465482      include 'incl_lund.h'
     483      double precision ebiasrs, shbm1, shbm2, etmp, ehbmmrs, ehp, etmp1
     484      double precision xij, yij, zij, r2, r6
     485
     486      integer istres, nml, indres, i, j, ihpi, ihptype, ihpj, i1, i2
     487      integer iat1, iat2, iatt1, iatt2
     488
    466489      character mynm*4
    467490      logical prlvr
     
    485508     &           .or.(mynm.eq.'pron').or.(mynm.eq.'pro+')) then
    486509            prlvr=.true.        ! residue i is a proline variant
    487          else 
     510         else
    488511            prlvr=.false.
    489          endif 
     512         endif
    490513
    491514!     Bias, or local electrostatic term. Excluded from the list are
     
    502525!     j run over the whole set of amino acids.
    503526!     No terms for residue i, if it is a proline variant.
    504          if (.not.prlvr) then 
     527         if (.not.prlvr) then
    505528            do j=istres,indres
    506                if ((j.lt.(i-2)).or.(j.gt.(i+1))) then 
     529               if ((j.lt.(i-2)).or.(j.gt.(i+1))) then
    507530                    shbm2=1.0
    508531                    if ((j.eq.istres).or.(j.eq.indres)) shbm2=0.5
    509532                    etmp=ehbmmrs(i,j)
    510533                    eyhb=eyhb+shbm1*shbm2*etmp
    511                 endif 
     534                endif
    512535            enddo
    513536         endif
    514537!     Hydrophobicity, only if residue i is hydrophobic to start with
    515538         ihpi=ihptype(i)
    516          if (ihpi.ge.0) then 
     539         if (ihpi.ge.0) then
    517540!        Unlike hydrogen bonds, the hydrophobicity potential is symmetric
    518541!        in i and j. So, the loop for j runs from i+1 to the end.
     
    526549!                  print *, 'hydrophobicity contribution ',etmp,i,j
    527550                  eysl=eysl+etmp
    528                endif 
     551               endif
    529552            enddo
    530553         endif
     
    535558!     Local pair or third-neighbour excluded volume
    536559!     Numerically this is normally the term with largest positive
    537 !     contribution to the energy in an equilibrated stystem. 
     560!     contribution to the energy in an equilibrated stystem.
    538561
    539562      i1=ilpst(nml)
     
    551574         r2=(xij*xij + yij*yij + zij*zij)
    552575         if (r2.le.exvcut2) then
    553             r6=sig2lcp(iatt1,iatt2)/r2 
     576            r6=sig2lcp(iatt1,iatt2)/r2
    554577            r6=r6*r6*r6
    555578            etmp1=(r6*r6+asalcp(iatt1,iatt2)+bsalcp(iatt1,iatt2)*r2)
     
    560583            etmp=etmp+etmp1
    561584         endif
    562 !         print *,'pair : ',iat1,iat2,' contribution ',etmp1 
     585!         print *,'pair : ',iat1,iat2,' contribution ',etmp1
    563586!         print *,exvcut2,r2
    564587      enddo
     
    579602      include 'INCL.H'
    580603      include 'incl_lund.h'
     604      double precision b2, a2, r2min, xij, yij, zij, dtmp, ssum
     605
     606      integer ihp1, ihp2, ni, i1, nj, i2, i, k, j, l
     607
    581608      dimension r2min(12)
    582609
     
    608635      ssum=0
    609636      do i=1,ni+nj
    610          if (r2min(i).le.b2) then 
    611             if (r2min(i).lt.a2) then 
     637         if (r2min(i).le.b2) then
     638            if (r2min(i).lt.a2) then
    612639               ssum=ssum+1
    613             else 
     640            else
    614641               ssum=ssum+(b2-r2min(i))/(b2-a2)
    615642            endif
     
    626653      include 'incl_lund.h'
    627654!     For multi-chain systems it makes little sense to split the calculation
    628 !     of this term into an 'interaction part' and a contribution from 
     655!     of this term into an 'interaction part' and a contribution from
    629656!     individual molecules. So, normally this should always be called with
    630657!     argument nml=0. Only for diagnostic reasons, you might want to find
    631 !     the contribution from one molecule in a multi-chain system assuming 
     658!     the contribution from one molecule in a multi-chain system assuming
    632659!     there was no other molecule.
     660      double precision xmin, ymin, zmin, xmax, ymax, zmax, sizex, sizey
     661      double precision sizez, shiftx, shifty, shiftz, etmp, xij, yij
     662      double precision zij, r2, r6, etmp1
     663
     664      integer nml, istat, indat, i, incell, ndx, ndy, ndz, nxy, ncell
     665      integer nocccl, locccl, j, mx, my, mz, icellj, icell, jj, isort
     666      integer icl, lcell, ix, iz, iy, nex, ney, nez, nsame, nngbr, jx
     667      integer jy, jz, jcl, ii, ngbr, i1, iat1, i2, iat2, iatt1, iatt2
     668
    633669      dimension isort(mxat),ngbr(mxat),locccl(mxat),incell(mxcell)
    634670      dimension icell(mxat)
    635671      integer :: jx1, jy1, jz1
    636       logical doit
    637 
    638       if (nml.eq.0) then
     672
     673      if (nml.eq.0) then
    639674         istat=iatrs1(irsml1(1))
    640675         indat=iatrs2(irsml2(ntlml))
    641       else 
     676      else
    642677         istat=iatrs1(irsml1(nml))
    643678         indat=iatrs2(irsml2(nml))
     
    645680
    646681      eyvw=0.0
    647 !     The beginning part of this implementation is very similar to the 
    648 !     assignment of cells to the atoms during calculation of solvent 
    649 !     accessible surface area. So, much of that part is similar. But 
     682!     The beginning part of this implementation is very similar to the
     683!     assignment of cells to the atoms during calculation of solvent
     684!     accessible surface area. So, much of that part is similar. But
    650685!     unlike the accessible surface calculations, this term is symmetric
    651686!     in any two participating atoms. So, the part after the assignment
     
    724759         icellj=mx+my*ndx+mz*nxy+1
    725760         icell(j)=icellj
    726          if (icellj.gt.mxcell) then 
     761         if (icellj.gt.mxcell) then
    727762            print *,'exvlun> bad cell index ',icellj,' for atom ',j
    728763            stop
    729          else 
    730             if (incell(icellj).eq.0) then 
     764         else
     765            if (incell(icellj).eq.0) then
    731766!           previously unoccupied cell
    732767               nocccl=nocccl+1
     
    756791         ix=mod(lcell-1,ndx)
    757792         iz = (lcell - 1) / nxy
    758          iy = ((lcell - 1) - iz * nxy) / ndx 
     793         iy = ((lcell - 1) - iz * nxy) / ndx
    759794
    760795c         print *,'icl=',icl,'absolute index of cell = ',lcell
     
    767802         nngbr=0
    768803         do jx=ix,nex
    769             if (jx.ge.ndx) then 
     804            if (jx.ge.ndx) then
    770805               jx1=0
    771             else 
     806            else
    772807               jx1=jx
    773808            endif
    774809            do jy=iy,ney
    775                if (jy.ge.ndy) then 
     810               if (jy.ge.ndy) then
    776811                  jy1=0
    777                else 
     812               else
    778813                  jy1=jy
    779                endif 
     814               endif
    780815               do jz=iz,nez
    781                   if (jz.ge.ndz) then 
     816                  if (jz.ge.ndz) then
    782817                     jz1=0
    783                   else 
     818                  else
    784819                     jz1=jz
    785820                  endif
    786821                  jcl=jx1 + ndx*jy1 + nxy*jz1 + 1
    787 !                  write(*,*)'jcl,jx1,jy1,jz1:', jcl,jx1,jy1,jz1
     822!                  write (logString, *)'jcl,jx1,jy1,jz1:', jcl,jx1,jy1,jz1
    788823                  do ii=incell(jcl)+1,incell(jcl+1)
    789824!     count the total number of neighbours
     
    799834         enddo
    800835!     A few more cells need to be searched, so that we cover 13 of the 26
    801 !     neighbouring cells. 
     836!     neighbouring cells.
    802837!        1
    803838         jx=ix+1
    804          if (jx.ge.ndx) jx=0 
     839         if (jx.ge.ndx) jx=0
    805840         jy=iy
    806841         jz=iz-1
     
    883918               r2=(xij*xij+yij*yij+zij*zij)
    884919
    885                if (r2.le.exvcutg2) then
    886                   doit=.false.
    887                   if (abs(iat2-iat1).gt.mxconr ) then
    888                     doit=.true.
    889                   else if (matcon(iat2-iat1,iat1).eq.1) then
    890                     doit=.true.
    891                   endif
    892                   if (doit) then
     920               if (r2.le.exvcutg2) then
     921                  if (abs(iat2-iat1).gt.mxconr.or.
     922     &                 matcon(iat2-iat1,iat1).eq.1) then
    893923                     iatt1=ityat(iat1)
    894924                     iatt2=ityat(iat2)
     
    931961      include 'incl_lund.h'
    932962
     963      double precision etmp, etmp1, xij, yij, zij, r2, r6
     964
     965      integer iat1, iat2, iatt1, iatt2
     966
    933967      etmp=0.0
    934968      etmp1=0.0
     
    941975            r2=(xij*xij+yij*yij+zij*zij)
    942976
    943             if (r2.le.exvcutg2) then 
     977            if (r2.le.exvcutg2) then
    944978               if (abs(iat2-iat1).gt.mxconr.or.
    945979     &                 matcon(iat2-iat1,iat1).eq.1) then
     
    951985     &                 +bsaexv(iatt1,iatt2)*r2
    952986                  etmp=etmp+etmp1
    953                else 
     987               else
    954988!                  print *,'atoms ', iat1,' and ',iat2,' were close',
    955989!     #                 'but matcon is ',matcon(iat2-iat1,iat1)
Note: See TracChangeset for help on using the changeset viewer.