34double d = 0.99999 /
p;
46 for (
size_t i = 0; i <
p; ++i)
48 __asm__ __volatile__(
"");
55 for (
size_t i = 0; i <
p; ++i)
57 __asm__ __volatile__(
"");
64 for (
size_t i = 0; i <
p; ++i)
66 __asm__ __volatile__(
"");
69 if (write)
nnplog <<
strpr(
" %10.2E %6.1f %10.2E %9.1f\n",
82 for (
size_t i = 0; i <
p; ++i)
87 if (cutoffType == CutoffFunction::CT_HARD)
tbf = tf;
92 for (
size_t i = 0; i <
p; ++i)
97 if (cutoffType == CutoffFunction::CT_HARD)
tbdf = tdf;
102 for (
size_t i = 0; i <
p; ++i)
109 if (cutoffType == CutoffFunction::CT_HARD)
tbfdf = tfdf;
111 nnplog <<
strpr(
" %10.2E %6.1f %6.1f %10.2E %9.1f\n",
116 100.0 * tfdf / (tf + tdf));
121 logFile.open(
"nnp-cutoff.log");
124 nnplog <<
"-------------------------------------------------------------------------------------------------------------\n";
125 nnplog <<
"Speed test tool for cutoff functions:\n";
126 nnplog <<
"-------------------------------------------------------------------------------------------------------------\n";
127 nnplog <<
"Column f : Time for calling f (no derivatives ).\n";
128 nnplog <<
"Column df : Time for calling df (only derivatives).\n";
129 nnplog <<
"Column fdf : Time for calling fdf (f and df at once).\n";
130 nnplog <<
"Column compL : Time compared to LOOP ONLY.\n";
131 nnplog <<
"Column compH : Time compared to CT_HARD.\n";
132 nnplog <<
"Column diff : Time difference between calling f + df (separately) and fdf.\n";
133 nnplog <<
"Column ratio : Ratio time(fdf) / (time(f) + time(df)) in %.\n";
134 nnplog <<
"-------------------------------------------------------------------------------------------------------------\n";
135 nnplog <<
"CutoffType : f [s] compL compH df [s] compL compH fdf[s] compL compH diff [s] ratio [%]\n";
136 nnplog <<
"-------------------------------------------------------------------------------------------------------------\n";
147 runTest(CutoffFunction::CT_HARD);
151 runTest(CutoffFunction::CT_COS);
154 runTest(CutoffFunction::CT_TANHU);
157 runTest(CutoffFunction::CT_TANH);
161 runTest(CutoffFunction::CT_EXP);
165 runTest(CutoffFunction::CT_POLY1);
169 runTest(CutoffFunction::CT_POLY2);
173 runTest(CutoffFunction::CT_POLY3);
177 runTest(CutoffFunction::CT_POLY4);
CutoffType
List of available cutoff function types.
double f(double r) const
Cutoff function .
void fdf(double r, double &fc, double &dfc) const
Calculate cutoff function and derivative .
void setCutoffParameter(double const alpha)
Set parameter for polynomial cutoff function (CT_POLY).
void setCutoffType(CutoffType const cutoffType)
Set cutoff type.
double df(double r) const
Derivative of cutoff function .
void setCutoffRadius(double const cutoffRadius)
Set cutoff radius.
Logging class for library output.
void registerStreamPointer(std::ofstream *const &streamPointer)
Register new C++ ofstream pointer.
Implements a simple stopwatch on different platforms.
void reset()
Reset stopwatch (total and loop time zero, clock not running).
double stop()
Stop and return total time.
void start(bool newLoop=true)
Start the stopwatch.
string strpr(const char *format,...)
String version of printf function.