-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue in nnp-checkf (non-periodic cases)
Added tests and documentation
- Loading branch information
Showing
13 changed files
with
140 additions
and
10,420 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
.. _nnp-checkf: | ||
|
||
nnp-checkf | ||
========== | ||
|
||
This tool is useful for debugging as it computes numeric forces via the | ||
symmetric difference quotient (central difference) and compares it to the | ||
analytic forces obtained directly from n2p2's prediction. Parallelization via | ||
MPI is supported and it can process multiple configurations in the input file. | ||
|
||
Requirements: | ||
------------- | ||
|
||
The HDNNP setup, symmetry function scaling data and weight parameters are | ||
required in the usual files. The data file ``input.data`` may contain multiple | ||
configurations. | ||
|
||
* ``input.data`` | ||
* ``input.nn`` | ||
* ``scaling.data`` | ||
* ``weights.???.data`` | ||
|
||
Usage: | ||
------ | ||
|
||
.. code-block:: none | ||
mpirun -np <np> nnp-checkf <<delta>> | ||
where | ||
|
||
.. code-block:: none | ||
<np> ........ Number of MPI processes to use. | ||
<<nbins>> ... (optional) Displacement for central difference (default: 1.0e-4). | ||
The ``<<delta>>`` parameter determines the position displacement of atoms used | ||
for the central difference approximation of the forces. If no value is provided | ||
the default is :math:`\delta = 10^{-4}`. | ||
|
||
Sample screen output: | ||
--------------------- | ||
|
||
.. code-block:: none | ||
*** ANALYTIC/NUMERIC FORCES CHECK ********************************************* | ||
Delta for symmetric difference quotient: 1.000E-04 | ||
Individual analytic/numeric forces will be written to "checkf-forces.out" | ||
Per-structure summary of analytic/numeric force comparison will be | ||
written to "checkf-summary.out" | ||
Found 3 configurations in data file: input.data. | ||
Starting loop over 3 configurations... | ||
numForces meanAbsError maxAbsError verdict | ||
------------------------------------------------------------------- | ||
Configuration 1: 144 7.168E-10 2.984E-09 OK. | ||
Configuration 2: 144 8.215E-10 3.212E-09 OK. | ||
Configuration 3: 144 7.254E-10 2.459E-09 OK. | ||
******************************************************************************* | ||
File output: | ||
------------ | ||
|
||
* ``checkf-forces.out``: Comparison of analytic/numeric values, each force one | ||
line. | ||
|
||
* ``checkf-summary.out``: Per-structure accumulated comparison (same as screen | ||
output). | ||
|
||
Examples: | ||
--------- | ||
|
||
* Run on 4 cores and override default :math:`\delta` value: | ||
|
||
.. code-block:: none | ||
mpirun -np 4 nnp-checkf 1.0E-3 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef EXAMPLE_NNP_CHECKF_H | ||
#define EXAMPLE_NNP_CHECKF_H | ||
|
||
#include "Example_nnp.h" | ||
#include "BoostDataContainer.h" | ||
|
||
struct Example_nnp_checkf : public Example_nnp | ||
{ | ||
Example_nnp_checkf(std::string name) | ||
: Example_nnp("nnp-checkf", name) {}; | ||
}; | ||
|
||
template<> | ||
void BoostDataContainer<Example_nnp_checkf>::setup() | ||
{ | ||
Example_nnp_checkf* e = nullptr; | ||
|
||
examples.push_back(Example_nnp_checkf("H2O_RPBE-D3")); | ||
e = &(examples.back()); | ||
e->args = ""; | ||
|
||
examples.push_back(Example_nnp_checkf("LJ")); | ||
e = &(examples.back()); | ||
e->args = ""; | ||
|
||
return; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#define BOOST_TEST_DYN_LINK | ||
#define BOOST_TEST_MODULE nnp-checkf | ||
#include "Example_nnp_checkf.h" | ||
#include "nnp_test.h" | ||
|
||
#include <limits> // std::numeric_limits | ||
|
||
using namespace std; | ||
|
||
double const accuracy = 10.0 * numeric_limits<double>::epsilon(); | ||
|
||
BoostDataContainer<Example_nnp_checkf> container; | ||
|
||
NNP_TOOL_TEST_CASE() | ||
|
||
void nnpToolTestBody(Example_nnp_checkf const /*example*/) | ||
{ | ||
BOOST_REQUIRE(bfs::exists("nnp-checkf.log.0000")); | ||
BOOST_REQUIRE(bfs::exists("checkf-forces.out")); | ||
BOOST_REQUIRE(bfs::exists("checkf-summary.out")); | ||
|
||
return; | ||
} |