|
k-dot-p 0.1
|
00001 /* 00002 * Structures for creating a (temporary; will be discretized) 00003 * continuous structure from an input. 00004 00005 Copyright (C) 2009 Joseph Pingenot 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU Affero General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Affero General Public License for more details. 00016 00017 You should have received a copy of the GNU Affero General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 00020 */ 00021 00022 #ifndef ____LIBMODELING_CONTINUOUS_STRUCTURE_HXX____ 00023 #define ____LIBMODELING_CONTINUOUS_STRUCTURE_HXX____ 00024 00025 #include <glib.h> 00026 #include <libmodelxx/grid.h++> 00027 #include <libmodelxx/material.h++> 00028 #include <libmodelxx/generic_structure.h++> 00029 #include <libmodelxx/function_specification.h++> 00030 00031 #define CONTINUOUS_STRUCTURE_DOMAIN 56931 00032 00033 namespace kdotp { 00034 namespace libmodelxx { 00035 namespace continuous_structure { 00036 00037 struct region { 00038 struct grid::shape_tree* st; 00039 structure::material* m; 00040 /*Material, or first material in a blended system*/ 00041 char* mat1; 00042 /*Null, or second material in a blended system*/ 00043 char* mat2; 00044 /*Percentage of mat1, from 0 to 1, exclusive*/ 00045 float x; 00046 /*Expression to use instead of float, if present*/ 00047 postprocessing::function_exp* f; 00048 /*Storage for key/value pairs in raw input.*/ 00049 GList* key_values; 00050 }; 00051 00052 struct doping { 00053 struct grid::shape_tree* st; 00054 /*Doping density units are dependent upon dimensionality: 00055 * TODO: THIS IS CURRENTLY A LIE! Units are currently #(singly-ionized dopants)/cm^-3 00056 * 1D: mC/nm^2 00057 * 2D: mC/nm^1 00058 * 3D: mC 00059 */ 00060 postprocessing::function_exp* f; 00061 /*Storage for key/value pairs in raw input.*/ 00062 GList* key_values; 00063 }; 00064 00065 struct potential { 00066 double* E; 00067 postprocessing::function_exp* function; 00068 GList *Evec; 00069 }; 00070 00071 struct continuous_structure { 00072 struct grid::grid* g; 00073 /*Placeholder for raw key/value pairs*/ 00074 GList* key_values; 00075 /*\var list containing the regions, in order of occurrance*/ 00076 GList* regions; 00077 GList* dopings; 00078 GList* potential; 00079 }; 00080 00081 enum length { 00082 ANGSTROM, 00083 NANOMETER, 00084 MICROMETER, 00085 MILLIMETER, 00086 CENTIMETER, 00087 METER, 00088 UNKNOWN_LENGTH 00089 }; 00090 00091 enum energy { 00092 EVOLT, 00093 JOULE, 00094 ERG, 00095 HARTREE, 00096 UNKNOWN_ENERGY 00097 }; 00098 00099 /** 00100 *Processes the structure after it's been read in from a file.* 00101 *\param s pointer to the structure from the input file 00102 */ 00103 struct structure::generic_structure* postprocess_structure(struct continuous_structure *s, const struct structure::matdb* mdb, GHashTable* global_symbol_table,GError **err); 00104 00105 /** 00106 *pretty-prints a processed structure. 00107 *\param s pointer to the structure from the input file 00108 */ 00109 void print_structure(const struct continuous_structure *s); 00110 00111 /** 00112 *converts a length to nm 00113 *\param len length 00114 *\param unit units 00115 */ 00116 double convert_length_to_nm(double len, enum length unit); 00117 00118 /** 00119 *converts an energy to hartree 00120 *\param en energy 00121 *\param unit units 00122 */ 00123 double convert_energy_to_hartree(double en, enum energy unit); 00124 00125 /** 00126 *Gets the length corresponding to a string 00127 *\param str the string to convert 00128 */ 00129 enum length length_from_str(const char* str); 00130 00131 /** 00132 *Gets the energy corresponding to a string 00133 *\param str the string to convert 00134 */ 00135 enum energy energy_from_str(const char* str); 00136 00137 /** 00138 *Gets the length string from a length 00139 *\param l the length 00140 */ 00141 const char* str_from_length(enum length l); 00142 00143 /** 00144 *Gets the energy string from an energy 00145 *\param e the energy 00146 */ 00147 const char* str_from_energy(enum energy e); 00148 } 00149 } 00150 } 00151 00152 00153 #endif