Commit graph

841 commits

Author SHA1 Message Date
Jiacheng Xu
71c3ab0c0b
build: drop UCC requirement for cuSOLVERMp 0.7+ (#5618) 2026-07-24 11:35:44 +02:00
SY Wang
2a9776c2cd
Libxc 7.1.1 -> 7.1.2 (#5612) 2026-07-21 10:43:21 +02:00
SY Wang
290501bb7f
Libxc 7.0.0 -> 7.1.1 (#5607) 2026-07-20 17:55:05 +02:00
Franz Pöschel
3d5583cc72
Revert custom GauXC patches (#5610) 2026-07-20 11:43:17 +02:00
Franz Pöschel
39fe4c47c6
Gauxc object caching (#5340)
Co-authored-by: Thomas D. Kuehne <tkuehne@cp2k.org>
Co-authored-by: Thomas Kuehne <kuehne88@users.noreply.github.com>
2026-07-15 13:48:13 +02:00
SY Wang
d4bfb39614
Toolchain: Download ELPA and PLUMED from cp2k.org (#5583) 2026-07-12 17:35:05 +02:00
SY Wang
cccb9b4cd4
Toolchain: PLUMED 2.10.1, ELPA 2026.02.002 (#5553) 2026-07-08 12:24:17 +02:00
SY Wang
0ff4726358
Toolchain: Drop obsolete --without-slurm for MPICH (#5535) 2026-07-06 11:13:08 +02:00
SY Wang
b95687185d
Docker: Fix Intel testers (#5517) 2026-07-04 20:42:51 +02:00
SY Wang
0a0a847578
Set OpenMPI default binding policy to none via environment variable (#5511) 2026-07-02 16:08:38 +02:00
Marcello Puligheddu
de7340f8be
PR for adding libGint to CP2K (#5446) 2026-07-02 14:30:11 +02:00
SY Wang
906b8b3f0a
Toolchain: Remove parse_if.py (#5498) 2026-07-01 17:46:21 +02:00
SY Wang
0d88fc2a8e
Toolchain: Download libxsmm from cp2k.org (#5493) 2026-06-30 13:32:13 +02:00
SY Wang
faf9aae912
Toolchain: Update ELPA patch and libxsmm version (#5490) 2026-06-30 09:28:30 +02:00
Ole Schütt
1ee2fa6ca7
Toolchain: Download libxs, libxstream, and DBCSR from cp2k.org (#5485) 2026-06-29 13:44:50 +02:00
SY Wang
39eddeee7a
Toolchain: Update libxs* and DBCSR; fix CUDA/HIP package discovery (#5472) 2026-06-28 22:15:19 +02:00
SY Wang
cf1540c906
Toolchain cleanup: Follow-up fix and enhancement (#5468) 2026-06-27 11:41:52 +02:00
SY Wang
b76ce4ef50
Toolchain cleanup: Remove unused flags (stage0-2) (#5463) 2026-06-26 12:17:11 +02:00
SY Wang
02e5e7c6ee
Toolchain cleanup: Remove unused flags (stage3-6) (#5459) 2026-06-25 16:27:58 +02:00
SY Wang
c04ca93c7f
Toolchain cleanup: Remove unused flags (stage7-9) (#5447) 2026-06-25 11:23:37 +02:00
SY Wang
f3f9c0959e
Toolchain: Move libFCI installation to stage7 (#5442) 2026-06-24 13:27:56 +02:00
SY Wang
5fdc47cff4
Toolchain: Add Eigen3 and Remove FindLibint2.cmake (#5427) 2026-06-23 21:49:03 +02:00
SY Wang
adc2cbe104
Use pdbg for Rawhide tester (#5419) 2026-06-22 13:28:55 +02:00
SY Wang
3223761494
Update libxs* dependencies (#5404) 2026-06-19 16:18:04 +02:00
SY Wang
25eb499bcb
Toolchain: Speed up ELPA and GauXC installation (#5402) 2026-06-16 11:37:02 +02:00
SY Wang
4d701726f9
Toolchain: Print categorized configuration summary (#5397) 2026-06-15 10:59:06 +02:00
SY Wang
85b8a9b49c
Attempt to fix CMake and toolchain behavior regarding LibXS path (#5365)
Co-authored-by: Taillefumier Mathieu <29380261+mtaillefumier@users.noreply.github.com>
Co-authored-by: Hans Pabst <hans.pabst@intel.com>
2026-06-13 14:58:02 +02:00
Dynamics of Condensed Matter
4cf809f41f
Enable optional GauXC CUTLASS toolchain builds (#5374)
Co-authored-by: Thomas D. Kuehne <tkuehne@cp2k.org>
2026-06-08 15:59:23 -06:00
Hans Pabst
2e4a83415a
Reintegrate with LIBXS, LIBXSTREAM, and LIBXSMM (#5343)
* LIBXS (https://libxs.readthedocs.io/) foundational library.
  - Implements SMMs with different JIT providers, e.g., MKL-JIT.
  - LIBXSMM only provides kernels (reg. upstream version).
* LIBXSTREAM (https://libxstream.readthedocs.io/).
  - Revised OpenCL backend now formally separate.
* CMake and Toolchain
  - Eliminated mkl_sequential/mkl_gnu_thread mismatch.
  - Toolchain adjusted for libxs/libxstream/libxsmm.
  - Case-insensitive CP2K_USE_ACCEL.  
    DBCSR originally wanted lower case.  
    This is to harmonize with DBCSR.
  - Allow CP2K's FYPP to be used for DBCSR.
    This enables DBCSR Tarball versions.
* Regenerated all Docker recipes.
  - This make FYPP available for DBCSR build.
  - This enables DBCSR Tarball versions.
2026-06-05 20:23:52 +02:00
SY Wang
db060cbc84
Toolchain: lammps-pace (ACE) 2023.11.25.fix2 -> 2025.12.4.p1 (#5320) 2026-05-31 14:37:26 +02:00
Ole Schütt
2d9c73baf3
Toolchain: Download tblite from cp2k.org (#5322) 2026-05-31 14:36:45 +02:00
Franz Pöschel
7641cd99dd
Follow up GauXC: Remove patch from GauXC installation (#5266) 2026-05-24 23:51:40 +02:00
Dynamics of Condensed Matter
b8318cf64b
Follow up GauXC/SKALA integration after #5084 (#5244)
Co-authored-by: Thomas D. Kuehne <tkuehne@cp2k.org>
2026-05-19 16:05:06 +02:00
Franz Pöschel
1dd88fb0fa
[WIP] Skala functional via GauXC for XC energy evaluation using deep learning models (#5084)
Co-authored-by: Thomas D. Kuehne <tkuehne@cp2k.org>
2026-05-18 18:37:12 +02:00
SY Wang
52dc25883c
Toolchain: Fix CMAKE_INSTALL_LIBDIR and adjust hints (#5224) 2026-05-17 09:49:26 +02:00
SY Wang
c22e5003df
Toolchain: tblite 0.5.0 -> 0.6.0 (#5215) 2026-05-16 21:05:06 +02:00
Dynamics of Condensed Matter
c523002d91
Add LibFCI active-space solver (#5167)
Co-authored-by: Thomas D. Kuehne <tkuehne@cp2k.org>
2026-05-12 19:36:10 +02:00
Dynamics of Condensed Matter
ce370e297b
Update DFTD4/simple-dftd3 toolchain patches 2026-05-07 10:05:37 +02:00
SY Wang
c29306b3a8
Toolchain: dftd4 4.1.1 -> 4.2.0 (#5141) 2026-05-06 21:33:20 +02:00
SY Wang
2748f813de
Toolchain: Remove unnecessary flags of tblite installation (#5138) 2026-05-06 15:01:04 +02:00
SY Wang
eb5a73070c
Toolchain: Download dftd4 from cp2k.org (#5137) 2026-05-06 12:56:13 +02:00
Dynamics of Condensed Matter
cccd2f3934
Fix TB gradients, virials, and k-point symmetry
# Fix TB gradients, virials, tblite reference checks, and k-point symmetry

## Summary

This PR continues the CP2K/tblite interface work originally started by Johann Pototschnig
(`jpoto`) and relies in part on Sebastian Ehlert's `tblite` library. It makes the CP2K tight
binding paths substantially more consistent for nuclear gradients, virials/stress tensors, and
k-point symmetry, especially for DFTB, CP2K-native GFN0/GFN1, and `&XTB &TBLITE` GFN1/GFN2/IPEA1.

Main changes:

- fix several CP2K/tblite force and virial terms for periodic systems,
- add a native `tblite` CLI reference path under `&XTB &TBLITE &REFERENCE_CLI`,
- enable and test k-point symmetry reduction for CP2K-native TB and CP2K/tblite TB paths,
- improve DFTB SCC/Ewald virials and update affected DFTB references,
- add/extend regtests for molecular and truly periodic systems, including force/stress DEBUG checks,
- update the CP2K toolchain patches for `tblite`/embedded DFTD4 and standalone DFTD4.

## User-visible input changes

- `&DFT &XTB` can now select the library implementation via
  `GFN_TYPE TBLITE`; in that case an `&XTB &TBLITE` section is required.
- `&XTB &TBLITE` supports `METHOD GFN1`, `METHOD GFN2`, and `METHOD IPEA1`.
- `&XTB &TBLITE` has an optional `REFERENCE_CLI` keyword and a lone
  `&REFERENCE_CLI` subsection. If present/enabled, CP2K writes a `.gen` geometry, runs native
  `tblite run --grad`, and compares energy, gradient, and virial.
- `SCC_MIXER TBLITE` is documented as a modified Broyden mixer; the associated controls are named
  `TBLITE_MIXER_DAMPING` and `TBLITE_MIXER_MAX_SCF`.
- `DO_EWALD` remains available as a deprecated/debug override; the manual now documents the required
  periodic `POISSON` setup for CP2K-native DFTB/xTB and the `TBLITE` exception.
- CP2K warns if `CELL%PERIODIC` and `POISSON%PERIODIC` differ, but still runs.

## What was fixed

### CP2K/tblite GFN1/GFN2/IPEA1

- Periodic image-cell matrix construction now fills all image cells instead of only image cell 1.
- H0, overlap/potential, GFN2 multipole, CN-chain-rule, and D4-related virial paths were checked
  term by term against finite differences.
- Periodic self-image virial signs/factors were corrected in the CP2K/tblite interface.
- The previously bad strongly distorted Si8/GFN2 Gamma stress case was traced to a hard D4 two-body
  cutoff discontinuity and fixed by adding a smooth switching region in the D4 path.
- `RUN_TYPE DEBUG` force/stress checks now behave consistently for molecular and periodic
  CP2K/tblite GFN1/GFN2 cases; isolated stress is allowed for tblite with a warning because it is a
  diagnostic virial, not a physical isolated-system stress.

### Native tblite CLI reference

The `REFERENCE_CLI` path initially showed good molecular agreement but poor periodic virials for
Ar-fcc:

- GFN1 periodic virial diff was about `1.15e-2`,
- GFN2 periodic virial diff was about `2.95e-2`.

The parser, units, row order, and sign convention were checked and were correct. The remaining error
was in native `tblite`: periodic H0 self-image pairs (`iat == jat`, non-zero translation) used the
normal pair sigma factor `0.5`. The correct symmetrized cell-derivative factor for these self-image
pairs is `0.25`.

Updated `REFERENCE_CLI` comparison after the native tblite H0 sigma fix:

| Case | SCF | Energy diff | Gradient diff sum/max | Virial diff sum/max |
| --- | ---: | ---: | ---: | ---: |
| CH2O/GFN1, molecular | 12 | `6.775398020409e-10` | `3.296429618975e-08` / `1.577689361792e-08` | `2.884140131919e-08` / `2.625531908551e-08` |
| CH2O/GFN2, molecular | 15 | `6.651852402229e-10` | `1.437665769393e-07` / `6.050656990025e-08` | `1.240845506761e-07` / `8.358997352631e-08` |
| Ar-fcc/GFN1, periodic | 7 | `3.595097552989e-09` | `1.125627343711e-09` / `3.688615600028e-10` | `5.441065574157e-09` / `1.653417298474e-09` |
| Ar-fcc/GFN2, periodic | 20 | `8.975906240494e-09` | `2.140900031075e-08` / `4.424293700931e-09` | `3.094086449720e-07` / `8.057020835922e-08` |

`REFERENCE_CLI` is intentionally skipped/guarded for CP2K multi-k-point runs: native `tblite` CLI is
a useful Gamma reference, but it is not a CP2K-equivalent k-point/symmetry implementation.

### DFTB and CP2K-native xTB/GFN0/GFN1

- DFTB SCC/Ewald background handling was fixed so the homogeneous background contributes to energy
  and atomic properties without entering the SCC overlap virial as a constant potential shift.
- The TB real-space Ewald self-image virial prefactor was fixed.
- CP2K-native DFTB/GFN0/GFN1 k-point symmetry support was extended and tested with the CP2K atomic
  backend and SPGLIB backend.
- Full atomic k-point symmetry is used for high-symmetry production geometries; for displaced DEBUG
  geometries the reduced symmetry is recomputed instead of reusing an invalid high-symmetry map.
- DFTB3 forces, Gamma stress, k-point forces, and k-point stress were tested and covered by new
  regtests.


## What was tried

The debugging was deliberately systematic rather than a single-code-path patch:

- molecular and truly periodic crystals were checked separately; large vacuum cells were not used as
  periodic substitutes,
- GFN1 and GFN2 were tested with tight `EPS_DEFAULT`/`EPS_SCF`, DX scans, and high `MAX_SCF`,
- CP2K/tblite results were compared to native `tblite` CLI for energy, gradient, and virial,
- H0, overlap/potential, Coulomb/multipole, CN-chain-rule, D4, D3/s-D3, DFTD4 and SCC/Ewald pieces
  were isolated where practical and checked against finite differences,
- CP2K-native DFTB, DFTB3, GFN0, GFN1, CP2K/tblite GFN1/GFN2/IPEA1, and native `tblite` CLI were
  tested separately,
- k-point full grids, CP2K atomic symmetry, SPGLIB symmetry, displaced atoms, skew cells, and
  MPI-rank reproducibility were checked,
- 1D/2D periodicity, charged systems, and open-shell/spin behavior were probed.

What helped:

- restoring periodic H0/CN self-image contributions,
- fixing self-image virial signs/factors,
- fixing the native tblite H0 self-image sigma factor,
- fixing the DFTB SCC/Ewald background gauge contribution,
- recomputing k-point symmetry for lowered-symmetry DEBUG geometries,
- smoothing the hard D4 two-body cutoff in the stress-sensitive GFN2/Si8 case,
- updating the external library toolchain patches and DFTB reference values.

What did not help or was not the root cause:

- simply tightening `EPS_SCF`, `EPS_DEFAULT`, `DX`, or `MAX_SCF`,
- changing only SCC damping/mixer parameters for the hard GFN2 stress cases,
- treating the native `tblite` CLI periodic virial as authoritative before fixing its own H0 sigma
  self-image term,
- using large vacuum boxes as stand-ins for true periodic crystals,
- assuming all heteronuclear crystals are good regtests: several are dominated by overlap
  conditioning/SCF-state sensitivity rather than a clean force/stress bug.

## What works now

- CP2K/tblite GFN1/GFN2 molecular force DEBUG checks are at `~1e-8`.
- CP2K/tblite GFN2 isolated diagnostic stress is `~4e-9`.
- CP2K/tblite GFN1/GFN2 Ar-fcc k-point force/stress DEBUG runs with `64 -> 4` k-point reduction.
- CP2K/tblite GFN2 `PERIODIC XZ` Ar-layer k-point stress DEBUG is reduced from the reproduced `5.83e-4` remainder to `2.66e-5`; forces are `2.29e-6`.
- CP2K/tblite GFN1/GFN2 skew/asym Si8 Gamma stress is now in the `~1e-6` range rather than
  `~1e-3`.
- CP2K/tblite IPEA1 runs with k-point reduction and force/stress DEBUG coverage.
- CP2K-native DFTB non-SCC/SCC and GFN0/GFN1 k-point symmetry paths pass the new tests.
- DFTB3 force, Gamma stress, k-point force, and k-point stress tests pass.
- DFTD4/DFTD3/D3(BJ) CP2K tests pass with the updated build; external DFTD4/tblite patches are ready
  for the toolchain.

Representative final regtest values:

| Path | Representative result |
| --- | ---: |
| CP2K/tblite GFN2 CH2O force DEBUG | `M042 = 1e-8` |
| CP2K/tblite GFN2 CH2O isolated stress DEBUG | `M042 = 4.067e-9` |
| CP2K/tblite GFN2 Si8 Gamma stress DEBUG | `M042 = 4.76966e-7` |
| CP2K/tblite GFN2 Ar-fcc k-point stress DEBUG | `M042 = 3.33e-7`, `N_special_kpoints = 4` |
| CP2K/tblite GFN2 Ar-layer XZ k-point stress DEBUG | `M042 = 2.66e-5`, `N_special_kpoints = 2` |
| CP2K/tblite GFN1 Ar-fcc k-point stress DEBUG | `M042 = 1.6417e-8`, `N_special_kpoints = 4` |
| CP2K/tblite IPEA1 Ar-fcc k-point stress DEBUG | `M042 = 2.4656e-8`, `N_special_kpoints = 4` |
| CP2K-native GFN0 Si k-point symmetry | `N_special_kpoints = 4`; displaced geometry `12` |
| DFTB non-SCC Si k-point stress | `M042 = 3.807e-9`, `N_special_kpoints = 4` |
| DFTB SCC C k-point stress | `M042 = 5.409e-9` |
| DFTB SCC ZnS k-point stress | `M042 = 2.18113e-7`, `N_special_kpoints = 4` |
| DFTB3 H2O k-point stress | `M042 = 6.89e-10`, `N_special_kpoints = 4` |

## Remaining limitations

- The reproduced `PERIODIC XZ` CP2K/tblite GFN2 Ar-layer k-point virial remainder is now much smaller (`2.66e-5` instead of `5.83e-4`), but not yet in the `1e-6` range; forces are good.
- `PERIODIC X` full stress DEBUG is limited by the general CP2K cell/Poisson/stress machinery, not by
  a TB-specific quick fix.
- CP2K/tblite open-shell/LSD still aborts intentionally:
  `LSD option not compatible with tblite library`.
- Native `tblite` CLI remains a serial external Gamma-reference path; it is not a k-point/symmetry
  reference implementation.
- Some heteronuclear CP2K/tblite crystals with k-points are sensitive to overlap conditioning and
  SCF state; Ar/Si remain the robust PR regtest choices.

## Verification

- formatting:
  - `tools/precommit/format_fortran.py` on changed Fortran files,
  - `tools/precommit/format_input_file.py` on changed/new CP2K inputs,
  - `tools/precommit/precommit.py -m` on non-Fortran/non-input files.
- patch checks:
  - `tblite-0.5.0-gradient-fixes.patch`: `patch -p1 --dry-run` against fresh `tblite-0.5.0`,
  - `dftd4-4.1.0-gradient-fixes.patch`: `patch -p1 --dry-run` against fresh `dftd4-4.1.0`.
- build:
  - `cmake --build build-tblite-mpi-check --target cp2k-bin -- -j 8`
- regtests with `mpiranks=2`, `ompthreads=1`:
  - `xTB/regtest-tblite-gfn2`, `xTB/regtest-tblite-gfn1-grad`,
    `xTB/regtest-tblite-ipea1`, `DFTB/regtest-scc-2`: `49 / 49` correct,
  - `DFTB/regtest-scc`, `DFTB/regtest-nonscc`: after updating affected references,
    `89 / 89` correct,
  - additionally checked in the same PR-ready run: `xTB/regtest-1`, `xTB/regtest-3`,
    `xTB/regtest-gfn0`, `QS/regtest-dft-vdw-corr-4`; those were green, with only the old DFTB
    references requiring the follow-up update above.
2026-05-06 00:47:46 +02:00
Dynamics of Condensed Matter
c7270bbdb5
Diagonalization: add opt-in direct generalized eigensolvers (#5108)
Co-authored-by: DCM-Uni-Paderborn <DCM-Uni-Paderborn@users.noreply.github.com>
Co-authored-by: Thomas D. Kuehne <tkuehne@cp2k.org>
2026-05-05 16:26:45 +02:00
SY Wang
2d33723005
Toolchain: Don't install fmt when SIRIUS is disabled (#5115) 2026-04-30 18:55:31 +02:00
SY Wang
1d63da52da
Toolchain: Updates of FFTW and OpenBLAS (#5102) 2026-04-27 10:20:21 +02:00
SY Wang
3a22a26910
Toolchain SIRIUS (#5098) 2026-04-26 22:07:14 +02:00
SY Wang
f577188f47
Toolchain: Replace "scripts/generate_cmake_options.sh" with "build_cp2k.sh" (#5080)
Co-authored-by: HE Zilong <159878975+he-zilong@users.noreply.github.com>
2026-04-26 12:40:37 +02:00
SY Wang
a1d43364c5
Toolchain: COSMA 2.8.2 -> 2.8.4 (#5076) 2026-04-19 13:09:08 +02:00
SY Wang
30e889138e
Toolchain: Avoid additional dependencies of libint and rollback COSMA upgrade (#5072) 2026-04-18 18:17:31 +02:00
Growl
c4157ab6c8 Toolchain: COSMA 2.8.2 -> 2.8.3 2026-04-17 10:14:22 +02:00