+C call vec_and_deriv
+C if (shield_mode.eq.1) then
+C call set_shield_fac
+C else if (shield_mode.eq.2) then
+C call set_shield_fac2
+C if (nfgtasks.gt.1) then
+C#define DEBUG
+C#ifdef DEBUG
+C write(iout,*) "befor reduce fac_shield reduce"
+C do i=1,nres
+C write(2,*) "fac",itype(i),fac_shield(i),grad_shield(1,i)
+C write(2,*) "list", shield_list(1,i),ishield_list(i),
+C & grad_shield_side(1,1,i),grad_shield_loc(1,1,i)
+C enddo
+C#endif
+C call MPI_Allgatherv(fac_shield(ivec_start),ivec_count(fg_rank1),
+C & MPI_DOUBLE_PRECISION,fac_shield(1),ivec_count(0),ivec_displ(0),
+C & MPI_DOUBLE_PRECISION,FG_COMM,IERR)
+C call MPI_Allgatherv(shield_list(1,ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_I50,shield_list(1,1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_I50,FG_COMM,IERR)
+C call MPI_Allgatherv(ishield_list(ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_INTEGER,ishield_list(1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_INTEGER,FG_COMM,IERR)
+C call MPI_Allgatherv(grad_shield(1,ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_UYZ,grad_shield(1,1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_UYZ,FG_COMM,IERR)
+C call MPI_Allgatherv(grad_shield_side(1,1,ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_SHI,grad_shield_side(1,1,1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_SHI,FG_COMM,IERR)
+C call MPI_Allgatherv(grad_shield_loc(1,1,ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_SHI,grad_shield_loc(1,1,1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_SHI,FG_COMM,IERR)
+C#ifdef DEBUG
+C write(iout,*) "after reduce fac_shield reduce"
+C do i=1,nres
+C write(2,*) "fac",itype(i),fac_shield(i),grad_shield(1,i)
+C write(2,*) "list", shield_list(1,i),ishield_list(i),
+C & grad_shield_side(1,1,i),grad_shield_loc(1,1,i)
+C enddo
+C#endif
+C#undef DEBUG
+C endif
+C
+C endif
+C if (ipot.lt.6) then
+C#ifdef SPLITELE
+C if (welec.gt.0d0.or.wvdwpp.gt.0d0.or.wel_loc.gt.0d0.or.
+C & wturn3.gt.0d0.or.wturn4.gt.0d0 .or. wcorr.gt.0.0d0
+C & .or. wcorr4.gt.0.0d0 .or. wcorr5.gt.0.d0
+C & .or. wcorr6.gt.0.0d0 .or. wturn6.gt.0.0d0 ) then
+C#else
+C if (welec.gt.0d0.or.wel_loc.gt.0d0.or.
+C & wturn3.gt.0d0.or.wturn4.gt.0d0 .or. wcorr.gt.0.0d0
+C & .or. wcorr4.gt.0.0d0 .or. wcorr5.gt.0.d0
+C & .or. wcorr6.gt.0.0d0 .or. wturn6.gt.0.0d0 ) then
+C#endif
+C call eelec_scale(ees,evdw1,eel_loc,eello_turn3,eello_turn4)
+C else
+C ees=0
+C evdw1=0
+C eel_loc=0
+C eello_turn3=0
+C eello_turn4=0
+C endif
+C else