|
gimme-alpha 0.1
|
#include <glib.h>#include <stdio.h>#include <libnextnano/read_nextnano_inputfile.h>#include <libnextnano/read_nextnano_effectivemass_output.h>#include <libcommon/textfile_common.h>#include <libcommon/gimme_alpha_types.h>#include <libnextnano/nextnano_wavefunction_conversion.h>
Include dependency graph for read_nextnano_effectivemass_output.c:Go to the source code of this file.
Defines | |
| #define | NEXTNANO_FIELD_TITLE_BUFFER_LEN 32 |
| #define | NEXTNANO_FILENAME_PART_BUFFER_LEN 32 |
Functions | |
| GString * | get_wavefunction_filename (enum bands band, short unsigned int cluster_num, short unsigned int schroedinger_num, short unsigned int subsolution_num, enum boundary_types boundary, short unsigned int Kz_num) |
| static void | destroy_hash (gpointer hash, gpointer private) |
| struct mstar_wavefunction_1d * | read_effectivemass_complex_wavefunction2 (enum bands band, short unsigned int cluster_num, short unsigned int schroedinger_num, short unsigned int subsolution_num, enum boundary_types boundary, short unsigned int Kz_num, short unsigned int soln_num, GFile *base, GHashTable *input, GError **error) |
| GList * | read_effectivemass_complex_wavefunctionfile (GInputStream *istream, GError **err, GList **titles) |
| static void | print_wavefunction_rowitem_by_title (gpointer title, gpointer row) |
| static void | print_wavefunction_row (gpointer row, gpointer titles) |
| void | print_effectivemass_wavefunction (GList *titles, GList *rows) |
| #define NEXTNANO_FIELD_TITLE_BUFFER_LEN 32 |
Definition at line 37 of file read_nextnano_effectivemass_output.c.
| #define NEXTNANO_FILENAME_PART_BUFFER_LEN 32 |
Definition at line 40 of file read_nextnano_effectivemass_output.c.
Referenced by get_wavefunction_filename().
| static void destroy_hash | ( | gpointer | hash, |
| gpointer | private | ||
| ) | [static] |
Definition at line 97 of file read_nextnano_effectivemass_output.c.
Referenced by read_effectivemass_complex_wavefunction2().
{
g_hash_table_destroy((GHashTable*)hash);
}
Here is the caller graph for this function:| GString* get_wavefunction_filename | ( | enum bands | band, |
| short unsigned int | cluster_num, | ||
| short unsigned int | schroedinger_num, | ||
| short unsigned int | subsolution_num, | ||
| enum boundary_types | boundary, | ||
| short unsigned int | Kz_num | ||
| ) |
Definition at line 42 of file read_nextnano_effectivemass_output.c.
References CB, CB_L, CB_X, DIR, HH, LH, NEU, NEXTNANO_FILENAME_PART_BUFFER_LEN, and SO.
Referenced by read_effectivemass_complex_wavefunction2().
{
char buffer[NEXTNANO_FILENAME_PART_BUFFER_LEN];
char *leadin;
switch (band) {
case CB:
leadin = "cb001_";
break;
case CB_L:
leadin = "cb002_";
break;
case CB_X:
leadin = "cb003_";
break;
case HH:
leadin = "vb001_";
break;
case LH:
leadin = "vb002_";
break;
case SO:
leadin = "vb003_";
break;
default:
fprintf(stderr, "read_effectivemass_complex_wavefunction2: INTERNAL ERROR: invalid band given (%d)\n", band);
return NULL;
}
GString *wf_filename = g_string_new(leadin);
snprintf(buffer, NEXTNANO_FILENAME_PART_BUFFER_LEN, "qc%03d_", cluster_num);
buffer[NEXTNANO_FILENAME_PART_BUFFER_LEN-1] = '\0';
wf_filename = g_string_append(wf_filename, buffer);
snprintf(buffer, NEXTNANO_FILENAME_PART_BUFFER_LEN, "sg%03d_", schroedinger_num);
buffer[NEXTNANO_FILENAME_PART_BUFFER_LEN-1] = '\0';
wf_filename = g_string_append(wf_filename, buffer);
snprintf(buffer, NEXTNANO_FILENAME_PART_BUFFER_LEN, "deg%03d_", subsolution_num);
buffer[NEXTNANO_FILENAME_PART_BUFFER_LEN-1] = '\0';
wf_filename = g_string_append(wf_filename, buffer);
switch (boundary) {
case NEU:
leadin = "neu_";
break;
case DIR:
leadin = "dir_";
break;
default:
fprintf(stderr, "read_effectivemass_complex_wavefunction2: INTERNAL ERROR: invalid boundary type given (%d)\n", boundary);
return NULL;
}
wf_filename = g_string_append(wf_filename, leadin);
snprintf(buffer, NEXTNANO_FILENAME_PART_BUFFER_LEN, "Kz%03d_", Kz_num);
buffer[NEXTNANO_FILENAME_PART_BUFFER_LEN-1] = '\0';
wf_filename = g_string_append(wf_filename, buffer);
wf_filename = g_string_append(wf_filename, "cmplx.dat");
return wf_filename;
}
Here is the caller graph for this function:| void print_effectivemass_wavefunction | ( | GList * | titles, |
| GList * | rows | ||
| ) |
Definition at line 146 of file read_nextnano_effectivemass_output.c.
References print_wavefunction_row(), and print_wavefunction_rowitem_by_title().
{
g_list_foreach(titles, print_wavefunction_rowitem_by_title, NULL);
printf("\n");
g_list_foreach(rows, print_wavefunction_row, titles);
}
Here is the call graph for this function:| static void print_wavefunction_row | ( | gpointer | row, |
| gpointer | titles | ||
| ) | [static] |
Definition at line 141 of file read_nextnano_effectivemass_output.c.
References print_wavefunction_rowitem_by_title().
Referenced by print_effectivemass_wavefunction().
{
g_list_foreach(titles, print_wavefunction_rowitem_by_title, row);
printf("\n");
}
Here is the call graph for this function:
Here is the caller graph for this function:| static void print_wavefunction_rowitem_by_title | ( | gpointer | title, |
| gpointer | row | ||
| ) | [static] |
Definition at line 136 of file read_nextnano_effectivemass_output.c.
References unlikely.
Referenced by print_effectivemass_wavefunction(), and print_wavefunction_row().
{
if(unlikely(row == NULL)) printf("%s\t", (char*)title);
else printf("%g\t", *(double*)g_hash_table_lookup(row, title));
}
Here is the caller graph for this function:| struct mstar_wavefunction_1d* read_effectivemass_complex_wavefunction2 | ( | enum bands | band, |
| short unsigned int | cluster_num, | ||
| short unsigned int | schroedinger_num, | ||
| short unsigned int | subsolution_num, | ||
| enum boundary_types | boundary, | ||
| short unsigned int | Kz_num, | ||
| short unsigned int | soln_num, | ||
| GFile * | base, | ||
| GHashTable * | input, | ||
| GError ** | error | ||
| ) | [read] |
Definition at line 101 of file read_nextnano_effectivemass_output.c.
References convert_nextnano_mstar_wavefunction_to_general_1d(), destroy_hash(), DOUBLE_TYPE, get_wavefunction_filename(), read_nextnano_extract_item(), and read_titled_whitespaced_data().
Referenced by main().
{
int err;
*error = NULL;
GList *titles = NULL;
/*TODO: Provide sanity checks to make sure that the cluster,
schroedinger, subsoln, and kz numbs requested should actually exist!*/
char *wf_dir_str = read_nextnano_extract_item(input, "output-1-band-schroedinger", 0, "destination-directory", &err);
if(err != 0) {
fprintf(stderr, "Error extracting output-densities destination-directory from nextnano input.\n");
return NULL;
}
GString *wf_filename = get_wavefunction_filename(band, cluster_num, schroedinger_num, subsolution_num, boundary, Kz_num);
GFile *wf_dir = g_file_get_child(base, wf_dir_str);
GFile *wf_file = g_file_get_child(wf_dir, wf_filename->str);
GFileInputStream *wf_stream = g_file_read(wf_file, NULL, error);
if(*error != NULL) {
fprintf(stderr, "Error opening the wavefunction file (%s) for reading (error %s)\n", wf_filename->str, (*error)->message);
return NULL;
}
GList *wf_list = read_titled_whitespaced_data(G_INPUT_STREAM(wf_stream), error, &titles, '!', DOUBLE_TYPE);
struct mstar_wavefunction_1d *wf = convert_nextnano_mstar_wavefunction_to_general_1d(wf_list, "x-pos:", "ef_re(", "ef_im(", "):", soln_num);
g_list_free(titles);
g_list_foreach(wf_list, destroy_hash, NULL);
g_list_free(wf_list);
return wf;
}
Here is the call graph for this function:
Here is the caller graph for this function:| GList* read_effectivemass_complex_wavefunctionfile | ( | GInputStream * | istream, |
| GError ** | err, | ||
| GList ** | titles | ||
| ) |
Definition at line 130 of file read_nextnano_effectivemass_output.c.
References DOUBLE_TYPE, and read_titled_whitespaced_data().
{
/*String version of the data*/
*titles = NULL;
return read_titled_whitespaced_data(istream, err, titles, '!', DOUBLE_TYPE);
}
Here is the call graph for this function: