dftbplus icon indicating copy to clipboard operation
dftbplus copied to clipboard

Compiling DFTB+ for AMBER

Open almeida85 opened this issue 2 months ago • 2 comments

Hello,

I am trying to compile DFBT+ to link it together with XTB to run in AMBER. I am following the instructions in https://ambermd.org/doc12/Amber24.pdf (pages 193 and 194). After downloading the code, I am running:

cmake -DCMAKE_INSTALL_PREFIX=$DFTBPLUSHOME -DHYBRID_CONFIG_METHODS="Find" -DCMAKE_PREFIX_PATH=$XTBHOME -DBLAS_LIBRARY="-lopenblas" -DWITH_API=TRUE -DBUILD_SHARED_LIBS=TRUE -DWITH_SDFTD3=TRUE -B compilation .

But I get the error:

(...)
-- s-dftd3: Trying to find installed package
-- s-dftd3: Installed package could not be found
CMake Error at cmake/DftbPlusUtils.cmake:628 (message):
  Could not configure s-dftd3 to export target 's-dftd3::s-dftd3'
Call Stack (most recent call first):
  CMakeLists.txt:259 (dftbp_config_hybrid_dependency)

If I remove the -DWITH_SDFTD3=TRUE flag, the configuration and compilation runs well.

Any help is appreciated.

almeida85 avatar Nov 13 '25 11:11 almeida85

The s-dftd3 library is not part of the DFTB+ git repository. There are 3 different ways to invoke those external modules into the build process, which are controlled by the value of the HYBRID_CONFIG_METHODS CMake variable:

  • Submodule: DFTB+ expects those dependencies being present as submodules
  • Find: Those dependencies must be already installed on your system (and the CMAKE_PREFIX_PATH environment variable is set accordingly, so that CMake can find them)
  • Fetch: DFTB+ downloads the dependencies on the fly as part of the build process.

The Amber manual suggest to set -DHYBRID_CONFIG_METHODS="Find", which means, all dependencies must be already on the system. If that is the case, adjust the CMAKE_PREFIX_PATH environment variable accordingly. Alternatively, set -DHYBRID_CONFIG_METHODS="Find;Fetch", which would allow for downloading external libraries, if they can not be found.

aradi avatar Nov 19 '25 08:11 aradi

Thank you very much for your reply. I will try it.

almeida85 avatar Nov 19 '25 08:11 almeida85