readpdb correction
authorCezary Czaplewski <czarek@chem.univ.gda.pl>
Sat, 11 Apr 2020 13:08:39 +0000 (15:08 +0200)
committerCezary Czaplewski <czarek@chem.univ.gda.pl>
Sat, 11 Apr 2020 13:08:39 +0000 (15:08 +0200)
source/cluster/wham/src-HCD-5D/readpdb.F
source/unres/src-HCD-5D/readpdb-mult.F
source/wham/src-HCD-5D/readpdb.F

index 09e6e4e..a7bb52b 100644 (file)
@@ -13,7 +13,7 @@ C geometry.
       include 'COMMON.NAMES'
       include 'COMMON.CONTROL'
       integer i,j,ibeg,ishift1,ires,iii,ires_old,ishift,ity
-      logical lprn /.false./,fail
+      logical lprn /.false./,fail,sccalc
       double precision e1(3),e2(3),e3(3)
       double precision dcj,efree_temp
       character*3 seq,res
@@ -30,6 +30,7 @@ c      write (2,*) "UNRES_PDB",unres_pdb
       ires=0
       ires_old=0
       iii=0
+      sccalc=.false.
       lsecondary=.false.
       nhfrag=0
       nbfrag=0
@@ -73,11 +74,13 @@ c      write (2,*) "UNRES_PDB",unres_pdb
             call sccenter(ires,iii,sccor)
           endif
           iii=0
+          sccalc=.true.
         endif
 ! Read free energy
         if (index(card,"FREE ENERGY").gt.0) read(card(35:),*) efree_temp
 ! Fish out the ATOM cards.
         if (index(card(1:4),'ATOM').gt.0) then  
+          sccalc=.false.
           read (card(12:16),*) atom
 c          write (2,'(a)') card
 !          write (iout,*) "! ",atom," !",ires
@@ -101,6 +104,7 @@ c          write (2,'(a)') card
                 call sccenter(ires_old,iii,sccor)
               endif
               iii=0
+              sccalc=.true.
             endif
 ! Start new residue.
             if (res.eq.'Cl-' .or. res.eq.'Na+') then
@@ -221,7 +225,7 @@ C          endif !unres_pdb
         endif  !itype.eq.ntyp1
       enddo
 C Calculate the CM of the last side chain.
-      call sccenter(ires,iii,sccor)
+      if (.not.sccalc) call sccenter(ires,iii,sccor)
       nsup=nres
       nstart_sup=1
       if (itype(nres).ne.10) then
index cc9aec9..4c47572 100644 (file)
@@ -19,7 +19,7 @@ C geometry.
       double precision sccor(3,50)
       double precision e1(3),e2(3),e3(3)
       integer rescode,iterter(maxres),cou
-      logical fail
+      logical fail,sccalc
       integer i,j,iii,ires,ires_old,ishift,ishift1,ibeg
       double precision dcj,efree_temp
       bfac=0.0d0
@@ -32,6 +32,7 @@ C geometry.
       nhfrag=0
       nbfrag=0
       iii=0
+      sccalc=.false.
       do
         read (ipdbin,'(a80)',end=10) card
 c        write (iout,'(a)') card
@@ -72,11 +73,13 @@ c        write (iout,'(a)') card
             call sccenter(ires,iii,sccor)
           endif
           iii=0
+          sccalc=.true.
         endif
 ! Read free energy
         if (index(card,"FREE ENERGY").gt.0) read(card(35:),*) efree_temp
 ! Fish out the ATOM cards.
         if (index(card(1:4),'ATOM').gt.0) then  
+          sccalc=.false.
           read (card(12:16),*) atom
 c          write (2,'(a)') card
 c          write (iout,*) "ibeg",ibeg
@@ -101,6 +104,7 @@ c              write (iout,*) "Calculating sidechain center iii",iii
                 call sccenter(ires_old,iii,sccor)
               endif
               iii=0
+              sccalc=.true.
             endif
 ! Start new residue.
             if (res.eq.'Cl-' .or. res.eq.'Na+') then
@@ -200,6 +204,7 @@ C 2/15/2013 by Adam: corrected insertion of the last dummy residue
             if (dcj.eq.0) dcj=1.23591524223
              c(j,i)=c(j,i-1)+dcj
              c(j,nres+i)=c(j,i)
+             dC(j,i)=c(j,i)
            enddo     
           endif   !unres_pdb
          else     !itype(i+1).eq.ntyp1
@@ -220,6 +225,7 @@ C 2/15/2013 by Adam: corrected insertion of the first dummy residue
             if (dcj.eq.0) dcj=1.23591524223
             c(j,i)=c(j,i+1)-dcj
             c(j,nres+i)=c(j,i)
+            dC(j,i)=c(j,i)
            enddo
           endif !unres_pdb
          endif !itype(i+1).eq.ntyp1
@@ -227,6 +233,7 @@ C 2/15/2013 by Adam: corrected insertion of the first dummy residue
       enddo
       write (iout,*) "After loop in readpbd"
 C Calculate the CM of the last side chain.
+      if (.not. sccalc) then
       if (unres_pdb) then
         do j=1,3
           dc(j,ires)=sccor(j,iii)
@@ -235,6 +242,7 @@ C Calculate the CM of the last side chain.
 c        write (iout,*) "Calling sccenter iii",iii
         call sccenter(ires,iii,sccor)
       endif
+      endif
       nsup=nres
       nstart_sup=1
       if (itype(nres).ne.10) then
@@ -302,8 +310,8 @@ C Calculate internal coordinates.
      &    restyp(itype(ires)),ires,(c(j,ires),j=1,3),
      &    (c(j,ires+nres),j=1,3)
       enddo
-      endif
       call flush(iout)
+      endif
 c      write(iout,*)"before int_from_cart nres",nres
       call int_from_cart(.true.,.false.)
       do i=1,nres
index 855d754..8a85b8c 100644 (file)
@@ -20,12 +20,13 @@ C geometry.
       integer i,j,iii,ibeg,ishift,ishift1,ity,ires,ires_old
       double precision dcj
       integer rescode,kkk,lll,icha,cou,kupa,iprzes
-      logical lsecondary
+      logical lsecondary,sccalc
       integer iterter(maxres)
       double precision efree_temp
       iii=0
       ibeg=1
       ishift1=0
+      sccalc=.false.
       do
         read (ipdbin,'(a80)',end=10) card
 !       write (iout,'(a)') card
@@ -66,11 +67,13 @@ C geometry.
             call sccenter(ires,iii,sccor)
           endif
           iii=0
+          sccalc=.true.
         endif
 ! Read free energy
         if (index(card,"FREE ENERGY").gt.0) read(card(35:),*) efree_temp
 ! Fish out the ATOM cards.
         if (index(card(1:4),'ATOM').gt.0) then  
+          sccalc=.false.
           read (card(12:16),*) atom
 c          write (2,'(a)') card
 !          write (iout,*) "! ",atom," !",ires
@@ -94,6 +97,7 @@ c          write (2,'(a)') card
                 call sccenter(ires_old,iii,sccor)
               endif
               iii=0
+              sccalc=.true.
             endif
 ! Start new residue.
             if (res.eq.'Cl-' .or. res.eq.'Na+') then
@@ -214,7 +218,7 @@ C          endif !unres_pdb
         endif  !itype.eq.ntyp1
       enddo
 C Calculate the CM of the last side chain.
-      call sccenter(ires,iii,sccor)
+      if (.not. sccalc) call sccenter(ires,iii,sccor)
       nsup=nres
       nstart_sup=1
       if (itype(nres).ne.10) then