Adam's changes
[unres.git] / source / wham / src-HCD / readpdb.F
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