!------------------------------------------------------------------- ! function : Qfunc ! ! package : Li3 Potential ! ! Language : Fortran 77 - freeform ! ! author : F. Colavecchia (flavioc@lanl.gov) ! ! date : 03/10/03 version: ! revision : version: ! ! purpose : Compute the Q function eq. (19) of the paper JCP 118 5484 (2003). ! ! input : t -> (dim=3) integrity basis eq. (16) ! x -> (dim=n) vector of coefficients of the expansion (20). ! n -> number of coefficients ! ! output : qfunc -> Q function eq. (19) ! !------------------------------------------------------------------- real*8 function Qfunc(t,x,n) implicit none integer n real*8 t(3),x(n) logical debug integer i,j,k,l integer i1,i2,i3,i4 real*8 tmp1 data debug /.false./ ! 0th order tmp1 = 1d0 ! 1st order tmp1 = tmp1 + t(1)*x(3) ! 2nd order tmp1 = tmp1 + x(4)*t(1)**2+x(5)*t(2) ! 3rd order tmp1 = tmp1 + x(6)*t(1)**3+x(7)*t(2)*t(1)+x(8)*t(3) ! 4th order tmp1 = tmp1 + x(9)*t(1)**4+x(10)*t(2)*t(1)**2+x(11)*t(1)*t(3) > + x(12)*t(2)**2 ! 5th order tmp1 = tmp1 + x(13)*t(1)**5+x(14)*t(2)*t(1)**3+x(15)*t(1)**2*t(3) > + x(16)*t(1)*t(2)**2+x(17)*t(2)*t(3) Qfunc = tmp1 return end !------------------------------------------------------------------- ! subroutine: dQfunc ! ! package : Li3 Potential ! ! Language : Fortran 77 - freeform ! ! author : F. Colavecchia (flavioc@lanl.gov) ! ! date : 03/10/03 version: ! revision : version: ! ! purpose : Compute the gradient respect to ! the parameters of Q function eq. (19) of the paper JCP 118 5484 (2003) ! ! input : t -> (dim=3) integrity basis eq. (16) ! x -> (dim=n) vector of coefficients of the expansion (20). ! n -> number of coefficients ! ! output : grad -> gradient of Q function eq. (19) ! !------------------------------------------------------------------- subroutine dQfunc(t,x,grad,n) implicit none integer n real*8 t(3),x(n),grad(n) integer i,j,k,l integer i1,i2,i3,i4 ! ! x(2-4) = C(1-3) ! x(5-10) = C11,C21,C22,C31,C32,C33 ! x(11-20) = C111,.... ! ! Unfold x ! grad(3) = t(1) grad(4) = t(1)**2 grad(5) = t(2) grad(6) = t(1)**3 grad(7) = t(2)*t(1) grad(8) = t(3) grad(9) = t(1)**4 grad(10)= t(2)*t(1)**2 grad(11)= t(1)*t(3) grad(12)= t(2)**2 grad(13)= t(1)**5 grad(14)= t(2)*t(1)**3 grad(15)= t(1)**2*t(3) grad(16)= t(1)*t(2)**2 grad(17)= t(2)*t(3) return end