	function thundr(nn,eg,npp,pe,acc,epart,ppde,nlong)
c
	dimension eg(1),pe(1),acc(nlong,1)
c
c	find nearest energies
	do 1 ie=2,nn
	if (epart.lt.eg(ie)) goto 2
1	continue
	ie=nn
c	interpolate along pperp/e grid at energies ie-1 and ie
2	je=ie-1
	do 3 jp=2,npp
	if (ppde.lt.pe(jp)) goto 6
3	continue
	jp=npp
6	acca=(acc(jp-1,je)*(pe(jp)-ppde)+acc(jp,je)*(ppde-pe(jp-1)))
& 	/(pe(jp)-pe(jp-1))
	accb=(acc(jp-1,ie)*(pe(jp)-ppde)+acc(jp,ie)*(ppde-pe(jp-1)))
& 	/(pe(jp)-pe(jp-1))
	thundr=(accb*(epart-eg(je))+acca*(eg(ie)-epart))/
& 	(eg(ie)-eg(je))
	return
c
	end
