32 states_ = options.
get(
".states").
as<std::vector<QMStateType>>();
36 if (options.
exists(
".distancemode")) {
37 std::string distancemode = options.
get(
"distancemode").
as<std::string>();
38 if (distancemode ==
"centerofmass") {
50 std::string seg_name = seg.getType();
55 std::cout << std::endl
57 <<
" segments (pattern='" <<
seg_pattern_ <<
"')" << std::flush;
60 <<
"... ... ... NOTE Statistics of site energies and spatial"
61 <<
" correlations thereof are based on the short-listed segments only. "
63 std::cout << std::endl
65 <<
"Statistics of site-energy differences operate on the full list."
76 std::cout << std::endl
77 <<
"... ... excited state " << state.ToString() << std::flush;
80 std::cout << std::endl
81 <<
"... ... ... No segments short-listed. Skip ... "
89 std::cout << std::endl
90 <<
"... ... ... No pairs in topology. Skip ... " << std::flush;
95 std::cout << std::endl;
101 std::vector<double> Es;
107 double MAX = *std::max_element(Es.begin(), Es.end());
108 double MIN = *std::min_element(Es.begin(), Es.end());
109 double sum = std::accumulate(Es.begin(), Es.end(), 0.0);
110 double AVG = sum / double(Es.size());
111 double sq_sum = std::inner_product(Es.begin(), Es.end(), Es.begin(), 0.0);
112 double STD = std::sqrt(sq_sum /
double(Es.size()) - AVG * AVG);
118 hist.Initialize(MIN, MAX, BIN);
119 hist.ProcessRange<std::vector<double>::iterator>(Es.begin(), Es.end());
121 tab.
flags() = std::vector<char>(tab.
size(),
' ');
122 std::string comment =
123 (boost::format(
"EANALYZE: SITE-ENERGY HISTOGRAM[eV] \n # AVG %1$4.7f STD "
124 "%2$4.7f MIN %3$4.7f MAX %4$4.7f") %
125 AVG % STD % MIN % MAX)
127 std::string filename =
"eanalyze.sitehist_" + state.
ToString() +
".out";
133 std::string filename2 =
"eanalyze.landscape_" + state.
ToString() +
".out";
137 throw std::runtime_error(
"error, cannot open file " + filename2);
146 double E = seg->getSiteEnergy(state);
147 for (
Atom &atm : *seg) {
148 out << boost::format(
"%1$3s %2$4.7f %3$4.7f %4$4.7f %5$4.7f\n") %
149 seg->getType() % atm.getPos().x() % atm.getPos().y() %
150 atm.getPos().z() % E;
161 std::string filenamelist =
"eanalyze.pairlist_" + state.
ToString() +
".out";
164 std::vector<double> dE;
165 dE.reserve(2 * nblist.
size());
167 out.open(filenamelist);
169 throw std::runtime_error(
"error, cannot open file " + filenamelist);
171 for (
QMPair *pair : nblist) {
173 dE.push_back(deltaE);
174 dE.push_back(-deltaE);
175 out << boost::format(
"%1$5d %2$5d %3$4.7f \n") % pair->Seg1()->getId() %
176 pair->Seg2()->getId() % deltaE;
180 double MAX = *std::max_element(dE.begin(), dE.end());
181 double MIN = *std::min_element(dE.begin(), dE.end());
182 double sum = std::accumulate(dE.begin(), dE.end(), 0.0);
183 double AVG = sum / double(dE.size());
184 double sq_sum = std::inner_product(dE.begin(), dE.end(), dE.begin(), 0.0);
185 double STD = std::sqrt(sq_sum /
double(dE.size()) - AVG * AVG);
188 std::string filename2 =
"eanalyze.pairhist_" + state.
ToString() +
".out";
190 hist.Initialize(MIN, MAX, BIN);
191 hist.ProcessRange<std::vector<double>::iterator>(dE.begin(), dE.end());
193 std::string comment =
194 (boost::format(
"EANALYZE: PAIR-ENERGY HISTOGRAM[eV] \n # AVG %1$4.7f STD "
195 "%2$4.7f MIN %3$4.7f MAX %4$4.7f") %
196 AVG % STD % MIN % MAX)
199 tab.
flags() = std::vector<char>(tab.
size(),
' ');
205 std::vector<double> Es;
211 double sum = std::accumulate(Es.begin(), Es.end(), 0.0);
212 double AVG = sum / double(Es.size());
213 double sq_sum = std::inner_product(Es.begin(), Es.end(), Es.begin(), 0.0);
214 double VAR = sq_sum / double(Es.size()) - AVG * AVG;
215 double STD = std::sqrt(VAR);
241 double MIN = tabcorr.
x().minCoeff();
242 double MAX = tabcorr.
x().maxCoeff();
246 std::vector<std::vector<double>> histCs;
249 for (
Index i = 0; i < tabcorr.
size(); ++i) {
251 histCs[bin].push_back(tabcorr.
y()[i]);
258 for (
Index bin = 0; bin < BIN; ++bin) {
261 for (
double entry : histCs[bin]) {
264 corr = corr / double(histCs[bin].size());
265 for (
Index i = 0; i <
Index(histCs[bin].size()); ++i) {
266 dcorr2 += (histCs[bin][i] / VAR / double(histCs[bin].size()) - corr) *
267 (histCs[bin][i] / VAR /
double(histCs[bin].size()) - corr);
271 dcorr2 / double(histCs[bin].size()) / double(histCs[bin].size() - 1);
273 histC.
set(bin, R, corr,
' ', std::sqrt(dcorr2));
276 std::string filename =
"eanalyze.sitecorr_" + state.
ToString() +
".out";
277 std::string comment =
278 (boost::format(
"EANALYZE: DISTANCE[nm] SPATIAL SITE-ENERGY "
279 "CORRELATION[eV] \n # AVG "
280 "%1$4.7f STD %2$4.7f MIN %3$4.7f MAX %4$4.7f") %
281 AVG % STD % MIN % MAX)
284 histC.
Save(filename);
const Eigen::Vector3d & getPos() const
void SiteHist(QMStateType state) const
void ParseOptions(const tools::Property &user_options)
std::vector< Segment * > seg_shortlist_
std::vector< QMStateType > states_
bool Evaluate(Topology &top)
void SiteCorr(const Topology &top, QMStateType state) const
void PairHist(const Topology &top, QMStateType state) const
double resolution_spatial_
std::string ToString() const
double getSiteEnergy(QMStateType state) const
Container for segments and box and atoms.
Eigen::Vector3d PbShortestConnect(const Eigen::Vector3d &r1, const Eigen::Vector3d &r2) const
std::vector< Segment > & Segments()
double GetShortestDist(const Segment &seg1, const Segment &seg2) const
base class for all analysis tools