Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/build_bfree_tr.pro'
;+
; NAME:
;	Build_BFree_Tr
; PURPOSE:
;	Build bound-free transitions from selected energy Levels to the
;	ionization continuum by creating an approximate/simplified
;	photo-ionization cross-section for each selected Level.
;	Accomplished interactively with the widget: Approx_Xsecs.
; CALLING:
;	Build_BFree_Tr, ELevs, BFree_Trans
;
; INPUT & OUTPUT:	All thru common blocks:
;
;	ELevs = array of structures with tags for energy of level,
;		quantum numbers, and handles pointing to
;		full and approximate photo-ionization cross-sections.
;		Updated with new approximate photo-ionization cross-sections,
;		(full cross-sections are unchanged).
;
; COMMON BLOCKS:
;	see file: ~/modion/code/modion_common.pro
; EXTERNAL CALLS:
;	function N_struct
;	function Approx_Xsecs	(~/modion/code/widgets/approx_xsecs.pro)
;	pro Modion_Status
; PROCEDURE:
;	Just call Approx_Xsecs widget and then check the "disp" tag for changes.
; HISTORY:
;	Written: Frank Varosi NASA/GSFC 1995.
;-

pro Build_BFree_Tr

@modion_common

	if N_struct( ELevs ) LE 0 then return

	Lsel = where( ELevs.Sel AND $
			(ELevs.group EQ 0) AND (ELevs.N GT 0), nsel )

	if (nsel LE 0) then begin
		Modion_Status,"no Levels are selected!",/APPEND
		return
	   endif

	BFree_Trans = ELevs(Lsel)
	base = Approx_Xsecs( BFree_Trans, ion_info, /MODAL )

	w = where( BFree_Trans.disp, nmod )

	if (nmod GT 0) then begin
		Lw = Lsel(w)
		ELevs(Lw).npx = BFree_Trans(w).npx
		ELevs(Lw).disp = BFree_Trans(w).disp
		ELevs(Lw).edge_xsec = BFree_Trans(w).edge_xsec
		ELevs(Lw).freq_approx = BFree_Trans(w).freq_approx
		ELevs(Lw).xsec_approx = BFree_Trans(w).xsec_approx
	   endif

	if (nmod EQ 1) then mess = " approx. single-Level X-sec was modified" $
			else mess = " approx. single-Level X-secs were modified"

	Modion_Status, strtrim( nmod,2 ) + mess
end