real*8 function calcfuncall(ifunc,x,y,z)
integer ifunc
real*8 x,y,z
if (ifunc==1) then
if (allocated(b)) then
calcfuncall=fdens(x,y,z)
else
calcfuncall=calcprodens(x,y,z,0) !Use promolecular density
end if
else if (ifunc==2) then
calcfuncall=fgrad(x,y,z,'t')
else if (ifunc==3) then
calcfuncall=flapl(x,y,z,'t')
else if (ifunc==4) then
calcfuncall=fmo(x,y,z,iorbsel)
else if (ifunc==5) then
calcfuncall=fspindens(x,y,z,'s')