1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
#include "ElectronChargeDensity.h"
#include "ATC_Error.h"
#include <iostream>
#include <vector>
using ATC_Utility::command_line;
using ATC_Utility::str2dbl;
using ATC_Utility::str2int;
using std::fstream;
using std::map;
using std::string;
using std::vector;
namespace ATC {
ElectronChargeDensityInterpolation::ElectronChargeDensityInterpolation(
fstream &fileId, map<string,double> & /* parameters */)
: ElectronChargeDensity(), n_()
{
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
vector<string> line;
int npts = 0;
double coef = 1.;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line[0] == "end") return;
else if (line[0] == "scale") coef = str2dbl(line[1]);
else if (line[0] == "number_of_points") {
npts = str2int(line[1]);
n_.initialize(npts,fileId,coef);
}
}
}
ElectronChargeDensityLinear::ElectronChargeDensityLinear(
fstream &fileId, map<string,double> & parameters)
: ElectronChargeDensity()
{
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
vector<string> line;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line[0] == "end") return;
double value = str2dbl(line[1]);
if (line[0] == "coefficient") {
C_ = value;
parameters["coefficient"] = C_;
}
}
}
ElectronChargeDensityExponential::ElectronChargeDensityExponential(
fstream &fileId, map<string,double> & parameters)
: ElectronChargeDensity(),
intrinsicConcentration_(0),
intrinsicEnergy_(0),
referenceTemperature_(0)
{
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
vector<string> line;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line[0] == "end") return;
double value = str2dbl(line[1]);
if (line[0] == "intrinsic_concentration") {
intrinsicConcentration_ = value;
parameters["intrinsic_concentration"] = intrinsicConcentration_;
}
else if (line[0] == "intrinsic_energy") {
intrinsicEnergy_ = value;
parameters["intrinsic_energy"] = intrinsicEnergy_;
}
else if (line[0] == "reference_temperature") {
referenceTemperature_ = value;
parameters["reference_temperature"] = referenceTemperature_;
}
else {
throw ATC_Error( "unrecognized material function "+line[0]);
}
}
}
ElectronChargeDensityFermiDirac::ElectronChargeDensityFermiDirac(
fstream &fileId, map<string,double> & parameters)
: ElectronChargeDensity(),
Ef_(0),
referenceTemperature_(0),
Ed_(0), Nd_(0), Eb_(0),
hasReferenceTemperature_(false),
donorIonization_(false)
{
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
vector<string> line;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line[0] == "end") return;
double value = str2dbl(line[1]);
if (line[0] == "fermi_energy") {
Ef_ = value;
parameters["fermi_energy"] = Ef_;
}
else if (line[0] == "reference_temperature") {
hasReferenceTemperature_ = true;
referenceTemperature_ = value;
parameters["reference_temperature"] = referenceTemperature_;
}
else if (line[0] == "band_edge") {
Eb_ = value;
parameters["band_edge_potential"] = Eb_;
}
else if (line[0] == "donor_ionization_energy") {
donorIonization_ = true;
Ed_ = value;
parameters["donor_ionization_energy"] = Ed_;
}
else if (line[0] == "donor_concentration") {
donorIonization_ = true;
Nd_ = value;
parameters["donor_concentration"] = Nd_;
}
else {
throw ATC_Error( "unrecognized material function "+line[0]);
}
}
}
}
|