       subroutine mfunc(x,f,g)
       double precision x(3),g(3),xp,yp,zp,f
       double precision rho,elfd,drho(3),delf(3),d2rho(6),d2elf(6)
       integer level
       level=1
       xp=x(1)
       yp=x(2)
       zp=x(3)
       call elf_eval(rho,drho,d2rho,elfd,delf,d2elf,xp,yp,zp,level)
       f=elfd
       g(1)=delf(1)
       g(2)=delf(2)
       g(3)=delf(3)
       return
       end
