Merge branch 'homology' of mmka.chem.univ.gda.pl:unres into homology
[unres.git] / source / unres / src_MD / energy_p_new_barrier.F
index e893d55..cb97c0a 100644 (file)
@@ -257,9 +257,9 @@ cd    print *,'nterm=',nterm
 
       if (constr_homology.ge.1) then
         call e_modeller(ehomology_constr)
-        print *,'iset=',iset,'me=',me,ehomology_constr,
-     &  'Processor',fg_rank,' CG group',kolor,
-     &  ' absolute rank',MyRank
+c        print *,'iset=',iset,'me=',me,ehomology_constr,
+c     &  'Processor',fg_rank,' CG group',kolor,
+c     &  ' absolute rank',MyRank
       else
         ehomology_constr=0.0d0
       endif
@@ -4863,6 +4863,8 @@ C
       logical lprn /.false./, lprn1 /.false./
       etheta=0.0D0
       do i=ithet_start,ithet_end
+        if ((itype(i-1).eq.ntyp1).or.(itype(i-2).eq.ntyp1).or.
+     &(itype(i).eq.ntyp1)) cycle
         dethetai=0.0d0
         dephii=0.0d0
         dephii1=0.0d0
@@ -4872,7 +4874,8 @@ C
           coskt(k)=dcos(k*theti2)
           sinkt(k)=dsin(k*theti2)
         enddo
-        if (i.gt.3) then
+C        if (i.gt.3) then
+         if (i.gt.3 .and. itype(i-3).ne.ntyp1) then
 #ifdef OSF
           phii=phi(i)
           if (phii.ne.phii) phii=150.0
           enddo
         else
           phii=0.0d0
-          ityp1=nthetyp+1
+          ityp1=ithetyp(itype(i-2))
           do k=1,nsingle
             cosph1(k)=0.0d0
             sinph1(k)=0.0d0
           enddo 
         endif
-        if (i.lt.nres) then
+        if ((i.lt.nres).and. itype(i+1).ne.ntyp1) then
 #ifdef OSF
           phii1=phi(i+1)
           if (phii1.ne.phii1) phii1=150.0
@@ -4907,7 +4910,7 @@ C
           enddo
         else
           phii1=0.0d0
-          ityp3=nthetyp+1
+          ityp3=ithetyp(itype(i))
           do k=1,nsingle
             cosph2(k)=0.0d0
             sinph2(k)=0.0d0
@@ -6451,7 +6454,8 @@ c Addition of energy of theta angle and SC local geom over constr_homologs ref s
 c
 c     ehomology_constr=odleg+kat
       if (homol_nset.gt.1)then
-       ehomology_constr=waga_dist1(iset)*odleg+waga_angle1(iset)*kat+waga_theta*Eval
+       ehomology_constr=waga_dist1(iset)*odleg+waga_angle1(iset)*kat
+     &              +waga_theta*Eval
      &              +waga_d*Erot     
       else
        ehomology_constr=waga_dist*odleg+waga_angle*kat+waga_theta*Eval
@@ -6570,6 +6574,7 @@ c      write (iout,*) "EBACK_SC_COR",iphi_start,iphi_end,nterm_sccor
       esccor=0.0D0
       do i=itau_start,itau_end
         esccor_ii=0.0D0
+        if ((itype(i-2).eq.ntyp1).or.(itype(i-1).eq.ntyp1)) cycle
         isccori=isccortyp(itype(i-2))
         isccori1=isccortyp(itype(i-1))
         phii=phi(i)