From 8650d2447e1ed33f8da531c5b71c69ce61128b9e Mon Sep 17 00:00:00 2001 From: Andreas Singraber Date: Mon, 21 Dec 2020 17:37:35 +0100 Subject: [PATCH] Prefixed compile-time options with NNP_ - Also added underscores. - Changed IMPROVED_SFD_MEMORY (enabled by default) to FULL_SFD_MEMORY (disabled by default). --- README.md | 2 +- src/application/nnp-comp2.cpp | 2 +- src/application/nnp-dataset.cpp | 4 +- src/application/nnp-scaling.cpp | 4 +- src/application/nnp-sfclust.cpp | 4 +- src/doc/sphinx/source/topics/build.rst | 66 ++++++++++++++---------- src/libnnp/Atom.cpp | 28 +++++----- src/libnnp/Atom.h | 8 +-- src/libnnp/CompactFunction.cpp | 2 +- src/libnnp/CompactFunction.h | 2 +- src/libnnp/CoreFunction.cpp | 2 +- src/libnnp/CoreFunction.h | 12 ++--- src/libnnp/Element.cpp | 2 +- src/libnnp/Element.h | 6 +-- src/libnnp/Mode.cpp | 22 ++++---- src/libnnp/Mode.h | 2 +- src/libnnp/Prediction.cpp | 2 +- src/libnnp/Stopwatch.cpp | 8 +-- src/libnnp/Stopwatch.h | 8 +-- src/libnnp/SymFnc.cpp | 4 +- src/libnnp/SymFnc.h | 6 +-- src/libnnp/SymFncBaseComp.cpp | 4 +- src/libnnp/SymFncBaseCompAng.cpp | 2 +- src/libnnp/SymFncBaseCompAng.h | 2 +- src/libnnp/SymFncBaseCompAngWeighted.cpp | 2 +- src/libnnp/SymFncBaseCompAngWeighted.h | 2 +- src/libnnp/SymFncBaseExpAng.cpp | 2 +- src/libnnp/SymFncBaseExpAng.h | 2 +- src/libnnp/SymFncCompAngn.cpp | 6 +-- src/libnnp/SymFncCompAngnWeighted.cpp | 6 +-- src/libnnp/SymFncCompAngw.cpp | 6 +-- src/libnnp/SymFncCompAngwWeighted.cpp | 6 +-- src/libnnp/SymFncCompRad.cpp | 8 +-- src/libnnp/SymFncCompRad.h | 2 +- src/libnnp/SymFncCompRadWeighted.cpp | 6 +-- src/libnnp/SymFncCompRadWeighted.h | 2 +- src/libnnp/SymFncExpAngn.cpp | 6 +-- src/libnnp/SymFncExpAngnWeighted.cpp | 8 +-- src/libnnp/SymFncExpAngnWeighted.h | 2 +- src/libnnp/SymFncExpAngw.cpp | 6 +-- src/libnnp/SymFncExpRad.cpp | 8 +-- src/libnnp/SymFncExpRad.h | 2 +- src/libnnp/SymFncExpRadWeighted.cpp | 6 +-- src/libnnp/SymFncExpRadWeighted.h | 2 +- src/libnnp/SymGrpBaseCompAng.h | 2 +- src/libnnp/SymGrpBaseCompAngWeighted.h | 2 +- src/libnnp/SymGrpCompAngn.cpp | 12 ++--- src/libnnp/SymGrpCompAngnWeighted.cpp | 12 ++--- src/libnnp/SymGrpCompAngw.cpp | 12 ++--- src/libnnp/SymGrpCompAngwWeighted.cpp | 12 ++--- src/libnnp/SymGrpCompRad.cpp | 8 +-- src/libnnp/SymGrpCompRad.h | 2 +- src/libnnp/SymGrpCompRadWeighted.cpp | 6 +-- src/libnnp/SymGrpExpAngn.cpp | 12 ++--- src/libnnp/SymGrpExpAngnWeighted.cpp | 12 ++--- src/libnnp/SymGrpExpAngw.cpp | 12 ++--- src/libnnp/SymGrpExpRad.cpp | 8 +-- src/libnnp/SymGrpExpRadWeighted.cpp | 8 +-- src/libnnpif/LAMMPS/InterfaceLammps.cpp | 14 ++--- src/libnnpif/LAMMPS/Makefile.lammps | 2 +- src/libnnpif/makefile | 2 +- src/libnnptrain/Dataset.cpp | 18 +++---- src/libnnptrain/Training.cpp | 20 +++---- src/libnnptrain/Training.h | 4 +- src/makefile.gnu | 18 +++---- src/makefile.intel | 18 +++---- src/makefile.llvm | 18 +++---- src/pynnp/Atom.pyx | 14 ++--- src/pynnp/pynnp_dec.pxd | 2 +- test/python/test_Atom.py | 10 ++-- 70 files changed, 284 insertions(+), 270 deletions(-) diff --git a/README.md b/README.md index 9f8aff627..9b01807c7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ network potentials in computational physics and chemistry. # [Documentation](http://compphysvienna.github.io/n2p2) This package uses automatic documentation generation via -[Sphinx](http://www.sphinx-doc.org) +[Sphinx](http://www.sphinx-doc.org), [Breathe](https://breathe.readthedocs.io/en/latest/#) and [doxygen](http://www.doxygen.nl/). An online version of the documentation which is automatically updated with the master branch of the repository can be found diff --git a/src/application/nnp-comp2.cpp b/src/application/nnp-comp2.cpp index 5640c2488..5196b7bfc 100644 --- a/src/application/nnp-comp2.cpp +++ b/src/application/nnp-comp2.cpp @@ -189,7 +189,7 @@ int main(int argc, char* argv[]) it != dataset.structures.end(); ++it) { it->calculateNeighborList(dataset.getMaxCutoffRadius()); -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS dataset.calculateSymmetryFunctions((*it), useForces); #else dataset.calculateSymmetryFunctionGroups((*it), useForces); diff --git a/src/application/nnp-dataset.cpp b/src/application/nnp-dataset.cpp index 7bd9522de..2b10d0861 100644 --- a/src/application/nnp-dataset.cpp +++ b/src/application/nnp-dataset.cpp @@ -199,7 +199,7 @@ int main(int argc, char* argv[]) it != dataset.structures.end(); ++it) { it->calculateNeighborList(dataset.getMaxCutoffRadius()); -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS dataset.calculateSymmetryFunctions((*it), useForces); #else dataset.calculateSymmetryFunctionGroups((*it), useForces); @@ -246,7 +246,7 @@ int main(int argc, char* argv[]) it2->dEdG.clear(); vector(it2->dEdG).swap(it2->dEdG); -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY it2->dGdxia.clear(); vector(it2->dGdxia).swap(it2->dGdxia); #endif diff --git a/src/application/nnp-scaling.cpp b/src/application/nnp-scaling.cpp index 4237e6264..2224235ad 100644 --- a/src/application/nnp-scaling.cpp +++ b/src/application/nnp-scaling.cpp @@ -80,7 +80,7 @@ int main(int argc, char* argv[]) it != dataset.structures.end(); ++it) { it->calculateNeighborList(dataset.getMaxCutoffRadius()); -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS dataset.calculateSymmetryFunctions((*it), useForces); #else dataset.calculateSymmetryFunctionGroups((*it), useForces); @@ -105,7 +105,7 @@ int main(int argc, char* argv[]) it2->dEdG.clear(); vector(it2->dEdG).swap(it2->dEdG); -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY it2->dGdxia.clear(); vector(it2->dGdxia).swap(it2->dGdxia); #endif diff --git a/src/application/nnp-sfclust.cpp b/src/application/nnp-sfclust.cpp index 6c3ad8997..ba018dba3 100644 --- a/src/application/nnp-sfclust.cpp +++ b/src/application/nnp-sfclust.cpp @@ -95,7 +95,7 @@ int main(int argc, char* argv[]) it != dataset.structures.end(); ++it) { it->calculateNeighborList(dataset.getMaxCutoffRadius()); -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS dataset.calculateSymmetryFunctions((*it), useForces); #else dataset.calculateSymmetryFunctionGroups((*it), useForces); @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) it2->dEdG.clear(); vector(it2->dEdG).swap(it2->dEdG); -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY it2->dGdxia.clear(); vector(it2->dGdxia).swap(it2->dGdxia); #endif diff --git a/src/doc/sphinx/source/topics/build.rst b/src/doc/sphinx/source/topics/build.rst index 8c09cf3ce..d0b484942 100644 --- a/src/doc/sphinx/source/topics/build.rst +++ b/src/doc/sphinx/source/topics/build.rst @@ -160,7 +160,7 @@ time: Symmetry function groups ^^^^^^^^^^^^^^^^^^^^^^^^ -**Flag:** ``-DNOSFGROUPS`` (default: *disabled*) +**Flag:** ``-DNNP_NO_SF_GROUPS`` (default: *disabled*) If this flag is set the symmetry function group feature will be disabled everywhere. This will result in a much worse performance but may be useful for @@ -170,18 +170,31 @@ will not change results, please see details in this publication [1]_. Improved symmetry function derivative memory ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -**Flag:** ``-DIMPROVED_SFD_MEMORY`` (default: *enabled*) - -Reduces the memory usage for symmetry function derivatives when multiple -elements are present. The actual reduction depends on the symmetry function -setup, as a rough estimate expect about 30 to 50% reduction. This feature is -particularly useful for training of large data sets when symmetry function -derivatives are stored in memory (keyword ``memorize_symfunc_results``). An -additional section in the :ref:`libnnp ` output will displayed after -the ``SETUP: SYMMETRY FUNCTIONS`` section, which indicates the amount of -still required memory for symmetry function derivatives. Here is how the -output looks like for the RPBE-D3 water example -(``examples/nnp-predict/H2O_RPBE-D3``): +**Flag:** ``-DNNP_FULL_SFD_MEMORY`` (default: *disabled*) + +By default *n2p2* reduces the memory usage when multiple elements are present by +eliminating storage for symmetry function derivatives which are zero by +definition. This happens whenever a symmetry function is only sensitive to +neighbors of certain (and not all) elements. Then, there is no space required +for derivatives with respect to neighbors of all other elements and hence a +significant amount of memory allocation can be avoided. The actual benefit +depends on the symmetry function setup, as a rough estimate expect about 30 to +50% reduction. This feature is particularly useful for training of large data +sets when symmetry function derivatives are stored in memory (keyword +``memorize_symfunc_results``). + +However, for debugging and development purposes it can be helpful to keep the +naive, full symmetry function derivative memory allocation. This can be achieved +by enabling the flag ``-DNNP_FULL_SFD_MEMORY``. Only in this case there is a +one-to-one correspondance between the list of symmetry functions in the +:ref:`libnnp ` output and the symmetry function derivative vectors in +:cpp:member:`nnp::Atom::Neighbor::dGdr`. + +Normally, i.e. when ``-DNNP_FULL_SFD_MEMORY`` is **disabled**, an additional +section in the :ref:`libnnp ` output will displayed after the ``SETUP: +SYMMETRY FUNCTIONS`` section, which indicates the amount of still required +memory for symmetry function derivatives. Here is how the output looks like for +the RPBE-D3 water example (``examples/nnp-predict/H2O_RPBE-D3``): .. code-block:: none @@ -204,24 +217,25 @@ output looks like for the RPBE-D3 water example Benchmarking the training program and the LAMMPS interface with the same system gives the following results: -+---------------------------------+-------------+-----------+------------+ -| ``-DIMPROVED_SFD_MEMORY`` | *disabled* | *enabled* | difference | -+=================================+=============+===========+============+ -| Training (memory) | 55.2 GB | 37.8 GB | -31.5 % | -+---------------------------------+-------------+-----------+------------+ -| MD with LAMMPS (memory) | 725.6 MB | 500.0 MB | -31.1 % | -+---------------------------------+-------------+-----------+------------+ -| MD with LAMMPS (speed) | 33.82 s | 34.14 s | +0.9 % | -+---------------------------------+-------------+-----------+------------+ ++---------------------------------+-------------+------------+------------+ +| ``-DNNP_FULL_SFD_MEMORY`` | *enabled* | *disabled* | difference | ++=================================+=============+============+============+ +| Training (memory) | 55.2 GB | 37.8 GB | -31.5 % | ++---------------------------------+-------------+------------+------------+ +| MD with LAMMPS (memory) | 725.6 MB | 500.0 MB | -31.1 % | ++---------------------------------+-------------+------------+------------+ +| MD with LAMMPS (speed) | 33.82 s | 34.14 s | +0.9 % | ++---------------------------------+-------------+------------+------------+ Given the significant reduction in memory and the negligible impact on speed -this feature is enabled by default. +the improved memory layout is used by default (``-DNNP_FULL_SFD_MEMORY`` +disabled). .. important:: - If you prefer to disable this functionality please also remove the flag - ``-DIMPROVED_SFD_MEMORY`` from the LAMMPS makefile in - ``src/libnnpif/Makefile.lammps``! + If you need the full symmetry function derivative memory together with the + LAMMPS interface add ``-DNNP_FULL_SFD_MEMORY`` to the ``nnp_SYSINC =`` + variable in the LAMMPS makefile in ``src/libnnpif/LAMMPS/Makefile.lammps``! .. [1] Singraber, A.; Behler, J.; Dellago, C. Library-Based LAMMPS Implementation of High-Dimensional Neural Network Potentials. J. Chem. Theory diff --git a/src/libnnp/Atom.cpp b/src/libnnp/Atom.cpp index fb23c45fc..158b39d8b 100644 --- a/src/libnnp/Atom.cpp +++ b/src/libnnp/Atom.cpp @@ -37,7 +37,7 @@ Atom::Atom() : hasNeighborList (false), { } -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY void Atom::collectDGdxia(size_t indexAtom, size_t indexComponent) { for (size_t i = 0; i < dGdxia.size(); i++) @@ -78,7 +78,7 @@ void Atom::toNormalizedUnits(double convEnergy, double convLength) { dEdG.at(i) *= convEnergy; dGdr.at(i) /= convLength; -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY dGdxia.at(i) /= convLength; #endif } @@ -116,7 +116,7 @@ void Atom::toPhysicalUnits(double convEnergy, double convLength) { dEdG.at(i) /= convEnergy; dGdr.at(i) *= convLength; -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY dGdxia.at(i) *= convLength; #endif } @@ -153,14 +153,14 @@ void Atom::allocate(bool all) // Clear all symmetry function related vectors (also for derivatives). G.clear(); dEdG.clear(); -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY dGdxia.clear(); #endif dGdr.clear(); for (vector::iterator it = neighbors.begin(); it != neighbors.end(); ++it) { -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE it->cache.clear(); #endif it->dGdr.clear(); @@ -174,7 +174,7 @@ void Atom::allocate(bool all) G.resize(numSymmetryFunctions, 0.0); if (all) { -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY if (numSymmetryFunctionDerivatives.size() == 0) { throw range_error("ERROR: Number of symmetry function derivatives" @@ -182,7 +182,7 @@ void Atom::allocate(bool all) } #endif dEdG.resize(numSymmetryFunctions, 0.0); -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY dGdxia.resize(numSymmetryFunctions, 0.0); #endif dGdr.resize(numSymmetryFunctions); @@ -190,13 +190,13 @@ void Atom::allocate(bool all) for (vector::iterator it = neighbors.begin(); it != neighbors.end(); ++it) { -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE it->cache.resize(cacheSizePerElement.at(it->element), -numeric_limits::max()); #endif if (all) { -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY it->dGdr.resize(numSymmetryFunctionDerivatives.at(it->element)); #else it->dGdr.resize(numSymmetryFunctions); @@ -214,7 +214,7 @@ void Atom::free(bool all) G.clear(); vector(G).swap(G); hasSymmetryFunctions = false; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE for (vector::iterator it = neighbors.begin(); it != neighbors.end(); ++it) { @@ -226,7 +226,7 @@ void Atom::free(bool all) dEdG.clear(); vector(dEdG).swap(dEdG); -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY dGdxia.clear(); vector(dGdxia).swap(dGdxia); #endif @@ -350,7 +350,7 @@ vector Atom::info() const { v.push_back(strpr("%29d : %d\n", i, numSymmetryFunctionDerivatives.at(i))); } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE v.push_back(strpr("--------------------------------\n")); v.push_back(strpr("--------------------------------\n")); v.push_back(strpr("cacheSizePerElement [*] : %d\n", cacheSizePerElement.size())); @@ -377,7 +377,7 @@ vector Atom::info() const v.push_back(strpr("%29d : %16.8E\n", i, dEdG.at(i))); } v.push_back(strpr("--------------------------------\n")); -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY v.push_back(strpr("--------------------------------\n")); v.push_back(strpr("dGdxia [*] : %d\n", dGdxia.size())); v.push_back(strpr("--------------------------------\n")); @@ -446,7 +446,7 @@ vector Atom::Neighbor::info() const v.push_back(strpr("d : %16.8E\n", d)); v.push_back(strpr("dr : %16.8E %16.8E %16.8E\n", dr[0], dr[1], dr[2])); v.push_back(strpr("--------------------------------\n")); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE v.push_back(strpr("cache [*] : %d\n", cache.size())); v.push_back(strpr("--------------------------------\n")); for (size_t i = 0; i < cache.size(); ++i) diff --git a/src/libnnp/Atom.h b/src/libnnp/Atom.h index 182bc6808..f2412de30 100644 --- a/src/libnnp/Atom.h +++ b/src/libnnp/Atom.h @@ -41,7 +41,7 @@ struct Atom double d; /// Distance vector to neighbor atom. Vec3D dr; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /// Symmetry function cache (e.g. for cutoffs, compact functions). std::vector cache; #endif @@ -120,7 +120,7 @@ struct Atom std::vector numNeighborsPerElement; /// Number of neighbor atom symmetry function derivatives per element. std::vector numSymmetryFunctionDerivatives; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /// Cache size for each element. std::vector cacheSizePerElement; #endif @@ -128,7 +128,7 @@ struct Atom std::vector G; /// Derivative of atomic energy with respect to symmetry functions. std::vector dEdG; -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY /// Derivative of symmetry functions with respect to one specific atom /// coordinate. std::vector dGdxia; @@ -142,7 +142,7 @@ struct Atom /** Atom constructor, initialize to zero. */ Atom(); -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY /** Collect derivative of symmetry functions with repect to one atom's * coordinate. * diff --git a/src/libnnp/CompactFunction.cpp b/src/libnnp/CompactFunction.cpp index 2c60b10c1..5921d03ac 100644 --- a/src/libnnp/CompactFunction.cpp +++ b/src/libnnp/CompactFunction.cpp @@ -30,7 +30,7 @@ CompactFunction::CompactFunction() : center (0.0 ), core.setType(CoreFunction::Type::POLY2); } -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY bool CompactFunction::getAsymmetric() const { return core.getAsymmetric(); diff --git a/src/libnnp/CompactFunction.h b/src/libnnp/CompactFunction.h index 983d3f21b..63e58ee12 100644 --- a/src/libnnp/CompactFunction.h +++ b/src/libnnp/CompactFunction.h @@ -56,7 +56,7 @@ class CompactFunction * @return Type used. */ CoreFunction::Type getCoreFunctionType() const; -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY /** Set asymmetric property in core function. * * @param[in] asymmetric Whether asymmetry should be activated. diff --git a/src/libnnp/CoreFunction.cpp b/src/libnnp/CoreFunction.cpp index 27e25ac94..6f54e5042 100644 --- a/src/libnnp/CoreFunction.cpp +++ b/src/libnnp/CoreFunction.cpp @@ -24,7 +24,7 @@ using namespace nnp; double const CoreFunction::E = exp(1.0); CoreFunction::CoreFunction() : type (Type::POLY2 ), -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY asymmetric(false ), #endif fPtr (&CoreFunction:: fPOLY2), diff --git a/src/libnnp/CoreFunction.h b/src/libnnp/CoreFunction.h index eb256f0d4..4ba182072 100644 --- a/src/libnnp/CoreFunction.h +++ b/src/libnnp/CoreFunction.h @@ -59,7 +59,7 @@ class CoreFunction * @return Type used. */ Type getType() const; -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY /** Set asymmetric property. * * @param[in] asymmetric Whether asymmetry should be activated. @@ -95,7 +95,7 @@ class CoreFunction static double const E; /// Core function type. Type type; -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY /// Enables asymmetry modification (use with polynomials). bool asymmetric; #endif @@ -139,7 +139,7 @@ inline CoreFunction::Type CoreFunction::getType() const return type; } -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY inline void CoreFunction::setAsymmetric(bool asymmetric) { this->asymmetric = asymmetric; @@ -155,7 +155,7 @@ inline bool CoreFunction::getAsymmetric() const inline double CoreFunction::f(double x) const { -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY if (asymmetric) x = (2.0 - x) * x; #endif return (this->*fPtr)(x); @@ -163,7 +163,7 @@ inline double CoreFunction::f(double x) const inline double CoreFunction::df(double x) const { -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY if (asymmetric) return (2.0 - 2.0 * x) * (this->*dfPtr)((2.0 - x) * x); else return (this->*dfPtr)(x); #else @@ -173,7 +173,7 @@ inline double CoreFunction::df(double x) const inline void CoreFunction::fdf(double x, double& fx, double& dfx) const { -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY if (asymmetric) { (this->*fdfPtr)((2.0 - x) * x, fx, dfx); diff --git a/src/libnnp/Element.cpp b/src/libnnp/Element.cpp index 224a506cc..3ed134454 100644 --- a/src/libnnp/Element.cpp +++ b/src/libnnp/Element.cpp @@ -536,7 +536,7 @@ size_t Element::updateSymmetryFunctionStatistics(Atom const& atom) return countExtrapolationWarnings; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE void Element::setCacheIndices(vector> cacheLists) { this->cacheLists = cacheLists; diff --git a/src/libnnp/Element.h b/src/libnnp/Element.h index 956a0602e..cd7685922 100644 --- a/src/libnnp/Element.h +++ b/src/libnnp/Element.h @@ -38,7 +38,7 @@ class Element { public: -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /// List of symmetry functions corresponding to one cache identifier. struct SFCacheList { @@ -206,7 +206,7 @@ class Element * @return Symmetry function object. */ SymFnc const& getSymmetryFunction(std::size_t index) const; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Set cache indices for all symmetry functions of this element. * * @param[in] cacheLists List of cache identifier strings and corresponding @@ -242,7 +242,7 @@ class Element std::vector symmetryFunctionNumTable; /// List of symmetry function indices relevant for each neighbor element. std::vector> symmetryFunctionTable; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /// Symmetry function cache lists. std::vector> cacheLists; #endif diff --git a/src/libnnp/Mode.cpp b/src/libnnp/Mode.cpp index 6c8f0fb3b..790527dcd 100644 --- a/src/libnnp/Mode.cpp +++ b/src/libnnp/Mode.cpp @@ -24,7 +24,7 @@ #include // std::min, std::max, std::remove_if #include // atoi, atof #include // std::ifstream -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE #include // std::multimap #endif #include // std::numeric_limits @@ -90,13 +90,13 @@ void Mode::setupGeneric() setupElements(); setupCutoff(); setupSymmetryFunctions(); -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY setupSymmetryFunctionMemory(false); #endif -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE setupSymmetryFunctionCache(); #endif -#ifndef NOSFGROUPS +#ifndef NNP_NO_SF_GROUPS setupSymmetryFunctionGroups(); #endif setupNeuralNetwork(); @@ -681,7 +681,7 @@ void Mode::setupSymmetryFunctionMemory(bool verbose) return; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE void Mode::setupSymmetryFunctionCache(bool verbose) { log << "\n"; @@ -1055,11 +1055,11 @@ void Mode::calculateSymmetryFunctions(Structure& structure, a->numSymmetryFunctionDerivatives = e->getSymmetryFunctionNumTable(); } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE a->cacheSizePerElement = e->getCacheSizes(); #endif -#ifndef NONEIGHCHECK +#ifndef NNP_NO_NEIGH_CHECK // Check if atom has low number of neighbors. size_t numNeighbors = a->getNumNeighbors( minCutoffRadius.at(e->getIndex())); @@ -1132,11 +1132,11 @@ void Mode::calculateSymmetryFunctionGroups(Structure& structure, a->numSymmetryFunctionDerivatives = e->getSymmetryFunctionNumTable(); } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE a->cacheSizePerElement = e->getCacheSizes(); #endif -#ifndef NONEIGHCHECK +#ifndef NNP_NO_NEIGH_CHECK // Check if atom has low number of neighbors. size_t numNeighbors = a->getNumNeighbors( minCutoffRadius.at(e->getIndex())); @@ -1246,7 +1246,7 @@ void Mode::calculateForces(Structure& structure) const { // Define shortcut for atom j (aj). Atom& aj = structure.atoms.at(*it); -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY vector > const& tableFull = elements.at(aj.element).getSymmetryFunctionTable(); #endif @@ -1257,7 +1257,7 @@ void Mode::calculateForces(Structure& structure) const // If atom j's neighbor is atom i add force contributions. if (n->index == ai->index) { -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY vector const& table = tableFull.at(n->element); for (size_t j = 0; j < n->dGdr.size(); ++j) { diff --git a/src/libnnp/Mode.h b/src/libnnp/Mode.h index a0f40a1f2..9dd5e9d0a 100644 --- a/src/libnnp/Mode.h +++ b/src/libnnp/Mode.h @@ -156,7 +156,7 @@ class Mode * ensure that correct scaling behavior has already been set. */ virtual void setupSymmetryFunctionGroups(); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Set up symmetry function cache. * * @param[in] verbose If true, print more cache information. diff --git a/src/libnnp/Prediction.cpp b/src/libnnp/Prediction.cpp index d778d0f5d..806a6f5f8 100644 --- a/src/libnnp/Prediction.cpp +++ b/src/libnnp/Prediction.cpp @@ -60,7 +60,7 @@ void Prediction::readStructureFromFile(string const& fileName) void Prediction::predict() { structure.calculateNeighborList(maxCutoffRadius); -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS calculateSymmetryFunctions(structure, true); #else calculateSymmetryFunctionGroups(structure, true); diff --git a/src/libnnp/Stopwatch.cpp b/src/libnnp/Stopwatch.cpp index 776f37756..d49c8a068 100644 --- a/src/libnnp/Stopwatch.cpp +++ b/src/libnnp/Stopwatch.cpp @@ -25,7 +25,7 @@ Stopwatch::Stopwatch() { state = STOPPED; timeElapsed = 0.0; -#ifdef NOTIME +#ifdef NNP_NO_TIME //fprintf(stderr, "WARNING: Stopwatch is using dummy implementation.\n"); #elif __linux__ time.tv_sec = 0; @@ -40,7 +40,7 @@ void Stopwatch::start() { if (state == STOPPED) { -#ifdef NOTIME +#ifdef NNP_NO_TIME #elif __linux__ clock_gettime(CLOCK_MONOTONIC, &time); #elif __MACH__ @@ -94,7 +94,7 @@ void Stopwatch::reset() { state = STOPPED; timeElapsed = 0.0; -#ifdef NOTIME +#ifdef NNP_NO_TIME #elif __linux__ time.tv_sec = 0; time.tv_nsec = 0; @@ -109,7 +109,7 @@ double Stopwatch::updateTime() { if (state == RUNNING) { -#ifdef NOTIME +#ifdef NNP_NO_TIME return 1.0; #elif __linux__ time_t secLast = time.tv_sec; diff --git a/src/libnnp/Stopwatch.h b/src/libnnp/Stopwatch.h index f931dbe2a..905f36a72 100644 --- a/src/libnnp/Stopwatch.h +++ b/src/libnnp/Stopwatch.h @@ -19,11 +19,11 @@ #if !(defined(__linux__) || defined(__MACH__)) #pragma message("WARNING: Platform not supported.") -#define NOTIME +#define NNP_NO_TIME #endif -#ifdef NOTIME -#pragma message("WARNING: Compiling dummy Stopwatch class (-DNOTIME).") +#ifdef NNP_NO_TIME +#pragma message("WARNING: Compiling dummy Stopwatch class (-DNNP_NO_TIME).") #endif #include @@ -64,7 +64,7 @@ class Stopwatch State state; static const double NSEC; double timeElapsed; -#ifdef NOTIME +#ifdef NNP_NO_TIME #elif __linux__ timespec time; #elif __MACH__ diff --git a/src/libnnp/SymFnc.cpp b/src/libnnp/SymFnc.cpp index 204a3d154..334353e41 100644 --- a/src/libnnp/SymFnc.cpp +++ b/src/libnnp/SymFnc.cpp @@ -97,7 +97,7 @@ void SymFnc::setScalingType(ScalingType scalingType, return; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE vector SymFnc::getCacheIdentifiers() const { return vector(); @@ -160,7 +160,7 @@ SymFnc::SymFnc(size_t type, ElementMap const& elementMap) : // "uninitialized" state. indexPerElement.resize(elementMap.size(), numeric_limits::max()); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Initialize cache indices vector. cacheIndices.resize(elementMap.size(), vector()); #endif diff --git a/src/libnnp/SymFnc.h b/src/libnnp/SymFnc.h index 0a7c6a04f..92387e165 100644 --- a/src/libnnp/SymFnc.h +++ b/src/libnnp/SymFnc.h @@ -238,7 +238,7 @@ class SymFnc * otherwise. */ virtual bool checkRelevantElement(std::size_t index) const = 0; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Get unique cache identifiers. * * @return Vector of string identifying the type of cache this symmetry @@ -300,7 +300,7 @@ class SymFnc std::set parameters; /// Per-element index for derivative memory in Atom::Neighbor::dGdr arrays. std::vector indexPerElement; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /// Cache indices for each element. std::vector< std::vector> cacheIndices; @@ -392,7 +392,7 @@ inline void SymFnc::setIndexPerElement(std::size_t elementIndex, return; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE inline std::vector> SymFnc::getCacheIndices() const { return cacheIndices; diff --git a/src/libnnp/SymFncBaseComp.cpp b/src/libnnp/SymFncBaseComp.cpp index 89222a0c8..1e3a685dd 100644 --- a/src/libnnp/SymFncBaseComp.cpp +++ b/src/libnnp/SymFncBaseComp.cpp @@ -62,13 +62,13 @@ void SymFncBaseComp::setCompactFunction(string subtype) { if (subtype.at(2) == 'a') { -#ifndef NOASYMPOLY +#ifndef NNP_NO_ASYM_POLY asymmetric = true; cr.setAsymmetric(true); #else throw runtime_error("ERROR: Compiled without support for " "asymmetric polynomial symmetry functions " - "(-DNOASYMPOLY).\n"); + "(-DNNP_NO_ASYM_POLY).\n"); #endif } else diff --git a/src/libnnp/SymFncBaseCompAng.cpp b/src/libnnp/SymFncBaseCompAng.cpp index 6820d7345..af69e5de5 100644 --- a/src/libnnp/SymFncBaseCompAng.cpp +++ b/src/libnnp/SymFncBaseCompAng.cpp @@ -193,7 +193,7 @@ bool SymFncBaseCompAng::checkRelevantElement(size_t index) const else return false; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE vector SymFncBaseCompAng::getCacheIdentifiers() const { vector v; diff --git a/src/libnnp/SymFncBaseCompAng.h b/src/libnnp/SymFncBaseCompAng.h index bebb9c262..b94cf9c2c 100644 --- a/src/libnnp/SymFncBaseCompAng.h +++ b/src/libnnp/SymFncBaseCompAng.h @@ -95,7 +95,7 @@ class SymFncBaseCompAng : public SymFncBaseComp * otherwise. */ virtual bool checkRelevantElement(std::size_t index) const; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Get unique cache identifiers. * * @return Vector of string identifying the type of cache this symmetry diff --git a/src/libnnp/SymFncBaseCompAngWeighted.cpp b/src/libnnp/SymFncBaseCompAngWeighted.cpp index 43a43acb6..515b08128 100644 --- a/src/libnnp/SymFncBaseCompAngWeighted.cpp +++ b/src/libnnp/SymFncBaseCompAngWeighted.cpp @@ -171,7 +171,7 @@ bool SymFncBaseCompAngWeighted::checkRelevantElement(size_t /*index*/) const return true; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE vector SymFncBaseCompAngWeighted::getCacheIdentifiers() const { vector v; diff --git a/src/libnnp/SymFncBaseCompAngWeighted.h b/src/libnnp/SymFncBaseCompAngWeighted.h index c0953e0b4..dfeb86ea4 100644 --- a/src/libnnp/SymFncBaseCompAngWeighted.h +++ b/src/libnnp/SymFncBaseCompAngWeighted.h @@ -89,7 +89,7 @@ class SymFncBaseCompAngWeighted : public SymFncBaseComp * otherwise. */ virtual bool checkRelevantElement(std::size_t index) const; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Get unique cache identifiers. * * @return Vector of string identifying the type of cache this symmetry diff --git a/src/libnnp/SymFncBaseExpAng.cpp b/src/libnnp/SymFncBaseExpAng.cpp index d364f718f..a389f6df4 100644 --- a/src/libnnp/SymFncBaseExpAng.cpp +++ b/src/libnnp/SymFncBaseExpAng.cpp @@ -182,7 +182,7 @@ bool SymFncBaseExpAng::checkRelevantElement(size_t index) const else return false; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE vector SymFncBaseExpAng::getCacheIdentifiers() const { vector v; diff --git a/src/libnnp/SymFncBaseExpAng.h b/src/libnnp/SymFncBaseExpAng.h index 3dc245707..f1e33216b 100644 --- a/src/libnnp/SymFncBaseExpAng.h +++ b/src/libnnp/SymFncBaseExpAng.h @@ -75,7 +75,7 @@ class SymFncBaseExpAng : public SymFncBaseCutoff * otherwise. */ virtual bool checkRelevantElement(std::size_t index) const; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Get unique cache identifiers. * * @return Vector of string identifying the type of cache this symmetry diff --git a/src/libnnp/SymFncCompAngn.cpp b/src/libnnp/SymFncCompAngn.cpp index ec0baccc3..fc2b8890a 100644 --- a/src/libnnp/SymFncCompAngn.cpp +++ b/src/libnnp/SymFncCompAngn.cpp @@ -93,7 +93,7 @@ void SymFncCompAngn::calculate(Atom& atom, bool const derivatives) const { double radij; double dradij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) cr.fdf(rij, radij, dradij); else { @@ -126,7 +126,7 @@ void SymFncCompAngn::calculate(Atom& atom, bool const derivatives) const double radik; double dradik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nek].size() == 0) { cr.fdf(rik, radik, dradik); @@ -197,7 +197,7 @@ void SymFncCompAngn::calculate(Atom& atom, bool const derivatives) const // Save force contributions in Atom storage. atom.dGdr[index] += drij + drik; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY nj.dGdr[indexPerElement[nej]] -= drij + drjk; nk.dGdr[indexPerElement[nek]] -= drik - drjk; #else diff --git a/src/libnnp/SymFncCompAngnWeighted.cpp b/src/libnnp/SymFncCompAngnWeighted.cpp index 21c8cd40f..9751ca502 100644 --- a/src/libnnp/SymFncCompAngnWeighted.cpp +++ b/src/libnnp/SymFncCompAngnWeighted.cpp @@ -89,7 +89,7 @@ void SymFncCompAngnWeighted::calculate(Atom& atom, bool const derivatives) const { double radij; double dradij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) cr.fdf(rij, radij, dradij); else { @@ -119,7 +119,7 @@ void SymFncCompAngnWeighted::calculate(Atom& atom, bool const derivatives) const double radik; double dradik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nek].size() == 0) { cr.fdf(rik, radik, dradik); @@ -194,7 +194,7 @@ void SymFncCompAngnWeighted::calculate(Atom& atom, bool const derivatives) const // Save force contributions in Atom storage. atom.dGdr[index] += drij + drik; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY nj.dGdr[indexPerElement[nej]] -= drij + drjk; nk.dGdr[indexPerElement[nek]] -= drik - drjk; #else diff --git a/src/libnnp/SymFncCompAngw.cpp b/src/libnnp/SymFncCompAngw.cpp index b97b313da..f2d35519c 100644 --- a/src/libnnp/SymFncCompAngw.cpp +++ b/src/libnnp/SymFncCompAngw.cpp @@ -90,7 +90,7 @@ void SymFncCompAngw::calculate(Atom& atom, bool const derivatives) const { double radij; double dradij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) cr.fdf(rij, radij, dradij); else { @@ -116,7 +116,7 @@ void SymFncCompAngw::calculate(Atom& atom, bool const derivatives) const // Energy calculation. double radik; double dradik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nek].size() == 0) { cr.fdf(rik, radik, dradik); @@ -186,7 +186,7 @@ void SymFncCompAngw::calculate(Atom& atom, bool const derivatives) const // Save force contributions in Atom storage. atom.dGdr[index] += drij + drik; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY nj.dGdr[indexPerElement[nej]] -= drij + drjk; nk.dGdr[indexPerElement[nek]] -= drik - drjk; #else diff --git a/src/libnnp/SymFncCompAngwWeighted.cpp b/src/libnnp/SymFncCompAngwWeighted.cpp index 7c153df67..bd49f15ad 100644 --- a/src/libnnp/SymFncCompAngwWeighted.cpp +++ b/src/libnnp/SymFncCompAngwWeighted.cpp @@ -86,7 +86,7 @@ void SymFncCompAngwWeighted::calculate(Atom& atom, bool const derivatives) const { double radij; double dradij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) cr.fdf(rij, radij, dradij); else { @@ -109,7 +109,7 @@ void SymFncCompAngwWeighted::calculate(Atom& atom, bool const derivatives) const // Energy calculation. double radik; double dradik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nek].size() == 0) { cr.fdf(rik, radik, dradik); @@ -182,7 +182,7 @@ void SymFncCompAngwWeighted::calculate(Atom& atom, bool const derivatives) const // Save force contributions in Atom storage. atom.dGdr[index] += drij + drik; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY nj.dGdr[indexPerElement[nej]] -= drij + drjk; nk.dGdr[indexPerElement[nek]] -= drik - drjk; #else diff --git a/src/libnnp/SymFncCompRad.cpp b/src/libnnp/SymFncCompRad.cpp index d9206f2af..4137aa966 100644 --- a/src/libnnp/SymFncCompRad.cpp +++ b/src/libnnp/SymFncCompRad.cpp @@ -125,7 +125,7 @@ string SymFncCompRad::getSettingsLine() const void SymFncCompRad::calculate(Atom& atom, bool const derivatives) const { double result = 0.0; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE bool unique = true; size_t c0 = 0; size_t c1 = 0; @@ -148,7 +148,7 @@ void SymFncCompRad::calculate(Atom& atom, bool const derivatives) const double rad; double drad; double r = rij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (unique) cr.fdf(r, rad, drad); else { @@ -169,7 +169,7 @@ void SymFncCompRad::calculate(Atom& atom, bool const derivatives) const Vec3D dij = p1 * n.dr; // Save force contributions in Atom storage. atom.dGdr[index] += dij; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY n.dGdr[indexPerElement[e1]] -= dij; #else n.dGdr[index] -= dij; @@ -225,7 +225,7 @@ bool SymFncCompRad::checkRelevantElement(size_t index) const else return false; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE vector SymFncCompRad::getCacheIdentifiers() const { vector v; diff --git a/src/libnnp/SymFncCompRad.h b/src/libnnp/SymFncCompRad.h index b0e0e5bf7..46304b531 100644 --- a/src/libnnp/SymFncCompRad.h +++ b/src/libnnp/SymFncCompRad.h @@ -124,7 +124,7 @@ class SymFncCompRad : public SymFncBaseComp * otherwise. */ virtual bool checkRelevantElement(std::size_t index) const; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Get unique cache identifiers. * * @return Vector of string identifying the type of cache this symmetry diff --git a/src/libnnp/SymFncCompRadWeighted.cpp b/src/libnnp/SymFncCompRadWeighted.cpp index 565683ebd..26ee33057 100644 --- a/src/libnnp/SymFncCompRadWeighted.cpp +++ b/src/libnnp/SymFncCompRadWeighted.cpp @@ -133,7 +133,7 @@ void SymFncCompRadWeighted::calculate(Atom& atom, bool const derivatives) const double rad; double drad; double r = rij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[ne].size() == 0) cr.fdf(r, rad, drad); else { @@ -155,7 +155,7 @@ void SymFncCompRadWeighted::calculate(Atom& atom, bool const derivatives) const Vec3D dij = p1 * n.dr; // Save force contributions in Atom storage. atom.dGdr[index] += dij; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY n.dGdr[indexPerElement[ne]] -= dij; #else n.dGdr[index] -= dij; @@ -204,7 +204,7 @@ bool SymFncCompRadWeighted::checkRelevantElement(size_t /*index*/) const return true; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE vector SymFncCompRadWeighted::getCacheIdentifiers() const { vector v; diff --git a/src/libnnp/SymFncCompRadWeighted.h b/src/libnnp/SymFncCompRadWeighted.h index 3f4951515..03633658a 100644 --- a/src/libnnp/SymFncCompRadWeighted.h +++ b/src/libnnp/SymFncCompRadWeighted.h @@ -122,7 +122,7 @@ class SymFncCompRadWeighted : public SymFncBaseComp * otherwise. */ virtual bool checkRelevantElement(std::size_t index) const; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Get unique cache identifiers. * * @return Vector of string identifying the type of cache this symmetry diff --git a/src/libnnp/SymFncExpAngn.cpp b/src/libnnp/SymFncExpAngn.cpp index ac5c9e302..514514fe0 100644 --- a/src/libnnp/SymFncExpAngn.cpp +++ b/src/libnnp/SymFncExpAngn.cpp @@ -99,7 +99,7 @@ void SymFncExpAngn::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfcij; double pdfcij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) fc.fdf(rij, pfcij, pdfcij); else { @@ -129,7 +129,7 @@ void SymFncExpAngn::calculate(Atom& atom, bool const derivatives) const // Energy calculation. double pfcik; double pdfcik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) { fc.fdf(rik, pfcik, pdfcik); @@ -203,7 +203,7 @@ void SymFncExpAngn::calculate(Atom& atom, bool const derivatives) const // Save force contributions in Atom storage. atom.dGdr[index] += drij + drik; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY nj.dGdr[indexPerElement[nej]] -= drij + drjk; nk.dGdr[indexPerElement[nek]] -= drik - drjk; #else diff --git a/src/libnnp/SymFncExpAngnWeighted.cpp b/src/libnnp/SymFncExpAngnWeighted.cpp index 97255b141..31d34830f 100644 --- a/src/libnnp/SymFncExpAngnWeighted.cpp +++ b/src/libnnp/SymFncExpAngnWeighted.cpp @@ -167,7 +167,7 @@ void SymFncExpAngnWeighted::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfcij; double pdfcij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) fc.fdf(rij, pfcij, pdfcij); else { @@ -194,7 +194,7 @@ void SymFncExpAngnWeighted::calculate(Atom& atom, bool const derivatives) const // Energy calculation. double pfcik; double pdfcik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) { fc.fdf(rik, pfcik, pdfcik); @@ -268,7 +268,7 @@ void SymFncExpAngnWeighted::calculate(Atom& atom, bool const derivatives) const // Save force contributions in Atom storage. atom.dGdr[index] += drij + drik; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY nj.dGdr[indexPerElement[nj.element]] -= drij + drjk; nk.dGdr[indexPerElement[nk.element]] -= drik - drjk; #else @@ -340,7 +340,7 @@ bool SymFncExpAngnWeighted::checkRelevantElement(size_t /*index*/) const return true; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE vector SymFncExpAngnWeighted::getCacheIdentifiers() const { vector v; diff --git a/src/libnnp/SymFncExpAngnWeighted.h b/src/libnnp/SymFncExpAngnWeighted.h index 359c7b7cd..7f94f55a9 100644 --- a/src/libnnp/SymFncExpAngnWeighted.h +++ b/src/libnnp/SymFncExpAngnWeighted.h @@ -133,7 +133,7 @@ class SymFncExpAngnWeighted : public SymFncBaseCutoff * otherwise. */ virtual bool checkRelevantElement(std::size_t index) const; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Get unique cache identifiers. * * @return Vector of string identifying the type of cache this symmetry diff --git a/src/libnnp/SymFncExpAngw.cpp b/src/libnnp/SymFncExpAngw.cpp index 17e099c45..cdac34dfb 100644 --- a/src/libnnp/SymFncExpAngw.cpp +++ b/src/libnnp/SymFncExpAngw.cpp @@ -98,7 +98,7 @@ void SymFncExpAngw::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfcij; double pdfcij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) fc.fdf(rij, pfcij, pdfcij); else { @@ -124,7 +124,7 @@ void SymFncExpAngw::calculate(Atom& atom, bool const derivatives) const // Energy calculation. double pfcik; double pdfcik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) { fc.fdf(rik, pfcik, pdfcik); @@ -188,7 +188,7 @@ void SymFncExpAngw::calculate(Atom& atom, bool const derivatives) const // Save force contributions in Atom storage. atom.dGdr[index] += drij + drik; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY nj.dGdr[indexPerElement[nej]] -= drij + drjk; nk.dGdr[indexPerElement[nek]] -= drik - drjk; #else diff --git a/src/libnnp/SymFncExpRad.cpp b/src/libnnp/SymFncExpRad.cpp index 01acc1a09..bde42b73d 100644 --- a/src/libnnp/SymFncExpRad.cpp +++ b/src/libnnp/SymFncExpRad.cpp @@ -124,7 +124,7 @@ string SymFncExpRad::getSettingsLine() const void SymFncExpRad::calculate(Atom& atom, bool const derivatives) const { double result = 0.0; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE bool unique = true; size_t c0 = 0; size_t c1 = 0; @@ -148,7 +148,7 @@ void SymFncExpRad::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfc; double pdfc; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (unique) fc.fdf(rij, pfc, pdfc); else { @@ -170,7 +170,7 @@ void SymFncExpRad::calculate(Atom& atom, bool const derivatives) const Vec3D dij = p1 * n.dr; // Save force contributions in Atom storage. atom.dGdr[index] += dij; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY n.dGdr[indexPerElement[e1]] -= dij; #else n.dGdr[index] -= dij; @@ -233,7 +233,7 @@ bool SymFncExpRad::checkRelevantElement(size_t index) const else return false; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE vector SymFncExpRad::getCacheIdentifiers() const { vector v; diff --git a/src/libnnp/SymFncExpRad.h b/src/libnnp/SymFncExpRad.h index e58ecf59a..0c98dcbd2 100644 --- a/src/libnnp/SymFncExpRad.h +++ b/src/libnnp/SymFncExpRad.h @@ -119,7 +119,7 @@ class SymFncExpRad : public SymFncBaseCutoff * otherwise. */ virtual bool checkRelevantElement(std::size_t index) const; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Get unique cache identifiers. * * @return Vector of string identifying the type of cache this symmetry diff --git a/src/libnnp/SymFncExpRadWeighted.cpp b/src/libnnp/SymFncExpRadWeighted.cpp index 0c97b16d0..3a3627302 100644 --- a/src/libnnp/SymFncExpRadWeighted.cpp +++ b/src/libnnp/SymFncExpRadWeighted.cpp @@ -134,7 +134,7 @@ void SymFncExpRadWeighted::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfc; double pdfc; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[ne].size() == 0) fc.fdf(rij, pfc, pdfc); else { @@ -156,7 +156,7 @@ void SymFncExpRadWeighted::calculate(Atom& atom, bool const derivatives) const Vec3D dij = p1 * n.dr; // Save force contributions in Atom storage. atom.dGdr[index] += dij; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY n.dGdr[indexPerElement[ne]] -= dij; #else n.dGdr[index] -= dij; @@ -215,7 +215,7 @@ bool SymFncExpRadWeighted::checkRelevantElement(size_t /*index*/) const return true; } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE vector SymFncExpRadWeighted::getCacheIdentifiers() const { vector v; diff --git a/src/libnnp/SymFncExpRadWeighted.h b/src/libnnp/SymFncExpRadWeighted.h index 031aa2874..6783b1697 100644 --- a/src/libnnp/SymFncExpRadWeighted.h +++ b/src/libnnp/SymFncExpRadWeighted.h @@ -116,7 +116,7 @@ class SymFncExpRadWeighted : public SymFncBaseCutoff * otherwise. */ virtual bool checkRelevantElement(std::size_t index) const; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /** Get unique cache identifiers. * * @return Vector of string identifying the type of cache this symmetry diff --git a/src/libnnp/SymGrpBaseCompAng.h b/src/libnnp/SymGrpBaseCompAng.h index 60294b853..b12328ebd 100644 --- a/src/libnnp/SymGrpBaseCompAng.h +++ b/src/libnnp/SymGrpBaseCompAng.h @@ -68,7 +68,7 @@ class SymGrpBaseCompAng : public SymGrpBaseComp std::vector mal; /// Member angleRight. std::vector mar; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /// Member cache indices for actual neighbor element. std::vector>> mci; diff --git a/src/libnnp/SymGrpBaseCompAngWeighted.h b/src/libnnp/SymGrpBaseCompAngWeighted.h index 44c0e09ce..d3621d813 100644 --- a/src/libnnp/SymGrpBaseCompAngWeighted.h +++ b/src/libnnp/SymGrpBaseCompAngWeighted.h @@ -65,7 +65,7 @@ class SymGrpBaseCompAngWeighted : public SymGrpBaseComp std::vector mal; /// Member angleRight. std::vector mar; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /// Member cache indices for actual neighbor element. std::vector>> mci; diff --git a/src/libnnp/SymGrpCompAngn.cpp b/src/libnnp/SymGrpCompAngn.cpp index 3d2b8705b..816ef5587 100644 --- a/src/libnnp/SymGrpCompAngn.cpp +++ b/src/libnnp/SymGrpCompAngn.cpp @@ -126,7 +126,7 @@ void SymGrpCompAngn::sortMembers() } } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE mci.resize(members.size()); for (size_t k = 0; k < members.size(); ++k) { @@ -177,7 +177,7 @@ void SymGrpCompAngn::calculate(Atom& atom, bool const derivatives) const if (rij > mrl[l] && rij < mrc[l]) { SymFncCompAngn const& sf = *(members[l]); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (mci[l][nej].size() == 0) { sf.getCompactRadial(rij, radij[l], dradij[l]); @@ -272,7 +272,7 @@ void SymGrpCompAngn::calculate(Atom& atom, bool const derivatives) const } SymFncCompAngn const& sf = *(members[l]); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (mci[l][nek].size() == 0) { sf.getCompactRadial(rik, radik, dradik); @@ -360,7 +360,7 @@ void SymGrpCompAngn::calculate(Atom& atom, bool const derivatives) const double const p3drjky = p3 * dr31; double const p3drjkz = p3 * dr32; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t li = memberIndex[l]; #else size_t const li = memberIndex[l]; @@ -370,7 +370,7 @@ void SymGrpCompAngn::calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy + p2driky; dGdr[2] += p1drijz + p2drikz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nej]; #endif dGdr = nj.dGdr[li].r; @@ -378,7 +378,7 @@ void SymGrpCompAngn::calculate(Atom& atom, bool const derivatives) const dGdr[1] -= p1drijy + p3drjky; dGdr[2] -= p1drijz + p3drjkz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nek]; #endif dGdr = nk.dGdr[li].r; diff --git a/src/libnnp/SymGrpCompAngnWeighted.cpp b/src/libnnp/SymGrpCompAngnWeighted.cpp index ae71e2a9a..82581902b 100644 --- a/src/libnnp/SymGrpCompAngnWeighted.cpp +++ b/src/libnnp/SymGrpCompAngnWeighted.cpp @@ -114,7 +114,7 @@ void SymGrpCompAngnWeighted::sortMembers() } } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE mci.resize(members.size()); for (size_t k = 0; k < members.size(); ++k) { @@ -166,7 +166,7 @@ calculate(Atom& atom, bool const derivatives) const if (rij > mrl[l] && rij < mrc[l]) { SymFncCompAngnWeighted const& sf = *(members[l]); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (mci[l][nej].size() == 0) { sf.getCompactRadial(rij, radij[l], dradij[l]); @@ -258,7 +258,7 @@ calculate(Atom& atom, bool const derivatives) const } SymFncCompAngnWeighted const& sf = *(members[l]); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (mci[l][nek].size() == 0) { sf.getCompactRadial(rik, radik, dradik); @@ -349,7 +349,7 @@ calculate(Atom& atom, bool const derivatives) const double const p3drjky = p3 * dr31; double const p3drjkz = p3 * dr32; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t li = memberIndex[l]; #else size_t const li = memberIndex[l]; @@ -359,7 +359,7 @@ calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy + p2driky; dGdr[2] += p1drijz + p2drikz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nej]; #endif dGdr = nj.dGdr[li].r; @@ -367,7 +367,7 @@ calculate(Atom& atom, bool const derivatives) const dGdr[1] -= p1drijy + p3drjky; dGdr[2] -= p1drijz + p3drjkz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nek]; #endif dGdr = nk.dGdr[li].r; diff --git a/src/libnnp/SymGrpCompAngw.cpp b/src/libnnp/SymGrpCompAngw.cpp index d2b990988..47ac05ba4 100644 --- a/src/libnnp/SymGrpCompAngw.cpp +++ b/src/libnnp/SymGrpCompAngw.cpp @@ -111,7 +111,7 @@ void SymGrpCompAngw::sortMembers() calculateComp.push_back(true); } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE mci.resize(members.size()); for (size_t k = 0; k < members.size(); ++k) { @@ -162,7 +162,7 @@ void SymGrpCompAngw::calculate(Atom& atom, bool const derivatives) const if (rij > mrl[l] && rij < mrc[l]) { SymFncCompAngw const& sf = *(members[l]); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (mci[l][nej].size() == 0) { sf.getCompactRadial(rij, radij[l], dradij[l]); @@ -244,7 +244,7 @@ void SymGrpCompAngw::calculate(Atom& atom, bool const derivatives) const } SymFncCompAngw const& sf = *(members[l]); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (mci[l][nek].size() == 0) { sf.getCompactRadial(rik, radik, dradik); @@ -321,7 +321,7 @@ void SymGrpCompAngw::calculate(Atom& atom, bool const derivatives) const double const p3drjky = p3 * dr31; double const p3drjkz = p3 * dr32; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t li = memberIndex[l]; #else size_t const li = memberIndex[l]; @@ -331,7 +331,7 @@ void SymGrpCompAngw::calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy + p2driky; dGdr[2] += p1drijz + p2drikz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nej]; #endif dGdr = nj.dGdr[li].r; @@ -339,7 +339,7 @@ void SymGrpCompAngw::calculate(Atom& atom, bool const derivatives) const dGdr[1] -= p1drijy + p3drjky; dGdr[2] -= p1drijz + p3drjkz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nek]; #endif dGdr = nk.dGdr[li].r; diff --git a/src/libnnp/SymGrpCompAngwWeighted.cpp b/src/libnnp/SymGrpCompAngwWeighted.cpp index 15c4935fb..76b0f30e4 100644 --- a/src/libnnp/SymGrpCompAngwWeighted.cpp +++ b/src/libnnp/SymGrpCompAngwWeighted.cpp @@ -99,7 +99,7 @@ void SymGrpCompAngwWeighted::sortMembers() calculateComp.push_back(true); } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE mci.resize(members.size()); for (size_t k = 0; k < members.size(); ++k) { @@ -148,7 +148,7 @@ calculate(Atom& atom, bool const derivatives) const if (rij > mrl[l] && rij < mrc[l]) { SymFncCompAngwWeighted const& sf = *(members[l]); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (mci[l][nej].size() == 0) { sf.getCompactRadial(rij, radij[l], dradij[l]); @@ -227,7 +227,7 @@ calculate(Atom& atom, bool const derivatives) const } SymFncCompAngwWeighted const& sf = *(members[l]); -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (mci[l][nek].size() == 0) { sf.getCompactRadial(rik, radik, dradik); @@ -307,7 +307,7 @@ calculate(Atom& atom, bool const derivatives) const double const p3drjky = p3 * dr31; double const p3drjkz = p3 * dr32; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t li = memberIndex[l]; #else size_t const li = memberIndex[l]; @@ -317,7 +317,7 @@ calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy + p2driky; dGdr[2] += p1drijz + p2drikz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nej]; #endif dGdr = nj.dGdr[li].r; @@ -325,7 +325,7 @@ calculate(Atom& atom, bool const derivatives) const dGdr[1] -= p1drijy + p3drjky; dGdr[2] -= p1drijz + p3drjkz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nek]; #endif dGdr = nk.dGdr[li].r; diff --git a/src/libnnp/SymGrpCompRad.cpp b/src/libnnp/SymGrpCompRad.cpp index c34097b6c..593482906 100644 --- a/src/libnnp/SymGrpCompRad.cpp +++ b/src/libnnp/SymGrpCompRad.cpp @@ -108,7 +108,7 @@ void SymGrpCompRad::sortMembers() mrc.at(i) = members[i]->getRc(); } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE mci.resize(members.size()); for (size_t k = 0; k < members.size(); ++k) { @@ -158,7 +158,7 @@ void SymGrpCompRad::calculate(Atom& atom, bool const derivatives) const if (rij <= mrl[k] || rij >= mrc[k]) continue; double rad; double drad; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (mci[k].size() == 0) sf.getCompactOnly(rij, rad, drad); else { @@ -183,7 +183,7 @@ void SymGrpCompRad::calculate(Atom& atom, bool const derivatives) const double const p1drijz = drad * d1[2]; // Save force contributions in Atom storage. -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t ki = memberIndex[k]; #else size_t const ki = memberIndex[k]; @@ -197,7 +197,7 @@ void SymGrpCompRad::calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy; dGdr[2] += p1drijz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY ki = memberIndexPerElement[k][e1]; #endif dGdr = n.dGdr[ki].r; diff --git a/src/libnnp/SymGrpCompRad.h b/src/libnnp/SymGrpCompRad.h index 710662d56..f44951568 100644 --- a/src/libnnp/SymGrpCompRad.h +++ b/src/libnnp/SymGrpCompRad.h @@ -96,7 +96,7 @@ class SymGrpCompRad : public SymGrpBaseComp std::vector mrl; /// Member rc. std::vector mrc; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE /// Member cache indices for actual neighbor element. std::vector> mci; #endif diff --git a/src/libnnp/SymGrpCompRadWeighted.cpp b/src/libnnp/SymGrpCompRadWeighted.cpp index 34f4dea35..ec327ab38 100644 --- a/src/libnnp/SymGrpCompRadWeighted.cpp +++ b/src/libnnp/SymGrpCompRadWeighted.cpp @@ -142,7 +142,7 @@ void SymGrpCompRadWeighted::calculate(Atom& atom, bool const derivatives) const if (rij <= mrl[k] || rij >= mrc[k]) continue; double rad; double drad; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE auto ci = sf.getCacheIndices(); if (ci[ne].size() == 0) sf.getCompactOnly(rij, rad, drad); else @@ -168,7 +168,7 @@ void SymGrpCompRadWeighted::calculate(Atom& atom, bool const derivatives) const double const p1drijz = drad * d1[2]; // Save force contributions in Atom storage. -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t ki = memberIndex[k]; #else size_t const ki = memberIndex[k]; @@ -182,7 +182,7 @@ void SymGrpCompRadWeighted::calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy; dGdr[2] += p1drijz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY ki = memberIndexPerElement[k][ne]; #endif dGdr = n.dGdr[ki].r; diff --git a/src/libnnp/SymGrpExpAngn.cpp b/src/libnnp/SymGrpExpAngn.cpp index 3a97ab2d0..7bc15dba1 100644 --- a/src/libnnp/SymGrpExpAngn.cpp +++ b/src/libnnp/SymGrpExpAngn.cpp @@ -155,7 +155,7 @@ void SymGrpExpAngn::sortMembers() // expressions are kept in comments marked with "SIMPLE EXPRESSIONS:". void SymGrpExpAngn::calculate(Atom& atom, bool const derivatives) const { -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Can use cache indices of any member because this group is defined via // identical symmetry function type, neighbors and cutoff functions. auto cacheIndices = members.at(0)->getCacheIndices(); @@ -183,7 +183,7 @@ void SymGrpExpAngn::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfcij; double pdfcij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) fc.fdf(rij, pfcij, pdfcij); else { @@ -228,7 +228,7 @@ void SymGrpExpAngn::calculate(Atom& atom, bool const derivatives) const // Energy calculation. double pfcik; double pdfcik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nek].size() == 0) { fc.fdf(rik, pfcik, pdfcik); @@ -357,7 +357,7 @@ void SymGrpExpAngn::calculate(Atom& atom, bool const derivatives) const double const p3drjky = p3 * dr3[1]; double const p3drjkz = p3 * dr3[2]; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t li = memberIndex[l]; #else size_t const li = memberIndex[l]; @@ -367,7 +367,7 @@ void SymGrpExpAngn::calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy + p2driky; dGdr[2] += p1drijz + p2drikz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nej]; #endif dGdr = nj.dGdr[li].r; @@ -375,7 +375,7 @@ void SymGrpExpAngn::calculate(Atom& atom, bool const derivatives) const dGdr[1] -= p1drijy + p3drjky; dGdr[2] -= p1drijz + p3drjkz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nek]; #endif dGdr = nk.dGdr[li].r; diff --git a/src/libnnp/SymGrpExpAngnWeighted.cpp b/src/libnnp/SymGrpExpAngnWeighted.cpp index 6322670bb..4347cde8f 100644 --- a/src/libnnp/SymGrpExpAngnWeighted.cpp +++ b/src/libnnp/SymGrpExpAngnWeighted.cpp @@ -166,7 +166,7 @@ void SymGrpExpAngnWeighted::setScalingFactors() // expressions are kept in comments marked with "SIMPLE EXPRESSIONS:". void SymGrpExpAngnWeighted::calculate(Atom& atom, bool const derivatives) const { -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Can use cache indices of any member because this group is defined via // identical symmetry function type and cutoff functions. auto cacheIndices = members.at(0)->getCacheIndices(); @@ -194,7 +194,7 @@ void SymGrpExpAngnWeighted::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfcij; double pdfcij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) fc.fdf(rij, pfcij, pdfcij); else { @@ -236,7 +236,7 @@ void SymGrpExpAngnWeighted::calculate(Atom& atom, bool const derivatives) const // Energy calculation. double pfcik; double pdfcik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) { fc.fdf(rik, pfcik, pdfcik); @@ -345,7 +345,7 @@ void SymGrpExpAngnWeighted::calculate(Atom& atom, bool const derivatives) const double const p3drjky = p3 * dr3[1]; double const p3drjkz = p3 * dr3[2]; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t li = memberIndex[l]; #else size_t const li = memberIndex[l]; @@ -355,7 +355,7 @@ void SymGrpExpAngnWeighted::calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy + p2driky; dGdr[2] += p1drijz + p2drikz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nej]; #endif dGdr = nj.dGdr[li].r; @@ -363,7 +363,7 @@ void SymGrpExpAngnWeighted::calculate(Atom& atom, bool const derivatives) const dGdr[1] -= p1drijy + p3drjky; dGdr[2] -= p1drijz + p3drjkz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nek]; #endif dGdr = nk.dGdr[li].r; diff --git a/src/libnnp/SymGrpExpAngw.cpp b/src/libnnp/SymGrpExpAngw.cpp index 3791c0dcf..6a9511d30 100644 --- a/src/libnnp/SymGrpExpAngw.cpp +++ b/src/libnnp/SymGrpExpAngw.cpp @@ -155,7 +155,7 @@ void SymGrpExpAngw::sortMembers() // expressions are kept in comments marked with "SIMPLE EXPRESSIONS:". void SymGrpExpAngw::calculate(Atom& atom, bool const derivatives) const { -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Can use cache indices of any member because this group is defined via // identical symmetry function type, neighbors and cutoff functions. auto cacheIndices = members.at(0)->getCacheIndices(); @@ -182,7 +182,7 @@ void SymGrpExpAngw::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfcij; double pdfcij; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) fc.fdf(rij, pfcij, pdfcij); else { @@ -220,7 +220,7 @@ void SymGrpExpAngw::calculate(Atom& atom, bool const derivatives) const // Energy calculation. double pfcik; double pdfcik; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nek].size() == 0) { fc.fdf(rik, pfcik, pdfcik); @@ -332,7 +332,7 @@ void SymGrpExpAngw::calculate(Atom& atom, bool const derivatives) const double const p3drjky = p3 * dr31; double const p3drjkz = p3 * dr32; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t li = memberIndex[l]; #else size_t const li = memberIndex[l]; @@ -342,7 +342,7 @@ void SymGrpExpAngw::calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy + p2driky; dGdr[2] += p1drijz + p2drikz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nej]; #endif dGdr = nj.dGdr[li].r; @@ -350,7 +350,7 @@ void SymGrpExpAngw::calculate(Atom& atom, bool const derivatives) const dGdr[1] -= p1drijy + p3drjky; dGdr[2] -= p1drijz + p3drjkz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY li = memberIndexPerElement[l][nek]; #endif dGdr = nk.dGdr[li].r; diff --git a/src/libnnp/SymGrpExpRad.cpp b/src/libnnp/SymGrpExpRad.cpp index 1bd55ac3a..cbe3cd93c 100644 --- a/src/libnnp/SymGrpExpRad.cpp +++ b/src/libnnp/SymGrpExpRad.cpp @@ -143,7 +143,7 @@ void SymGrpExpRad::setScalingFactors() // expressions are kept in comments marked with "SIMPLE EXPRESSIONS:". void SymGrpExpRad::calculate(Atom& atom, bool const derivatives) const { -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Can use cache indices of any member because this group is defined via // identical symmetry function type, neighbors and cutoff functions. auto cacheIndices = members.at(0)->getCacheIndices(); @@ -174,7 +174,7 @@ void SymGrpExpRad::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfc; double pdfc; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (unique) fc.fdf(rij, pfc, pdfc); else { @@ -203,7 +203,7 @@ void SymGrpExpRad::calculate(Atom& atom, bool const derivatives) const double const p1drijz = p1 * d1[2]; // Save force contributions in Atom storage. -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t ki = memberIndex[k]; #else size_t const ki = memberIndex[k]; @@ -217,7 +217,7 @@ void SymGrpExpRad::calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy; dGdr[2] += p1drijz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY ki = memberIndexPerElement[k][e1]; #endif dGdr = n.dGdr[ki].r; diff --git a/src/libnnp/SymGrpExpRadWeighted.cpp b/src/libnnp/SymGrpExpRadWeighted.cpp index 3cd5276d0..d4d901576 100644 --- a/src/libnnp/SymGrpExpRadWeighted.cpp +++ b/src/libnnp/SymGrpExpRadWeighted.cpp @@ -137,7 +137,7 @@ void SymGrpExpRadWeighted::setScalingFactors() // expressions are kept in comments marked with "SIMPLE EXPRESSIONS:". void SymGrpExpRadWeighted::calculate(Atom& atom, bool const derivatives) const { -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Can use cache indices of any member because this group is defined via // identical symmetry function type and cutoff functions. auto cacheIndices = members.at(0)->getCacheIndices(); @@ -160,7 +160,7 @@ void SymGrpExpRadWeighted::calculate(Atom& atom, bool const derivatives) const // Calculate cutoff function and derivative. double pfc; double pdfc; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE if (cacheIndices[nej].size() == 0) fc.fdf(rij, pfc, pdfc); else { @@ -190,7 +190,7 @@ void SymGrpExpRadWeighted::calculate(Atom& atom, bool const derivatives) const double const p1drijz = p1 * d1[2]; // Save force contributions in Atom storage. -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY size_t ki = memberIndex[k]; #else size_t const ki = memberIndex[k]; @@ -204,7 +204,7 @@ void SymGrpExpRadWeighted::calculate(Atom& atom, bool const derivatives) const dGdr[1] += p1drijy; dGdr[2] += p1drijz; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY ki = memberIndexPerElement[k][nej]; #endif dGdr = n.dGdr[ki].r; diff --git a/src/libnnpif/LAMMPS/InterfaceLammps.cpp b/src/libnnpif/LAMMPS/InterfaceLammps.cpp index fcb111751..e6eaa248e 100644 --- a/src/libnnpif/LAMMPS/InterfaceLammps.cpp +++ b/src/libnnpif/LAMMPS/InterfaceLammps.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef NOMPI +#ifndef NNP_NO_MPI #include #include "mpi-extra.h" #endif @@ -324,7 +324,7 @@ void InterfaceLammps::addNeighbor(int i, void InterfaceLammps::process() { -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS calculateSymmetryFunctions(structure, true); #else calculateSymmetryFunctionGroups(structure, true); @@ -379,7 +379,7 @@ void InterfaceLammps::getForces(double* const* const& atomF) const // Set pointer to atom. a = &(structure.atoms.at(i)); -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY vector > const& tableFull = elements.at(a->element).getSymmetryFunctionTable(); #endif @@ -392,7 +392,7 @@ void InterfaceLammps::getForces(double* const* const& atomF) const size_t const in = n->index; // Now loop over all symmetry functions and add force contributions // (local + ghost atoms). -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY vector const& table = tableFull.at(n->element); for (size_t s = 0; s < n->dGdr.size(); ++s) { @@ -429,7 +429,7 @@ void InterfaceLammps::getForces(double* const* const& atomF) const long InterfaceLammps::getEWBufferSize() const { long bs = 0; -#ifndef NOMPI +#ifndef NNP_NO_MPI int ss = 0; // size_t size. int ds = 0; // double size. int cs = 0; // char size. @@ -462,7 +462,7 @@ long InterfaceLammps::getEWBufferSize() const void InterfaceLammps::fillEWBuffer(char* const& buf, int bs) const { -#ifndef NOMPI +#ifndef NNP_NO_MPI int p = 0; for (vector::const_iterator it = elements.begin(); it != elements.end(); ++it) @@ -490,7 +490,7 @@ void InterfaceLammps::fillEWBuffer(char* const& buf, int bs) const void InterfaceLammps::extractEWBuffer(char const* const& buf, int bs) { -#ifndef NOMPI +#ifndef NNP_NO_MPI int p = 0; for (vector::iterator it = elements.begin(); it != elements.end(); ++it) diff --git a/src/libnnpif/LAMMPS/Makefile.lammps b/src/libnnpif/LAMMPS/Makefile.lammps index 7014b454e..144fd0dbc 100644 --- a/src/libnnpif/LAMMPS/Makefile.lammps +++ b/src/libnnpif/LAMMPS/Makefile.lammps @@ -1,5 +1,5 @@ # Settings that the LAMMPS build will import when this package library is used -nnp_SYSINC = -DIMPROVED_SFD_MEMORY +nnp_SYSINC = nnp_SYSLIB = nnp_SYSPATH = diff --git a/src/libnnpif/makefile b/src/libnnpif/makefile index 72d4907a5..09587d9c7 100644 --- a/src/libnnpif/makefile +++ b/src/libnnpif/makefile @@ -46,7 +46,7 @@ LIB=lib$(NAME) # PROJECT COMPILER AND FLAGS ############################################################################### CC=$(PROJECT_CC) -ifneq (,$(findstring NOMPI,${PROJECT_OPTIONS})) +ifneq (,$(findstring NNP_NO_MPI,${PROJECT_OPTIONS})) MPICC=${PROJECT_CC} CFLAGS=${PROJECT_CFLAGS} else diff --git a/src/libnnptrain/Dataset.cpp b/src/libnnptrain/Dataset.cpp index ea423640e..3f97505b1 100644 --- a/src/libnnptrain/Dataset.cpp +++ b/src/libnnptrain/Dataset.cpp @@ -202,7 +202,7 @@ int Dataset::calculateBufferSize(Structure const& structure) const // Atom.numSymmetryFunctionDerivatives bs += ss; bs += it->numSymmetryFunctionDerivatives.size() * ss; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Atom.cacheSizePerElement bs += ss; bs += it->cacheSizePerElement.size() * ss; @@ -213,7 +213,7 @@ int Dataset::calculateBufferSize(Structure const& structure) const // Atom.dEdG bs += ss; bs += it->dEdG.size() * ds; -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY // Atom.dGdxia bs += ss; bs += it->dGdxia.size() * ds; @@ -228,7 +228,7 @@ int Dataset::calculateBufferSize(Structure const& structure) const { // Neighbor bs += 3 * ss + ds + 3 * ds; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Neighbor.cache bs += ss; bs += it2->cache.size() * ds; @@ -344,7 +344,7 @@ int Dataset::sendStructure(Structure const& structure, int dest) const MPI_Pack(&(it->numSymmetryFunctionDerivatives.front()), ts2, MPI_SIZE_T, buf, bs, &p, comm); } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Atom.cacheSizePerElement ts2 = it->cacheSizePerElement.size(); MPI_Pack(&ts2, 1, MPI_SIZE_T, buf, bs, &p, comm); @@ -370,7 +370,7 @@ int Dataset::sendStructure(Structure const& structure, int dest) const MPI_Pack(&(it->dEdG.front()), ts2, MPI_DOUBLE, buf, bs, &p, comm); } -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY // Atom.dGdxia ts2 = it->dGdxia.size(); MPI_Pack(&ts2, 1, MPI_SIZE_T, buf, bs, &p, comm); @@ -408,7 +408,7 @@ int Dataset::sendStructure(Structure const& structure, int dest) const MPI_Pack( it2->dr.r , 3, MPI_DOUBLE, buf, bs, &p, comm); size_t ts3 = 0; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Neighbor.cache ts3 = it2->cache.size(); MPI_Pack(&ts3, 1, MPI_SIZE_T, buf, bs, &p, comm); @@ -563,7 +563,7 @@ int Dataset::recvStructure(Structure* const structure, int src) MPI_Unpack(buf, bs, &p, &(it->numSymmetryFunctionDerivatives.front()), ts2, MPI_SIZE_T, comm); } -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Atom.cacheSizePerElement ts2 = 0; MPI_Unpack(buf, bs, &p, &ts2, 1, MPI_SIZE_T, comm); @@ -595,7 +595,7 @@ int Dataset::recvStructure(Structure* const structure, int src) MPI_Unpack(buf, bs, &p, &(it->dEdG.front()), ts2, MPI_DOUBLE, comm); } -#ifndef IMPROVED_SFD_MEMORY +#ifdef NNP_FULL_SFD_MEMORY // Atom.dGdxia ts2 = 0; MPI_Unpack(buf, bs, &p, &ts2, 1, MPI_SIZE_T, comm); @@ -639,7 +639,7 @@ int Dataset::recvStructure(Structure* const structure, int src) MPI_Unpack(buf, bs, &p, it2->dr.r , 3, MPI_DOUBLE, comm); size_t ts3 = 0; -#ifndef NOSFCACHE +#ifndef NNP_NO_SF_CACHE // Neighbor.cache ts3 = 0; MPI_Unpack(buf, bs, &p, &ts3, 1, MPI_SIZE_T, comm); diff --git a/src/libnnptrain/Training.cpp b/src/libnnptrain/Training.cpp index ba293c7d0..85f78880f 100644 --- a/src/libnnptrain/Training.cpp +++ b/src/libnnptrain/Training.cpp @@ -1295,7 +1295,7 @@ void Training::calculateError(bool const writeCompFiles, for (vector::iterator it = structures.begin(); it != structures.end(); ++it) { -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS calculateSymmetryFunctions((*it), useForces); #else calculateSymmetryFunctionGroups((*it), useForces); @@ -2118,7 +2118,7 @@ void Training::update(bool force) Structure& s = structures.at(c->s); // Calculate symmetry functions (if results are already stored // these functions will return immediately). -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS calculateSymmetryFunctions(s, force); #else calculateSymmetryFunctionGroups(s, force); @@ -2189,7 +2189,7 @@ void Training::update(bool force) // Need to calculate the symmetry functions again, maybe results // were not stored. Structure& s = structures.at(c->s); -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS calculateSymmetryFunctions(s, force); #else calculateSymmetryFunctionGroups(s, force); @@ -2254,7 +2254,7 @@ void Training::update(bool force) { // For force update save derivative of symmetry function with // respect to coordinate. -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY if (force) collectDGdxia((*it), c->a, c->c); #else if (force) it->collectDGdxia(c->a, c->c); @@ -2269,7 +2269,7 @@ void Training::update(bool force) // network connections (weights + biases). if (force) { -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY nn->calculateDFdc(&(dXdc.at(i).front()), &(dGdxia.front())); #else @@ -2610,7 +2610,7 @@ vector< vector > Training::calculateWeightDerivatives(Structure* structure) { Structure& s = *structure; -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS calculateSymmetryFunctions(s, false); #else calculateSymmetryFunctionGroups(s, false); @@ -2651,7 +2651,7 @@ vector > Training::calculateWeightDerivatives(Structure* structure, std::size_t component) { Structure& s = *structure; -#ifdef NOSFGROUPS +#ifdef NNP_NO_SF_GROUPS calculateSymmetryFunctions(s, true); #else calculateSymmetryFunctionGroups(s, true); @@ -2670,7 +2670,7 @@ vector > Training::calculateWeightDerivatives(Structure* structure, for (vector::iterator it = s.atoms.begin(); it != s.atoms.end(); ++it) { -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY collectDGdxia((*it), atom, component); #else it->collectDGdxia(atom, component); @@ -2680,7 +2680,7 @@ vector > Training::calculateWeightDerivatives(Structure* structure, nn->setInput(&((it->G).front())); nn->propagate(); nn->getOutput(&(it->energy)); -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY nn->calculateDFdc(&(dfdc.at(i).front()), &(dGdxia.front())); #else nn->calculateDFdc(&(dfdc.at(i).front()), &(it->dGdxia.front())); @@ -2785,7 +2785,7 @@ void Training::addTrainingLogEntry(int proc, return; } -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY void Training::collectDGdxia(Atom const& atom, size_t indexAtom, size_t indexComponent) diff --git a/src/libnnptrain/Training.h b/src/libnnptrain/Training.h index 1ae678255..12d0f17bf 100644 --- a/src/libnnptrain/Training.h +++ b/src/libnnptrain/Training.h @@ -417,7 +417,7 @@ class Training : public Dataset std::vector errorForcesTrain; /// Current error metrics of test forces. std::vector errorForcesTest; -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY /// Derivative of symmetry functions with respect to one specific atom /// coordinate. std::vector dGdxia; @@ -504,7 +504,7 @@ class Training : public Dataset std::size_t is, std::size_t ia, std::size_t ic); -#ifdef IMPROVED_SFD_MEMORY +#ifndef NNP_FULL_SFD_MEMORY /** Collect derivative of symmetry functions with repect to one atom's * coordinate. * diff --git a/src/makefile.gnu b/src/makefile.gnu index f77a5b5a2..856e4cf6a 100644 --- a/src/makefile.gnu +++ b/src/makefile.gnu @@ -28,22 +28,25 @@ PROJECT_LDFLAGS_BLAS=-lblas -lgsl -lgslcblas ############################################################################### # Do not use symmetry function groups. -#PROJECT_OPTIONS+= -DNOSFGROUPS +#PROJECT_OPTIONS+= -DNNP_NO_SF_GROUPS # Do not use symmetry function cache. -#PROJECT_OPTIONS+= -DNOSFCACHE +#PROJECT_OPTIONS+= -DNNP_NO_SF_CACHE # Disable asymmetric polynomial symmetry functions. -#PROJECT_OPTIONS+= -DNOASYMPOLY +#PROJECT_OPTIONS+= -DNNP_NO_ASYM_POLY # Build with dummy Stopwatch class. -#PROJECT_OPTIONS+= -DNOTIME +#PROJECT_OPTIONS+= -DNNP_NO_TIME # Disable check for low number of neighbors. -#PROJECT_OPTIONS+= -DNONEIGHCHECK +#PROJECT_OPTIONS+= -DNNP_NO_NEIGH_CHECK + +# Use alternative (older) memory layout for symmetry function derivatives. +#PROJECT_OPTIONS+= -DNNP_FULL_SFD_MEMORY # Compile without MPI support. -#PROJECT_OPTIONS+= -DNOMPI +#PROJECT_OPTIONS+= -DNNP_NO_MPI # Use BLAS together with Eigen. PROJECT_OPTIONS+= -DEIGEN_USE_BLAS @@ -56,6 +59,3 @@ PROJECT_OPTIONS+= -DEIGEN_USE_BLAS # Disable Eigen multi threading. PROJECT_OPTIONS+= -DEIGEN_DONT_PARALLELIZE - -# Use improved memory layout for symmetry function derivatives. -PROJECT_OPTIONS+= -DIMPROVED_SFD_MEMORY diff --git a/src/makefile.intel b/src/makefile.intel index 3d7b14973..e12b40a7a 100644 --- a/src/makefile.intel +++ b/src/makefile.intel @@ -29,22 +29,25 @@ PROJECT_LDFLAGS_BLAS=-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm ############################################################################### # Do not use symmetry function groups. -#PROJECT_OPTIONS+= -DNOSFGROUPS +#PROJECT_OPTIONS+= -DNNP_NO_SF_GROUPS # Do not use symmetry function cache. -#PROJECT_OPTIONS+= -DNOSFCACHE +#PROJECT_OPTIONS+= -DNNP_NO_SF_CACHE # Disable asymmetric polynomial symmetry functions. -#PROJECT_OPTIONS+= -DNOASYMPOLY +#PROJECT_OPTIONS+= -DNNP_NO_ASYM_POLY # Build with dummy Stopwatch class. -#PROJECT_OPTIONS+= -DNOTIME +#PROJECT_OPTIONS+= -DNNP_NO_TIME # Disable check for low number of neighbors. -#PROJECT_OPTIONS+= -DNONEIGHCHECK +#PROJECT_OPTIONS+= -DNNP_NO_NEIGH_CHECK + +# Use alternative (older) memory layout for symmetry function derivatives. +#PROJECT_OPTIONS+= -DNNP_FULL_SFD_MEMORY # Compile without MPI support. -#PROJECT_OPTIONS+= -DNOMPI +#PROJECT_OPTIONS+= -DNNP_NO_MPI # Use BLAS together with Eigen. #PROJECT_OPTIONS+= -DEIGEN_USE_BLAS @@ -57,6 +60,3 @@ PROJECT_OPTIONS+= -DEIGEN_USE_MKL_ALL # Disable Eigen multi threading. PROJECT_OPTIONS+= -DEIGEN_DONT_PARALLELIZE - -# Use improved memory layout for symmetry function derivatives. -PROJECT_OPTIONS+= -DIMPROVED_SFD_MEMORY diff --git a/src/makefile.llvm b/src/makefile.llvm index d100ba155..5a121a208 100644 --- a/src/makefile.llvm +++ b/src/makefile.llvm @@ -30,22 +30,25 @@ PROJECT_OPTIONS=-I${HOME}/miniconda3/envs/n2p2/include/ ############################################################################### # Do not use symmetry function groups. -#PROJECT_OPTIONS+= -DNOSFGROUPS +#PROJECT_OPTIONS+= -DNNP_NO_SF_GROUPS # Do not use symmetry function cache. -#PROJECT_OPTIONS+= -DNOSFCACHE +#PROJECT_OPTIONS+= -DNNP_NO_SF_CACHE # Disable asymmetric polynomial symmetry functions. -#PROJECT_OPTIONS+= -DNOASYMPOLY +#PROJECT_OPTIONS+= -DNNP_NO_ASYM_POLY # Build with dummy Stopwatch class. -#PROJECT_OPTIONS+= -DNOTIME +#PROJECT_OPTIONS+= -DNNP_NO_TIME # Disable check for low number of neighbors. -#PROJECT_OPTIONS+= -DNONEIGHCHECK +#PROJECT_OPTIONS+= -DNNP_NO_NEIGH_CHECK + +# Use alternative (older) memory layout for symmetry function derivatives. +#PROJECT_OPTIONS+= -DNNP_FULL_SFD_MEMORY # Compile without MPI support. -#PROJECT_OPTIONS+= -DNOMPI +#PROJECT_OPTIONS+= -DNNP_NO_MPI # Use BLAS together with Eigen. PROJECT_OPTIONS+= -DEIGEN_USE_BLAS @@ -58,6 +61,3 @@ PROJECT_OPTIONS+= -DEIGEN_USE_BLAS # Disable Eigen multi threading. PROJECT_OPTIONS+= -DEIGEN_DONT_PARALLELIZE - -# Use improved memory layout for symmetry function derivatives. -PROJECT_OPTIONS+= -DIMPROVED_SFD_MEMORY diff --git a/src/pynnp/Atom.pyx b/src/pynnp/Atom.pyx index 611eb5852..d87547e12 100644 --- a/src/pynnp/Atom.pyx +++ b/src/pynnp/Atom.pyx @@ -279,13 +279,13 @@ cdef class Atom: @dEdG.setter def dEdG(self, value): deref(self.thisptr).dEdG = value - # dGdxia - @property - def dGdxia(self): - return deref(self.thisptr).dGdxia - @dGdxia.setter - def dGdxia(self, value): - deref(self.thisptr).dGdxia = value + ## dGdxia + #@property + #def dGdxia(self): + # return deref(self.thisptr).dGdxia + #@dGdxia.setter + #def dGdxia(self, value): + # deref(self.thisptr).dGdxia = value # dGdr @property def dGdr(self): diff --git a/src/pynnp/pynnp_dec.pxd b/src/pynnp/pynnp_dec.pxd index 3fd3d2ccd..a078429de 100644 --- a/src/pynnp/pynnp_dec.pxd +++ b/src/pynnp/pynnp_dec.pxd @@ -169,7 +169,7 @@ cdef extern from "Atom.h" namespace "nnp": vector[size_t] cacheSizePerElement; vector[double] G vector[double] dEdG - vector[double] dGdxia + #vector[double] dGdxia vector[Vec3D] dGdr vector[Neighbor] neighbors Atom() except + diff --git a/test/python/test_Atom.py b/test/python/test_Atom.py index 49a91904a..745681304 100644 --- a/test/python/test_Atom.py +++ b/test/python/test_Atom.py @@ -196,11 +196,11 @@ def test_correct_type(self, a1): "Wrong attribute type.") # TODO: Test content. -class Test_dGdxia: - def test_correct_type(self, a1): - assert isinstance(a1.dGdxia, list), ( - "Wrong attribute type.") - # TODO: Test content. +#class Test_dGdxia: +# def test_correct_type(self, a1): +# assert isinstance(a1.dGdxia, list), ( +# "Wrong attribute type.") +# # TODO: Test content. class Test_dGdr: def test_correct_type(self, a1):