dustem_run.pro 1.47 KB
FUNCTION dustem_run,params,help=help,use_previous_fortran=use_previous_fortran

;+
; NAME:
;    dustem_run
;
; PURPOSE:
;    Runs the DUSTEM code and returns the results into a structure.
;
; CATEGORY:
;    DustEMWrap, Distributed, Mid-Level, Fortran
;
; CALLING SEQUENCE:
;    st=dustem_run(params[,/help])
;
; INPUTS:
;    params = model parameter values
;
; OPTIONAL INPUT PARAMETERS:
;    None
;
; OUTPUTS:
;    st: output structure
;
; OPTIONAL OUTPUT PARAMETERS:
;    None
;
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
;    use_previous_fortran = if set, uses the output of the previous fortran run, and does not run the fortran.
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;    None
;
; RESTRICTIONS:
;    The DustEM fortran code must be installed
;    The DustEMWrap idl code must be installed
;
; PROCEDURE:
;    None
;
; EXAMPLES
;    st=dustem_run(params)
;
; MODIFICATION HISTORY:
;    Written by JPB 2007
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
;-

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_run'
  st=0.
  goto,the_end
ENDIF

CASE n_params() OF
  0: BEGIN
     END
  1: BEGIN
       dustem_set_params,params
     END
  ELSE: BEGIN
    message,'usage: st=dustem_run([params])',/info
    st=0
    GOTO,the_end
  END
ENDCASE

IF not keyword_set(use_previous_fortran) THEN BEGIN
  spawn,!dustem_f90_exec
  ;stop
ENDIF
st=dustem_read_all_res(!dustem_res,/silent)


the_end:

RETURN,st
  
END