votca 2026-dev
Loading...
Searching...
No Matches
votca::xtp::StochasticNetworkFit Class Reference

Fits the parameters of a StochasticNetwork to a microscopic system (a state file with site energies and couplings). More...

#include <stochasticnetworkfit.h>

Collaboration diagram for votca::xtp::StochasticNetworkFit:

Classes

struct  TrapInput
struct  Settings
struct  Data
 microscopic system More...
struct  Curve
 a function on a grid More...
struct  EnergyFit
struct  CouplingFit
struct  PointFit
struct  Result

Public Member Functions

 StochasticNetworkFit (const Data &data, const Settings &settings)
Result Fit () const

Static Public Member Functions

static Data FromTopology (const Topology &top, const std::vector< QMStateType > &carriers)
static Data FromNetwork (const StochasticNetwork &net, const std::vector< QMStateType > &carriers, const Eigen::Vector3d &box)
 the same data from a model network (validation)
static std::vector< double > NearestDistances (const std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d &box)
 nearest neighbour distances
static std::vector< double > ContactDistances (const std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d &box, Index probes, std::uint64_t seed)
 distances of probes random positions to the nearest point
static Curve Cdf (const std::vector< double > &x, const std::vector< double > &r)
 empirical distribution function on a grid
static Curve PairCorrelation (const std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d &box, double bin, double rmax)
 pair correlation function in bins of width bin up to rmax
static Curve Correlation (const std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d &box, const std::vector< double > &z, double bin, double rmax, const std::vector< char > &skip={})
static double NormalQuantile (double u)
 inverse of the standard normal distribution function
static std::vector< Curve > Overlaps (const std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d &box, const std::vector< Index > &l, double bin, double rmax)
 overlap curves O_l(r) for the given l
static double FitWeights (const Curve &kappa, const Curve &Ob, const Curve &Oc, double &w_b, double &w_c)
static Curve PairsPerSite (const Data &data, double bin, double rmax)
 pairs per site in distance bins (connected pairs of the data)
static Curve MeanLog10J2 (const Data &data, Index carrier, double bin, double rmax)
 mean of log10(J^2/eV^2) in distance bins

Private Member Functions

PointFit FitPoints () const
Curve FitConnection () const
CouplingFit FitCoupling (Index carrier, std::vector< double > &standardized) const

Private Attributes

const Data & data_
Settings settings_

Detailed Description

Fits the parameters of a StochasticNetwork to a microscopic system (a state file with site energies and couplings).

  • Point process: hard core, mean and variance of the radii by a coarse grid and Nelder-Mead on the squared differences of the nearest neighbour distance distribution D(r), the spherical contact distribution H(r) and (weight 1/4) the pair correlation function g(r), averaged over a few realizations with fixed random numbers.
  • Site energies (per carrier): mean, standard deviation and the spatial correlation kappa(r) = mean of z_i z_j over pairs at distance r. The moving average gives kappa(r) = w_b O_{l_b}(r) + w_c O_{l_c}(r), with O_l(r) the mean overlap |N_l(i) cap N_l(j)| / l of the neighbour sets of two sites at distance r, evaluated on the microscopic sites. For every (l_b, l_c) of the grids the weights (w_b, w_c >= 0, w_b + w_c <= 1) are a weighted least squares fit; the best pair is taken. The microscopic kappa is estimated with the sample mean and variance, which biases it by the mean correlation cbar = (w_a + w_b l_b + w_c l_c) / N over all pairs; the model is compared in the same form, (kappa - cbar) / (1 - cbar) (fixed point iteration), so that large model networks have the unbiased kappa; the standard deviation is corrected in the same way, sigma = s / sqrt(1 - cbar). Correlations over distances comparable to the box are not determined by the microscopic system; the fit reports when l_c is at the end of its grid. The site energies are the full site energies (electrostatic, polarization and internal).
  • Connections: f(r) = (number of pairs) / (number of site pairs) in distance bins.
  • Couplings (per carrier): y = log10(J^2/eV^2) linear in r, the squared residuals linear in r, quantiles of the standardized residuals.
  • Two carriers: correlation of the site energies (Pearson) and of the coupling residuals (normal scores, Gaussian copula). The moving average of the second carrier is fitted to (kappa_2 - rho^2 kappa_1) / (1 - rho^2), so that the model reproduces kappa_2.
  • Reorganization energies: means over the segments.
  • Traps (Settings::traps, e.g. from TrapFinder): their sites are left out of the site energy statistics of all carriers (mean, sigma, kappa, carrier correlation), and each becomes a StochasticNetwork::Trap template (energies of its sites relative to the bulk mean, all carriers) with the density 1/N of the microscopic system.

Definition at line 82 of file stochasticnetworkfit.h.

Constructor & Destructor Documentation

◆ StochasticNetworkFit()

votca::xtp::StochasticNetworkFit::StochasticNetworkFit ( const Data & data,
const Settings & settings )

Definition at line 444 of file stochasticnetworkfit.cc.

Member Function Documentation

◆ Cdf()

StochasticNetworkFit::Curve votca::xtp::StochasticNetworkFit::Cdf ( const std::vector< double > & x,
const std::vector< double > & r )
static

