From c35b81adfa549825c2941392bb0bfb9e7dc2ad7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Aradi?= Date: Thu, 5 Mar 2026 14:22:10 +0100 Subject: [PATCH 1/2] Upgrade toolchain information for 2026 (#1808) --- CMakeLists.txt | 2 +- INSTALL.rst | 52 +++++++++++++++++++++++++-------------- cmake/DftbPlusUtils.cmake | 2 +- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92b21c27a3..20354f6191 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.22...4.2) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) diff --git a/INSTALL.rst b/INSTALL.rst index 9ee9f51105..65bfebcade 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -18,13 +18,13 @@ In order to compile DFTB+, you need the following software components: * C++ compiler (when built with ELSI/PEXSI or ChIMES support) -* CMake (version 3.16 or newer) +* CMake (version 3.22 or newer) * GNU make * LAPACK/BLAS libraries (or compatible equivalents) -* Python (version >= 3.2) for the source preprocessor +* Python (version >= 3.7) for the source preprocessor Fortran compiler @@ -32,15 +32,15 @@ Fortran compiler The following Fortran compilers are known to build DFTB+ correctly: -* GNU >= 12.2 +* GNU >= 13.2 * Intel >= 2021.5 * NAG >= 7.2 (when built without OpenMP support) -Older versions of the compilers above are likely to fail due to missing Fortran -features and/or compiler bugs. Compilers by other vendors may work, but have not -been tested extensively (see also `Tested build environments +Older versions of the compilers above may work but are neither tested nor +supported. Similarly, compilers by other vendors may work, but have not been +tested extensively (see also `Tested build environments <#tested-build-environments>`_ and `Testing DFTB+ <#testing-dftb>`_). @@ -52,11 +52,10 @@ Additionally there are optional requirements for some DFTB+ features: * ScaLAPACK (version 2.0 or later) and a Fortran aware MPI framework, if you want to build the MPI-parallelised version of the code. -* In addition to ScaLAPACK, for MPI parallel builds it is recommended - to use the `ELSI `_ library - for large scale systems (versions 2.6.x – 2.11.x of the library, - with partial support for 2.5.0). If ELSI was compiled with PEXSI - included, you will also need a C++ compiler. +* In addition to ScaLAPACK, for MPI parallel builds it is recommended to use the + `ELSI `_ library for large + scale systems. If ELSI was compiled with PEXSI included, you will also need a + C++ compiler. * The ARPACK-ng library if using the excited state DFTB functionality. For MPI-parallel builds, the parallel version of ARPACK-ng (containing also @@ -69,11 +68,26 @@ Additionally there are optional requirements for some DFTB+ features: is controlled at runtime by the `MAGMA_NUM_GPUS` shell variable (the usual default is 1). -* The `PLUMED2 `_ library for +* The `PLUMED2 `_ library for metadynamics simulations. If you build DFTB+ with MPI, the linked PLUMED library must also be MPI-aware (and must have been built with the same MPI-framework as DFTB+). +* The `TBLite `_ library for carrying out + simulations using xTB-type Hamiltonians. + +* The `simple-dftd3 `_ library for + D3-type dispersion. + +* The `many-body dispersion `_ library for + taking many-body dispersions into account. + +* The `ChIMES calculator `_ + library for using Chebishev-polynomial based many-body repulsive interactions. + +* The `libNEGF `_ library for carrying out + non-equilibrium Green's function based transport calculations. + External library requirements ----------------------------- @@ -97,7 +111,7 @@ Requirements for testing DFTB+ In order to execute the code tests and validate them against precalculated results, you will additionally need: -* Python (version >= 3.2) with NumPy +* Python (version >= 3.7) with NumPy * The Slater-Koster data used in the tests (see below) @@ -111,10 +125,6 @@ following architectures: +---------------+----------------------+-------------+------------------+-----+ | Architecture | Compiler | MPI | Ext. libraries |Notes| +===============+======================+=============+==================+=====+ -| x86_64 / | GNU Fortran/C 12.2 | OpenMPI 4.1 | OpenBlas 0.3.21, | | -| Linux | | | ScaLAPACK 2.2, | | -| | | | ELSI 2.9 | | -+---------------+----------------------+-------------+------------------+-----+ | x86_64 / | GNU Fortran/C 13.2 | OpenMPI 5.0 | OpenBlas 0.3.25, | | | Linux | | | ScaLAPACK 2.2, | | | | | | ELSI 2.9 | | @@ -123,14 +133,18 @@ following architectures: | Linux | | | ScaLAPACK 2.2, | | | | | | ELSI 2.11 | | +---------------+----------------------+-------------+------------------+-----+ +| x86_64 / | GNU Fortran/C 15.2 | OpenMPI 5.0 | OpenBlas 0.3.30, | | +| Linux | | | ScaLAPACK 2.2, | | +| | | | ELSI 2.12 | | ++---------------+----------------------+-------------+------------------+-----+ | x86_64 / | Intel Fortran/C | IntelMPI | MKL 2022.0, | | | Linux | 2022.0 | 2021.5 | ELSI 2.8 | | +---------------+----------------------+-------------+------------------+-----+ | x86_64 / | Intel Fortran/C | IntelMPI | MKL 2024.2, | | | Linux | 2024.2 | 2021.14 | ELSI 2.11 | | +---------------+----------------------+-------------+------------------+-----+ -| x86_64 / | Intel Fortran/C | IntelMPI | MKL 2025.0, | | -| Linux | 2025.0 | 2021.14 | ELSI 2.11 | | +| x86_64 / | Intel Fortran/C | IntelMPI | MKL 2025.3, | | +| Linux | 2025.3 | 2021.17 | ELSI 2.12 | | +---------------+----------------------+-------------+------------------+-----+ | x86_64 / | NAG Fortran 7.2 | MPICH 4.2 | OpenBlas 0.3.26 | [1] | | Linux | GNU C 13.2 | | ScaLAPACK 2.2 | | diff --git a/cmake/DftbPlusUtils.cmake b/cmake/DftbPlusUtils.cmake index 82861bef8c..ac9f771179 100644 --- a/cmake/DftbPlusUtils.cmake +++ b/cmake/DftbPlusUtils.cmake @@ -228,7 +228,7 @@ function (dftbp_ensure_config_consistency) endif() # Check minimal compiler versions - set(fortran_minimal_versions "GNU;12.2" "Intel;2021.5" "IntelLLVM;2024.2" "NAG;7.2") + set(fortran_minimal_versions "GNU;13.2" "Intel;2021.5" "IntelLLVM;2024.2" "NAG;7.2") dftbp_check_minimal_compiler_version("Fortran" "${fortran_minimal_versions}") # Note: The consistency check below will / can not be executed in multi-config mode From c5097710362ff8ef18ad73df159e7622b8dfe948 Mon Sep 17 00:00:00 2001 From: Alessandro Pecchia Date: Wed, 18 Feb 2026 12:24:17 +0100 Subject: [PATCH 2/2] Move RecomputeAfterDensity Relocate out of Poisson block. Also document use for single-shot calculations with read-in charges. --- doc/dftb+/manual/dftbp.tex | 12 ++++++++++ doc/dftb+/manual/transport.tex | 7 ------ src/dftbp/dftbplus/inputdata.F90 | 4 +++- src/dftbp/dftbplus/oldcompat.F90 | 39 +++++++++++++++++++++++++++++++- src/dftbp/dftbplus/parser.F90 | 14 +++++------- 5 files changed, 59 insertions(+), 17 deletions(-) diff --git a/doc/dftb+/manual/dftbp.tex b/doc/dftb+/manual/dftbp.tex index 2215c6ce4e..5530359ee4 100644 --- a/doc/dftb+/manual/dftbp.tex +++ b/doc/dftb+/manual/dftbp.tex @@ -1368,6 +1368,7 @@ \subsection{Density Functional based Tight Binding} \kw{SCCTolerance} &r& SCC = Yes & 1e-5 & \\ \kw{MaxSCCIterations} &i& SCC = Yes & 100 & \\ \kw{ConvergentSccOnly} & l & SCC = Yes & \is{Yes}\\ + \kw{RecomputeAfterDensity} & l & & Yes & \\ \kw{EwaldParameter} & r & Periodic = Yes SCC = Yes & 0.0 & \\ \kw{EwaldTolerance} & r & Periodic = Yes SCC = Yes & 1e-9 & \\ \kw{ShellResolvedSCC} & l & SCC = Yes & No & \\ @@ -1437,6 +1438,17 @@ \subsection{Density Functional based Tight Binding} before proceeding to subsequent stages of the calculation (forces, analysis, etc.). +\item[\is{RecomputeAfterDensity}] When set to \is{Yes} the + electrostatic potentials is updated with the newly computed DM and + atomic charges. This is done in order to make the electrostatic + energy consistent and forces variational. It can be set to \is{No} + in transport calculations to avoid an unnecessary invocation of the + Poisson solver, when energy and forces are not relevant. It should + also be set to \is{No} when the user would like to perform a + fixed-charge calculation with charges that are initialized from an + external file. In this case also set \is{MaxSCCIterations=1} and + \is{ReadInitialCharges=Yes}. + \item[\is{EwaldParameter}] Sets the dimensionless parameter $\alpha$ in the Ewald electrostatic summation for periodic calculations. This controls the fraction of the Ewald summation occurring in real and diff --git a/doc/dftb+/manual/transport.tex b/doc/dftb+/manual/transport.tex index 7659186ee2..d2765cbf8d 100644 --- a/doc/dftb+/manual/transport.tex +++ b/doc/dftb+/manual/transport.tex @@ -631,7 +631,6 @@ \section{Poisson solver} \kw{BoundaryRegion} & m & & global\{\} & \pref{Boundary Conditions} \\ \kw{Gate} & m & & none\{\} & \pref{Electrostatic Gates} \\ \kw{MaxParallelNodes} & m & & none\{\} & \pref{Parallelisations} \\ - \kw{RecomputeAfterDensity} & l & & No & \\ \kw{PoissonThickness} & r & contacts = 1 & &\\ \end{ptableh} @@ -678,12 +677,6 @@ \section{Poisson solver} the Poisson equation (default value 10$^{-6}$). \item[\is{MaxPoissonIterations}] Defines the maximum number of iterations allowed for the solver. -\item[\is{RecomputeAfterDensity}] When set to \is{Yes}, Poisson's equation is - solved again after the density matrix is created in order to make the - electrostatic energy consistent with the newly updated charges. In transport - calculations it is set to \is{No} by default in order to avoid the extra time - spent on the Poisson step. This does not affect the SCC loop or other - calculations apart from the electronic energy and forces. \item[\is{PoissonThickness}] In the special case of a single contact (cases like the end of semi-infinite wires or surfaces of crystals), the thickness of the Poisson box normal to the surface of the contact can be set with this command. diff --git a/src/dftbp/dftbplus/inputdata.F90 b/src/dftbp/dftbplus/inputdata.F90 index 62f0a63bf4..977c7c4190 100644 --- a/src/dftbp/dftbplus/inputdata.F90 +++ b/src/dftbp/dftbplus/inputdata.F90 @@ -568,7 +568,9 @@ module dftbp_dftbplus_inputdata type(TReksInp) :: reksInp !> Whether Scc should be updated with the output charges (obtained after diagonalization) - !> Could be set to .false. to prevent costly recalculations (e.g. when using Poisson-solver) + !! Could be set to .false. to prevent costly recalculations (e.g. when using Poisson-solver) + !! It can also be set to .false. in case of fixed-charge calculations + !! (e.g. when setting MaxSCCIterations=1; ReadInitialCharges=Yes) logical :: updateSccAfterDiag = .true. !> Write cavity information as COSMO file diff --git a/src/dftbp/dftbplus/oldcompat.F90 b/src/dftbp/dftbplus/oldcompat.F90 index 42e8bd3c48..542e90cf2d 100644 --- a/src/dftbp/dftbplus/oldcompat.F90 +++ b/src/dftbp/dftbplus/oldcompat.F90 @@ -28,7 +28,7 @@ module dftbp_dftbplus_oldcompat !> Actual input version <-> parser version maps (must be updated at every public release) type(TVersionMap), parameter :: versionMaps(*) = [& - & TVersionMap("25.1", 14),& + & TVersionMap("26.1", 15), TVersionMap("25.1", 14),& & TVersionMap("24.1", 14), TVersionMap("23.1", 13), TVersionMap("22.2", 12),& & TVersionMap("22.1", 11), TVersionMap("21.2", 10), TVersionMap("21.1", 9),& & TVersionMap("20.2", 9), TVersionMap("20.1", 8), TVersionMap("19.1", 7),& @@ -101,6 +101,9 @@ subroutine convertOldHSD(root, oldVersion, curVersion) case (13) call convert_13_14(root) version = 14 + case (14) + call convert_14_15(root) + version = 15 end select end do @@ -938,6 +941,40 @@ subroutine convert_13_14(root) end subroutine convert_13_14 + !> Converts input from version 14 to 15. (Version 18 February 2026) + subroutine convert_14_15(root) + + !> Root tag of the HSD-tree + type(fnode), pointer :: root + + type(fnode), pointer :: ch1, ch2, par, hamil, dummy + logical :: isRecomputed + + ! Move RecomputeAfterDensity to the Hamiltonian block. + ! The normal default is RecomputeAfterDensity=.true. + ! Check if Poisson block is present. If NOT RecomputeAfterDensity will take the new default. + call getDescendant(root, "Hamiltonian/DFTB/Electrostatics/Poisson", ch1, parent=par) + if (associated(ch1)) then + call getDescendant(root, "Hamiltonian/DFTB/Electrostatics/Poisson/RecomputeAfterDensity", & + & ch1, parent=par) + if (associated(ch1)) then + call getChildValue(par, "RecomputeAfterDensity", isRecomputed) + call detailedWarning(ch1, "Keyword Moved to Hamiltonian {} block.") + dummy => removeChild(par, ch1) + call destroyNode(ch1) + else + isRecomputed = .false. + end if + ! Check if the tag is already present and issue an error. + call getDescendant(root, "Hamiltonian/DFTB/RecomputeAfterDensity", ch1) + if (associated(ch1)) call detailedError(ch1, "RecomputeAfterDensity is already present.") + call getDescendant(root, "Hamiltonian/DFTB", hamil) + call setChildValue(hamil, "RecomputeAfterDensity", isRecomputed, child=ch2) + call setUnprocessed(ch2) + end if + + end subroutine convert_14_15 + !> Update values in the DftD3 block to match behaviour of v6 parser subroutine handleD3Defaults(root) diff --git a/src/dftbp/dftbplus/parser.F90 b/src/dftbp/dftbplus/parser.F90 index 883465cf1c..56df838ace 100644 --- a/src/dftbp/dftbplus/parser.F90 +++ b/src/dftbp/dftbplus/parser.F90 @@ -2151,9 +2151,9 @@ subroutine readElectrostatics(node, ctrl, geo, poisson) #:block REQUIRES_COMPONENT('Poisson-solver', WITH_POISSON) ctrl%tPoisson = .true. #:if WITH_TRANSPORT - call readPoisson(value1, poisson, geo%tPeriodic, tp, geo%latVecs, ctrl%updateSccAfterDiag) + call readPoisson(value1, poisson, geo%tPeriodic, tp, geo%latVecs) #:else - call readPoisson(value1, poisson, geo%tPeriodic, geo%latVecs, ctrl%updateSccAfterDiag) + call readPoisson(value1, poisson, geo%tPeriodic, geo%latVecs) #:endif #:endblock @@ -3279,6 +3279,8 @@ subroutine readSccOptions(node, ctrl, geo) ! self consistency required or not to proceed call getChildValue(node, "ConvergentSCCOnly", ctrl%isSccConvRequired, .true.) + call getChildValue(node, "RecomputeAfterDensity", ctrl%updateSccAfterDiag, .true.) + end subroutine readSccOptions @@ -6480,9 +6482,9 @@ end subroutine readGreensFunction !> Read in Poisson related data #:if WITH_TRANSPORT - subroutine readPoisson(pNode, poisson, tPeriodic, transpar, latVecs, updateSccAfterDiag) + subroutine readPoisson(pNode, poisson, tPeriodic, transpar, latVecs) #:else - subroutine readPoisson(pNode, poisson, tPeriodic, latVecs, updateSccAfterDiag) + subroutine readPoisson(pNode, poisson, tPeriodic, latVecs) #:endif !> Input tree @@ -6502,9 +6504,6 @@ subroutine readPoisson(pNode, poisson, tPeriodic, latVecs, updateSccAfterDiag) !> Lattice vectors if periodic real(dp), allocatable, intent(in) :: latVecs(:,:) - !> Whether Scc should be updated with the output charges (obtained after diagonalisation) - logical, intent(out) :: updateSccAfterDiag - type(fnode), pointer :: pTmp, pTmp2, pChild, field type(string) :: buffer, modifier real(dp) :: denstol, gatelength_l @@ -6574,7 +6573,6 @@ subroutine readPoisson(pNode, poisson, tPeriodic, latVecs, updateSccAfterDiag) call getChildValue(pNode, "PoissonAccuracy", poisson%poissAcc, 1.0e-6_dp) call getChildValue(pNode, "BuildBulkPotential", poisson%bulkBC, .true.) call getChildValue(pNode, "ReadOldBulkPotential", poisson%readBulkPot, .false.) - call getChildValue(pNode, "RecomputeAfterDensity", updateSccAfterDiag, .false.) call getChildValue(pNode, "MaxPoissonIterations", poisson%maxPoissIter, 60) poisson%overrideBC(:) = poissonBCsEnum%periodic