|
gimme-alpha 0.1
|
#include <gsl/gsl_errno.h>#include <gsl/gsl_interp.h>#include <gsl/gsl_spline.h>#include <gsl/gsl_integration.h>#include <math.h>#include <libcommon/gimme-alpha_structs.h>#include <libpostproccalx/alpha_calc.h>#include <libmodeling/wavefunction.h>#include <libcommon/gcc_hints.h>
Include dependency graph for alpha_calc.c:Go to the source code of this file.
Classes | |
| struct | expectation_value_params |
| struct | integration_param |
| struct | integration_param_2 |
Defines | |
| #define | MAX_GSL_INTEGRATION_INTERVALS 4096 |
Functions | |
| __const double | InGaAs_Ep (double x) |
| ___const double | AlInSb_gamma8_bandedge (float x) |
| ___const double | AlInSb_gamma7_bandedge (float x) |
| ___const double | AlInSb_Ep (float x) |
| ___const double | complex_magnitude (double re, double im) |
| double | expectation_value_integrand0 (double x, void *params) |
| double | expectation_value_integrand1 (double x, void *params) |
| double | expectation_value_integrand2 (double x, void *params) |
| double | average_discrete_function (const double *function, const double *x, int N, const struct mstar_wavefunction_1d *wf, short int derivative, double abserr, double relerr, double *err) |
| calculates the expectation value of func in state wf. ARGS: | |
| double * | average_arrays (double *arrays[], int n_arrays, int array_size) |
| char * | find_left_right_of_iface (double iface, int *prev, int *next, double *x, int N) |
| double | alpha_interface_term_mstar_nostrain (const struct mstar_wavefunction_1d *wf, const struct band *hh_band, const struct band *lh_band, const struct band *so_band, const struct band *cb_band, const struct potential *potential, GList *ifs, double Ep) |
| __always_inline double | band_terms (double x, void *params) |
| double | integrand (double x, void *params) |
| __always_inline double | band_terms_del_psi2_method (double x, void *params) |
| __always_inline double | del_psi2 (double x, gsl_spline *re, gsl_interp_accel *re_accel, gsl_spline *im, gsl_interp_accel *im_accel) |
| double | integrand_del_psi2_method (double x, void *params) |
| double | alpha_electric_term_mstar_nostrain (const struct mstar_wavefunction_1d *wf, const struct band *hh_band, const struct band *lh_band, const struct band *so_band, const struct band *cb_band, const struct potential *potential, struct alpha_integrand_verificator *vfp, double *integration_error, double abserr, double relerr, gboolean no_integrate, double Ep) |
| double | alpha_from_del_psi2_nostrain (const struct mstar_wavefunction_1d *wf, const struct band *hh_band, const struct band *lh_band, const struct band *so_band, const struct band *cb_band, const struct potential *potential, struct alpha_integrand_verificator_2 *vfp2, double *integration_error, double abserr, double relerr, gboolean no_integrate, double Ep) |
| GError * | alpha_write_verificator_data (GFile *f, const struct alpha_integrand_verificator *vf) |
| GError * | alpha_write_verificator2_data (GFile *f, const struct alpha_integrand_verificator_2 *vf2) |
| void | alpha_free_verificator_data (struct alpha_integrand_verificator *vf) |
| void | alpha_free_verificator2_data (struct alpha_integrand_verificator_2 *vf2) |
Variables | |
| const double | hbar |
| const double | q_e |
| const double | oo_q_e |
| const double | m_e_0 |
| const double | oo_m_e_0 |
| const double | Ep_InSb = 23.3 |
| const double | Ep_AlSb = 18.7 |
| const double | Gamma8_edge_InSb = 23.3 |
| const double | Gamma8_edge_AlSb = 18.7 |
| const double | Gamma7_edge_InSb = 23.3 |
| const double | Gamma7_edge_AlSb = 18.7 |
| const double | Ep_InAs = 21.5 |
| const double | Ep_GaAs = 28.8 |
Definition in file alpha_calc.c.
| #define MAX_GSL_INTEGRATION_INTERVALS 4096 |
Definition at line 41 of file alpha_calc.c.
Referenced by alpha_electric_term_mstar_nostrain(), alpha_from_del_psi2_nostrain(), and average_discrete_function().
| ___const double AlInSb_Ep | ( | float | x | ) |
| ___const double AlInSb_gamma7_bandedge | ( | float | x | ) |
Definition at line 76 of file alpha_calc.c.
References Gamma7_edge_AlSb, and Gamma7_edge_InSb.
{
return Gamma7_edge_AlSb + (Gamma7_edge_InSb - Gamma7_edge_AlSb)*x;
}
| ___const double AlInSb_gamma8_bandedge | ( | float | x | ) |
Definition at line 72 of file alpha_calc.c.
References Gamma8_edge_AlSb, and Gamma8_edge_InSb.
{
return Gamma8_edge_AlSb + (Gamma8_edge_InSb - Gamma8_edge_AlSb)*x;
}
| double alpha_electric_term_mstar_nostrain | ( | const struct mstar_wavefunction_1d * | wf, |
| const struct band * | hh_band, | ||
| const struct band * | lh_band, | ||
| const struct band * | so_band, | ||
| const struct band * | cb_band, | ||
| const struct potential * | potential, | ||
| struct alpha_integrand_verificator * | vfp, | ||
| double * | integration_error, | ||
| double | abserr, | ||
| double | relerr, | ||
| gboolean | no_integrate, | ||
| double | Ep | ||
| ) |
Definition at line 479 of file alpha_calc.c.
References average_arrays(), alpha_integrand_verificator::avg, integration_param::avg, band_terms(), band::bandedge, integration_param::cb, complex_magnitude(), hbar, integration_param::hh, alpha_integrand_verificator::iface_equiv, integration_param::im, alpha_integrand_verificator::integrand, integrand(), integration_param::lh, MAX_GSL_INTEGRATION_INTERVALS, mstar_wavefunction_1d_repack(), alpha_integrand_verificator::N, mstar_wavefunction_1d::N, potential::N, band::N, alpha_integrand_verificator::oo_avg, oo_m_e_0, alpha_integrand_verificator::oo_sob, alpha_integrand_verificator::pot, integration_param::pot, alpha_integrand_verificator::pot_deriv, potential::potential, alpha_integrand_verificator::prob_density, integration_param::re, integration_param::so, alpha_integrand_verificator::sob, alpha_integrand_verificator::x, potential::x, and band::x.
Referenced by main().
{
/*HH*/
gsl_interp_accel *hh_acc = gsl_interp_accel_alloc();
gsl_spline *hh = gsl_spline_alloc(gsl_interp_akima, hh_band->N);
gsl_spline_init(hh, hh_band->x, hh_band->bandedge, hh_band->N);
/*LH*/
gsl_interp_accel *lh_acc = gsl_interp_accel_alloc();
gsl_spline *lh = gsl_spline_alloc(gsl_interp_akima, lh_band->N);
gsl_spline_init(lh, lh_band->x, lh_band->bandedge, lh_band->N);
/*SO*/
gsl_interp_accel *so_acc = gsl_interp_accel_alloc();
gsl_spline *so = gsl_spline_alloc(gsl_interp_akima, so_band->N);
gsl_spline_init(so, so_band->x, so_band->bandedge, so_band->N);
/*CB*/
gsl_interp_accel *cb_acc = gsl_interp_accel_alloc();
gsl_spline *cb = gsl_spline_alloc(gsl_interp_akima, cb_band->N);
gsl_spline_init(cb, cb_band->x, cb_band->bandedge, cb_band->N);
/*Potential*/
gsl_interp_accel *pot_acc = gsl_interp_accel_alloc();
gsl_spline *pot = gsl_spline_alloc(gsl_interp_akima, potential->N);
gsl_spline_init(pot, potential->x, potential->potential, potential->N);
/*Get the average of the heavy and light holes for now*/
double *arrays[] = {hh_band->bandedge, lh_band->bandedge};
double *avg_array = average_arrays(arrays, 2, hh_band->N);
gsl_interp_accel *avg_acc = gsl_interp_accel_alloc();
gsl_spline *avg = gsl_spline_alloc(gsl_interp_akima, hh_band->N);
gsl_spline_init(avg, hh_band->x, avg_array, hh_band->N);
/*Wavefunction*/
double* repacked_x;
double* repacked_re;
double* repacked_im;
//for(unsigned i=0; i<wf->N; i++) fprintf(stderr, "wf.x=%g wf.re=%g\n", wf->points[i].x, wf->points[i].re);
mstar_wavefunction_1d_repack(wf, &repacked_x, &repacked_re, &repacked_im, 1);
//for(unsigned i=0; i<wf->N; i++) fprintf(stderr, "->repacked_x=%g repacked_re=%g\n", repacked_x[i], repacked_re[i]);
gsl_interp_accel *re_acc = gsl_interp_accel_alloc();
gsl_spline *re = gsl_spline_alloc(gsl_interp_akima, wf->N);
gsl_spline_init(re, repacked_x, repacked_re, wf->N);
gsl_interp_accel *im_acc = gsl_interp_accel_alloc();
gsl_spline *im = gsl_spline_alloc(gsl_interp_akima, wf->N);
gsl_spline_init(im, repacked_x, repacked_im, wf->N);
/*DO THE INTEGRATION*/
struct integration_param parms = {
.re = re,
.re_accel = re_acc,
.im = im,
.im_accel = im_acc,
.hh = hh,
.hh_accel = hh_acc,
.lh = lh,
.lh_accel = lh_acc,
.so = so,
.so_accel = so_acc,
.cb = cb,
.cb_accel = cb_acc,
.avg = avg,
.avg_accel = avg_acc,
.pot = pot,
.pot_accel = pot_acc,
};
gsl_function gsl_func = {
.function = &integrand,
.params = &parms
};
gsl_integration_workspace *w = gsl_integration_workspace_alloc(MAX_GSL_INTEGRATION_INTERVALS);
double alpha;
int status=0;
if(!no_integrate) status = gsl_integration_qag(&gsl_func, repacked_x[0], repacked_x[wf->N-1], abserr, relerr, MAX_GSL_INTEGRATION_INTERVALS, GSL_INTEG_GAUSS61, w, &alpha, integration_error);
if(status != 0) {
fprintf(stderr, "alpha_electric_field_term_mstar_nostrain: ERROR occurred while integrating: %d (%s); returned %g w/error %g. Retrying with GAUSS31\n", status, gsl_strerror(status), alpha, *integration_error);
status = gsl_integration_qag(&gsl_func, repacked_x[0], repacked_x[wf->N-1], abserr, relerr, MAX_GSL_INTEGRATION_INTERVALS, GSL_INTEG_GAUSS31, w, &alpha, integration_error);
if(status != 0) {
fprintf(stderr, "\tFAILED: %d (%s); returned %g w/error %g Retrying with GAUSS15\n", status, gsl_strerror(status), alpha, *integration_error);
status = gsl_integration_qag(&gsl_func, repacked_x[0], repacked_x[wf->N-1], abserr, relerr, MAX_GSL_INTEGRATION_INTERVALS, GSL_INTEG_GAUSS15, w, &alpha, integration_error);
if(status != 0) {
size_t neval;
fprintf(stderr, "\t\tFAILEd: %d (%s); returned %g w/error %g Retrying with non-adaptive Gauss-Kronrod\n", status, gsl_strerror(status), alpha, *integration_error);
status = gsl_integration_qng (&gsl_func, repacked_x[0], repacked_x[wf->N-1], abserr, relerr, &alpha, integration_error, &neval);
if(status != 0) {
fprintf(stderr, "\t\t\tFAILED : %d (%s); returned %g w/error %g (%ld evals)\n", status, gsl_strerror(status), alpha, *integration_error, (long int)neval);
}else{
fprintf(stderr, "\t\t\tSUCCESS: got %g w/error %g (%ld evals)\n", alpha, *integration_error, (long int)neval);
}
}else{
fprintf(stderr, "\t\tSUCCESS: got %g w/error %g\n", alpha, *integration_error);
}
}else{
fprintf(stderr, "\tSUCCESS: got %g w/error %g\n", alpha, *integration_error);
}
}
gsl_integration_workspace_free(w);
/*Save off the verification info, if needed.*/
if(vfp != NULL) {
vfp->N = 5000;
vfp->x = malloc((vfp->N)*sizeof(double));
vfp->prob_density = malloc((vfp->N)*sizeof(double));
vfp->integrand = malloc((vfp->N)*sizeof(double));
vfp->pot_deriv = malloc((vfp->N)*sizeof(double));
vfp->pot = malloc((vfp->N)*sizeof(double));
vfp->iface_equiv = malloc((vfp->N)*sizeof(double));
vfp->sob = malloc((vfp->N)*sizeof(double));
vfp->avg = malloc((vfp->N)*sizeof(double));
vfp->oo_sob = malloc((vfp->N)*sizeof(double));
vfp->oo_avg = malloc((vfp->N)*sizeof(double));
for(int i=0; i<(vfp->N); i++) {
(vfp->x)[i] = (potential->x)[0] + ((potential->x)[potential->N-1] - (potential->x)[0])/vfp->N*i;
(vfp->integrand)[i] = integrand((vfp->x)[i], &parms);
(vfp->prob_density)[i] = complex_magnitude(gsl_spline_eval(re, (vfp->x)[i], re_acc), gsl_spline_eval(im, (vfp->x)[i], im_acc));
(vfp->pot_deriv)[i] = gsl_spline_eval_deriv(pot, (vfp->x)[i], pot_acc);
(vfp->pot)[i] = gsl_spline_eval(pot, (vfp->x)[i], pot_acc);
(vfp->iface_equiv)[i] = band_terms((vfp->x)[i], &parms);
(vfp->sob)[i] = gsl_spline_eval(so, (vfp->x)[i], so_acc);
(vfp->avg)[i] = gsl_spline_eval(avg, (vfp->x)[i], avg_acc);
(vfp->oo_sob)[i] = 1.0/(vfp->sob)[i];
(vfp->oo_avg)[i] = 1.0/(vfp->avg)[i];
}
}
/*De-allocate structures.*/
/*HH*/
gsl_spline_free(hh);
gsl_interp_accel_free(hh_acc);
/*LH*/
gsl_spline_free(lh);
gsl_interp_accel_free(lh_acc);
/*SO*/
gsl_spline_free(so);
gsl_interp_accel_free(so_acc);
/*CB*/
gsl_spline_free(cb);
gsl_interp_accel_free(cb_acc);
/*pot*/
gsl_spline_free(pot);
gsl_interp_accel_free(pot_acc);
/*wavefunc*/
gsl_spline_free(re);
gsl_interp_accel_free(re_acc);
/*HH*/
gsl_spline_free(im);
gsl_interp_accel_free(im_acc);
free(repacked_x);
free(repacked_re);
free(repacked_im);
free(avg);
/*The factor of - is required to convert the volts to eV*/
/*Don't forget to convert nm->m (from the wavefunction)*/
*integration_error *= -hbar*hbar*Ep/6*oo_m_e_0*1e9;
//alpha *= hbar*hbar*22/6*oo_m_e_0*1e9;
alpha *= hbar*hbar*Ep/6*oo_m_e_0*1e9;
return alpha;
}
Here is the call graph for this function:
Here is the caller graph for this function:| void alpha_free_verificator2_data | ( | struct alpha_integrand_verificator_2 * | vf2 | ) |
frees the *data* in a verificator2. The struct itself is still kept (so you can point to a stack-allocated struct safely
Definition at line 863 of file alpha_calc.c.
References alpha_integrand_verificator_2::avg, alpha_integrand_verificator_2::band_term, alpha_integrand_verificator_2::d_prob_density, alpha_integrand_verificator_2::integrand, alpha_integrand_verificator_2::oo_avg, alpha_integrand_verificator_2::oo_sob, alpha_integrand_verificator_2::prob_density, alpha_integrand_verificator_2::sob, and alpha_integrand_verificator_2::x.
{
free(vf2->x);
free(vf2->prob_density);
free(vf2->d_prob_density);
free(vf2->band_term);
free(vf2->sob);
free(vf2->avg);
free(vf2->oo_sob);
free(vf2->oo_avg);
free(vf2->integrand);
}
| void alpha_free_verificator_data | ( | struct alpha_integrand_verificator * | vf | ) |
frees the *data* in a verificator. The struct itself is still kept (so you can point to a stack-allocated struct safely
Definition at line 850 of file alpha_calc.c.
References alpha_integrand_verificator::avg, alpha_integrand_verificator::iface_equiv, alpha_integrand_verificator::integrand, alpha_integrand_verificator::oo_avg, alpha_integrand_verificator::oo_sob, alpha_integrand_verificator::pot, alpha_integrand_verificator::pot_deriv, alpha_integrand_verificator::prob_density, alpha_integrand_verificator::sob, and alpha_integrand_verificator::x.
{
free(vf->x);
free(vf->prob_density);
free(vf->integrand);
free(vf->pot_deriv);
free(vf->iface_equiv);
free(vf->sob);
free(vf->avg);
free(vf->oo_sob);
free(vf->oo_avg);
free(vf->pot);
}
| double alpha_from_del_psi2_nostrain | ( | const struct mstar_wavefunction_1d * | wf, |
| const struct band * | hh_band, | ||
| const struct band * | lh_band, | ||
| const struct band * | so_band, | ||
| const struct band * | cb_band, | ||
| const struct potential * | potential, | ||
| struct alpha_integrand_verificator_2 * | vfp2, | ||
| double * | integration_error, | ||
| double | abserr, | ||
| double | relerr, | ||
| gboolean | no_integrate, | ||
| double | Ep | ||
| ) |
Definition at line 630 of file alpha_calc.c.
References average_arrays(), alpha_integrand_verificator_2::avg, integration_param_2::avg, integration_param::avg, alpha_integrand_verificator_2::band_term, band_terms_del_psi2_method(), band::bandedge, integration_param_2::cb, integration_param::cb, complex_magnitude(), alpha_integrand_verificator_2::d_prob_density, del_psi2(), integration_param_2::Ep, hbar, integration_param_2::hh, integration_param::hh, integration_param_2::im, integration_param::im, alpha_integrand_verificator_2::integrand, integrand_del_psi2_method(), integration_param_2::lh, integration_param::lh, MAX_GSL_INTEGRATION_INTERVALS, mstar_wavefunction_1d_repack(), alpha_integrand_verificator_2::N, mstar_wavefunction_1d::N, potential::N, band::N, alpha_integrand_verificator_2::oo_avg, oo_m_e_0, alpha_integrand_verificator_2::oo_sob, integration_param_2::pot, integration_param::pot, potential::potential, alpha_integrand_verificator_2::prob_density, integration_param_2::re, integration_param::re, integration_param_2::so, integration_param::so, alpha_integrand_verificator_2::sob, alpha_integrand_verificator_2::x, potential::x, and band::x.
Referenced by main().
{
/*HH*/
gsl_interp_accel *hh_acc = gsl_interp_accel_alloc();
gsl_spline *hh = gsl_spline_alloc(gsl_interp_akima, hh_band->N);
gsl_spline_init(hh, hh_band->x, hh_band->bandedge, hh_band->N);
/*LH*/
gsl_interp_accel *lh_acc = gsl_interp_accel_alloc();
gsl_spline *lh = gsl_spline_alloc(gsl_interp_akima, lh_band->N);
gsl_spline_init(lh, lh_band->x, lh_band->bandedge, lh_band->N);
/*SO*/
gsl_interp_accel *so_acc = gsl_interp_accel_alloc();
gsl_spline *so = gsl_spline_alloc(gsl_interp_akima, so_band->N);
gsl_spline_init(so, so_band->x, so_band->bandedge, so_band->N);
/*CB*/
gsl_interp_accel *cb_acc = gsl_interp_accel_alloc();
gsl_spline *cb = gsl_spline_alloc(gsl_interp_akima, cb_band->N);
gsl_spline_init(cb, cb_band->x, cb_band->bandedge, cb_band->N);
/*Potential*/
gsl_interp_accel *pot_acc = gsl_interp_accel_alloc();
gsl_spline *pot = gsl_spline_alloc(gsl_interp_akima, potential->N);
gsl_spline_init(pot, potential->x, potential->potential, potential->N);
/*Get the average of the heavy and light holes for now*/
double *arrays[] = {hh_band->bandedge, lh_band->bandedge};
double *avg_array = average_arrays(arrays, 2, hh_band->N);
gsl_interp_accel *avg_acc = gsl_interp_accel_alloc();
gsl_spline *avg = gsl_spline_alloc(gsl_interp_akima, hh_band->N);
gsl_spline_init(avg, hh_band->x, avg_array, hh_band->N);
/*Wavefunction*/
double* repacked_x;
double* repacked_re;
double* repacked_im;
mstar_wavefunction_1d_repack(wf, &repacked_x, &repacked_re, &repacked_im, 1);
gsl_interp_accel *re_acc = gsl_interp_accel_alloc();
/*gsl_spline *re = gsl_spline_alloc(gsl_interp_cspline, wf->N);*/
gsl_spline *re = gsl_spline_alloc(gsl_interp_akima, wf->N);
gsl_spline_init(re, repacked_x, repacked_re, wf->N);
gsl_interp_accel *im_acc = gsl_interp_accel_alloc();
/*gsl_spline *im = gsl_spline_alloc(gsl_interp_cspline, wf->N);*/
gsl_spline *im = gsl_spline_alloc(gsl_interp_akima, wf->N);
gsl_spline_init(im, repacked_x, repacked_im, wf->N);
/*DO THE INTEGRATION*/
struct integration_param_2 parms = {
.re = re,
.re_accel = re_acc,
.im = im,
.im_accel = im_acc,
.hh = hh,
.hh_accel = hh_acc,
.lh = lh,
.lh_accel = lh_acc,
.so = so,
.so_accel = so_acc,
.cb = cb,
.cb_accel = cb_acc,
.avg = avg,
.avg_accel = avg_acc,
.pot = pot,
.pot_accel = pot_acc,
.Ep = Ep,
.Ep_z = NULL,
.Ep_z_accel = NULL
};
gsl_function gsl_func = {
.function = & integrand_del_psi2_method,
.params = &parms
};
gsl_integration_workspace *w = gsl_integration_workspace_alloc(MAX_GSL_INTEGRATION_INTERVALS);
double alpha;
int status=0;
if(!no_integrate) status = gsl_integration_qag(&gsl_func, repacked_x[0], repacked_x[wf->N-1], abserr, relerr, MAX_GSL_INTEGRATION_INTERVALS, GSL_INTEG_GAUSS61, w, &alpha, integration_error);
if(status != 0) {
fprintf(stderr, "alpha_calc::alpha_from_del_psi2_nostrain: ERROR occurred while integrating: %d (%s)\n", status, gsl_strerror(status));
}
gsl_integration_workspace_free(w);
/*Save off the verification info, if needed.*/
if(vfp2 != NULL) {
vfp2->N = 5000;
vfp2->x = malloc((vfp2->N)*sizeof(double));
vfp2->prob_density = malloc((vfp2->N)*sizeof(double));
vfp2->d_prob_density = malloc((vfp2->N)*sizeof(double));
vfp2->integrand = malloc((vfp2->N)*sizeof(double));
vfp2->sob = malloc((vfp2->N)*sizeof(double));
vfp2->avg = malloc((vfp2->N)*sizeof(double));
vfp2->oo_sob = malloc((vfp2->N)*sizeof(double));
vfp2->oo_avg = malloc((vfp2->N)*sizeof(double));
vfp2->band_term = malloc((vfp2->N)*sizeof(double));
for(int i=0; i<(vfp2->N); i++) {
(vfp2->x)[i] = (potential->x)[0] + ((potential->x)[potential->N-1] - (potential->x)[0])/vfp2->N*i;
(vfp2->integrand)[i] = integrand_del_psi2_method((vfp2->x)[i], &parms);
(vfp2->prob_density)[i] = complex_magnitude(gsl_spline_eval(re, (vfp2->x)[i], re_acc), gsl_spline_eval(im, (vfp2->x)[i], im_acc));
(vfp2->d_prob_density)[i] = del_psi2((vfp2->x)[i], re, re_acc, im, im_acc);
(vfp2->sob)[i] = gsl_spline_eval(so, (vfp2->x)[i], so_acc);
(vfp2->avg)[i] = gsl_spline_eval(avg, (vfp2->x)[i], avg_acc);
(vfp2->oo_sob)[i] = 1.0/(vfp2->sob)[i];
(vfp2->oo_avg)[i] = 1.0/(vfp2->avg)[i];
(vfp2->band_term)[i] = band_terms_del_psi2_method((vfp2->x)[i], &parms);
}
}
/*De-allocate structures.*/
/*HH*/
gsl_spline_free(hh);
gsl_interp_accel_free(hh_acc);
/*LH*/
gsl_spline_free(lh);
gsl_interp_accel_free(lh_acc);
/*SO*/
gsl_spline_free(so);
gsl_interp_accel_free(so_acc);
/*CB*/
gsl_spline_free(cb);
gsl_interp_accel_free(cb_acc);
/*pot*/
gsl_spline_free(pot);
gsl_interp_accel_free(pot_acc);
/*wavefunc*/
gsl_spline_free(re);
gsl_interp_accel_free(re_acc);
/*HH*/
gsl_spline_free(im);
gsl_interp_accel_free(im_acc);
free(repacked_x);
free(repacked_re);
free(repacked_im);
/*The factor of - is required to convert the volts to eV*/
/*Don't forget to convert nm->m (from the wavefunction)*/
*integration_error *= -hbar*hbar*6*oo_m_e_0*1e9;
//alpha *= hbar*hbar*22/6*oo_m_e_0*1e9;
alpha *= hbar*hbar*6*oo_m_e_0*1e9;
return alpha;
}
Here is the call graph for this function:
Here is the caller graph for this function:| double alpha_interface_term_mstar_nostrain | ( | const struct mstar_wavefunction_1d * | wf, |
| const struct band * | hh_band, | ||
| const struct band * | lh_band, | ||
| const struct band * | so_band, | ||
| const struct band * | cb_band, | ||
| const struct potential * | potential, | ||
| GList * | ifs, | ||
| double | Ep | ||
| ) |
Definition at line 262 of file alpha_calc.c.
References average_arrays(), band::bandedge, complex_magnitude(), find_left_right_of_iface(), hbar, expectation_value_params::im, m_e_0, mstar_wavefunction_1d_repack(), mstar_wavefunction_1d::N, potential::N, band::N, potential::potential, expectation_value_params::re, unlikely, potential::x, and band::x.
Referenced by main().
{
double alpha = 0;
int i=0;
/*HH*/
gsl_interp_accel *hh_acc = gsl_interp_accel_alloc();
gsl_spline *hh = gsl_spline_alloc(gsl_interp_akima, hh_band->N);
gsl_spline_init(hh, hh_band->x, hh_band->bandedge, hh_band->N);
/*LH*/
gsl_interp_accel *lh_acc = gsl_interp_accel_alloc();
gsl_spline *lh = gsl_spline_alloc(gsl_interp_akima, lh_band->N);
gsl_spline_init(lh, lh_band->x, lh_band->bandedge, lh_band->N);
/*SO*/
gsl_interp_accel *so_acc = gsl_interp_accel_alloc();
gsl_spline *so = gsl_spline_alloc(gsl_interp_akima, so_band->N);
gsl_spline_init(so, so_band->x, so_band->bandedge, so_band->N);
/*CB*/
gsl_interp_accel *cb_acc = gsl_interp_accel_alloc();
gsl_spline *cb = gsl_spline_alloc(gsl_interp_akima, cb_band->N);
gsl_spline_init(cb, cb_band->x, cb_band->bandedge, cb_band->N);
/*Potential*/
gsl_interp_accel *pot_acc = gsl_interp_accel_alloc();
gsl_spline *pot = gsl_spline_alloc(gsl_interp_akima, potential->N);
gsl_spline_init(pot, potential->x, potential->potential, potential->N);
/*Wavefunction*/
double *repacked_x;
double *repacked_re;
double *repacked_im;
//for(unsigned i=0; i<wf->N; i++) fprintf(stderr, "wf.x=%g wf.re=%g\n", wf->points[i].x, wf->points[i].re);
mstar_wavefunction_1d_repack(wf, &repacked_x, &repacked_re, &repacked_im, 1);
//for(unsigned i=0; i<wf->N; i++) fprintf(stderr, "->repacked_x=%g repacked_re=%g\n", repacked_x[i], repacked_re[i]);
gsl_interp_accel *re_acc = gsl_interp_accel_alloc();
gsl_spline *re = gsl_spline_alloc(gsl_interp_akima, wf->N);
gsl_spline_init(re, repacked_x, repacked_re, wf->N);
gsl_interp_accel *im_acc = gsl_interp_accel_alloc();
gsl_spline *im = gsl_spline_alloc(gsl_interp_akima, wf->N);
gsl_spline_init(im, repacked_x, repacked_im, wf->N);
/*Evaluate at the interfaces*/
double *arrays[] = {hh_band->bandedge, lh_band->bandedge};
double *avg = average_arrays(arrays, 2, hh_band->N);
int prev=0, next=0;
char* err;
/*We don't need to keep track of the sign of the interface; that's
*preserved from the definition of A and B; we just blindly use prev
*and next; see epsilon_7^A and friends below for why*/
double avg_p;
double avg_n;
double so_p;
double so_n;
double pot_p;
double pot_n;
/*the 0-point of energies reported in the printf below*/
int zero_index_prev=0, zero_index_next=0;
double relative_to;
if(unlikely((err = find_left_right_of_iface(0, &zero_index_prev, &zero_index_next, hh_band->x, hh_band->N)) != NULL)) {
fprintf(stderr, "WARNING: diagnostic print band structure is going to be relative to 0 (E_Fermi) (err=%s)\n", err);
relative_to=0;
}else{
/*Average prev and next if there's no actual point at 0.*/
if((zero_index_prev + 1) == zero_index_next) {
relative_to = (((cb_band->bandedge)[zero_index_prev+1]) + ((cb_band->bandedge)[zero_index_prev+1]))*0.5;
}else{
relative_to = (cb_band->bandedge)[zero_index_prev+1];
}
}
for(GList *i=g_list_first(ifs); i!=NULL; i=g_list_next(i)) {
if(unlikely((err = find_left_right_of_iface(*((double*)(i->data)), &prev, &next, hh_band->x, hh_band->N)) != NULL)) {
fprintf(stderr, "ERROR when getting prev/next indices for interface at %g: %s\n", *((double*)(i->data)), err);
return -0;
}
/*
epsilon_7^A is so_band->bandedge)[next]
epsilon_7^B is (so_band->bandedge)[prev]
epsilon_8^A is avg[prev]
epsilon_8^B is avg[next]
delta_7 = epsilon_7^B - epsilon_7^A
= (so_band->bandedge)[next] - (so_band->bandedge)[prev]
delta_8 = epsilon_8^B - epsilon_8^A
= avg[next] - avg[prev]
NOTE that the above have the potential still in them!
*/
avg_p = avg[prev];
avg_n = avg[next];
so_p = (so_band->bandedge)[prev];
so_n = (so_band->bandedge)[next];
pot_p = (potential->potential)[prev];
pot_n = (potential->potential)[next];
//fprintf(stderr, "%g: d_avg=%g d_so=%g avg_n=%g avg_p=%g so_n=%g so_p=%g pot_n=%g pot_p=%g mag=%g (rel=%g)\n", *((double*)(i->data)), ((avg_n+pot_n)-(avg_p+pot_p)), ((so_n+pot_n)-(so_p+pot_p)), (avg_n-relative_to), (avg_p-relative_to), (so_n-relative_to), (so_p-relative_to), (pot_n), (pot_p), complex_magnitude(gsl_spline_eval(re, *((double*)(i->data)), re_acc), gsl_spline_eval(im, *((double*)(i->data)), im_acc)), relative_to);
alpha += complex_magnitude(gsl_spline_eval(re, *((double*)(i->data)), re_acc), gsl_spline_eval(im, *((double*)(i->data)), im_acc))
*(
((so_n+pot_n)-(so_p+pot_p))*(1.0/((so_n)*(so_n))+1.0/((so_p)*(so_p)))
-((avg_n+pot_n)-(avg_p+pot_p))*(1.0/((avg_n)*(avg_n))+1.0/((avg_p)*(avg_p)))
);
}
/*De-allocate structures.*/
/*HH*/
gsl_spline_free(hh);
gsl_interp_accel_free(hh_acc);
/*LH*/
gsl_spline_free(lh);
gsl_interp_accel_free(lh_acc);
/*SO*/
gsl_spline_free(so);
gsl_interp_accel_free(so_acc);
/*CB*/
gsl_spline_free(cb);
gsl_interp_accel_free(cb_acc);
/*pot*/
gsl_spline_free(pot);
gsl_interp_accel_free(pot_acc);
/*wavefunc*/
gsl_spline_free(re);
gsl_interp_accel_free(re_acc);
/*HH*/
gsl_spline_free(im);
gsl_interp_accel_free(im_acc);
free(repacked_x);
free(repacked_re);
free(repacked_im);
free(avg);
/*NOTE that the one-half from the summation has been absorbed into here.*/
/*NOTE that the minus sign comes from the definitions of
delta_gamma_x and S_n. See notebook on April 28, 2009*/
/*Don't forget to convert nm->m (from the wavefunction)*/
//alpha *= hbar*hbar*22/12/m_e_0*1e9; /*22eV, from the paper*/
alpha *= hbar*hbar*Ep/12/m_e_0*1e9; /*22eV, from the paper*/
return alpha;
}
Here is the call graph for this function:
Here is the caller graph for this function:| GError* alpha_write_verificator2_data | ( | GFile * | f, |
| const struct alpha_integrand_verificator_2 * | vf2 | ||
| ) |
Definition at line 805 of file alpha_calc.c.
References alpha_integrand_verificator_2::avg, alpha_integrand_verificator_2::band_term, alpha_integrand_verificator_2::d_prob_density, alpha_integrand_verificator_2::integrand, alpha_integrand_verificator_2::N, alpha_integrand_verificator_2::oo_avg, alpha_integrand_verificator_2::oo_sob, alpha_integrand_verificator_2::prob_density, alpha_integrand_verificator_2::sob, str, and alpha_integrand_verificator_2::x.
Referenced by main().
{
GError *gerror = NULL;
GFileOutputStream *os = g_file_replace(f, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &gerror);
if(os == NULL) {
GError *e = NULL;
g_propagate_prefixed_error(&e, gerror, "ERROR when opening method 2 instrumentation file for writing");
return e;
}
GString *str = g_string_new("");
GDataOutputStream *gdos = g_data_output_stream_new((GOutputStream*)os);
g_string_printf(str, "#x(nm)\tprob_density(1/nm)\td_dz prob_density\tintegrand(1/(ev^2 nm))\tsplit-off (eV)\taverged HH,LH (eV)\t1/split-off (1/eV)\t1/averaged (1/eV)\tband terms (1eV)\n");
g_data_output_stream_put_string(gdos, str->str, NULL, &gerror);
if(gerror != NULL) {
GError *e = NULL;
g_propagate_prefixed_error(&e, gerror, "ERROR when writing method 2 instrumentation file header");
g_object_unref(os);
g_object_unref(gdos);
g_string_free(str, TRUE);
return e;
}
int N;
N = vf2->N;
for(int i=0; i<N; i++) {
g_string_printf(str, "%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\n", (vf2->x)[i], (vf2->prob_density)[i], (vf2->d_prob_density)[i], (vf2->integrand)[i], (vf2->sob)[i], (vf2->avg)[i], (vf2->oo_sob)[i], (vf2->oo_avg)[i], (vf2->band_term)[i]);
g_data_output_stream_put_string(gdos, str->str, NULL, &gerror);
if(gerror != NULL) {
GError *e = NULL;
g_propagate_prefixed_error(&e, gerror, "ERROR when writing method 2 instrumentation file header (Missing line would have been:%s)", str->str);
g_object_unref(os);
g_object_unref(gdos);
g_string_free(str, TRUE);
return e;
}
}
g_output_stream_close(G_OUTPUT_STREAM(gdos), NULL, &gerror);
if(gerror != NULL) {
GError *e = NULL;
g_propagate_prefixed_error(&e, gerror, "ERROR when closing method 2 instrumentation output stream.\n");
}
g_object_unref(gdos);
g_object_unref(os);
g_string_free(str, TRUE);
return NULL;
}
Here is the caller graph for this function:| GError* alpha_write_verificator_data | ( | GFile * | f, |
| const struct alpha_integrand_verificator * | vf | ||
| ) |
Definition at line 761 of file alpha_calc.c.
References alpha_integrand_verificator::avg, alpha_integrand_verificator::iface_equiv, alpha_integrand_verificator::integrand, alpha_integrand_verificator::N, alpha_integrand_verificator::oo_avg, alpha_integrand_verificator::oo_sob, alpha_integrand_verificator::pot, alpha_integrand_verificator::pot_deriv, alpha_integrand_verificator::prob_density, alpha_integrand_verificator::sob, str, and alpha_integrand_verificator::x.
Referenced by main().
{
GError *gerror = NULL;
GFileOutputStream *os = g_file_replace(f, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &gerror);
if(os == NULL) {
GError *e = NULL;
g_propagate_prefixed_error(&e, gerror, "ERROR when opening alpha_efield instrumentation file for writing");
return e;
}
GString *str = g_string_new("");
GDataOutputStream *gdos = g_data_output_stream_new((GOutputStream*)os);
g_string_printf(str, "#x(nm)\tprob_density(1/nm)\tintegrand(1/(ev^2 nm))\tpot_deriv(v/nm)\tband_terms(1/ev^2)\tsplit-off (eV)\taverged HH,LH (eV)\t1/split-off (1/eV)\t1/averaged (1/eV)\tPotential (eV)\n");
g_data_output_stream_put_string(gdos, str->str, NULL, &gerror);
if(gerror != NULL) {
GError *e = NULL;
g_propagate_prefixed_error(&e, gerror, "ERROR when writing alpha_efield instrumentation file header");
g_object_unref(os);
g_object_unref(gdos);
g_string_free(str, TRUE);
return e;
}
int N;
N = vf->N;
for(int i=0; i<N; i++) {
g_string_printf(str, "%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\n", (vf->x)[i], (vf->prob_density)[i], (vf->integrand)[i], (vf->pot_deriv)[i], (vf->iface_equiv)[i], (vf->sob)[i], (vf->avg)[i], (vf->oo_sob)[i], (vf->oo_avg)[i], (vf->pot)[i]);
g_data_output_stream_put_string(gdos, str->str, NULL, &gerror);
if(gerror != NULL) {
GError *e = NULL;
g_propagate_prefixed_error(&e, gerror, "ERROR when writing alpha_efield instrumentation file header (Missing line would have been:%s)", str->str);
g_object_unref(os);
g_object_unref(gdos);
g_string_free(str, TRUE);
return e;
}
}
g_output_stream_close(G_OUTPUT_STREAM(gdos), NULL, &gerror);
if(gerror != NULL) {
GError *e = NULL;
g_propagate_prefixed_error(&e, gerror, "ERROR when closing alpha_efield instrumentation output stream.\n");
}
g_object_unref(gdos);
g_object_unref(os);
g_string_free(str, TRUE);
return NULL;
}
Here is the caller graph for this function:| double* average_arrays | ( | double * | arrays[], |
| int | n_arrays, | ||
| int | array_size | ||
| ) |
Averages n_arrays of array_size doubles.
| arrays | pointer to an array of arrays of doubles |
| n_arrays | number of arrays given |
| array_size | the size of the arrays stored in arrays. |
Definition at line 203 of file alpha_calc.c.
References unlikely.
Referenced by alpha_electric_term_mstar_nostrain(), alpha_from_del_psi2_nostrain(), alpha_interface_term_mstar_nostrain(), and check_average_arrays().
{
if(unlikely(arrays == NULL)) return NULL;
double *avg = malloc(sizeof(double)*array_size);
if(unlikely(avg == NULL)) return NULL;
if(unlikely(n_arrays < 1)) {
free(avg);
return NULL;
}
register int i;
for(i=0; i<array_size; i++) {
avg[i] = (arrays[0])[i];
//fprintf(stderr, "(arrays[0])[%d]=%g\tavg[%d]=%g\n", i, (arrays[0])[i], i, avg[i]);
}
for(i=1; i<n_arrays; i++) {
for(int j=0; j<array_size; j++) {
avg[j] += (arrays[i])[j];
//fprintf(stderr, "(arrays[%d])[%d]=%g\tavg[%d]=%g\n", i, j, (arrays[i])[j], i, avg[j]);
}
}
for(i=0; i<array_size; i++) {
avg[i] /= n_arrays;
}
return avg;
}
Here is the caller graph for this function:| double average_discrete_function | ( | const double * | function, |
| const double * | x, | ||
| int | N, | ||
| const struct mstar_wavefunction_1d * | wf, | ||
| short int | derivative, | ||
| double | abserr, | ||
| double | relerr, | ||
| double * | err | ||
| ) |
calculates the expectation value of func in state wf. ARGS:
| function,: | array of N doubles containing the function. : array of N doubles containing the x points at which function was sampled |
| N,: | the numnber of points in discrete function function. |
| wf,: | pointer to an mstar_wavefunction_1d structure containing |
| derivative,: | which derivative, if any, to use in evaluating the function, e.g. derivative=1 -> find the expectation value of the first derivative of function in state wf. |
| abserr | largest acceptable absolute integration error (GSL) |
| relerr | largest acceptable relative integration error (GSL) |
| err | pointer to a double to store the value of the (GSL) estimated integration error. RETURNS: The expectation value of the derivative-th derivative of function in state wf. NOTE: function must ONLY be a function of x! NOTE: only up to second derivative is supported. |
Definition at line 140 of file alpha_calc.c.
References expectation_value_integrand0(), expectation_value_integrand1(), expectation_value_integrand2(), expectation_value_params::func_accel, expectation_value_params::im, expectation_value_params::im_accel, MAX_GSL_INTEGRATION_INTERVALS, mstar_wavefunction_1d_repack(), mstar_wavefunction_1d::N, expectation_value_params::re, and expectation_value_params::re_accel.
Referenced by avg_discrete_func_gaussian_1(), avg_discrete_func_gaussian_x(), and main().
{
gsl_interp_accel *func_accel = gsl_interp_accel_alloc();
gsl_spline *func = gsl_spline_alloc(gsl_interp_akima, N);
gsl_spline_init(func, x, function, N);
/*Wavefunction*/
double *repacked_x;
double *repacked_re;
double *repacked_im;
mstar_wavefunction_1d_repack(wf, &repacked_x, &repacked_re, &repacked_im, 1);
gsl_interp_accel *re_accel = gsl_interp_accel_alloc();
gsl_spline *re = gsl_spline_alloc(gsl_interp_akima, wf->N);
gsl_spline_init(re, repacked_x, repacked_re, wf->N);
gsl_interp_accel *im_accel = gsl_interp_accel_alloc();
gsl_spline *im = gsl_spline_alloc(gsl_interp_akima, wf->N);
gsl_spline_init(im, repacked_x, repacked_im, wf->N);
struct expectation_value_params expectation_value_params = {
.re_accel = re_accel,
.im_accel = im_accel,
.func_accel = func_accel,
.re = re,
.im = im,
.func = func
};
gsl_function gsl_func = {
.function = &expectation_value_integrand0,
.params = &expectation_value_params
};
double e_val;
double status=0;
gsl_integration_workspace *w = gsl_integration_workspace_alloc(MAX_GSL_INTEGRATION_INTERVALS);
switch(derivative) {
case 0:
gsl_func.function = &expectation_value_integrand0;
break;
case 1:
gsl_func.function = &expectation_value_integrand1;
break;
case 2:
gsl_func.function = &expectation_value_integrand2;
break;
default:
return nan("char-sequence");
}
/*Here's where we do the integration.*/
status = gsl_integration_qag(&gsl_func, repacked_x[0], repacked_x[wf->N-1], abserr, relerr, MAX_GSL_INTEGRATION_INTERVALS, GSL_INTEG_GAUSS61, w, &e_val, err);
gsl_spline_free(re);
gsl_spline_free(im);
gsl_spline_free(func);
gsl_interp_accel_free(re_accel);
gsl_interp_accel_free(im_accel);
gsl_interp_accel_free(func_accel);
free(repacked_x);
free(repacked_re);
free(repacked_im);
return e_val;
}
Here is the call graph for this function:
Here is the caller graph for this function:| __always_inline double band_terms | ( | double | x, |
| void * | params | ||
| ) |
Definition at line 438 of file alpha_calc.c.
Referenced by alpha_electric_term_mstar_nostrain(), and integrand().
{
//register double pot = gsl_spline_eval(((struct integration_param*)params)->pot, x, ((struct integration_param*)params)->pot_accel);
double avg = (gsl_spline_eval(((struct integration_param*)params)->avg, x, ((struct integration_param*)params)->avg_accel));
double so = (gsl_spline_eval(((struct integration_param*)params)->so, x, ((struct integration_param*)params)->so_accel));
return (1.0/(so*so) - 1.0/(avg*avg));
}
Here is the caller graph for this function:| __always_inline double band_terms_del_psi2_method | ( | double | x, |
| void * | params | ||
| ) |
Definition at line 453 of file alpha_calc.c.
Referenced by alpha_from_del_psi2_nostrain(), and integrand_del_psi2_method().
{
//register double pot = gsl_spline_eval(((struct integration_param_2*)params)->pot, x, ((struct integration_param_2*)params)->pot_accel);
double avg = (gsl_spline_eval(((struct integration_param_2*)params)->avg, x, ((struct integration_param_2*)params)->avg_accel));
double so = (gsl_spline_eval(((struct integration_param_2*)params)->so, x, ((struct integration_param_2*)params)->so_accel));
return (1.0/so - 1.0/avg);
}
Here is the caller graph for this function:| ___const double complex_magnitude | ( | double | re, |
| double | im | ||
| ) |
Definition at line 84 of file alpha_calc.c.
Referenced by alpha_electric_term_mstar_nostrain(), alpha_from_del_psi2_nostrain(), alpha_interface_term_mstar_nostrain(), expectation_value_integrand0(), expectation_value_integrand1(), and expectation_value_integrand2().
Here is the caller graph for this function:| __always_inline double del_psi2 | ( | double | x, |
| gsl_spline * | re, | ||
| gsl_interp_accel * | re_accel, | ||
| gsl_spline * | im, | ||
| gsl_interp_accel * | im_accel | ||
| ) |
Definition at line 461 of file alpha_calc.c.
Referenced by alpha_from_del_psi2_nostrain(), and integrand_del_psi2_method().
{
//fprintf(stderr, "%g: %g->%g %g->%g\n", x, gsl_spline_eval(re, x, re_accel), gsl_spline_eval_deriv(re, x, re_accel), gsl_spline_eval(im, x, im_accel), gsl_spline_eval_deriv(im, x, im_accel));
return 2*(gsl_spline_eval(re, x, re_accel)*gsl_spline_eval_deriv(re, x, re_accel) + gsl_spline_eval(im, x, im_accel)*gsl_spline_eval_deriv(im, x, im_accel));
}
Here is the caller graph for this function:| double expectation_value_integrand0 | ( | double | x, |
| void * | params | ||
| ) |
Definition at line 102 of file alpha_calc.c.
References complex_magnitude().
Referenced by average_discrete_function().
{
return complex_magnitude(
gsl_spline_eval(((struct expectation_value_params*)params)->re, x, ((struct expectation_value_params*)params)->re_accel),
gsl_spline_eval(((struct expectation_value_params*)params)->im, x, ((struct expectation_value_params*)params)->im_accel)
)*gsl_spline_eval(((struct expectation_value_params*)params)->func, x, ((struct expectation_value_params*)params)->func_accel);
}
Here is the call graph for this function:
Here is the caller graph for this function:| double expectation_value_integrand1 | ( | double | x, |
| void * | params | ||
| ) |
Definition at line 108 of file alpha_calc.c.
References complex_magnitude().
Referenced by average_discrete_function().
{
return complex_magnitude(
gsl_spline_eval(((struct expectation_value_params*)params)->re, x, ((struct expectation_value_params*)params)->re_accel),
gsl_spline_eval(((struct expectation_value_params*)params)->im, x, ((struct expectation_value_params*)params)->im_accel)
)*gsl_spline_eval_deriv(((struct expectation_value_params*)params)->func, x, ((struct expectation_value_params*)params)->func_accel);
}
Here is the call graph for this function:
Here is the caller graph for this function:| double expectation_value_integrand2 | ( | double | x, |
| void * | params | ||
| ) |
Definition at line 114 of file alpha_calc.c.
References complex_magnitude().
Referenced by average_discrete_function().
{
return complex_magnitude(
gsl_spline_eval(((struct expectation_value_params*)params)->re, x, ((struct expectation_value_params*)params)->re_accel),
gsl_spline_eval(((struct expectation_value_params*)params)->im, x, ((struct expectation_value_params*)params)->im_accel)
)*gsl_spline_eval_deriv2(((struct expectation_value_params*)params)->func, x, ((struct expectation_value_params*)params)->func_accel);
}
Here is the call graph for this function:
Here is the caller graph for this function:| char* find_left_right_of_iface | ( | double | iface, |
| int * | prev, | ||
| int * | next, | ||
| double * | x, | ||
| int | N | ||
| ) |
Finds the points to the left and right of the specified interface
| iface | interface point |
| prev | pointer to an int to store the index of the previous point |
| next | Same, but the next point |
| x | array of x values, assumed to be sorted from smallest to largest |
| N | number of points in the x array |
Definition at line 236 of file alpha_calc.c.
References unlikely.
Referenced by alpha_interface_term_mstar_nostrain().
{
register int i;
for(i=0; i<N; i++) {
if(x[i] >= iface) {
*prev = i-1;
if(x[i] == iface) {
//fprintf(stderr, "=(p=%i, n=%i, %g==%g [%g < %g])\n", *prev, *next, x[i], iface, x[*prev], iface);
*next = i+1;
}else{
//fprintf(stderr, ">(p=%i, n=%i, %g>%g [%g < %g])\n", *prev, *next, x[i], iface, x[*prev], iface);
*next = i;
}
break;
}
//fprintf(stderr, ".");
}
if(unlikely((i == N) || (*prev < 0) || (*next >= N))) {
//fprintf(stderr, "E\n");
if(i == N) return "specified interface not in structure";
if(*prev < 0) return "specified interface is the start of the structure";
if(*next >= N) return "specified interface is the end of the structure";
}
return NULL;
}
Here is the caller graph for this function:| __const double InGaAs_Ep | ( | double | x | ) |
| double integrand | ( | double | x, |
| void * | params | ||
| ) |
Definition at line 446 of file alpha_calc.c.
References band_terms().
Referenced by alpha_electric_term_mstar_nostrain().
{
register double re = gsl_spline_eval(((struct integration_param*)params)->re, x, ((struct integration_param*)params)->re_accel);
register double im = gsl_spline_eval(((struct integration_param*)params)->im, x, ((struct integration_param*)params)->im_accel);
register double ef = gsl_spline_eval_deriv(((struct integration_param*)params)->pot, x, ((struct integration_param*)params)->pot_accel);
return ef*(re*re + im*im)*band_terms(x, params);
}
Here is the call graph for this function:
Here is the caller graph for this function:| double integrand_del_psi2_method | ( | double | x, |
| void * | params | ||
| ) |
Definition at line 467 of file alpha_calc.c.
References band_terms_del_psi2_method(), and del_psi2().
Referenced by alpha_from_del_psi2_nostrain().
{
if(((struct integration_param_2*)params)->Ep_z == NULL) {
return (((struct integration_param_2*)params)->Ep)
*del_psi2(x, ((struct integration_param_2*)params)->re, ((struct integration_param_2*)params)->re_accel, ((struct integration_param_2*)params)->im, ((struct integration_param_2*)params)->im_accel)
*band_terms_del_psi2_method(x, params);
}else{
return gsl_spline_eval(((struct integration_param_2*)params)->Ep_z, x, ((struct integration_param_2*)params)->Ep_z_accel)
*del_psi2(x, ((struct integration_param_2*)params)->re, ((struct integration_param_2*)params)->re_accel, ((struct integration_param_2*)params)->im, ((struct integration_param_2*)params)->im_accel)
*band_terms_del_psi2_method(x, params);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| const double Ep_AlSb = 18.7 |
Definition at line 53 of file alpha_calc.c.
Referenced by AlInSb_Ep().
| const double Ep_GaAs = 28.8 |
Definition at line 65 of file alpha_calc.c.
Referenced by InGaAs_Ep().
| const double Ep_InAs = 21.5 |
Definition at line 64 of file alpha_calc.c.
Referenced by InGaAs_Ep().
| const double Ep_InSb = 23.3 |
Definition at line 51 of file alpha_calc.c.
Referenced by AlInSb_Ep().
| const double Gamma7_edge_AlSb = 18.7 |
Definition at line 61 of file alpha_calc.c.
Referenced by AlInSb_gamma7_bandedge().
| const double Gamma7_edge_InSb = 23.3 |
Definition at line 59 of file alpha_calc.c.
Referenced by AlInSb_gamma7_bandedge().
| const double Gamma8_edge_AlSb = 18.7 |
Definition at line 57 of file alpha_calc.c.
Referenced by AlInSb_gamma8_bandedge().
| const double Gamma8_edge_InSb = 23.3 |
Definition at line 55 of file alpha_calc.c.
Referenced by AlInSb_gamma8_bandedge().
| const double hbar |
| const double m_e_0 |
Definition at line 24 of file consts.c.
Referenced by alpha_interface_term_mstar_nostrain().
| const double oo_m_e_0 |
Definition at line 25 of file consts.c.
Referenced by alpha_electric_term_mstar_nostrain(), and alpha_from_del_psi2_nostrain().
| const double q_e |