n2p2 - A neural network potential package
SymFncBaseCompAng.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 SYMFNCBASECOMPANG_H
19#define SYMFNCBASECOMPANG_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
31{
32public:
38 virtual void setParameters(std::string const& parameterString);
43 virtual void changeLengthUnit(double convLength);
48 virtual std::string getSettingsLine() const;
49 // Core fcts
50 void getCompactAngle(double const x,
51 double& fx,
52 double& dfx) const;
53 void getCompactRadial(double const x,
54 double& fx,
55 double& dfx) const;
60 virtual std::string parameterLine() const;
65 virtual std::vector<
66 std::string> parameterInfo() const;
69 std::size_t getE1() const;
72 std::size_t getE2() const;
75 double getAngleLeft() const;
78 double getAngleRight() const;
84 virtual double calculateRadialPart(double distance) const;
90 virtual double calculateAngularPart(double angle) const;
97 virtual bool checkRelevantElement(std::size_t index) const;
98#ifndef N2P2_NO_SF_CACHE
104 virtual std::vector<
105 std::string> getCacheIdentifiers() const;
106#endif
107
108protected:
110 std::size_t e1;
112 std::size_t e2;
114 double angleLeft;
123
126 SymFncBaseCompAng(std::size_t type, ElementMap const&);
127};
128
130// Inlined function definitions //
132
133inline std::size_t SymFncBaseCompAng::getE1() const { return e1; }
134inline std::size_t SymFncBaseCompAng::getE2() const { return e2; }
135inline double SymFncBaseCompAng::getAngleLeft() const { return angleLeft; }
136inline double SymFncBaseCompAng::getAngleRight() const { return angleRight; }
137
138inline void SymFncBaseCompAng::getCompactAngle(double const x,
139 double& fx,
140 double& dfx) const
141{
142 ca.fdf(x, fx, dfx);
143 return;
144}
145
146inline void SymFncBaseCompAng::getCompactRadial(double const x,
147 double& fx,
148 double& dfx) const
149{
150 cr.fdf(x, fx, dfx);
151 return;
152}
153
154}
155
156#endif
A general function with compact support.
void fdf(double a, double &fa, double &dfa) const
Calculate compact function and derivative at once.
Contains element map.
Definition: ElementMap.h:30
Intermediate symmetry function class for angular SFs with compact support.
double angleLeft
Left angle boundary.
std::size_t getE2() const
Get private e2 member variable.
double angleRight
Right angle boundary.
double angleRightRadians
Right angle boundary in radians.
std::size_t e2
Element index of neighbor atom 2.
virtual std::vector< std::string > getCacheIdentifiers() const
Get unique cache identifiers.
virtual void changeLengthUnit(double convLength)
Change length unit.
virtual bool checkRelevantElement(std::size_t index) const
Check whether symmetry function is relevant for given element.
CompactFunction ca
Compact function member for angular part.
SymFncBaseCompAng(std::size_t type, ElementMap const &)
Constructor, initializes type.
virtual std::string parameterLine() const
Give symmetry function parameters in one line.
virtual double calculateAngularPart(double angle) const
Calculate (partial) symmetry function value for one given angle.
virtual void setParameters(std::string const &parameterString)
Set symmetry function parameters.
std::size_t getE1() const
Get private e1 member variable.
virtual std::vector< std::string > parameterInfo() const
Get description with parameter names and values.
virtual double calculateRadialPart(double distance) const
Calculate (partial) symmetry function value for one given distance.
double angleLeftRadians
Left angle boundary in radians.
virtual std::string getSettingsLine() const
Get settings file line from currently set parameters.
void getCompactRadial(double const x, double &fx, double &dfx) const
std::size_t e1
Element index of neighbor atom 1.
double getAngleRight() const
Get private angleRight member variable.
void getCompactAngle(double const x, double &fx, double &dfx) const
double getAngleLeft() const
Get private angleLeft member variable.
Symmetry function base class for SFs with compact support.
CompactFunction cr
Compact function for radial part.
double convLength
Data set normalization length conversion factor.
Definition: SymFnc.h:296
std::size_t type
Symmetry function type.
Definition: SymFnc.h:268
std::size_t index
Symmetry function index (per element).
Definition: SymFnc.h:272
Definition: Atom.h:29