17#include "marley/coulomb_wavefunctions.hh"
18#include "builtin/marley_gsl.hh"
19#include "marley/Logger.hh"
21std::complex< double > coulomb_H_plus(
int l,
double eta,
double rho ) {
27 auto* previous_handler = gsl_set_error_handler( &marley_gsl_error_handler );
30 gsl_sf_result F, Fp, G, Gp;
32 int code = gsl_sf_coulomb_wave_FG_e( eta, rho,
static_cast<double>(l), 0,
33 &F, &Fp, &G, &Gp, &exp_F, &exp_G );
37 std::complex< double > result;
39 if ( code == GSL_EOVRFLW ) {
40 double Fl = F.val * std::exp( exp_F );
41 double Gl = G.val * std::exp( exp_G );
42 result = std::complex<double>( Gl, Fl );
45 result = std::complex<double>( G.val, F.val );
50 gsl_set_error_handler( previous_handler );
57void marley_gsl_error_handler(
const char* reason,
const char* file,
int line,
62 if ( gsl_errno == GSL_EOVRFLW )
return;
64 MARLEY_LOG( ERROR,
"physics.formfactor" ) <<
"GSL error: " << reason
65 <<
" in file " << file
66 <<
" at line " << line <<
" with error code " << gsl_errno;