c prog to test s/r ellipse 10 type*,' enter hm,hc 2f5.0' read(5,500) hm,hc type*,' enter edm,ed,dndh 3e10.3' read(5,501) edm,ed,dndh 500 format(3f5.0) 501 format(3e10.3) call ellipse (hm,edm,hc,ed,dndh,xc,yc,a,b) go to 10 end subroutine ellipse (hm,edm,hc,ed,dndh,xc,yc,a,b) c s/r to determine the parameters of an ellipse c [(x-xc)/a]**2 + [(y-yc)/b]**2 = 1 c which is tangential to a layer peak at (hm,edm) and has a c specified electron density (ed) and slope (dndh) at a height hc c c written by leo mcnamara 4-aug-87 c----- last modified 5-aug-87 c dhdn = 1. / dndh type*,' ELLIPSE c/s ',hm,edm,hc,ed,dndh yc = hm t1 = ed - edm t2 = hc - yc t3 = t1 * t2 t4 = dhdn * t1 * t1 type*,' t1,t2,t3,t4 ',t1,t2,t3,t4 top = (ed-edm) * (hc-yc) - dhdn * (ed-edm) ** 2 b1 = hc - yc b2 = 2. * dhdn * (ed - edm) type*,' b1,b2 ',b1,b2 bot = (hc-yc) - 2. * dhdn * (ed-edm) a = top / bot type*,' top,bot,a ',top,bot,a b2 = -a * a * dhdn * (hc-yc) / (ed-edm-a) b = sqrt (b2) xc = edm + a type*,' ELLIPSE results ',xc,yc,a,b c return end