n2p2 - A neural network potential package
SymFncBaseCutoff.cpp
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#include "SymFncBaseCutoff.h"
18#include "utility.h"
19#include <string>
20
21using namespace std;
22using namespace nnp;
23
24vector<string> SymFncBaseCutoff::parameterInfo() const
25{
26 vector<string> v = SymFnc::parameterInfo();
27 string s;
28 size_t w = sfinfoWidth;
29
30 s = "subtype";
31 v.push_back(strpr((pad(s, w) + "%s" ).c_str(), subtype.c_str()));
32 s = "alpha";
33 v.push_back(strpr((pad(s, w) + "%14.8E").c_str(), cutoffAlpha));
34
35 return v;
36}
37
40 double cutoffAlpha)
41{
42 this->cutoffType = cutoffType;
43 this->cutoffAlpha = cutoffAlpha;
46 this->subtype = string("ct") + strpr("%d", static_cast<int>(cutoffType));
47
48 return;
49}
50
52 ElementMap const& elementMap) :
53 SymFnc(type, elementMap),
54 cutoffAlpha (0.0 ),
55 subtype ("ct0" ),
56 cutoffType (CutoffFunction::CT_HARD)
57{
58 // Add cutoff-related parameter IDs to set.
59 parameters.insert("subtype");
60 parameters.insert("alpha");
61}
CutoffType
List of available cutoff function types.
void setCutoffParameter(double const alpha)
Set parameter for polynomial cutoff function (CT_POLY).
void setCutoffType(CutoffType const cutoffType)
Set cutoff type.
Contains element map.
Definition: ElementMap.h:30
std::string subtype
Subtype string (specifies cutoff type).
CutoffFunction fc
Cutoff function used by this symmetry function.
SymFncBaseCutoff(std::size_t type, ElementMap const &)
Constructor, initializes type.
CutoffFunction::CutoffType cutoffType
Cutoff type used by this symmetry function.
double cutoffAlpha
Cutoff parameter .
void setCutoffFunction(CutoffFunction::CutoffType cutoffType, double cutoffAlpha)
Set cutoff function type and parameter.
Symmetry function base class.
Definition: SymFnc.h:40
std::set< std::string > parameters
Set with symmetry function parameter IDs (lookup for printing).
Definition: SymFnc.h:300
static std::size_t const sfinfoWidth
Width of the SFINFO parameter description field (see parameterInfo()).
Definition: SymFnc.h:309
virtual std::vector< std::string > parameterInfo() const
Get description with parameter names and values.
Definition: SymFnc.cpp:32
Definition: Atom.h:29
string pad(string const &input, size_t num, char fill, bool right)
Definition: utility.cpp:79
string strpr(const char *format,...)
String version of printf function.
Definition: utility.cpp:90