	function emaxm(ptsq,ce,cf,ss,pp)
c     calculates the maximum energy kinematically allowed for pperp-squared
c     of ptsq for beam momentum
c
	include '/u1/gcf/e350/crystal/cb/beam'
c
	emaxm=(-ce+sqrt(ce*ce-4.*ss*(cf+pp*ptsq)))*.5/ss
	return
c
	end
