critical bugfix for rand_conf multichain
[unres4.git] / source / wham / enecalc.F90
index b175378..9adc19a 100644 (file)
@@ -556,7 +556,7 @@ write(iout,*)"enecalc_ i ntot",i,ntot
           (vbld(j).lt.2.0d0 .or. vbld(j).gt.5.0d0)) then
           if (iprint.gt.0) &
           write (iout,*) "Bad CA-CA bond length",j," ",vbld(j),&
-            " for conformation",ii
+            " for conformation",ii,mnum
           if (iprint.gt.1) then
             write (iout,*) "The Cartesian geometry is:"
             write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
@@ -837,7 +837,7 @@ write(iout,*)"enecalc_ i ntot",i,ntot
       enddo
       enddo
 ! Store parameters of the cumulants
-      do i=-nloctyp,nloctyp
+      do i=1,nloctyp
         do j=1,2
           b1_all(j,i,iparm)=b1(j,i)
           b1tilde_all(j,i,iparm)=b1tilde(j,i)
@@ -1119,7 +1119,7 @@ write(iout,*)"end of store_parm"
       enddo
      
 ! Restore parameters of the cumulants
-      do i=-nloctyp,nloctyp
+      do i=1,nloctyp
         do j=1,2
           b1(j,i)=b1_all(j,i,iparm)
           b1tilde(j,i)=b1tilde_all(j,i,iparm)
@@ -1229,7 +1229,10 @@ write(iout,*)"end of store_parm"
       real(kind=8) :: etot,evdw,evdw_t,evdw2,ees,evdw1,ebe,etors,&
             escloc,ehpb,ecorr,ecorr5,ecorr6,eello_turn4,eello_turn3,&
             eello_turn6,eel_loc,edihcnstr,etors_d,estr,evdw2_14,esccor,tt, &
-            ecation_prot, ecationcation
+            ecation_prot, ecationcation,evdwpp,eespp,evdwpsb,eelpsb,evdwsb, &
+            eelsb,estr_nucl,ebe_nucl,esbloc,etors_nucl,etors_d_nucl,&
+            ecorr_nucl,ecorr3_nucl,escbase, epepbase,escpho, epeppho
+
       integer :: i,ii,ik,iproc,iscor,j,k,l,ib,iparm,iprot,nlist
       real(kind=8) :: qfree,sumprob,eini,efree,rmsdev
       character(len=80) :: bxname
@@ -1380,6 +1383,27 @@ write(iout,*)"end of store_parm"
             edihcnstr=enetb(19,i,iparm)
             ecationcation=enetb(42,i,iparm)
             ecation_prot=enetb(41,i,iparm)
+            evdwpp =      enetb(26,i,iparm)
+            eespp =      enetb(27,i,iparm)
+            evdwpsb =      enetb(28,i,iparm)
+            eelpsb =      enetb(29,i,iparm)
+            evdwsb =      enetb(30,i,iparm)
+            eelsb =      enetb(31,i,iparm)
+            estr_nucl =      enetb(32,i,iparm)
+            ebe_nucl =      enetb(33,i,iparm)
+            esbloc =      enetb(34,i,iparm)
+            etors_nucl =      enetb(35,i,iparm)
+            etors_d_nucl =      enetb(36,i,iparm)
+            ecorr_nucl =      enetb(37,i,iparm)
+            ecorr3_nucl =      enetb(38,i,iparm)
+            epeppho=   enetb(49,i,iparm)
+            escpho=    enetb(48,i,iparm)
+            epepbase=  enetb(47,i,iparm)
+            escbase=   enetb(46,i,iparm)
+!      wscbase=ww(46)
+!      wpepbase=ww(47)
+!      wscpho=ww(48)
+!      wpeppho=ww(49)
 
 !#ifdef SPLITELE
 !            etot=wsc*(evdw+ft(6)*evdw_t)+wscp*evdw2+ft(1)*welec*ees &
@@ -1412,7 +1436,14 @@ write(iout,*)"end of store_parm"
             +wturn3*eello_turn3 &
             +wturn6*eello_turn6+wel_loc*eel_loc &
             +edihcnstr+wtor_d*etors_d+wsccor*esccor &
-            +wbond*estr+wcatprot*ecation_prot+wcatcat*ecationcation
+            +wbond*estr+wcatprot*ecation_prot+wcatcat*ecationcation&
+            +wbond_nucl*estr_nucl+wang_nucl*ebe_nucl&
+            +wvdwpp_nucl*evdwpp+welpp*eespp+wvdwpsb*evdwpsb+welpsb*eelpsb&
+            +wvdwsb*evdwsb+welsb*eelsb+wsbloc*esbloc+wtor_nucl*etors_nucl&
+            +wtor_d_nucl*etors_d_nucl+wcorr_nucl*ecorr_nucl+wcorr3_nucl*ecorr3_nucl&
+            +wscbase*escbase&
+            +wpepbase*epepbase+wscpho*escpho+wpeppho*epeppho
+
 #else
             etot=wsc*evdw+wscp*evdw2 &
             +welec*(ees+evdw1) &
@@ -1422,7 +1453,14 @@ write(iout,*)"end of store_parm"
             +wturn3*eello_turn3 &
             +wturn6*eello_turn6+wel_loc*eel_loc+edihcnstr &
             +wtor_d*etors_d+wsccor*esccor &
-            +wbond*estr+wcatprot*ecation_prot+wcatcat*ecationcation
+            +wbond*estr+wcatprot*ecation_prot+wcatcat*ecationcation&
+            +wbond_nucl*estr_nucl+wang_nucl*ebe_nucl&
+            +wvdwpp_nucl*evdwpp+welpp*eespp+wvdwpsb*evdwpsb+welpsb*eelpsb&
+            +wvdwsb*evdwsb+welsb*eelsb+wsbloc*esbloc+wtor_nucl*etors_nucl&
+            +wtor_d_nucl*etors_d_nucl+wcorr_nucl*ecorr_nucl+wcorr3_nucl*ecorr3_nucl&
+            +wscbase*escbase&
+            +wpepbase*epepbase+wscpho*escpho+wpeppho*epeppho
+
 #endif
 
 #ifdef MPI