Installing libnxc

This covers how to install Libnxc, a library that contains Machine Learned functionals to be used in DFT codes developed by Marivi Fernandez and Sebastian Dick, available in github https://github.com/semodi/libnxc

In order to use the library, the libtorch library from Pytorch is needed, it can be obtained here https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with...

After the code is cloned from github, you need to modify the arch.make file in the main directory in order to point the Makefile to where libtorch is installed.

To build the library, go to the "build" directory and run the Makefile there. This will create the libnxc.so file, this is the library.

When you build your code you need to add the following compilation and linking lines in the Makefile:
-L/path_to_where_libnxc.so_file_resides
-lnxc

Once the program compiles, the LD_LIBRARY_PATH environment variable needs to be modified to add the path to where the libnxc.so file is located. To test if this is the case, run the ldd command on the compiled binary of dftsw

ldd dftsw

It should list the libraries the binary is using and their locations, if libnxc is not found then the following command should fix it.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path_to_where_libnxc.so_resides