18#ifndef ELEMENT_CABANA_H
19#define ELEMENT_CABANA_H
55 template <
class t_SF,
class h_t_
int>
57 std::vector<std::string> elementStrings,
58 int attype, t_SF SF,
double convLength,
59 h_t_int h_numSFperElem );
72 template <
class t_SF,
class h_t_
int>
82 bool compareSF( t_SF SF,
int attype,
int index1,
int index2 );
90 template <
class t_SF,
class h_t_
int>
91 std::vector<std::string>
93 h_t_int h_numSFperElem )
const;
104 template <
class t_SF,
class t_SFscaling,
class h_t_
int>
105 std::vector<std::string>
107 t_SF SF, t_SFscaling SFscaling,
109 h_t_int h_numSFperElem )
const;
121 template <
class t_SF,
class t_SFGmemberlist,
class h_t_
int>
123 int attype, h_t_int h_numSFperElem,
124 h_t_int h_numSFGperElem,
133 template <
class t_SF,
class t_SFGmemberlist,
class h_t_
int>
134 std::vector<std::string>
136 int attype, h_t_int h_numSFGperElem )
const;
146 template <
class t_SF,
class h_t_
int>
148 double const cutoffAlpha, t_SF SF,
int attype,
149 h_t_int h_numSFperElem );
164 template <
class t_SF,
class t_SFscaling,
class h_t_
int>
166 std::vector<std::string>
const &statisticsLine,
167 double minS,
double maxS, t_SF SF,
168 t_SFscaling SFscaling,
int attype,
169 h_t_int h_numSFperElem )
const;
178 template <
class h_t_
int>
190 template <
class t_SF>
201 template <
class t_SF,
class h_t_
int>
203 h_t_int h_numSFperElem )
const;
213 template <
class t_SF,
class h_t_
int>
215 h_t_int h_numSFperElem )
const;
236 template <
class t_SFscaling>
238 std::string statisticsLine,
239 double Smin,
double Smax,
240 t_SFscaling SFscaling,
241 int attype,
int k )
const;
250 template <
class t_SFscaling>
252 t_SFscaling SFscaling,
253 int attype,
int k )
const;
261 template <
class t_SFscaling>
262 inline double unscale(
int attype,
double value,
int k,
263 t_SFscaling SFscaling );
276template <
class h_t_
int>
279 h_t_int h_numSFperElem )
const
281 return h_numSFperElem( attype );
284template <
class t_SFscaling>
287 std::string statisticsLine,
double Smin,
288 double Smax, t_SFscaling SFscaling,
289 int attype,
int k )
const
291 double Gmin, Gmax, Gmean, Gsigma = 0, scalingFactor = 0;
292 std::vector<std::string> s =
split(
reduce( statisticsLine ) );
294 Gmin = atof( s.at( 2 ).c_str() );
295 Gmax = atof( s.at( 3 ).c_str() );
296 Gmean = atof( s.at( 4 ).c_str() );
297 SFscaling( attype, k, 0 ) = Gmin;
298 SFscaling( attype, k, 1 ) = Gmax;
299 SFscaling( attype, k, 2 ) = Gmean;
303 Gsigma = atof( s.at( 5 ).c_str() );
304 SFscaling( attype, k, 3 ) = Gsigma;
306 SFscaling( attype, k, 4 ) = Smin;
307 SFscaling( attype, k, 5 ) = Smax;
308 SFscaling( attype, k, 7 ) = scalingType;
313 scalingFactor = ( Smax - Smin ) / ( Gmax - Gmin );
317 scalingFactor = ( Smax - Smin ) / ( Gmax - Gmin );
319 scalingFactor = ( Smax - Smin ) / Gsigma;
320 SFscaling( attype, k, 6 ) = scalingFactor;
325template <
class t_SFscaling>
328 t_SFscaling SFscaling,
int attype,
331 return strpr(
"%4zu %9.2E %9.2E %9.2E %9.2E %9.2E %5.2f %5.2f %d\n",
332 k + 1, SFscaling( attype, k, 0 ),
333 SFscaling( attype, k, 1 ), SFscaling( attype, k, 2 ),
334 SFscaling( attype, k, 3 ), SFscaling( attype, k, 6 ),
335 SFscaling( attype, k, 4 ), SFscaling( attype, k, 5 ),
339template <
class t_SFscaling>
341 t_SFscaling SFscaling )
343 double scalingType = SFscaling( attype, k, 7 );
344 double scalingFactor = SFscaling( attype, k, 6 );
345 double Gmin = SFscaling( attype, k, 0 );
347 double Gmean = SFscaling( attype, k, 2 );
349 double Smin = SFscaling( attype, k, 4 );
352 if ( scalingType == 0.0 )
356 else if ( scalingType == 1.0 )
358 return ( value - Smin ) / scalingFactor + Gmin;
360 else if ( scalingType == 2.0 )
362 return value + Gmean;
364 else if ( scalingType == 3.0 )
366 return ( value - Smin ) / scalingFactor + Gmean;
368 else if ( scalingType == 4.0 )
370 return ( value - Smin ) / scalingFactor + Gmean;
CutoffType
List of available cutoff function types.
Derived Cabana class for element-specific data.
void setScaling(ScalingType scalingType, std::vector< std::string > const &statisticsLine, double minS, double maxS, t_SF SF, t_SFscaling SFscaling, int attype, h_t_int h_numSFperElem) const
Set scaling of all symmetry functions.
~ElementCabana()
Destructor.
std::size_t getMinNeighbors(int attype, t_SF SF, int nSF) const
Get maximum of required minimum number of neighbors for all symmetry functions for this element.
void setScalingType(ScalingType scalingType, std::string statisticsLine, double Smin, double Smax, t_SFscaling SFscaling, int attype, int k) const
Symmetry function statistics.
void changeLengthUnitSymmetryFunctions(double convLength)
Change length unit for all symmetry functions.
std::size_t index
Global index of this element.
void setCutoffFunction(CutoffFunction::CutoffType const cutoffType, double const cutoffAlpha, t_SF SF, int attype, h_t_int h_numSFperElem)
Set cutoff function for all symmetry functions.
bool compareSF(t_SF SF, int attype, int index1, int index2)
Print symmetry function parameter value information.
ElementCabana(std::size_t const index)
Constructor using index.
std::vector< std::string > infoSymmetryFunctionGroups(t_SF SF, t_SFGmemberlist SFGmemberlist, int attype, h_t_int h_numSFGperElem) const
Print symmetry function group info.
std::vector< std::string > infoSymmetryFunctionParameters(t_SF SF, int attype, h_t_int h_numSFperElem) const
Print symmetry function parameter value information.
std::vector< std::string > infoSymmetryFunctionScaling(ScalingType scalingType, t_SF SF, t_SFscaling SFscaling, int attype, h_t_int h_numSFperElem) const
Print symmetry function scaling information.
std::string scalingLine(ScalingType scalingType, t_SFscaling SFscaling, int attype, int k) const
Print scaling for one symmetry function.
double unscale(int attype, double value, int k, t_SFscaling SFscaling)
Unscale one symmetry function.
void addSymmetryFunction(std::string const ¶meters, std::vector< std::string > elementStrings, int attype, t_SF SF, double convLength, h_t_int h_numSFperElem)
Add one symmetry function.
Contains element-specific data.
void sortSymmetryFunctions()
Sort all symmetry function.
double getMinCutoffRadius() const
Get minimum cutoff radius of all symmetry functions.
void setupSymmetryFunctionGroups()
Set up symmetry function groups.
std::size_t index
Global index of this element.
std::string symbol
Element symbol.
double atomicEnergyOffset
Offset energy for every atom of this element.
double getMaxCutoffRadius() const
Get maximum cutoff radius of all symmetry functions.
std::size_t numSymmetryFunctions() const
Get number of symmetry functions.
std::size_t atomicNumber
Atomic number of this element.
string strpr(const char *format,...)
String version of printf function.
vector< string > split(string const &input, char delimiter)
Split string at each delimiter.
string reduce(string const &line, string const &whitespace, string const &fill)
Replace multiple whitespaces with fill.