empirical distribution function on a grid

Definition at line 203 of file stochasticnetworkfit.cc.

◆ ContactDistances()

std::vector< double > votca::xtp::StochasticNetworkFit::ContactDistances ( const std::vector< Eigen::Vector3d > & points,
const Eigen::Vector3d & box,
Index probes,
std::uint64_t seed )
static

distances of probes random positions to the nearest point

Definition at line 184 of file stochasticnetworkfit.cc.

◆ Correlation()

StochasticNetworkFit::Curve votca::xtp::StochasticNetworkFit::Correlation ( const std::vector< Eigen::Vector3d > & points,
const Eigen::Vector3d & box,
const std::vector< double > & z,
double bin,
double rmax,
const std::vector< char > & skip = {} )
static

kappa(r) of standardized values z in bins up to rmax (pairs with a site marked in skip are left out)

Definition at line 243 of file stochasticnetworkfit.cc.

◆ Fit()

StochasticNetworkFit::Result votca::xtp::StochasticNetworkFit::Fit ( ) const

Definition at line 785 of file stochasticnetworkfit.cc.

◆ FitConnection()

StochasticNetworkFit::Curve votca::xtp::StochasticNetworkFit::FitConnection ( ) const
private

Definition at line 653 of file stochasticnetworkfit.cc.

◆ FitCoupling()

StochasticNetworkFit::CouplingFit votca::xtp::StochasticNetworkFit::FitCoupling ( Index carrier,
std::vector< double > & standardized ) const
private

Definition at line 707 of file stochasticnetworkfit.cc.

◆ FitPoints()

StochasticNetworkFit::PointFit votca::xtp::StochasticNetworkFit::FitPoints ( ) const
private

Definition at line 459 of file stochasticnetworkfit.cc.

◆ FitWeights()

double votca::xtp::StochasticNetworkFit::FitWeights ( const Curve & kappa,
const Curve & Ob,
const Curve & Oc,
double & w_b,
double & w_c )
static

weights w_b, w_c >= 0, w_b + w_c <= 1 minimizing sum count (w_b Ob + w_c Oc - kappa)^2; returns the weighted mean square

Definition at line 332 of file stochasticnetworkfit.cc.

◆ FromNetwork()

StochasticNetworkFit::Data votca::xtp::StochasticNetworkFit::FromNetwork ( const StochasticNetwork & net,
const std::vector< QMStateType > & carriers,
const Eigen::Vector3d & box )
static

the same data from a model network (validation)

Definition at line 149 of file stochasticnetworkfit.cc.

◆ FromTopology()

StochasticNetworkFit::Data votca::xtp::StochasticNetworkFit::FromTopology ( const Topology & top,
const std::vector< QMStateType > & carriers )
static

Definition at line 90 of file stochasticnetworkfit.cc.

◆ MeanLog10J2()

StochasticNetworkFit::Curve votca::xtp::StochasticNetworkFit::MeanLog10J2 ( const Data & data,
Index carrier,
double bin,
double rmax )
static

mean of log10(J^2/eV^2) in distance bins

Definition at line 422 of file stochasticnetworkfit.cc.

◆ NearestDistances()

std::vector< double > votca::xtp::StochasticNetworkFit::NearestDistances ( const std::vector< Eigen::Vector3d > & points,
const Eigen::Vector3d & box )
static

nearest neighbour distances

Definition at line 170 of file stochasticnetworkfit.cc.

◆ NormalQuantile()

double votca::xtp::StochasticNetworkFit::NormalQuantile ( double u)
static

inverse of the standard normal distribution function

Definition at line 404 of file stochasticnetworkfit.cc.

◆ Overlaps()

std::vector< StochasticNetworkFit::Curve > votca::xtp::StochasticNetworkFit::Overlaps ( const std::vector< Eigen::Vector3d > & points,
const Eigen::Vector3d & box,
const std::vector< Index > & l,
double bin,
double rmax )
static

overlap curves O_l(r) for the given l

Definition at line 272 of file stochasticnetworkfit.cc.

◆ PairCorrelation()

StochasticNetworkFit::Curve votca::xtp::StochasticNetworkFit::PairCorrelation ( const std::vector< Eigen::Vector3d > & points,
const Eigen::Vector3d & box,
double bin,
double rmax )
static

pair correlation function in bins of width bin up to rmax

Definition at line 217 of file stochasticnetworkfit.cc.

◆ PairsPerSite()

StochasticNetworkFit::Curve votca::xtp::StochasticNetworkFit::PairsPerSite ( const Data & data,
double bin,
double rmax )
static

pairs per site in distance bins (connected pairs of the data)

Definition at line 408 of file stochasticnetworkfit.cc.

Member Data Documentation

◆ data_

const Data& votca::xtp::StochasticNetworkFit::data_
private

Definition at line 228 of file stochasticnetworkfit.h.

◆ settings_

Settings votca::xtp::StochasticNetworkFit::settings_
private

Definition at line 229 of file stochasticnetworkfit.h.


The documentation for this class was generated from the following files: