	function calcs(elo,route,resp,bmres)
c     calculates derivative of theory w r t beam momentum
c
	include '/u1/gcf/e350/crystal/cb/wenbin'
c
	include '/u1/gcf/e350/crystal/cb/beam'
c
	include '/u1/gcf/e350/crystal/cb/it'
c
	external resp
	external route
	external bmres
c
	calcs=0.
	do 3 ii=1,2
	ibm=nobeam+ii
	at=0.
	do 2 i=1,noint
	v=val(i,ibm)
	tt=0.
	do 1 k=1,moint
1		tt=tt+wgt1(k,it)*resp(elo+val1(k,it),v)
2		at=at+tt*wgt(i,ibm)*route(v)
3		calcs=at*bmres(pbm(ibm))-calcs
	return
c
	end
