41 throw std::runtime_error(
"grw cannot be run for state: " +
52 options.
get(
".observable").
as<std::string>());
55 options.
get(
".solver").
as<std::string>());
63 log_.setMultithreading(
true);
64 log_.setCommonPreface(
"\n ...");
69 "\n GRAPH RANDOM WALK TIME OF FLIGHT"
70 "\n-----------------------------------"
73 throw std::runtime_error(
74 "grw: numberofcarriers must be 1 or 2 (the state space grows as "
75 "n^N/N!; use kinetic Monte Carlo for more carriers)");
81 <<
"source segment " << s <<
" has no path to a sink, excluded"
94 <<
"Two carriers with site exclusion, observable: "
95 << (transit ?
"mean transit time per carrier (carriers removed at "
97 :
"time until the first carrier reaches the sink")
102 <<
"Solver: " << result.
solver <<
", " << result.
unknowns <<
" unknowns, "
103 << result.
iterations <<
" iterations, backward error "
105 <<
" refinement steps" << std::flush;
108 <<
"Warning: not converged (iteration limit or backward error above "
113 << std::setprecision(6) <<
"Time of flight (uniform injection over "
114 << result.
sources.size() <<
" source "
116 <<
" s" << std::flush;
122 <<
"Harmonic mean over the injection states: " << result.
tau_harmonic
123 <<
" s" << std::flush;
134 if (charge * Fn <= 0.0) {
136 <<
"Warning: the field does not drive the carriers towards the sink"
139 double factor = 1e4 / std::abs(Fn);
141 <<
"Mobility L/(tau F): " <<
L / result.
tau_mean * factor
143 <<
" cm^2/Vs (harmonic), with L = " <<
L * 1e9 <<
" nm and F = " << Fn
144 <<
" V/m along the normal" << std::flush;
148 ResultFile out(
"grw: mean hitting times of the sink (graph random walk)");
150 out.
Add(
"observable",
151 transit ? std::string(
"transit") : std::string(
"first"));
159 out.
Add(
"length",
L,
"m");
160 out.
Add(
"field_normal", Fn,
"V/m");
162 out.
Add(
"mobility_mean",
L / result.
tau_mean * 1e4 / std::abs(Fn),
184 out <<
"# per injection state: for each carrier segment id, x along the "
185 "normal [nm], site energy [eV]; then the mean time [s] and, if "
186 "available, the standard deviation of the hitting time [s]\n";
187 out << std::setprecision(10);
194 out << result.
tau[k];
195 if (result.
tau_std.size() == result.
tau.size()) {
196 out <<
" " << result.
tau_std[k];
205 out <<
"# expected time each segment is occupied before the carriers reach "
206 "the sink, uniform injection\n";
207 out <<
"# segment id, x along the normal [nm], site energy [eV], role, "
208 "time [s], fraction of the total occupation time\n";
209 out << std::setprecision(10);
210 const char* roles[] = {
"bulk",
"source",
"sink"};
215 << roles[
static_cast<int>(site.role)] <<
" " << t <<
" "
std::string occupationfile_
GraphRandomWalk::Settings settings_
void WriteOccupation(const ToFGraph &graph, const GraphRandomWalk::Result &result) const
void WriteSources(const ToFGraph &graph, const GraphRandomWalk::Result &result) const
void ParseOptions(const tools::Property &options) override
bool Evaluate(Topology &top) override
GraphRandomWalk::Observable observable_
Eigen::Vector3d field_Vm_
GraphRandomWalk::Solver solver_
Expected time of flight from hitting times of a continuous-time random walk on a ToFGraph,...
Result TwoCarriers(Observable observable, Solver solver=Solver::Auto) const
void setSettings(const Settings &settings)
static Solver SolverFromString(const std::string &name)
Result SingleCarrier(Solver solver=Solver::Auto) const
static Observable ObservableFromString(const std::string &name)
Small machine-readable result file of a calculator: one "key value unit" line per quantity (unit "-" ...
void Write(const std::string &filename) const
void Add(const std::string &key, double value, const std::string &unit)
Hopping graph for time-of-flight (ToF) transport.
const Site & getSite(Index i) const
const std::vector< Index > & DisconnectedSources() const
source sites from which no sink can be reached (excluded above)
const std::vector< Site > & Sites() const
const Eigen::Vector3d & Normal() const
unit normal of the cut face, pointing from source to sink side
static Options OptionsFromProperty(const tools::Property &tof)
Options from the "tof" subpackage (subpackages/tof.xml), lengths in nm.
std::string Summary() const
human readable summary
Container for segments and box and atoms.
#define XTP_LOG(level, log)
Charge transport classes.
Provides a means for comparing floating point numbers.
static Level current_level
std::vector< std::vector< Index > > sources
Index iterations
iterative solvers: total iterations
Eigen::VectorXd occupation_time
double tau_harmonic
harmonic mean over the injection states (eq. 3.4 of the paper)
double energy
site energy of the carrier
double x
coordinate along the transport normal, in [0, thickness)