k-dot-p 0.1

oneoff_1d.c++

Go to the documentation of this file.
00001 /*
00002  *A quick program to perform a 1D k-dot-p calc
00003 
00004  Copyright (C) 2010 Joseph Pingenot
00005 
00006  This program is free software: you can redistribute it and/or modify
00007  it under the terms of the GNU Affero General Public License as published by
00008  the Free Software Foundation, either version 3 of the License, or
00009  (at your option) any later version.
00010 
00011  This program is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  GNU Affero General Public License for more details.
00015 
00016  You should have received a copy of the GNU Affero General Public License
00017  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 #include <string>
00022 #include <stdio.h>
00023 #include <stdlib.h>
00024 #include <sys/stat.h>
00025 #include <sys/types.h>
00026 #include <glib.h>
00027 #include <gio/gio.h>
00028 #include <gsl/gsl_errno.h>
00029 #include <libmodelxx/matdb.h++>
00030 #include <libmodelxx/matdb-dotcode.h++>
00031 #include <libmodelxx/continuous_structure.h++>
00032 #include <libmodelxx/generic_structure.h++>
00033 #include <libmodelxx/cartesian_grid.h++>
00034 #include <libkdotp/hamiltonians.h++>
00035 #include <libmodelxx/material.h++>
00036 #include <libmodelxx/utilities.h++>
00037 #include <libmetacalc/calculation_self_consistent_potential.h++>
00038 #include <libkdotp/wavefunction_cartesian_effective_mass.h++>
00039 #include <libpostproccalx/alpha_calc.h>
00040 #include <libmodelxx/function_specification.h++>
00041 #include "oneoff_1d_argprocess.h++"
00042 
00043 using namespace kdotp::libmodelxx::continuous_structure;
00044 using namespace kdotp::libmodelxx::structure;
00045 using namespace kdotp::libkdotp::hamiltonian;
00046 using namespace kdotp::libmodelxx::utilities;
00047 using namespace kdotp::libmetacalc::self_consistent;
00048 using namespace kdotp::libkdotp::wavefunction;
00049 using namespace kdotp::libmodelxx::postprocessing;
00050 using namespace std;
00051 
00052 static void free_value(void* value, void* pridat) {free(value);}
00053 
00054 void yyparse();
00055 int yylex();
00056 extern int yydebug;
00057 
00058 extern struct continuous_structure* the_structure;
00059 extern GInputStream* instream;
00060 
00061 typedef kdotp::libmodelxx::grid::cartesian_grid<kdotp::libmodelxx::structure::material*,1,1> matgrid;
00062 typedef kdotp::libmodelxx::grid::cartesian_grid<double,1,1> potgrid;
00063 
00064 static void gsl_error_handler (const char * reason, const char * file, int line, int gsl_errno) {
00065   //fprintf(stderr, "GSL error occured in file %s, line %d (%d: %s).  This should be caught by the calling function, or report a bug.\n", file, line, gsl_errno, reason);
00066 }
00067 
00068 
00069 int main(int argc, char **argv) {
00070   g_type_init();
00071   gsl_set_error_handler(&gsl_error_handler);
00072   //yydebug = 1;
00073   struct args args;
00074   int err;
00075   err = process_args(argc, argv, &args);
00076   if(err != 0) exit(1);
00077   GString *mdb_file = g_string_new(args.matdb);
00078   struct matdb* mdb = read_matdb_dotcode(mdb_file, &err);
00079   if(mdb == NULL) {fprintf(stderr, "ERROR reading in the materials database %s: %d\n", args.matdb, err); return 1;}
00080 
00081   GList* l;
00082   GError* gerr = NULL;
00083   GString *gs = g_string_new("");
00084   gsize wlen;
00085   GHashTable *gst = new_symbol_table();
00086   GString *alpha_filename = g_string_new("");
00087   GFile* alpha_file;
00088   GFile* dump_file;
00089   for(l=(args.filestreams); l != NULL; l=l->next) {
00090     parameter_list_init(args.template_parameters);
00091     alpha_filename = g_string_assign(alpha_filename, ((struct file_info*)(l->data))->filename->str);
00092     alpha_filename = g_string_append(alpha_filename, "_alpha.pdata");
00093     alpha_file = g_file_new_for_path(alpha_filename->str);
00094     g_string_free(alpha_filename, TRUE);
00095     GOutputStream* alpha_gos = (GOutputStream*)g_file_replace(alpha_file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &gerr);
00096     if(gerr != NULL) {
00097       fprintf(stderr, "ERROR opening alpha file (%s): %s\n", g_file_get_uri(alpha_file), gerr->message);
00098       exit(32);
00099     }
00100     g_string_printf(gs, "#");
00101     char* paramstring;
00102     g_string_append(gs, paramstring = get_header_for_template_state(args.template_parameters));
00103     g_free(paramstring);
00104     g_string_append_printf(gs, "\tEp\talpha_iface (eVm)\talpha_efield\talpha method 1(eVm)\talpha method2(eVm)\n");
00105     if(!g_output_stream_write_all(alpha_gos, gs->str, gs->len, &wlen, NULL, &gerr)) {
00106       fprintf(stderr, "ERROR writing to alpha file (%s): %s\n", g_file_get_uri(alpha_file), gerr->message);
00107       exit(32);
00108     }
00109     /*Now do the loop*/
00110     do {
00111       gerr = NULL;
00112       add_template_parameters_to_symbol_table(gst, args.template_parameters);
00113       GString *gfn=g_string_new(((struct file_info*)(l->data))->filename->str);
00114       gfn = g_string_append(gfn, "_output/");
00115       GFile* job_directory = get_gfile_directory_for_template_state(gfn->str, args.template_parameters);
00116       g_string_free(gfn, TRUE);
00117       /*make the directory and cd into it*/
00118       g_file_make_directory_with_parents(job_directory, NULL, &gerr);
00119       /*Set the dump to go into this directory.*/
00120       dump_file = g_file_get_child(job_directory, "structure.griddump");
00121       if(gerr != NULL) {
00122   if(gerr->code != G_IO_ERROR_EXISTS) {
00123     char* fn = g_file_get_uri(job_directory);
00124     fprintf(stderr, "ERROR creating the target directory for templated job (%s): %s\n", fn, gerr->message);
00125     g_free(fn);
00126     exit(5);
00127   }else{
00128     /*If the directory already exists, that's OK.*/
00129     g_error_free(gerr);
00130     gerr = NULL;
00131   }
00132       }
00133       /*For now, we read in the file over and over.  It's inefficient, but not *that* inefficient.*/
00134       instream = (GInputStream*)((struct file_info*)(l->data))->instream;
00135       yyparse();
00136       if(the_structure == NULL) {
00137   fprintf(stderr, "the_structure was NULL!\n");
00138   exit(1);
00139       }
00140       struct generic_structure *s = postprocess_structure(the_structure, mdb, gst, &gerr);
00141       if(gerr != NULL) {
00142   fprintf(stderr, "ERROR while postprocessing structure: %s\n", gerr->message);
00143   return 5;
00144       }
00145       fprintf(stderr, "got structure!\n");
00146 
00147       gerr = generic_structure_dump(s, dump_file);
00148       if(gerr != NULL) {
00149   fprintf(stderr, "ERROR while dumping structure: %s\n", gerr->message);
00150   return 5;
00151       }
00152       fprintf(stderr, "got structure!\n");
00153       matgrid *mg = (matgrid*)(s->material_grid);
00154       potgrid *pg = (potgrid*)(s->potential_grid);
00155       int e;
00156       int L = mg->L[0];
00157 
00158       printf("Checking factorial: %u!->%lu %u^%u->%lu\n",
00159        13, compiletime_integer_factorial<13>(),
00160        4, 4, compiletime_integer_exponentiation<4>(4));
00161 
00162 
00163       GFile* file = g_file_get_child(job_directory, "bands.pdata");
00164       GOutputStream* gos = (GOutputStream*)g_file_replace(file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &gerr);
00165       if(gerr != NULL) {
00166   fprintf(stderr, "ERROR opening bands file (%s): %s\n", g_file_get_uri(file), gerr->message);
00167   exit(32);
00168       }
00169       g_string_printf(gs, "#pos(nm)\tCB\tHH/LH\tSO\tPotential\n");
00170       if(!g_output_stream_write_all(gos, gs->str, gs->len, &wlen, NULL, &gerr)) {
00171   fprintf(stderr, "ERROR writing to bands file (%s): %s\n", g_file_get_uri(file), gerr->message);
00172   exit(32);
00173       }
00174       double x;
00175       for(int i=0; i<L; i++) {
00176   e=0;
00177   double Eg = mg->data[i]->get_property("E_g_Gamma", &e);
00178   if(e != 0) fprintf(stderr, "ERROR: got error %d for property E_g_Gamma\n", e);
00179   e=0;
00180   double Ev = mg->data[i]->get_property("E_v", &e);
00181   if(e != 0) fprintf(stderr, "ERROR: got error %d for property E_v\n", e);
00182   e=0;
00183   double Delta = mg->data[i]->get_property("Delta", &e);
00184   if(e != 0) fprintf(stderr, "ERROR: got error %d for property Delta\n", e);
00185   unsigned X=i;
00186   mg->point_index_to_realspace(&X, &x);
00187   g_string_printf(gs, "%g\t%g\t%g\t%g\t%g\n", x, Eg+Ev, Ev, Ev-Delta, pg->data[i]);
00188   if(!g_output_stream_write_all(gos, gs->str, gs->len, &wlen, NULL, &gerr)) {
00189     fprintf(stderr, "ERROR writing to bands file (%s): %s\n", g_file_get_uri(file), gerr->message);
00190     exit(32);
00191   }
00192       }
00193       g_object_unref(gos);
00194 
00195       double dopant_ierr, potential_ierr, efield_ierr;
00196       self_consistent_potential< ::kdotp::libkdotp::hamiltonian::cartesian_effective_mass, 1> scpot_calc(s, ::kdotp::libkdotp::hamiltonian::HARDWALL, get_average_with_cartesian_effective_mass_block, get_cartesian_effective_mass_block_max_delta, 1e6, 1e-14);
00197 
00198       double* eigvals;
00199       double* eigvecs;
00200       int neigs=0;
00201       double Ef;
00202       gerr = scpot_calc.perform_calculation(3, 1001, 1e-8, 1, &eigvecs, &eigvals, ::kdotp::libkdotp::hamiltonian::OOMSTAR, ::kdotp::libkdotp::hamiltonian::EPSILON, &Ef, &dopant_ierr, &potential_ierr, &efield_ierr, job_directory);
00203       printf("dopant integration error: %g\npotential integration error: %g\nefield integration error: %g\n", dopant_ierr, potential_ierr, efield_ierr);
00204 
00205       /*Verify our potential*/
00206       /*
00207       double* potcheck = new double[scpot_calc.H->L];
00208       scpot_calc.H->get_parameter_function(::kdotp::libkdotp::hamiltonian::TOTAL_POTENTIAL, potcheck);
00209       for(unsigned i=0; i<scpot_calc.H->L; i++) fprintf(stderr, "pc@%u: %g\n", i, potcheck[i]);
00210       delete[] potcheck;
00211       */
00212 
00213 
00214       /*
00215       potcheck = new double[scpot_calc.H->L];
00216       scpot_calc.H->get_parameter_function(::kdotp::libkdotp::hamiltonian::TOTAL_POTENTIAL, potcheck);
00217       for(unsigned i=0; i<scpot_calc.H->L; i++) fprintf(stderr, "pc@%u: %g\n", i, potcheck[i]);
00218       delete[] potcheck;
00219       */
00220 
00221       if(gerr != NULL) {
00222   fprintf(stderr, "ERROR getting eigenvectors of Hamiltonian: %s\n", gerr->message);
00223       }else{
00224   printf("Got %d eigenvalues: %g, %g, %g\n", neigs, eigvals[0], eigvals[1], eigvals[2]);
00225   char fn[1024];
00226   double sum, val;
00227   printf("Checking normalization and writing wavefunctions:\n");
00228   double x;
00229   for(int j=0; j<3; j++) {
00230     //sprintf(fn, "eigvec_%g.pdata", eigvals[j]);
00231     printf("\t%g: ", eigvals[j]);
00232     g_string_printf(gs, "eigvec_%d.pdata", j);
00233     file = g_file_get_child(job_directory, gs->str);
00234     GOutputStream* gos = (GOutputStream*)g_file_replace(file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &gerr);
00235     if(gerr != NULL) {
00236       fprintf(stderr, "ERROR opening eigenvec %d file (%s): %s\n", j, g_file_get_uri(file), gerr->message);
00237       exit(32);
00238     }
00239     g_string_printf(gs, "#pos(nm)\tpsi\n");
00240     if(!g_output_stream_write_all(gos, gs->str, gs->len, &wlen, NULL, &gerr)) {
00241       fprintf(stderr, "ERROR writing to eigvec %d file (%s): %s\n", j, g_file_get_uri(file), gerr->message);
00242       exit(32);
00243     }
00244     sum = 0;
00245     for(int i=0; i<L; i++) {
00246       val=eigvecs[i + j*L];
00247       unsigned X=i;
00248       scpot_calc.H->matgrid->point_index_to_realspace(&X, &x);
00249       g_string_printf(gs, "%g\t%g\n", x, val);
00250       if(!g_output_stream_write_all(gos, gs->str, gs->len, &wlen, NULL, &gerr)) {
00251         fprintf(stderr, "ERROR writing to eigvec %d file (%s): %s\n", j, g_file_get_uri(file), gerr->message);
00252         exit(32);
00253       }
00254       sum += val*val;
00255     }
00256     if(fabs(1.0-sum) < 1e-8) {
00257       printf("Normalized (%g)\n", sum);
00258     }else{
00259       printf("NON-NORMALIZED (%g)\n", sum);
00260     }
00261     g_object_unref(gos);
00262   }
00263 
00264   /*
00265   potcheck = new double[scpot_calc.H->L];
00266   scpot_calc.H->get_parameter_function(::kdotp::libkdotp::hamiltonian::TOTAL_POTENTIAL, potcheck);
00267   for(unsigned i=0; i<scpot_calc.H->L; i++) fprintf(stderr, "pc@%u: %g\n", i, potcheck[i]);
00268   delete[] potcheck;
00269   */
00270 
00271   printf("################################################################\n");
00272   printf("################################################################\n");
00273   printf("## Final output\n");
00274   printf("################################################################\n");
00275   printf("################################################################\n");
00276   printf("Ef=%g\n", Ef);
00277 
00278 
00279   struct ::potential pot;
00280   pot.N = scpot_calc.H->L;
00281   pot.spacing=scpot_calc.H->dx;
00282 
00283   fprintf(stderr, "pot.x=%p pot.potential=%p H->internal_potential=%p\n", (void*)pot.x, (void*)pot.potential, (void*)scpot_calc.H->internal_potential);
00284   pot.x = (double*)malloc(sizeof(double)*pot.N);
00285   pot.potential = (double*)malloc(sizeof(double)*pot.N);
00286   if((pot.x == NULL) || (pot.potential == NULL)) {
00287     fprintf(stderr, "ERROR: unable to allocate memory for pot x or bandedge data!\n");
00288     exit(5);
00289   }
00290   /*
00291   potcheck = new double[scpot_calc.H->L];
00292   scpot_calc.H->get_parameter_function(::kdotp::libkdotp::hamiltonian::TOTAL_POTENTIAL, potcheck);
00293   for(unsigned i=0; i<scpot_calc.H->L; i++) fprintf(stderr, "apc@%u: %g\n", i, potcheck[i]);
00294   delete[] potcheck;
00295   */
00296 
00297   fprintf(stderr, "N=%d dx=%g\n", pot.N, pot.spacing);
00298 
00299   for(unsigned int i=0; i<(unsigned int)pot.N; i++) {
00300     scpot_calc.H->matgrid->point_index_to_realspace(&i, &(pot.x[i]));
00301     fprintf(stderr, "%u/%d: x=%g (&X=%p, &pot.x[%d]=%p(%p/%p))\n", X, i, pot.x[i], (void*)&i, i, (void*)&(pot.x[i]), (void*)pot.x, (void*)scpot_calc.H->internal_potential);
00302   }
00303   /*
00304   potcheck = new double[scpot_calc.H->L];
00305   scpot_calc.H->get_parameter_function(::kdotp::libkdotp::hamiltonian::TOTAL_POTENTIAL, potcheck);
00306   for(unsigned i=0; i<scpot_calc.H->L; i++) fprintf(stderr, "bpc@%u: %g\n", i, potcheck[i]);
00307   delete[] potcheck;
00308   */
00309 
00310   scpot_calc.H->get_parameter_function(TOTAL_POTENTIAL, pot.potential);
00311 
00312   /*
00313   potcheck = new double[scpot_calc.H->L];
00314   scpot_calc.H->get_parameter_function(::kdotp::libkdotp::hamiltonian::TOTAL_POTENTIAL, potcheck);
00315   for(unsigned i=0; i<scpot_calc.H->L; i++) fprintf(stderr, "cpc@%u: %g\n", i, potcheck[i]);
00316   delete[] potcheck;
00317   */
00318 
00319   struct mstar_wavefunction_1d *wf = mstar_wavefunction_1d_new(scpot_calc.H->L);
00320 
00321   if(wf == NULL) {
00322     fprintf(stderr, "ERROR: unable to allocate memory for wavefunction data!\n");
00323     exit(5);
00324   }
00325   for(int i=0; i<wf->N; i++) {
00326     unsigned int X=i;
00327     scpot_calc.H->matgrid->point_index_to_realspace(&X, &(wf->points[i].x));
00328     scpot_calc.H->matgrid->point_index_to_realspace(&X, &(wf->points[i].x));
00329     wf->points[i].im=0;
00330     /*We want the first wavefunction*/
00331     wf->points[i].re=eigvecs[i];
00332   }
00333 
00334   /**Bands: 0->CB, 1->HH, 2->SO*/
00335   struct band bands[3];
00336   int errnum;
00337   for(int i=0; i<3; i++) {
00338     bands[i].N = scpot_calc.H->L;
00339     bands[i].spacing=scpot_calc.H->dx;
00340     bands[i].x = (double*)malloc(sizeof(double)*bands[i].N);
00341     bands[i].bandedge = (double*)malloc(sizeof(double)*bands[i].N);
00342     if((bands[i].x == NULL) || (bands[i].bandedge == NULL)) {
00343       fprintf(stderr, "ERROR: unable to allocate memory for pot x or bandedge data!\n");
00344       exit(5);
00345     }
00346     for(unsigned int j=0; j<(unsigned int)bands[i].N; j++) {
00347       scpot_calc.H->matgrid->point_index_to_realspace(&j, &(bands[i].x[j]));
00348     }
00349   }
00350   /*For alpha_calch.h compat, and implying nextnano compat, we add in the potential*/
00351   /*\note these band edge energies are relative to Ef, for compatibility with alpha_calc (and therefore with nextnano*/
00352   scpot_calc.H->get_parameter_function(EC, bands[0].bandedge);
00353   for(unsigned j=0; j<scpot_calc.H->L; j++) {
00354     /*Add the potential to the CB*/
00355     bands[0].bandedge[j] += -(pot.potential[j] + Ef);
00356     /*Set the HH/LH band edge*/
00357     bands[1].bandedge[j] = scpot_calc.H->matgrid->data[j]->get_property("E_v", &errnum) - pot.potential[j] - Ef;
00358     if(errnum != 0) fprintf(stderr, "ERROR getting property Ev at gridsite %u: %d\n", j, errnum);
00359     /*Subtract the Delta from the HH/LH band edge (note: HH/LH includes potential and Ef already)*/
00360     bands[2].bandedge[j] = bands[1].bandedge[j] - scpot_calc.H->matgrid->data[j]->get_property("Delta", &errnum);
00361     if(errnum != 0) fprintf(stderr, "ERROR getting property Delta at gridsite %u: %d\n", j, errnum);
00362     /**\note that the bandedge of the HH/LH band includes the potential (previous loop)*/
00363   }
00364   /*Use method 1*/
00365   /*First, find the ifaces.*/
00366   GList* ifaces=NULL;
00367   /*We start at 1, since we compare against the *previous* point*/
00368   /*While we're going through it, get Ep for the material.*/
00369   double* Ep_in_structure = new double[scpot_calc.H->L];
00370   for(unsigned i=1; i<scpot_calc.H->L; i++) {
00371     if(scpot_calc.H->matgrid->data[i-1] != scpot_calc.H->matgrid->data[i]) {
00372       double *midpoint = new double;
00373       double x_prev, x_cur;
00374       unsigned prev=i-1;
00375       scpot_calc.H->matgrid->point_index_to_realspace(&prev, &x_prev);
00376       scpot_calc.H->matgrid->point_index_to_realspace(&i, &x_cur);
00377       /*cur and prev are fixed; the interface is halfway between.*/
00378       *midpoint = x_prev + (x_cur - x_prev)*0.5;
00379       ifaces = g_list_append(ifaces, midpoint);
00380       printf("Got interface: %g\n", *midpoint);
00381     }
00382     Ep_in_structure[i] = scpot_calc.H->matgrid->data[i]->get_property("E_p", &errnum);
00383     if(errnum != 0) fprintf(stderr, "ERROR getting property E_p at gridsite %u: %d\n", i, errnum);
00384   }
00385   delete[] Ep_in_structure;
00386 
00387   struct alpha_integrand_verificator vf1;
00388   struct alpha_integrand_verificator_2 vf2;
00389 
00390   double Ep = get_average_with_cartesian_effective_mass_block(eigvecs, 0, scpot_calc.H->L, Ep_in_structure);
00391 
00392   printf("Ep_avg=%g\n", Ep);
00393 
00394   double ierr_alpha, ierr_alpha_m2;
00395   double alpha_iface = alpha_interface_term_mstar_nostrain(wf, &bands[1], &bands[1], &bands[2], &bands[0], &pot, ifaces, Ep);
00396   g_list_foreach(ifaces, free_value, NULL);
00397   g_list_free(ifaces);
00398   double alpha_efield = alpha_electric_term_mstar_nostrain(wf, &bands[1], &bands[1], &bands[2], &bands[0], &pot, &vf1, &ierr_alpha, 1e-7, 1e-7, FALSE, Ep);
00399   double alpha_method2 = alpha_from_del_psi2_nostrain(wf, &bands[1], &bands[1], &bands[2], &bands[0], &pot, &vf2, &ierr_alpha_m2, 1e-7, 1e-7, FALSE, Ep);
00400 
00401   /*Write out the band ifnormation as it'll be passed into alpah_calc.*/
00402   file = g_file_get_child(job_directory, "bands2.pdata");
00403   GOutputStream* gos = (GOutputStream*)g_file_replace(file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &gerr);
00404   if(gerr != NULL) {
00405     fprintf(stderr, "ERROR opening bands2 file (%s): %s\n", g_file_get_uri(file), gerr->message);
00406     exit(32);
00407   }
00408   g_string_printf(gs, "#x(nm)\tcb(eV)\tHH/LH(eV)\tSO(eV)\tpot(eV)\tpsi^2(nm^-1)\n");
00409   if(!g_output_stream_write_all(gos, gs->str, gs->len, &wlen, NULL, &gerr)) {
00410     fprintf(stderr, "ERROR writing to bands2 file (%s): %s\n", g_file_get_uri(file), gerr->message);
00411     exit(32);
00412   }
00413   for(int i=0; i<bands[0].N; i++) {
00414     g_string_printf(gs, "%g\t", bands[0].x[i]);
00415     for(int j=0; j<3; j++) {
00416       g_string_append_printf(gs, "%g\t", bands[j].bandedge[i]);
00417     }
00418     g_string_append_printf(gs, "%g\n", pot.potential[i]);
00419     g_string_append_printf(gs, "%g\n", wf->points[i].re*wf->points[i].re);
00420     g_string_append_printf(gs, "#x(nm)\tcb(eV)\tHH/LH(eV)\tSO(eV)\tpot(eV)\tpsi^2(nm^-1)\n");
00421     if(!g_output_stream_write_all(gos, gs->str, gs->len, &wlen, NULL, &gerr)) {
00422       fprintf(stderr, "ERROR writing to bands2 file (%s): %s\n", g_file_get_uri(file), gerr->message);
00423       exit(32);
00424     }
00425   }
00426   g_object_unref(gos);
00427 
00428   gs = g_string_assign(gs, paramstring=get_string_for_template_state(args.template_parameters));
00429   g_free(paramstring);
00430   g_string_append_printf(gs, "\t%g\t%g\t%g\t%g\t%g\n", Ep, alpha_iface, alpha_efield, alpha_iface + alpha_efield, alpha_method2);
00431   if(!g_output_stream_write_all(alpha_gos, gs->str, gs->len, &wlen, NULL, &gerr)) {
00432     fprintf(stderr, "ERROR writing to alpha file (%s): %s\n", g_file_get_uri(alpha_file), gerr->message);
00433     exit(32);
00434   }
00435 
00436   GFile* vf1_file = g_file_get_child(job_directory, "alpha_method_1_efield_instrumentation.pdata");
00437   GFile* vf2_file = g_file_get_child(job_directory, "alpha_method_2_instrumentation.pdata");
00438   alpha_write_verificator_data(vf1_file, &vf1);
00439   alpha_write_verificator2_data(vf2_file, &vf2);
00440   g_object_unref(vf1_file);
00441   g_object_unref(vf2_file);
00442   for(int i=0; i<3; i++) {
00443     free(bands[i].x);
00444     free(bands[i].bandedge);
00445   }
00446   free(pot.potential);
00447   free(pot.x);
00448   mstar_wavefunction_1d_free(wf);
00449       }
00450     }while(!update_parameters_plus_check_if_done(args.template_parameters));
00451     g_object_unref(alpha_gos);
00452     g_object_unref(alpha_file);
00453     g_object_unref(dump_file);
00454   }
00455   return 0;
00456 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines