49 if (options.
exists(
".box") &&
50 !options.
get(
".box").
as<std::string>().empty()) {
51 box_ = options.
get(
".box").
as<std::vector<double>>();
52 if (
box_.size() != 3) {
53 throw std::runtime_error(
"networkgen: box needs three lengths");
63 log_.setMultithreading(
true);
64 log_.setCommonPreface(
"\n... ...");
67 throw std::runtime_error(
"networkgen: " +
statefile_ +
68 " exists already, remove it or choose another "
76 const Eigen::Vector3d fitted_box = opt.
box;
82 }
else if (fitted_sites > 0 && fitted_box.minCoeff() > 0.0) {
84 opt.
box = fitted_box * std::cbrt(
double(opt.
sites) /
double(fitted_sites));
86 throw std::runtime_error(
87 "networkgen: give box, the parameter file has no box and sites");
96 <<
" sites in a box of " << box_nm.x() <<
" x " << box_nm.y() <<
" x "
97 << box_nm.z() <<
" nm^3, seed " << opt.
seed << std::flush;
104 <<
"Point process: " << model.
Iterations() <<
" iterations; "
107 <<
" neighbours per site" << std::flush;
108 if (!opt.
traps.empty()) {
109 std::ostringstream t;
110 t <<
"Traps: " << model.
Traps().size() <<
" inserted (" << opt.
traps.size()
112 for (std::size_t k = 0; k < opt.
traps.size(); ++k) {
113 const auto& tr = opt.
traps[k];
117 return x.type == Index(k);
119 t <<
"\n template " << k <<
": "
120 << opt.
carriers[tr.carrier].state.ToString() <<
" trap of "
121 << tr.offsets.size() <<
" site(s), deepest "
123 <<
" eV from the bulk mean, density " << tr.density *
trap_factor_
124 <<
" per site: " << count <<
" inserted";
129 for (std::size_t c = 0; c < opt.
carriers.size(); ++c) {
131 double mean = std::accumulate(
e.begin(),
e.end(), 0.0) / double(
e.size());
132 double var = std::accumulate(
e.begin(),
e.end(), 0.0,
133 [mean](
double acc,
double x) {
134 return acc + (x - mean) * (x - mean);
140 double s2 = (sigma / kT) * (sigma / kT);
141 double nmin = std::exp((s2 + 5.7) / 1.05);
143 <<
"Carrier " << opt.
carriers[c].state.ToString()
145 <<
" eV, standard deviation " << sigma <<
" eV = " << sigma / kT
146 <<
" kT at " <<
temperature_ <<
" K; the density of occupied states "
147 << (double(opt.
sites) >= nmin ?
"is" :
"is NOT")
148 <<
" sampled (needs about " << std::setprecision(2) << std::scientific
149 << nmin <<
" sites)" << std::defaultfloat << std::setprecision(6)
159 out <<
"# segment id, x, y, z [nm], site energies [eV] of";
160 for (
const auto& c : opt.
carriers) {
161 out <<
" " << c.state.ToString();
163 out <<
"\n" << std::setprecision(12);
164 const std::vector<Eigen::Vector3d>& pos = model.
Positions();
167 out << i <<
" " << p.x() <<
" " << p.y() <<
" " << p.z();
168 for (std::size_t c = 0; c < opt.
carriers.size(); ++c) {
174 <<
"Wrote site energies to " <<
energyfile_ << std::flush;
std::string parameterfile_
void ParseOptions(const tools::Property &options) override
std::vector< double > box_
void WriteFrame(const Topology &top)
Stochastic network model of a molecular charge transport network (Baumeier, Stenzel,...
void BuildTopology(Topology &top) const
fill an empty topology (segments with one pseudo atom, box, pairs)
const std::vector< double > & SiteEnergies(Index c) const
site energies of carrier c (index into Options::carriers)
Index Iterations() const
iterations the point process needed
const std::vector< Eigen::Vector3d > & Positions() const
const std::vector< InsertedTrap > & Traps() const
Index NumberOfSites() const
static Options FromProperty(const tools::Property &p)
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
inserted traps: template index and sites (deepest first)
std::vector< Trap > traps
trap templates, inserted after the Gaussian energies
double trap_factor
multiplies all trap densities (0: no traps)
std::vector< Carrier > carriers