n2p2 - A neural network potential package
SymFncCompRad.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// Copyright (C) 2020 Martin P. Bircher
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18#ifndef SYMFNCCOMPRAD_H
19#define SYMFNCCOMPRAD_H
20
21#include "SymFncBaseComp.h"
22#include <cstddef> // std::size_t
23#include <string> // std::string
24#include <vector> // std::vector
25
26namespace nnp
27{
28
29struct Atom;
30class ElementMap;
31
56{
57public:
63 virtual bool operator==(SymFnc const& rhs) const;
66 virtual bool operator<(SymFnc const& rhs) const;
72 virtual void setParameters(std::string const& parameterString);
77 virtual void changeLengthUnit(double convLength);
82 virtual std::string getSettingsLine() const;
89 virtual void calculate(Atom& atom, bool const derivatives) const;
90 // Access core fct. for groups
91 void getCompactOnly(double const x,
92 double& fx,
93 double& dfx) const;
98 virtual std::string parameterLine() const;
103 virtual std::vector<
104 std::string> parameterInfo() const;
107 std::size_t getE1() const;
113 virtual double calculateRadialPart(double distance) const;
119 virtual double calculateAngularPart(double angle) const;
126 virtual bool checkRelevantElement(std::size_t index) const;
127#ifndef N2P2_NO_SF_CACHE
133 virtual std::vector<
134 std::string> getCacheIdentifiers() const;
135#endif
136
137private:
139 std::size_t e1;
140};
141
143// Inlined function definitions //
145
146inline std::size_t SymFncCompRad::getE1() const { return e1; }
147
148inline void SymFncCompRad::getCompactOnly(double const x,
149 double& fx,
150 double& dfx) const
151{
152 cr.fdf(x, fx, dfx);
153 return;
154}
155
156}
157
158#endif
void fdf(double a, double &fa, double &dfa) const
Calculate compact function and derivative at once.
Contains element map.
Definition: ElementMap.h:30
Symmetry function base class for SFs with compact support.
CompactFunction cr
Compact function for radial part.
Radial symmetry function with compact support (type 20)
Definition: SymFncCompRad.h:56
std::size_t getE1() const
Get private e1 member variable.
virtual double calculateAngularPart(double angle) const
Calculate (partial) symmetry function value for one given angle.
void getCompactOnly(double const x, double &fx, double &dfx) const
std::size_t e1
Element index of neighbor atom.
virtual void calculate(Atom &atom, bool const derivatives) const
Calculate symmetry function for one atom.
virtual std::vector< std::string > parameterInfo() const
Get description with parameter names and values.
virtual std::string parameterLine() const
Give symmetry function parameters in one line.
virtual void changeLengthUnit(double convLength)
Change length unit.
virtual bool operator<(SymFnc const &rhs) const
Overload < operator.
virtual double calculateRadialPart(double distance) const
Calculate (partial) symmetry function value for one given distance.
virtual void setParameters(std::string const &parameterString)
Set symmetry function parameters.
virtual std::vector< std::string > getCacheIdentifiers() const
Get unique cache identifiers.
virtual bool checkRelevantElement(std::size_t index) const
Check whether symmetry function is relevant for given element.
virtual bool operator==(SymFnc const &rhs) const
Overload == operator.
SymFncCompRad(ElementMap const &elementMap)
Constructor, sets type = 20.
virtual std::string getSettingsLine() const
Get settings file line from currently set parameters.
Symmetry function base class.
Definition: SymFnc.h:40
double convLength
Data set normalization length conversion factor.
Definition: SymFnc.h:296
std::size_t index
Symmetry function index (per element).
Definition: SymFnc.h:272
ElementMap elementMap
Copy of element map.
Definition: SymFnc.h:270
Definition: Atom.h:28
Storage for a single atom.
Definition: Atom.h:32