Skip to content

Commit

Permalink
Fixed 'eigen' include for lammps-nnp
Browse files Browse the repository at this point in the history
Also adjusted test results of H2O_RPBE-D3 for nnp-train
  • Loading branch information
philippmisof committed May 8, 2023
1 parent 6fbd9d0 commit 15a2fd7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/doc/sphinx/source/interfaces/if_lammps.rst
Expand Up @@ -22,6 +22,7 @@ Automatic build
The automatic compilation will only work on Unix-like systems as it relies on
tools such as ``sed`` and ``tar``.


For convenience the main makefile provides the compilation target ``lammps-nnp``
which will automatically download LAMMPS (version ``stable_3Mar2020`` from the
`GitHub releases page <https://github.com/lammps/lammps/releases>`__) into the
Expand All @@ -34,7 +35,8 @@ LAMMPS with NNP support is as easy as typing
make lammps-nnp
in the n2p2 ``src`` directory. Uninstall with ``make clean-lammps-nnp``.
in the n2p2 ``src`` directory. Uninstall with ``make clean-lammps-nnp``. The
automatic build requires ``wget`` to be installed.

.. note::

Expand Down
6 changes: 5 additions & 1 deletion src/interface/LAMMPS/src/USER-NNP/Install.sh
Expand Up @@ -32,11 +32,15 @@ done

# edit 2 Makefile.package files to include/exclude package info

# Get path of EIGEN library specified in make file
COMP=$(grep -Po '^COMP=\K([a-zA-Z]+)' ../../lib/nnp/src/makefile)
EIGEN_PATH=$(grep -Po '^PROJECT_EIGEN=\K([\w/]+)' ../../lib/nnp/src/makefile.$COMP)

if (test $1 = 1) then

if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*nnp[^ \t]* //g' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-I..\/..\/lib\/nnp\/include |' ../Makefile.package
sed -i -e "s|^PKG_INC =[ \t]*|&-I$EIGEN_PATH -I..\/..\/lib\/nnp\/include|" ../Makefile.package
sed -i -e 's|^PKG_PATH =[ \t]*|&-L..\/..\/lib\/nnp\/lib |' ../Makefile.package
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(nnp_SYSINC) |' ../Makefile.package
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(nnp_SYSLIB) |' ../Makefile.package
Expand Down
7 changes: 6 additions & 1 deletion src/interface/LAMMPS/src/USER-NNP/pair_nnp_develop.cpp
Expand Up @@ -39,7 +39,12 @@ void PairNNPDevelop::compute(int eflag, int vflag)
else evflag = vflag_fdotr = eflag_global = eflag_atom = 0;

// Set number of local atoms and add index and element.
interface.setLocalAtoms(atom->nlocal,atom->tag,atom->type);
interface.setLocalAtoms(atom->nlocal, atom->type);
// Transfer tags separately. Interface::setLocalTags is overloaded internally
// to work with both -DLAMMPS_SMALLBIG (tagint = int) and -DLAMMPS_BIGBIG
// (tagint = int64_t)
interface.setLocalTags(atom->tag);


// Also set absolute atom positions.
interface.setLocalAtomPositions(atom->x);
Expand Down
8 changes: 4 additions & 4 deletions test/cpp/Example_nnp_train.h
Expand Up @@ -37,10 +37,10 @@ void BoostDataContainer<Example_nnp_train>::setup()
examples.push_back(Example_nnp_train("H2O_RPBE-D3"));
e = &(examples.back());
e->lastEpoch = 2;
e->rmseEnergyTrain = 7.19538940E-04;
e->rmseEnergyTest = 3.57909502E-04;
e->rmseForcesTrain = 2.46334317E-02;
e->rmseForcesTest = 1.22544616E-02;
e->rmseEnergyTrain = 7.19539183E-04;
e->rmseEnergyTest = 3.57910403E-04;
e->rmseForcesTrain = 2.46334310E-02;
e->rmseForcesTest = 1.22544569E-02;
e->accuracy = 2.5E-9;

examples.push_back(Example_nnp_train("H2O_RPBE-D3_norm-force"));
Expand Down

0 comments on commit 15a2fd7

Please sign in to comment.