Skip to content

Commit 7457aee

Browse files
committed
Fixed issue in nnp-checkf (non-periodic cases)
Added tests and documentation
1 parent 12264df commit 7457aee

13 files changed

Lines changed: 140 additions & 10420 deletions

File tree

examples/nnp-checkf/Cu2S_PBE/input.data

Lines changed: 0 additions & 3040 deletions
This file was deleted.

examples/nnp-checkf/Cu2S_PBE/input.nn

Lines changed: 0 additions & 282 deletions
This file was deleted.

examples/nnp-checkf/Cu2S_PBE/scaling.data

Lines changed: 0 additions & 153 deletions
This file was deleted.

examples/nnp-checkf/Cu2S_PBE/weights.016.data

Lines changed: 0 additions & 2517 deletions
This file was deleted.

examples/nnp-checkf/Cu2S_PBE/weights.029.data

Lines changed: 0 additions & 2367 deletions
This file was deleted.

examples/nnp-checkf/H2O_RPBE-D3/input.data

Lines changed: 0 additions & 2056 deletions
Large diffs are not rendered by default.

src/application/nnp-checkf.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int main(int argc, char* argv[])
8282
delta);
8383
if (myRank == 0)
8484
{
85-
string fileName = "forces.out";
85+
string fileName = "checkf-forces.out";
8686
dataset.log << strpr("Individual analytic/numeric forces will be "
8787
"written to \"%s\"\n", fileName.c_str());
8888
outFileForces.open(fileName.c_str());
@@ -113,9 +113,10 @@ int main(int argc, char* argv[])
113113
appendLinesToFile(outFileForces,
114114
createFileHeader(title, colSize, colName, colInfo));
115115

116-
fileName = "summary.out";
116+
fileName = "checkf-summary.out";
117117
dataset.log << strpr("Per-structure summary of analytic/numeric force "
118-
"comparison will be written to \"%s\"\n",
118+
"comparison will be \n"
119+
"written to \"%s\"\n",
119120
fileName.c_str());
120121
outFileSummary.open(fileName.c_str());
121122
// File header.

src/doc/sphinx/source/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# import sys
2121
# sys.path.insert(0, os.path.abspath('.'))
2222

23+
import sphinx_rtd_theme
2324

2425
# -- General configuration ------------------------------------------------
2526

@@ -33,7 +34,8 @@
3334
extensions = [
3435
'breathe',
3536
# 'exhale',
36-
'sphinx.ext.mathjax'
37+
'sphinx.ext.mathjax',
38+
'sphinx_rtd_theme'
3739
]
3840

3941
# Setup the breathe extension

src/doc/sphinx/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ list of keywords is provided :ref:`here <keywords>`.
194194

195195
tools/libnnp
196196
tools/nnp-atomenv
197+
tools/nnp-checkf
197198
tools/nnp-convert
198199
tools/nnp-norm
199200
tools/nnp-predict
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
.. _nnp-checkf:
2+
3+
nnp-checkf
4+
==========
5+
6+
This tool is useful for debugging as it computes numeric forces via the
7+
symmetric difference quotient (central difference) and compares it to the
8+
analytic forces obtained directly from n2p2's prediction. Parallelization via
9+
MPI is supported and it can process multiple configurations in the input file.
10+
11+
Requirements:
12+
-------------
13+
14+
The HDNNP setup, symmetry function scaling data and weight parameters are
15+
required in the usual files. The data file ``input.data`` may contain multiple
16+
configurations.
17+
18+
* ``input.data``
19+
* ``input.nn``
20+
* ``scaling.data``
21+
* ``weights.???.data``
22+
23+
Usage:
24+
------
25+
26+
.. code-block:: none
27+
28+
mpirun -np <np> nnp-checkf <<delta>>
29+
30+
where
31+
32+
.. code-block:: none
33+
34+
<np> ........ Number of MPI processes to use.
35+
<<nbins>> ... (optional) Displacement for central difference (default: 1.0e-4).
36+
37+
The ``<<delta>>`` parameter determines the position displacement of atoms used
38+
for the central difference approximation of the forces. If no value is provided
39+
the default is :math:`\delta = 10^{-4}`.
40+
41+
Sample screen output:
42+
---------------------
43+
44+
.. code-block:: none
45+
46+
*** ANALYTIC/NUMERIC FORCES CHECK *********************************************
47+
48+
Delta for symmetric difference quotient: 1.000E-04
49+
Individual analytic/numeric forces will be written to "checkf-forces.out"
50+
Per-structure summary of analytic/numeric force comparison will be
51+
written to "checkf-summary.out"
52+
Found 3 configurations in data file: input.data.
53+
Starting loop over 3 configurations...
54+
55+
numForces meanAbsError maxAbsError verdict
56+
-------------------------------------------------------------------
57+
Configuration 1: 144 7.168E-10 2.984E-09 OK.
58+
Configuration 2: 144 8.215E-10 3.212E-09 OK.
59+
Configuration 3: 144 7.254E-10 2.459E-09 OK.
60+
*******************************************************************************
61+
62+
File output:
63+
------------
64+
65+
* ``checkf-forces.out``: Comparison of analytic/numeric values, each force one
66+
line.
67+
68+
* ``checkf-summary.out``: Per-structure accumulated comparison (same as screen
69+
output).
70+
71+
Examples:
72+
---------
73+
74+
* Run on 4 cores and override default :math:`\delta` value:
75+
76+
.. code-block:: none
77+
78+
mpirun -np 4 nnp-checkf 1.0E-3
79+

0 commit comments

Comments
 (0)