n2p2 - A neural network potential package
SymFncStatistics.h
Go to the documentation of this file.
1// n2p2 - A neural network potential package
2// Copyright (C) 2018 Andreas Singraber (University of Vienna)
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17#ifndef SYMFNCSTATISTICS
18#define SYMFNCSTATISTICS
19
20#include <cstddef> // std::size_t
21#include <map> // std::map
22#include <string> // std::string
23#include <vector> // std::vector
24
25namespace nnp
26{
27
29{
30public:
34 struct Container
35 {
37 std::size_t count;
39 std::size_t countEW;
41 std::size_t type;
43 double min;
45 double max;
47 double Gmin;
49 double Gmax;
51 double sum;
53 double sum2;
55 std::string element;
57 std::vector<std::size_t> indexStructureEW;
59 std::vector<std::size_t> indexAtomEW;
61 std::vector<double> valueEW;
62
68 Container();
71 void reset();
74 void resetStatistics();
78 };
79
89 std::map<std::size_t, Container> data;
90
103 void addValue(std::size_t index, double value);
115 void addExtrapolationWarning(std::size_t index,
116 std::size_t type,
117 double value,
118 double Gmin,
119 double Gmax,
120 std::string element,
121 std::size_t indexStructure,
122 std::size_t indexAtom);
127 std::vector<
128 std::string> getExtrapolationWarningLines() const;
133 std::size_t countExtrapolationWarnings() const;
136 void resetStatistics();
142 void clear();
143};
144
145}
146
147#endif
void clear()
Completely erase database.
std::vector< std::string > getExtrapolationWarningLines() const
Get lines with extrapolation warnings.
SymFncStatistics()
Constructor, initializes bool variables.
bool stopOnExtrapolationWarnings
Whether to raise an exception in case of extrapolation warnings.
std::map< std::size_t, Container > data
Map for all symmetry functions containing all gathered information.
void addValue(std::size_t index, double value)
Update symmetry function statistics with one value.
bool collectStatistics
Whether statistics are gathered.
void resetExtrapolationWarnings()
Reset extrapolation warnings for all symmetry functions at once.
void addExtrapolationWarning(std::size_t index, std::size_t type, double value, double Gmin, double Gmax, std::string element, std::size_t indexStructure, std::size_t indexAtom)
Add extrapolation warning entry.
std::size_t countExtrapolationWarnings() const
Count total number of extrapolation warnings.
bool collectExtrapolationWarnings
Whether extrapolation warnings are logged.
bool writeExtrapolationWarnings
Whether to write out extrapolation warnings immediately as they occur.
void resetStatistics()
Reset statistics for all symmetry functions at once.
Definition: Atom.h:28
Struct containing statistics gathered during symmetry function calculation.
void resetStatistics()
Reset only statistics.
void resetExtrapolationWarnings()
Reset only extrapolation warnings.
std::vector< std::size_t > indexStructureEW
Structure indices for which extrapolation warnings occured.
Container()
Constructor, initializes contents to zero.
std::vector< double > valueEW
Out-of-bounds values causing extrapolation warnings.
std::vector< std::size_t > indexAtomEW
Atom indices for which extrapolation warnings occured.
double min
Minimum symmetry function value encountered.
double sum2
Sum of squared symmetry function values (to compute sigma).
std::size_t countEW
Counts extrapolation warnings.
double sum
Sum of symmetry function values (to compute mean).
std::string element
Element string of central atom of symmetry function.
double Gmax
Maximum symmetry function from scaling data.
std::size_t type
Symmetry function type.
double max
Maximum symmetry function value encountered.
std::size_t count
Counts total number of symmetry function evaluations.
double Gmin
Minimum symmetry function from scaling data.