diff --git a/src/constrain_pot.f90 b/src/constrain_pot.f90 index 1ce0cddb8..f45f7e349 100644 --- a/src/constrain_pot.f90 +++ b/src/constrain_pot.f90 @@ -173,7 +173,7 @@ subroutine constrain_dist(fix,n,at,xyz,g,e) real(wp),intent(inout) :: e real(wp),intent(inout) :: g(3,n) - integer i,j,k,l,m,mm + integer i,j,k,l,m,mm,idx real(wp)rij(3),dum,r0,r,vp(3),ra(3),rb(3) real(wp)va(3),vb(3),vc(3),vab(3),vcb(3),deda(3),dedc(3),dedb(3) real(wp)dda(3),ddb(3),ddc(3),ddd(3) @@ -198,8 +198,10 @@ subroutine constrain_dist(fix,n,at,xyz,g,e) e=e+fix%fc*dum ff=fix%fc*fix%expo(m)*dum2 dum=ff/r - g(:,j)=g(:,j)+dum*rij - g(:,i)=g(:,i)-dum*rij + do idx = 1, 3 + g(idx,j)=g(idx,j)+dum*rij(idx) + g(idx,i)=g(idx,i)-dum*rij(idx) + end do enddo