|
gimme-alpha 0.1
|
00001 /** @file */ 00002 /* 00003 ** alpha_calc.c 00004 ** 00005 ** made by (Johnny Q. Hacker) 00006 ** Login <solarion@borkborkbork> 00007 00008 Copyright (C) 2009 Joseph Pingenot 00009 00010 This program is free software: you can redistribute it and/or modify 00011 it under the terms of the GNU Affero General Public License as published by 00012 the Free Software Foundation, either version 3 of the License, or 00013 (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU Affero General Public License for more details. 00019 00020 You should have received a copy of the GNU Affero General Public License 00021 along with this program. If not, see 00022 <http://www.gnu.org/licenses/>. 00023 00024 Equation is based off of JApplPhys_83_4324 00025 00026 ** Started on Fri Mar 6 11:22:01 2009 Johnny Q. Hacker 00027 ** Last update Wed Oct 7 15:15:00 2009 Johnny Q. Hacker 00028 */ 00029 00030 #include <gsl/gsl_errno.h> 00031 #include <gsl/gsl_interp.h> 00032 #include <gsl/gsl_spline.h> 00033 #include <gsl/gsl_integration.h> 00034 #include <math.h> 00035 #include <libcommon/gimme-alpha_structs.h> 00036 #include <libpostproccalx/alpha_calc.h> 00037 #include <libmodeling/wavefunction.h> 00038 #include <libcommon/gcc_hints.h> 00039 00040 /*Argument to the GSL integration workspace allocation calls*/ 00041 #define MAX_GSL_INTEGRATION_INTERVALS 4096 00042 00043 00044 extern const double hbar; 00045 extern const double q_e; 00046 extern const double oo_q_e; 00047 extern const double m_e_0; 00048 extern const double oo_m_e_0; 00049 00050 /*eV, for InSb*/ 00051 const double Ep_InSb=23.3; 00052 /*eV, for AlSb*/ 00053 const double Ep_AlSb=18.7; 00054 /*eV, for InSb*/ 00055 const double Gamma8_edge_InSb=23.3; 00056 /*eV, for AlSb*/ 00057 const double Gamma8_edge_AlSb=18.7; 00058 /*eV, for InSb*/ 00059 const double Gamma7_edge_InSb=23.3; 00060 /*eV, for AlSb*/ 00061 const double Gamma7_edge_AlSb=18.7; 00062 00063 /*For the InGaAs; eV*/ 00064 const double Ep_InAs=21.5; 00065 const double Ep_GaAs=28.8; 00066 00067 /*x is % InAs*/ 00068 __const double InGaAs_Ep(double x) { 00069 return Ep_GaAs + (Ep_InAs - Ep_GaAs)*x; 00070 } 00071 00072 ___const double AlInSb_gamma8_bandedge(float x) { 00073 return Gamma8_edge_AlSb + (Gamma8_edge_InSb - Gamma8_edge_AlSb)*x; 00074 } 00075 00076 ___const double AlInSb_gamma7_bandedge(float x) { 00077 return Gamma7_edge_AlSb + (Gamma7_edge_InSb - Gamma7_edge_AlSb)*x; 00078 } 00079 00080 ___const double AlInSb_Ep(float x) { 00081 return Ep_AlSb + (Ep_InSb - Ep_AlSb)*x; 00082 } 00083 00084 ___const double complex_magnitude(double re, double im) { 00085 return re*re + im*im; 00086 } 00087 00088 /*Information for the gsl integration callback.*/ 00089 struct expectation_value_params { 00090 gsl_interp_accel *re_accel; 00091 gsl_interp_accel *im_accel; 00092 gsl_interp_accel *func_accel; 00093 gsl_spline *re; 00094 gsl_spline *im; 00095 gsl_spline *func; 00096 }; 00097 /*This part is simple. We just want <psi|func|psi>, where func is 00098 ONLY a function of x 00099 *NOTE: this is provided as a callback to gsl. 00100 *NOTE: there are 3 flavours; one for each derivative. 00101 */ 00102 double expectation_value_integrand0(double x, void* params) { 00103 return complex_magnitude( 00104 gsl_spline_eval(((struct expectation_value_params*)params)->re, x, ((struct expectation_value_params*)params)->re_accel), 00105 gsl_spline_eval(((struct expectation_value_params*)params)->im, x, ((struct expectation_value_params*)params)->im_accel) 00106 )*gsl_spline_eval(((struct expectation_value_params*)params)->func, x, ((struct expectation_value_params*)params)->func_accel); 00107 } 00108 double expectation_value_integrand1(double x, void* params) { 00109 return complex_magnitude( 00110 gsl_spline_eval(((struct expectation_value_params*)params)->re, x, ((struct expectation_value_params*)params)->re_accel), 00111 gsl_spline_eval(((struct expectation_value_params*)params)->im, x, ((struct expectation_value_params*)params)->im_accel) 00112 )*gsl_spline_eval_deriv(((struct expectation_value_params*)params)->func, x, ((struct expectation_value_params*)params)->func_accel); 00113 } 00114 double expectation_value_integrand2(double x, void* params) { 00115 return complex_magnitude( 00116 gsl_spline_eval(((struct expectation_value_params*)params)->re, x, ((struct expectation_value_params*)params)->re_accel), 00117 gsl_spline_eval(((struct expectation_value_params*)params)->im, x, ((struct expectation_value_params*)params)->im_accel) 00118 )*gsl_spline_eval_deriv2(((struct expectation_value_params*)params)->func, x, ((struct expectation_value_params*)params)->func_accel); 00119 } 00120 00121 /*!\brief calculates the expectation value of func in state wf. 00122 *ARGS: 00123 * \param function: array of N doubles containing the function. 00124 * \paramx: array of N doubles containing the x points at which function was sampled 00125 * \param N: the numnber of points in discrete function function. 00126 * \param wf: pointer to an mstar_wavefunction_1d structure containing 00127 * \param derivative: which derivative, if any, to use in evaluating the 00128 * function, e.g. derivative=1 -> find the expectation value of the 00129 * first derivative of function in state wf. 00130 * \param abserr largest acceptable absolute integration error (GSL) 00131 * \param relerr largest acceptable relative integration error (GSL) 00132 * \param err pointer to a double to store the value of the (GSL) 00133 * estimated integration error. 00134 *RETURNS: 00135 * The expectation value of the derivative-th derivative of function 00136 *in state wf. 00137 *NOTE: function must ONLY be a function of x! 00138 *NOTE: only up to second derivative is supported. 00139 */ 00140 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) { 00141 gsl_interp_accel *func_accel = gsl_interp_accel_alloc(); 00142 gsl_spline *func = gsl_spline_alloc(gsl_interp_akima, N); 00143 gsl_spline_init(func, x, function, N); 00144 /*Wavefunction*/ 00145 double *repacked_x; 00146 double *repacked_re; 00147 double *repacked_im; 00148 mstar_wavefunction_1d_repack(wf, &repacked_x, &repacked_re, &repacked_im, 1); 00149 gsl_interp_accel *re_accel = gsl_interp_accel_alloc(); 00150 gsl_spline *re = gsl_spline_alloc(gsl_interp_akima, wf->N); 00151 gsl_spline_init(re, repacked_x, repacked_re, wf->N); 00152 gsl_interp_accel *im_accel = gsl_interp_accel_alloc(); 00153 gsl_spline *im = gsl_spline_alloc(gsl_interp_akima, wf->N); 00154 gsl_spline_init(im, repacked_x, repacked_im, wf->N); 00155 struct expectation_value_params expectation_value_params = { 00156 .re_accel = re_accel, 00157 .im_accel = im_accel, 00158 .func_accel = func_accel, 00159 .re = re, 00160 .im = im, 00161 .func = func 00162 }; 00163 gsl_function gsl_func = { 00164 .function = &expectation_value_integrand0, 00165 .params = &expectation_value_params 00166 }; 00167 double e_val; 00168 double status=0; 00169 gsl_integration_workspace *w = gsl_integration_workspace_alloc(MAX_GSL_INTEGRATION_INTERVALS); 00170 switch(derivative) { 00171 case 0: 00172 gsl_func.function = &expectation_value_integrand0; 00173 break; 00174 case 1: 00175 gsl_func.function = &expectation_value_integrand1; 00176 break; 00177 case 2: 00178 gsl_func.function = &expectation_value_integrand2; 00179 break; 00180 default: 00181 return nan("char-sequence"); 00182 } 00183 /*Here's where we do the integration.*/ 00184 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); 00185 gsl_spline_free(re); 00186 gsl_spline_free(im); 00187 gsl_spline_free(func); 00188 gsl_interp_accel_free(re_accel); 00189 gsl_interp_accel_free(im_accel); 00190 gsl_interp_accel_free(func_accel); 00191 free(repacked_x); 00192 free(repacked_re); 00193 free(repacked_im); 00194 return e_val; 00195 } 00196 00197 /*! Averages n_arrays of array_size doubles. 00198 * 00199 *\param arrays pointer to an array of arrays of doubles 00200 *\param n_arrays number of arrays given 00201 *\param array_size the size of the arrays stored in arrays. 00202 */ 00203 double* average_arrays(double *arrays[], int n_arrays, int array_size) { 00204 if(unlikely(arrays == NULL)) return NULL; 00205 double *avg = malloc(sizeof(double)*array_size); 00206 if(unlikely(avg == NULL)) return NULL; 00207 if(unlikely(n_arrays < 1)) { 00208 free(avg); 00209 return NULL; 00210 } 00211 register int i; 00212 for(i=0; i<array_size; i++) { 00213 avg[i] = (arrays[0])[i]; 00214 //fprintf(stderr, "(arrays[0])[%d]=%g\tavg[%d]=%g\n", i, (arrays[0])[i], i, avg[i]); 00215 } 00216 for(i=1; i<n_arrays; i++) { 00217 for(int j=0; j<array_size; j++) { 00218 avg[j] += (arrays[i])[j]; 00219 //fprintf(stderr, "(arrays[%d])[%d]=%g\tavg[%d]=%g\n", i, j, (arrays[i])[j], i, avg[j]); 00220 } 00221 } 00222 for(i=0; i<array_size; i++) { 00223 avg[i] /= n_arrays; 00224 } 00225 return avg; 00226 } 00227 00228 /*!Finds the points to the left and right of the specified interface 00229 \param iface interface point 00230 \param prev pointer to an int to store the index of the previous point 00231 \param next Same, but the next point 00232 \param x array of x values, assumed to be sorted from smallest to largest 00233 \param N number of points in the x array 00234 \return pointer to a string that contains an error message (NULL if succeeded) 00235 */ 00236 char* find_left_right_of_iface(double iface, int* prev, int* next, double *x, int N) { 00237 register int i; 00238 for(i=0; i<N; i++) { 00239 if(x[i] >= iface) { 00240 *prev = i-1; 00241 if(x[i] == iface) { 00242 //fprintf(stderr, "=(p=%i, n=%i, %g==%g [%g < %g])\n", *prev, *next, x[i], iface, x[*prev], iface); 00243 *next = i+1; 00244 }else{ 00245 //fprintf(stderr, ">(p=%i, n=%i, %g>%g [%g < %g])\n", *prev, *next, x[i], iface, x[*prev], iface); 00246 *next = i; 00247 } 00248 break; 00249 } 00250 //fprintf(stderr, "."); 00251 } 00252 if(unlikely((i == N) || (*prev < 0) || (*next >= N))) { 00253 //fprintf(stderr, "E\n"); 00254 if(i == N) return "specified interface not in structure"; 00255 if(*prev < 0) return "specified interface is the start of the structure"; 00256 if(*next >= N) return "specified interface is the end of the structure"; 00257 } 00258 return NULL; 00259 } 00260 00261 00262 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) { 00263 double alpha = 0; 00264 int i=0; 00265 /*HH*/ 00266 gsl_interp_accel *hh_acc = gsl_interp_accel_alloc(); 00267 gsl_spline *hh = gsl_spline_alloc(gsl_interp_akima, hh_band->N); 00268 gsl_spline_init(hh, hh_band->x, hh_band->bandedge, hh_band->N); 00269 /*LH*/ 00270 gsl_interp_accel *lh_acc = gsl_interp_accel_alloc(); 00271 gsl_spline *lh = gsl_spline_alloc(gsl_interp_akima, lh_band->N); 00272 gsl_spline_init(lh, lh_band->x, lh_band->bandedge, lh_band->N); 00273 /*SO*/ 00274 gsl_interp_accel *so_acc = gsl_interp_accel_alloc(); 00275 gsl_spline *so = gsl_spline_alloc(gsl_interp_akima, so_band->N); 00276 gsl_spline_init(so, so_band->x, so_band->bandedge, so_band->N); 00277 /*CB*/ 00278 gsl_interp_accel *cb_acc = gsl_interp_accel_alloc(); 00279 gsl_spline *cb = gsl_spline_alloc(gsl_interp_akima, cb_band->N); 00280 gsl_spline_init(cb, cb_band->x, cb_band->bandedge, cb_band->N); 00281 /*Potential*/ 00282 gsl_interp_accel *pot_acc = gsl_interp_accel_alloc(); 00283 gsl_spline *pot = gsl_spline_alloc(gsl_interp_akima, potential->N); 00284 gsl_spline_init(pot, potential->x, potential->potential, potential->N); 00285 /*Wavefunction*/ 00286 double *repacked_x; 00287 double *repacked_re; 00288 double *repacked_im; 00289 //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); 00290 mstar_wavefunction_1d_repack(wf, &repacked_x, &repacked_re, &repacked_im, 1); 00291 //for(unsigned i=0; i<wf->N; i++) fprintf(stderr, "->repacked_x=%g repacked_re=%g\n", repacked_x[i], repacked_re[i]); 00292 gsl_interp_accel *re_acc = gsl_interp_accel_alloc(); 00293 gsl_spline *re = gsl_spline_alloc(gsl_interp_akima, wf->N); 00294 gsl_spline_init(re, repacked_x, repacked_re, wf->N); 00295 gsl_interp_accel *im_acc = gsl_interp_accel_alloc(); 00296 gsl_spline *im = gsl_spline_alloc(gsl_interp_akima, wf->N); 00297 gsl_spline_init(im, repacked_x, repacked_im, wf->N); 00298 /*Evaluate at the interfaces*/ 00299 double *arrays[] = {hh_band->bandedge, lh_band->bandedge}; 00300 double *avg = average_arrays(arrays, 2, hh_band->N); 00301 int prev=0, next=0; 00302 char* err; 00303 /*We don't need to keep track of the sign of the interface; that's 00304 *preserved from the definition of A and B; we just blindly use prev 00305 *and next; see epsilon_7^A and friends below for why*/ 00306 double avg_p; 00307 double avg_n; 00308 double so_p; 00309 double so_n; 00310 double pot_p; 00311 double pot_n; 00312 /*the 0-point of energies reported in the printf below*/ 00313 int zero_index_prev=0, zero_index_next=0; 00314 double relative_to; 00315 if(unlikely((err = find_left_right_of_iface(0, &zero_index_prev, &zero_index_next, hh_band->x, hh_band->N)) != NULL)) { 00316 fprintf(stderr, "WARNING: diagnostic print band structure is going to be relative to 0 (E_Fermi) (err=%s)\n", err); 00317 relative_to=0; 00318 }else{ 00319 /*Average prev and next if there's no actual point at 0.*/ 00320 if((zero_index_prev + 1) == zero_index_next) { 00321 relative_to = (((cb_band->bandedge)[zero_index_prev+1]) + ((cb_band->bandedge)[zero_index_prev+1]))*0.5; 00322 }else{ 00323 relative_to = (cb_band->bandedge)[zero_index_prev+1]; 00324 } 00325 } 00326 for(GList *i=g_list_first(ifs); i!=NULL; i=g_list_next(i)) { 00327 if(unlikely((err = find_left_right_of_iface(*((double*)(i->data)), &prev, &next, hh_band->x, hh_band->N)) != NULL)) { 00328 fprintf(stderr, "ERROR when getting prev/next indices for interface at %g: %s\n", *((double*)(i->data)), err); 00329 return -0; 00330 } 00331 /* 00332 epsilon_7^A is so_band->bandedge)[next] 00333 epsilon_7^B is (so_band->bandedge)[prev] 00334 epsilon_8^A is avg[prev] 00335 epsilon_8^B is avg[next] 00336 delta_7 = epsilon_7^B - epsilon_7^A 00337 = (so_band->bandedge)[next] - (so_band->bandedge)[prev] 00338 delta_8 = epsilon_8^B - epsilon_8^A 00339 = avg[next] - avg[prev] 00340 NOTE that the above have the potential still in them! 00341 */ 00342 avg_p = avg[prev]; 00343 avg_n = avg[next]; 00344 so_p = (so_band->bandedge)[prev]; 00345 so_n = (so_band->bandedge)[next]; 00346 pot_p = (potential->potential)[prev]; 00347 pot_n = (potential->potential)[next]; 00348 //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); 00349 alpha += complex_magnitude(gsl_spline_eval(re, *((double*)(i->data)), re_acc), gsl_spline_eval(im, *((double*)(i->data)), im_acc)) 00350 *( 00351 ((so_n+pot_n)-(so_p+pot_p))*(1.0/((so_n)*(so_n))+1.0/((so_p)*(so_p))) 00352 -((avg_n+pot_n)-(avg_p+pot_p))*(1.0/((avg_n)*(avg_n))+1.0/((avg_p)*(avg_p))) 00353 ); 00354 } 00355 /*De-allocate structures.*/ 00356 /*HH*/ 00357 gsl_spline_free(hh); 00358 gsl_interp_accel_free(hh_acc); 00359 /*LH*/ 00360 gsl_spline_free(lh); 00361 gsl_interp_accel_free(lh_acc); 00362 /*SO*/ 00363 gsl_spline_free(so); 00364 gsl_interp_accel_free(so_acc); 00365 /*CB*/ 00366 gsl_spline_free(cb); 00367 gsl_interp_accel_free(cb_acc); 00368 /*pot*/ 00369 gsl_spline_free(pot); 00370 gsl_interp_accel_free(pot_acc); 00371 /*wavefunc*/ 00372 gsl_spline_free(re); 00373 gsl_interp_accel_free(re_acc); 00374 /*HH*/ 00375 gsl_spline_free(im); 00376 gsl_interp_accel_free(im_acc); 00377 free(repacked_x); 00378 free(repacked_re); 00379 free(repacked_im); 00380 free(avg); 00381 /*NOTE that the one-half from the summation has been absorbed into here.*/ 00382 /*NOTE that the minus sign comes from the definitions of 00383 delta_gamma_x and S_n. See notebook on April 28, 2009*/ 00384 /*Don't forget to convert nm->m (from the wavefunction)*/ 00385 //alpha *= hbar*hbar*22/12/m_e_0*1e9; /*22eV, from the paper*/ 00386 alpha *= hbar*hbar*Ep/12/m_e_0*1e9; /*22eV, from the paper*/ 00387 return alpha; 00388 } 00389 00390 struct integration_param { 00391 gsl_spline *re; 00392 gsl_interp_accel *re_accel; 00393 gsl_spline *im; 00394 gsl_interp_accel *im_accel; 00395 00396 gsl_spline *hh; 00397 gsl_interp_accel *hh_accel; 00398 gsl_spline *lh; 00399 gsl_interp_accel *lh_accel; 00400 gsl_spline *so; 00401 gsl_interp_accel *so_accel; 00402 gsl_spline *cb; 00403 gsl_interp_accel *cb_accel; 00404 00405 gsl_spline *avg; 00406 gsl_interp_accel *avg_accel; 00407 00408 gsl_spline *pot; 00409 gsl_interp_accel *pot_accel; 00410 }; 00411 00412 struct integration_param_2 { 00413 gsl_spline *re; 00414 gsl_interp_accel *re_accel; 00415 gsl_spline *im; 00416 gsl_interp_accel *im_accel; 00417 00418 gsl_spline *hh; 00419 gsl_interp_accel *hh_accel; 00420 gsl_spline *lh; 00421 gsl_interp_accel *lh_accel; 00422 gsl_spline *so; 00423 gsl_interp_accel *so_accel; 00424 gsl_spline *cb; 00425 gsl_interp_accel *cb_accel; 00426 00427 gsl_spline *avg; 00428 gsl_interp_accel *avg_accel; 00429 00430 gsl_spline *pot; 00431 gsl_interp_accel *pot_accel; 00432 00433 double Ep; 00434 gsl_spline *Ep_z; 00435 gsl_interp_accel *Ep_z_accel; 00436 }; 00437 00438 __always_inline double band_terms(double x, void *params) { 00439 //register double pot = gsl_spline_eval(((struct integration_param*)params)->pot, x, ((struct integration_param*)params)->pot_accel); 00440 double avg = (gsl_spline_eval(((struct integration_param*)params)->avg, x, ((struct integration_param*)params)->avg_accel)); 00441 double so = (gsl_spline_eval(((struct integration_param*)params)->so, x, ((struct integration_param*)params)->so_accel)); 00442 return (1.0/(so*so) - 1.0/(avg*avg)); 00443 } 00444 00445 /*E_F is at 0*/ 00446 double integrand(double x, void *params) { 00447 register double re = gsl_spline_eval(((struct integration_param*)params)->re, x, ((struct integration_param*)params)->re_accel); 00448 register double im = gsl_spline_eval(((struct integration_param*)params)->im, x, ((struct integration_param*)params)->im_accel); 00449 register double ef = gsl_spline_eval_deriv(((struct integration_param*)params)->pot, x, ((struct integration_param*)params)->pot_accel); 00450 return ef*(re*re + im*im)*band_terms(x, params); 00451 } 00452 00453 __always_inline double band_terms_del_psi2_method(double x, void *params) { 00454 //register double pot = gsl_spline_eval(((struct integration_param_2*)params)->pot, x, ((struct integration_param_2*)params)->pot_accel); 00455 double avg = (gsl_spline_eval(((struct integration_param_2*)params)->avg, x, ((struct integration_param_2*)params)->avg_accel)); 00456 double so = (gsl_spline_eval(((struct integration_param_2*)params)->so, x, ((struct integration_param_2*)params)->so_accel)); 00457 return (1.0/so - 1.0/avg); 00458 } 00459 00460 /*d/dz(re^2 + im^2) = 2*(re*d/dz re + im*d/dz im)*/ 00461 __always_inline double del_psi2(double x, gsl_spline *re, gsl_interp_accel *re_accel, gsl_spline *im, gsl_interp_accel *im_accel) { 00462 //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)); 00463 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)); 00464 } 00465 00466 /*E_F is at 0*/ 00467 double integrand_del_psi2_method(double x, void *params) { 00468 if(((struct integration_param_2*)params)->Ep_z == NULL) { 00469 return (((struct integration_param_2*)params)->Ep) 00470 *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) 00471 *band_terms_del_psi2_method(x, params); 00472 }else{ 00473 return gsl_spline_eval(((struct integration_param_2*)params)->Ep_z, x, ((struct integration_param_2*)params)->Ep_z_accel) 00474 *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) 00475 *band_terms_del_psi2_method(x, params); 00476 } 00477 } 00478 00479 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) { 00480 /*HH*/ 00481 gsl_interp_accel *hh_acc = gsl_interp_accel_alloc(); 00482 gsl_spline *hh = gsl_spline_alloc(gsl_interp_akima, hh_band->N); 00483 gsl_spline_init(hh, hh_band->x, hh_band->bandedge, hh_band->N); 00484 /*LH*/ 00485 gsl_interp_accel *lh_acc = gsl_interp_accel_alloc(); 00486 gsl_spline *lh = gsl_spline_alloc(gsl_interp_akima, lh_band->N); 00487 gsl_spline_init(lh, lh_band->x, lh_band->bandedge, lh_band->N); 00488 /*SO*/ 00489 gsl_interp_accel *so_acc = gsl_interp_accel_alloc(); 00490 gsl_spline *so = gsl_spline_alloc(gsl_interp_akima, so_band->N); 00491 gsl_spline_init(so, so_band->x, so_band->bandedge, so_band->N); 00492 /*CB*/ 00493 gsl_interp_accel *cb_acc = gsl_interp_accel_alloc(); 00494 gsl_spline *cb = gsl_spline_alloc(gsl_interp_akima, cb_band->N); 00495 gsl_spline_init(cb, cb_band->x, cb_band->bandedge, cb_band->N); 00496 /*Potential*/ 00497 gsl_interp_accel *pot_acc = gsl_interp_accel_alloc(); 00498 gsl_spline *pot = gsl_spline_alloc(gsl_interp_akima, potential->N); 00499 gsl_spline_init(pot, potential->x, potential->potential, potential->N); 00500 /*Get the average of the heavy and light holes for now*/ 00501 double *arrays[] = {hh_band->bandedge, lh_band->bandedge}; 00502 double *avg_array = average_arrays(arrays, 2, hh_band->N); 00503 gsl_interp_accel *avg_acc = gsl_interp_accel_alloc(); 00504 gsl_spline *avg = gsl_spline_alloc(gsl_interp_akima, hh_band->N); 00505 gsl_spline_init(avg, hh_band->x, avg_array, hh_band->N); 00506 /*Wavefunction*/ 00507 double* repacked_x; 00508 double* repacked_re; 00509 double* repacked_im; 00510 //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); 00511 mstar_wavefunction_1d_repack(wf, &repacked_x, &repacked_re, &repacked_im, 1); 00512 //for(unsigned i=0; i<wf->N; i++) fprintf(stderr, "->repacked_x=%g repacked_re=%g\n", repacked_x[i], repacked_re[i]); 00513 gsl_interp_accel *re_acc = gsl_interp_accel_alloc(); 00514 gsl_spline *re = gsl_spline_alloc(gsl_interp_akima, wf->N); 00515 gsl_spline_init(re, repacked_x, repacked_re, wf->N); 00516 gsl_interp_accel *im_acc = gsl_interp_accel_alloc(); 00517 gsl_spline *im = gsl_spline_alloc(gsl_interp_akima, wf->N); 00518 gsl_spline_init(im, repacked_x, repacked_im, wf->N); 00519 /*DO THE INTEGRATION*/ 00520 struct integration_param parms = { 00521 .re = re, 00522 .re_accel = re_acc, 00523 .im = im, 00524 .im_accel = im_acc, 00525 .hh = hh, 00526 .hh_accel = hh_acc, 00527 .lh = lh, 00528 .lh_accel = lh_acc, 00529 .so = so, 00530 .so_accel = so_acc, 00531 .cb = cb, 00532 .cb_accel = cb_acc, 00533 .avg = avg, 00534 .avg_accel = avg_acc, 00535 .pot = pot, 00536 .pot_accel = pot_acc, 00537 }; 00538 gsl_function gsl_func = { 00539 .function = &integrand, 00540 .params = &parms 00541 }; 00542 gsl_integration_workspace *w = gsl_integration_workspace_alloc(MAX_GSL_INTEGRATION_INTERVALS); 00543 double alpha; 00544 int status=0; 00545 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); 00546 if(status != 0) { 00547 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); 00548 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); 00549 if(status != 0) { 00550 fprintf(stderr, "\tFAILED: %d (%s); returned %g w/error %g Retrying with GAUSS15\n", status, gsl_strerror(status), alpha, *integration_error); 00551 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); 00552 if(status != 0) { 00553 size_t neval; 00554 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); 00555 status = gsl_integration_qng (&gsl_func, repacked_x[0], repacked_x[wf->N-1], abserr, relerr, &alpha, integration_error, &neval); 00556 if(status != 0) { 00557 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); 00558 }else{ 00559 fprintf(stderr, "\t\t\tSUCCESS: got %g w/error %g (%ld evals)\n", alpha, *integration_error, (long int)neval); 00560 } 00561 }else{ 00562 fprintf(stderr, "\t\tSUCCESS: got %g w/error %g\n", alpha, *integration_error); 00563 } 00564 }else{ 00565 fprintf(stderr, "\tSUCCESS: got %g w/error %g\n", alpha, *integration_error); 00566 } 00567 } 00568 gsl_integration_workspace_free(w); 00569 /*Save off the verification info, if needed.*/ 00570 if(vfp != NULL) { 00571 vfp->N = 5000; 00572 vfp->x = malloc((vfp->N)*sizeof(double)); 00573 vfp->prob_density = malloc((vfp->N)*sizeof(double)); 00574 vfp->integrand = malloc((vfp->N)*sizeof(double)); 00575 vfp->pot_deriv = malloc((vfp->N)*sizeof(double)); 00576 vfp->pot = malloc((vfp->N)*sizeof(double)); 00577 vfp->iface_equiv = malloc((vfp->N)*sizeof(double)); 00578 vfp->sob = malloc((vfp->N)*sizeof(double)); 00579 vfp->avg = malloc((vfp->N)*sizeof(double)); 00580 vfp->oo_sob = malloc((vfp->N)*sizeof(double)); 00581 vfp->oo_avg = malloc((vfp->N)*sizeof(double)); 00582 for(int i=0; i<(vfp->N); i++) { 00583 (vfp->x)[i] = (potential->x)[0] + ((potential->x)[potential->N-1] - (potential->x)[0])/vfp->N*i; 00584 (vfp->integrand)[i] = integrand((vfp->x)[i], &parms); 00585 (vfp->prob_density)[i] = complex_magnitude(gsl_spline_eval(re, (vfp->x)[i], re_acc), gsl_spline_eval(im, (vfp->x)[i], im_acc)); 00586 (vfp->pot_deriv)[i] = gsl_spline_eval_deriv(pot, (vfp->x)[i], pot_acc); 00587 (vfp->pot)[i] = gsl_spline_eval(pot, (vfp->x)[i], pot_acc); 00588 (vfp->iface_equiv)[i] = band_terms((vfp->x)[i], &parms); 00589 (vfp->sob)[i] = gsl_spline_eval(so, (vfp->x)[i], so_acc); 00590 (vfp->avg)[i] = gsl_spline_eval(avg, (vfp->x)[i], avg_acc); 00591 (vfp->oo_sob)[i] = 1.0/(vfp->sob)[i]; 00592 (vfp->oo_avg)[i] = 1.0/(vfp->avg)[i]; 00593 } 00594 } 00595 /*De-allocate structures.*/ 00596 /*HH*/ 00597 gsl_spline_free(hh); 00598 gsl_interp_accel_free(hh_acc); 00599 /*LH*/ 00600 gsl_spline_free(lh); 00601 gsl_interp_accel_free(lh_acc); 00602 /*SO*/ 00603 gsl_spline_free(so); 00604 gsl_interp_accel_free(so_acc); 00605 /*CB*/ 00606 gsl_spline_free(cb); 00607 gsl_interp_accel_free(cb_acc); 00608 /*pot*/ 00609 gsl_spline_free(pot); 00610 gsl_interp_accel_free(pot_acc); 00611 /*wavefunc*/ 00612 gsl_spline_free(re); 00613 gsl_interp_accel_free(re_acc); 00614 /*HH*/ 00615 gsl_spline_free(im); 00616 gsl_interp_accel_free(im_acc); 00617 free(repacked_x); 00618 free(repacked_re); 00619 free(repacked_im); 00620 free(avg); 00621 /*The factor of - is required to convert the volts to eV*/ 00622 /*Don't forget to convert nm->m (from the wavefunction)*/ 00623 *integration_error *= -hbar*hbar*Ep/6*oo_m_e_0*1e9; 00624 //alpha *= hbar*hbar*22/6*oo_m_e_0*1e9; 00625 alpha *= hbar*hbar*Ep/6*oo_m_e_0*1e9; 00626 return alpha; 00627 } 00628 00629 00630 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) { 00631 /*HH*/ 00632 gsl_interp_accel *hh_acc = gsl_interp_accel_alloc(); 00633 gsl_spline *hh = gsl_spline_alloc(gsl_interp_akima, hh_band->N); 00634 gsl_spline_init(hh, hh_band->x, hh_band->bandedge, hh_band->N); 00635 /*LH*/ 00636 gsl_interp_accel *lh_acc = gsl_interp_accel_alloc(); 00637 gsl_spline *lh = gsl_spline_alloc(gsl_interp_akima, lh_band->N); 00638 gsl_spline_init(lh, lh_band->x, lh_band->bandedge, lh_band->N); 00639 /*SO*/ 00640 gsl_interp_accel *so_acc = gsl_interp_accel_alloc(); 00641 gsl_spline *so = gsl_spline_alloc(gsl_interp_akima, so_band->N); 00642 gsl_spline_init(so, so_band->x, so_band->bandedge, so_band->N); 00643 /*CB*/ 00644 gsl_interp_accel *cb_acc = gsl_interp_accel_alloc(); 00645 gsl_spline *cb = gsl_spline_alloc(gsl_interp_akima, cb_band->N); 00646 gsl_spline_init(cb, cb_band->x, cb_band->bandedge, cb_band->N); 00647 /*Potential*/ 00648 gsl_interp_accel *pot_acc = gsl_interp_accel_alloc(); 00649 gsl_spline *pot = gsl_spline_alloc(gsl_interp_akima, potential->N); 00650 gsl_spline_init(pot, potential->x, potential->potential, potential->N); 00651 /*Get the average of the heavy and light holes for now*/ 00652 double *arrays[] = {hh_band->bandedge, lh_band->bandedge}; 00653 double *avg_array = average_arrays(arrays, 2, hh_band->N); 00654 gsl_interp_accel *avg_acc = gsl_interp_accel_alloc(); 00655 gsl_spline *avg = gsl_spline_alloc(gsl_interp_akima, hh_band->N); 00656 gsl_spline_init(avg, hh_band->x, avg_array, hh_band->N); 00657 /*Wavefunction*/ 00658 double* repacked_x; 00659 double* repacked_re; 00660 double* repacked_im; 00661 mstar_wavefunction_1d_repack(wf, &repacked_x, &repacked_re, &repacked_im, 1); 00662 gsl_interp_accel *re_acc = gsl_interp_accel_alloc(); 00663 /*gsl_spline *re = gsl_spline_alloc(gsl_interp_cspline, wf->N);*/ 00664 gsl_spline *re = gsl_spline_alloc(gsl_interp_akima, wf->N); 00665 gsl_spline_init(re, repacked_x, repacked_re, wf->N); 00666 gsl_interp_accel *im_acc = gsl_interp_accel_alloc(); 00667 /*gsl_spline *im = gsl_spline_alloc(gsl_interp_cspline, wf->N);*/ 00668 gsl_spline *im = gsl_spline_alloc(gsl_interp_akima, wf->N); 00669 gsl_spline_init(im, repacked_x, repacked_im, wf->N); 00670 /*DO THE INTEGRATION*/ 00671 struct integration_param_2 parms = { 00672 .re = re, 00673 .re_accel = re_acc, 00674 .im = im, 00675 .im_accel = im_acc, 00676 .hh = hh, 00677 .hh_accel = hh_acc, 00678 .lh = lh, 00679 .lh_accel = lh_acc, 00680 .so = so, 00681 .so_accel = so_acc, 00682 .cb = cb, 00683 .cb_accel = cb_acc, 00684 .avg = avg, 00685 .avg_accel = avg_acc, 00686 .pot = pot, 00687 .pot_accel = pot_acc, 00688 .Ep = Ep, 00689 .Ep_z = NULL, 00690 .Ep_z_accel = NULL 00691 }; 00692 gsl_function gsl_func = { 00693 .function = & integrand_del_psi2_method, 00694 .params = &parms 00695 }; 00696 gsl_integration_workspace *w = gsl_integration_workspace_alloc(MAX_GSL_INTEGRATION_INTERVALS); 00697 double alpha; 00698 int status=0; 00699 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); 00700 if(status != 0) { 00701 fprintf(stderr, "alpha_calc::alpha_from_del_psi2_nostrain: ERROR occurred while integrating: %d (%s)\n", status, gsl_strerror(status)); 00702 } 00703 gsl_integration_workspace_free(w); 00704 /*Save off the verification info, if needed.*/ 00705 if(vfp2 != NULL) { 00706 vfp2->N = 5000; 00707 vfp2->x = malloc((vfp2->N)*sizeof(double)); 00708 vfp2->prob_density = malloc((vfp2->N)*sizeof(double)); 00709 vfp2->d_prob_density = malloc((vfp2->N)*sizeof(double)); 00710 vfp2->integrand = malloc((vfp2->N)*sizeof(double)); 00711 vfp2->sob = malloc((vfp2->N)*sizeof(double)); 00712 vfp2->avg = malloc((vfp2->N)*sizeof(double)); 00713 vfp2->oo_sob = malloc((vfp2->N)*sizeof(double)); 00714 vfp2->oo_avg = malloc((vfp2->N)*sizeof(double)); 00715 vfp2->band_term = malloc((vfp2->N)*sizeof(double)); 00716 for(int i=0; i<(vfp2->N); i++) { 00717 (vfp2->x)[i] = (potential->x)[0] + ((potential->x)[potential->N-1] - (potential->x)[0])/vfp2->N*i; 00718 (vfp2->integrand)[i] = integrand_del_psi2_method((vfp2->x)[i], &parms); 00719 (vfp2->prob_density)[i] = complex_magnitude(gsl_spline_eval(re, (vfp2->x)[i], re_acc), gsl_spline_eval(im, (vfp2->x)[i], im_acc)); 00720 (vfp2->d_prob_density)[i] = del_psi2((vfp2->x)[i], re, re_acc, im, im_acc); 00721 (vfp2->sob)[i] = gsl_spline_eval(so, (vfp2->x)[i], so_acc); 00722 (vfp2->avg)[i] = gsl_spline_eval(avg, (vfp2->x)[i], avg_acc); 00723 (vfp2->oo_sob)[i] = 1.0/(vfp2->sob)[i]; 00724 (vfp2->oo_avg)[i] = 1.0/(vfp2->avg)[i]; 00725 (vfp2->band_term)[i] = band_terms_del_psi2_method((vfp2->x)[i], &parms); 00726 } 00727 } 00728 /*De-allocate structures.*/ 00729 /*HH*/ 00730 gsl_spline_free(hh); 00731 gsl_interp_accel_free(hh_acc); 00732 /*LH*/ 00733 gsl_spline_free(lh); 00734 gsl_interp_accel_free(lh_acc); 00735 /*SO*/ 00736 gsl_spline_free(so); 00737 gsl_interp_accel_free(so_acc); 00738 /*CB*/ 00739 gsl_spline_free(cb); 00740 gsl_interp_accel_free(cb_acc); 00741 /*pot*/ 00742 gsl_spline_free(pot); 00743 gsl_interp_accel_free(pot_acc); 00744 /*wavefunc*/ 00745 gsl_spline_free(re); 00746 gsl_interp_accel_free(re_acc); 00747 /*HH*/ 00748 gsl_spline_free(im); 00749 gsl_interp_accel_free(im_acc); 00750 free(repacked_x); 00751 free(repacked_re); 00752 free(repacked_im); 00753 /*The factor of - is required to convert the volts to eV*/ 00754 /*Don't forget to convert nm->m (from the wavefunction)*/ 00755 *integration_error *= -hbar*hbar*6*oo_m_e_0*1e9; 00756 //alpha *= hbar*hbar*22/6*oo_m_e_0*1e9; 00757 alpha *= hbar*hbar*6*oo_m_e_0*1e9; 00758 return alpha; 00759 } 00760 00761 GError* alpha_write_verificator_data(GFile* f, const struct alpha_integrand_verificator* vf) { 00762 GError *gerror = NULL; 00763 GFileOutputStream *os = g_file_replace(f, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &gerror); 00764 if(os == NULL) { 00765 GError *e = NULL; 00766 g_propagate_prefixed_error(&e, gerror, "ERROR when opening alpha_efield instrumentation file for writing"); 00767 return e; 00768 } 00769 GString *str = g_string_new(""); 00770 GDataOutputStream *gdos = g_data_output_stream_new((GOutputStream*)os); 00771 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"); 00772 g_data_output_stream_put_string(gdos, str->str, NULL, &gerror); 00773 if(gerror != NULL) { 00774 GError *e = NULL; 00775 g_propagate_prefixed_error(&e, gerror, "ERROR when writing alpha_efield instrumentation file header"); 00776 g_object_unref(os); 00777 g_object_unref(gdos); 00778 g_string_free(str, TRUE); 00779 return e; 00780 } 00781 int N; 00782 N = vf->N; 00783 for(int i=0; i<N; i++) { 00784 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]); 00785 g_data_output_stream_put_string(gdos, str->str, NULL, &gerror); 00786 if(gerror != NULL) { 00787 GError *e = NULL; 00788 g_propagate_prefixed_error(&e, gerror, "ERROR when writing alpha_efield instrumentation file header (Missing line would have been:%s)", str->str); 00789 g_object_unref(os); 00790 g_object_unref(gdos); 00791 g_string_free(str, TRUE); 00792 return e; 00793 } 00794 } 00795 g_output_stream_close(G_OUTPUT_STREAM(gdos), NULL, &gerror); 00796 if(gerror != NULL) { 00797 GError *e = NULL; 00798 g_propagate_prefixed_error(&e, gerror, "ERROR when closing alpha_efield instrumentation output stream.\n"); 00799 } 00800 g_object_unref(gdos); 00801 g_object_unref(os); 00802 g_string_free(str, TRUE); 00803 return NULL; 00804 } 00805 GError* alpha_write_verificator2_data(GFile* f, const struct alpha_integrand_verificator_2* vf2) { 00806 GError *gerror = NULL; 00807 GFileOutputStream *os = g_file_replace(f, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &gerror); 00808 if(os == NULL) { 00809 GError *e = NULL; 00810 g_propagate_prefixed_error(&e, gerror, "ERROR when opening method 2 instrumentation file for writing"); 00811 return e; 00812 } 00813 GString *str = g_string_new(""); 00814 GDataOutputStream *gdos = g_data_output_stream_new((GOutputStream*)os); 00815 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"); 00816 g_data_output_stream_put_string(gdos, str->str, NULL, &gerror); 00817 if(gerror != NULL) { 00818 GError *e = NULL; 00819 g_propagate_prefixed_error(&e, gerror, "ERROR when writing method 2 instrumentation file header"); 00820 g_object_unref(os); 00821 g_object_unref(gdos); 00822 g_string_free(str, TRUE); 00823 return e; 00824 } 00825 int N; 00826 N = vf2->N; 00827 for(int i=0; i<N; i++) { 00828 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]); 00829 g_data_output_stream_put_string(gdos, str->str, NULL, &gerror); 00830 if(gerror != NULL) { 00831 GError *e = NULL; 00832 g_propagate_prefixed_error(&e, gerror, "ERROR when writing method 2 instrumentation file header (Missing line would have been:%s)", str->str); 00833 g_object_unref(os); 00834 g_object_unref(gdos); 00835 g_string_free(str, TRUE); 00836 return e; 00837 } 00838 } 00839 g_output_stream_close(G_OUTPUT_STREAM(gdos), NULL, &gerror); 00840 if(gerror != NULL) { 00841 GError *e = NULL; 00842 g_propagate_prefixed_error(&e, gerror, "ERROR when closing method 2 instrumentation output stream.\n"); 00843 } 00844 g_object_unref(gdos); 00845 g_object_unref(os); 00846 g_string_free(str, TRUE); 00847 return NULL; 00848 } 00849 00850 void alpha_free_verificator_data(struct alpha_integrand_verificator *vf) { 00851 free(vf->x); 00852 free(vf->prob_density); 00853 free(vf->integrand); 00854 free(vf->pot_deriv); 00855 free(vf->iface_equiv); 00856 free(vf->sob); 00857 free(vf->avg); 00858 free(vf->oo_sob); 00859 free(vf->oo_avg); 00860 free(vf->pot); 00861 } 00862 00863 void alpha_free_verificator2_data(struct alpha_integrand_verificator_2* vf2) { 00864 free(vf2->x); 00865 free(vf2->prob_density); 00866 free(vf2->d_prob_density); 00867 free(vf2->band_term); 00868 free(vf2->sob); 00869 free(vf2->avg); 00870 free(vf2->oo_sob); 00871 free(vf2->oo_avg); 00872 free(vf2->integrand); 00873 }