From 4e033346065e8a80a9a38acc4beb69031039ce8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Sch=C3=BCtt?= Date: Tue, 24 Feb 2026 15:21:20 +0100 Subject: [PATCH] precommit: Update Python packages and re-format --- benchmarks/QS/check-release-comparison.py | 12 +- benchmarks/QS_LiH_HFX/README.md | 18 +- benchmarks/QS_low_scaling_GW/README.md | 6 +- benchmarks/QS_mp2_rpa/32-H2O/README.md | 8 +- benchmarks/QS_single_node/README.md | 2 +- docs/README.md | 2 +- docs/generate_input_reference.py | 1 - docs/methods/post_hartree_fock/low-scaling.md | 422 +++++++++--------- docs/methods/properties/bandstructure_gw.md | 6 +- .../properties/optical/vibronicspec.md | 10 +- docs/methods/properties/x-ray/delta-kick.md | 7 +- docs/methods/properties/x-ray/tddft.md | 2 +- docs/methods/qm_mm/builtin.md | 2 +- docs/methods/sampling/ehrenfest.md | 15 +- docs/methods/sampling/molecular_dynamics.md | 2 +- docs/technologies/eigensolvers/cusolvermp.md | 2 +- src/start/python/sample_force_env.py | 1 - tools/benchmark_plots/plot_benchmark.py | 1 + tools/benchmark_plots/plot_comparison.py | 1 + tools/build_utils/makedep.py | 4 +- tools/conventions/analyze_gfortran_ast.py | 1 - tools/docker/generate_dockerfiles.py | 54 +-- tools/docker/scripts/test_precommit.sh | 2 +- tools/precommit/format_fortran.py | 1 - tools/precommit/install_requirements.sh | 4 +- .../prettify_cp2k/normalizeFortranFile.py | 14 +- tools/precommit/requirements.txt | 52 +-- 27 files changed, 307 insertions(+), 345 deletions(-) diff --git a/benchmarks/QS/check-release-comparison.py b/benchmarks/QS/check-release-comparison.py index 6eeff4d469..f18c807a68 100755 --- a/benchmarks/QS/check-release-comparison.py +++ b/benchmarks/QS/check-release-comparison.py @@ -92,11 +92,9 @@ def run_benchmark(cp2k_exe_dir, input_file, mpi_wrapper="mpiexec -np {mpi_ranks} allok = True - print( - """ + print(""" CP2K | # Threads | # Ranks | Energy ------+-----------+---------+------------------------""" - ) +-----+-----------+---------+------------------------""") for (omp_num_threads, mpi_ranks), energy in zip(TEST_COMBINATIONS, energies): version = cp2k_version(omp_num_threads, mpi_ranks) @@ -109,11 +107,9 @@ CP2K | # Threads | # Ranks | Energy f"{version} | {omp_num_threads:9d} | {mpi_ranks:7d} | {energy:20.14f} {mark}" ) - print( - f"""\ + print(f"""\ ---------------------------------------------------- -mean: {mean:20.14f} +/- {var:16.12e}""" - ) +mean: {mean:20.14f} +/- {var:16.12e}""") return allok diff --git a/benchmarks/QS_LiH_HFX/README.md b/benchmarks/QS_LiH_HFX/README.md index bcb68bbd72..fb09f3a39b 100644 --- a/benchmarks/QS_LiH_HFX/README.md +++ b/benchmarks/QS_LiH_HFX/README.md @@ -119,12 +119,12 @@ with later ones. Running on ORNL's Cray XT5 (Jaguar) the following runtime has been obtained in a setup using 8 OMP threads per node (8 cores per node / 16 Gb per node). -| Cores | Full CP2K\[s\] | HFX\[s\] | local HFX\[s\] | Mem/node\[Mb\] | -| ----: | -------------: | -------: | -------------: | -------------: | -| 1024 | 6569.07 | 6488.24 | 6406.99 | 14845.00 | -| 2048 | 1369.92 | 1314.86 | 1259.82 | 13468.00 | -| 4096 | 722.24 | 670.18 | 631.11 | 7293.00 | -| 8192 | 402.18 | 352.21 | 317.59 | 4306.00 | -| 16384 | 274.41 | 213.88 | 172.88 | 2801.00 | -| 32768 | 201.71 | 135.47 | 85.29 | 2046.00 | -| 65536 | 255.97 | 117.33 | 41.43 | 1673.00 | +| Cores | Full CP2K[s] | HFX[s] | local HFX[s] | Mem/node[Mb] | +| ----: | -----------: | ------: | -----------: | -----------: | +| 1024 | 6569.07 | 6488.24 | 6406.99 | 14845.00 | +| 2048 | 1369.92 | 1314.86 | 1259.82 | 13468.00 | +| 4096 | 722.24 | 670.18 | 631.11 | 7293.00 | +| 8192 | 402.18 | 352.21 | 317.59 | 4306.00 | +| 16384 | 274.41 | 213.88 | 172.88 | 2801.00 | +| 32768 | 201.71 | 135.47 | 85.29 | 2046.00 | +| 65536 | 255.97 | 117.33 | 41.43 | 1673.00 | diff --git a/benchmarks/QS_low_scaling_GW/README.md b/benchmarks/QS_low_scaling_GW/README.md index 99c6dd9365..a516deff99 100644 --- a/benchmarks/QS_low_scaling_GW/README.md +++ b/benchmarks/QS_low_scaling_GW/README.md @@ -18,8 +18,8 @@ To run the benchmark, CP2K needs to be compiled with libint support (`-D__LIBINT ## Results on Piz Dora, CSCS -| Input File | Configuration | Total Number of Cores | Runtime \[s\] | -| ---------- | ------------------------: | --------------------: | ------------: | -| GW.inp | 16 nodes x 36 MPI x 1 OMP | 576 | 305 | +| Input File | Configuration | Total Number of Cores | Runtime [s] | +| ---------- | ------------------------: | --------------------: | ----------: | +| GW.inp | 16 nodes x 36 MPI x 1 OMP | 576 | 305 | The timings have been obtained on CRAY-XC40 (PizDora@CSCS) diff --git a/benchmarks/QS_mp2_rpa/32-H2O/README.md b/benchmarks/QS_mp2_rpa/32-H2O/README.md index 593c1b5e51..bf9351d708 100644 --- a/benchmarks/QS_mp2_rpa/32-H2O/README.md +++ b/benchmarks/QS_mp2_rpa/32-H2O/README.md @@ -28,9 +28,9 @@ the additional files [`t_c_g.dat`](../../../data/t_c_g.dat) and ### Results on Piz Dora, CSCS -| Input File | Configuration | Total Number of Cores | Runtime \[s\] | -| ---------- | ------------------------: | --------------------: | ------------: | -| RI-MP2.inp | 16 nodes x 16 MPI x 1 OMP | 256 | 392 | -| RI-RPA.inp | 16 nodes x 16 MPI x 1 OMP | 256 | 221 | +| Input File | Configuration | Total Number of Cores | Runtime [s] | +| ---------- | ------------------------: | --------------------: | ----------: | +| RI-MP2.inp | 16 nodes x 16 MPI x 1 OMP | 256 | 392 | +| RI-RPA.inp | 16 nodes x 16 MPI x 1 OMP | 256 | 221 | \*) The timings have been obtained on CRAY-XC40 (PizDora@CSCS) diff --git a/benchmarks/QS_single_node/README.md b/benchmarks/QS_single_node/README.md index 507d5bc3d5..e247684e78 100644 --- a/benchmarks/QS_single_node/README.md +++ b/benchmarks/QS_single_node/README.md @@ -1,5 +1,5 @@ # Quickstep Single Node Regression Tests The purpose of these tests is to give a quick idea of the performance of a system, when only a -single node is available. The tests should run in \< 5 minutes on a modern node, and require less +single node is available. The tests should run in < 5 minutes on a modern node, and require less than 16Gb of memory. diff --git a/docs/README.md b/docs/README.md index 2f2ce72439..fda8617628 100644 --- a/docs/README.md +++ b/docs/README.md @@ -38,7 +38,7 @@ To build a local version of the manual perform the following steps: 1. Browse the HTML output in the `_build/html` directory. -> \[!TIP\] +> [!TIP] > > While the first invocation of Sphinx can be quite slow, subsequent builds are significantly faster > thanks to its doctree cache. Nevertheless, a build with the full input reference can take several diff --git a/docs/generate_input_reference.py b/docs/generate_input_reference.py index 768f547f84..baccdad634 100755 --- a/docs/generate_input_reference.py +++ b/docs/generate_input_reference.py @@ -11,7 +11,6 @@ from datetime import datetime from collections import defaultdict from functools import cache - SectionPath = Tuple[str, ...] diff --git a/docs/methods/post_hartree_fock/low-scaling.md b/docs/methods/post_hartree_fock/low-scaling.md index af6e4f462a..c87c6e8912 100644 --- a/docs/methods/post_hartree_fock/low-scaling.md +++ b/docs/methods/post_hartree_fock/low-scaling.md @@ -62,7 +62,7 @@ operator with a cutoff radius of 1.5-2.0 Angstroms as a RI metric is safer. All post-HF calculations need an accurate and well converged SCF as a starting point. In this case, a pure Hartree-Fock calculation is performed. Note the use of the truncated Coulomb operator as HFX -potential, with cutoff radius \< L/2, as always required in periodic HF. Here, the value of 4.5 +potential, with cutoff radius < L/2, as always required in periodic HF. Here, the value of 4.5 Angstroms is somewhat small, and simulating a larger water box would be advised. A numerical Laplace transform is used to reduce the scaling of the method. The integral is replaced @@ -73,99 +73,99 @@ band gap of the system and the total spread of the SCF eigenvalues. If the selec point is innapropriate, a warning is issued. ```none -&GLOBAL - PROJECT water32 - RUN_TYPE MD - PRINT_LEVEL MEDIUM -&END GLOBAL -&MOTION - &MD - STEPS 3 - &END MD -&END MOTION -&FORCE_EVAL - &DFT - !cc-TZ: RI-MP2 optimized basis sets - BASIS_SET_FILE_NAME BASIS_RI_cc-TZ - POTENTIAL_FILE_NAME POTENTIAL - SORT_BASIS EXP - - &MGRID - CUTOFF 600 - REL_CUTOFF 50 - NGRIDS 5 - &END MGRID - - &SCF - SCF_GUESS RESTART - EPS_SCF 1.0E-6 - MAX_SCF 40 - &END SCF - - &XC - &XC_FUNCTIONAL NONE - &END XC_FUNCTIONAL - &HF - FRACTION 1.0 - &INTERACTION_POTENTIAL - !TC potential with cutoff < L/2 for periodic HFX - POTENTIAL_TYPE TRUNCATED - CUTOFF_RADIUS 4.5 - &END INTERACTION_POTENTIAL - &MEMORY - !maximum memory allocated to HFX ERI storage, per MPI rank - !the optimal number depends on the specifics of the computer - MAX_MEMORY 4000 - &END MEMORY +&GLOBAL + PROJECT water32 + RUN_TYPE MD + PRINT_LEVEL MEDIUM +&END GLOBAL +&MOTION + &MD + STEPS 3 + &END MD +&END MOTION +&FORCE_EVAL + &DFT + !cc-TZ: RI-MP2 optimized basis sets + BASIS_SET_FILE_NAME BASIS_RI_cc-TZ + POTENTIAL_FILE_NAME POTENTIAL + SORT_BASIS EXP + + &MGRID + CUTOFF 600 + REL_CUTOFF 50 + NGRIDS 5 + &END MGRID + + &SCF + SCF_GUESS RESTART + EPS_SCF 1.0E-6 + MAX_SCF 40 + &END SCF + + &XC + &XC_FUNCTIONAL NONE + &END XC_FUNCTIONAL + &HF + FRACTION 1.0 + &INTERACTION_POTENTIAL + !TC potential with cutoff < L/2 for periodic HFX + POTENTIAL_TYPE TRUNCATED + CUTOFF_RADIUS 4.5 + &END INTERACTION_POTENTIAL + &MEMORY + !maximum memory allocated to HFX ERI storage, per MPI rank + !the optimal number depends on the specifics of the computer + MAX_MEMORY 4000 + &END MEMORY &END HF - &WF_CORRELATION - !explicit opposite-spin scaling - SCALE_S 1.3 - &RI_SOS_MP2 - !MINIMAX quadrature by default - QUADRATURE_POINTS 6 + &WF_CORRELATION + !explicit opposite-spin scaling + SCALE_S 1.3 + &RI_SOS_MP2 + !MINIMAX quadrature by default + QUADRATURE_POINTS 6 &END RI_SOS_MP2 - !Enabling low-scaling - &LOW_SCALING - MEMORY_CUT 3 - &END LOW_SCALING - &RI - &RI_METRIC - !Short range RI metric for SOS-MP2 - POTENTIAL_TYPE TRUNCATED - CUTOFF_RADIUS 1.5 - &END RI_METRIC - &END RI - &INTEGRALS - ERI_METHOD GPW - &WFC_GPW - !Safe yet faster than default values - CUTOFF 200 - REL_CUTOFF 40 + !Enabling low-scaling + &LOW_SCALING + MEMORY_CUT 3 + &END LOW_SCALING + &RI + &RI_METRIC + !Short range RI metric for SOS-MP2 + POTENTIAL_TYPE TRUNCATED + CUTOFF_RADIUS 1.5 + &END RI_METRIC + &END RI + &INTEGRALS + ERI_METHOD GPW + &WFC_GPW + !Safe yet faster than default values + CUTOFF 200 + REL_CUTOFF 40 &END WFC_GPW &END INTEGRALS - &END WF_CORRELATION - &END XC - &END DFT - &SUBSYS - &CELL - ABC 9.8528 9.8528 9.8528 - &END CELL - &TOPOLOGY - COORD_FILE_FORMAT XYZ - COORD_FILE_NAME ./H2O-32.xyz - &END TOPOLOGY - &KIND H - BASIS_SET cc-DZ - BASIS_SET RI_AUX RI_DZ - POTENTIAL GTH-HF - &END KIND - &KIND O - BASIS_SET cc-DZ - BASIS_SET RI_AUX RI_DZ - POTENTIAL GTH-HF - &END KIND - &END SUBSYS + &END WF_CORRELATION + &END XC + &END DFT + &SUBSYS + &CELL + ABC 9.8528 9.8528 9.8528 + &END CELL + &TOPOLOGY + COORD_FILE_FORMAT XYZ + COORD_FILE_NAME ./H2O-32.xyz + &END TOPOLOGY + &KIND H + BASIS_SET cc-DZ + BASIS_SET RI_AUX RI_DZ + POTENTIAL GTH-HF + &END KIND + &KIND O + BASIS_SET cc-DZ + BASIS_SET RI_AUX RI_DZ + POTENTIAL GTH-HF + &END KIND + &END SUBSYS &END FORCE_EVAL ``` @@ -186,7 +186,7 @@ exchange energy (EXX) calculated with the same orbitals. The `&HF` section in RP last step. If taken to be the same as the SCF (except for `FRACTION` and `MEMORY`), the stored ERIs can be reused and rescaled instead of recomputed, thus saving precious computational time. The `ADMM` keyword in RPA specifies that the EXX should be calculated within the ADMM approximation. -Note the truncated Coulomb potential used for HFX, and its cutoff radius of 4.5 Angstroms (\< L/2), +Note the truncated Coulomb potential used for HFX, and its cutoff radius of 4.5 Angstroms (< L/2), necessary for periodic HFX calculations. This cutoff radius is on the shorter size, and using a larger simulation cell would be advised. @@ -195,126 +195,126 @@ efficiency, as the default grid follows a Clenshaw-Curtis scheme, which requires integration points for the same accuracy. ```none -&GLOBAL - PROJECT TiO2 - RUN_TYPE CELL_OPT - PRINT_LEVEL MEDIUM -&END GLOBAL -&MOTION - &CELL_OPT - MAX_ITER 2 - &END CELL_OPT -&END MOTION -&FORCE_EVAL - STRESS_TENSOR ANALYTICAL - &DFT - BASIS_SET_FILE_NAME BASIS_ccGRB_UZH - BASIS_SET_FILE_NAME BASIS_ADMM_UZH - POTENTIAL_FILE_NAME POTENTIAL_UZH - SORT_BASIS EXP - !automatically generated RI basis set - AUTO_BASIS RI_AUX SMALL - - !enabling the ADMM2 approximation - &AUXILIARY_DENSITY_MATRIX_METHOD - METHOD BASIS_PROJECTION - ADMM_PURIFICATION_METHOD NONE - EXCH_CORRECTION_FUNC PBEX - &END AUXILIARY_DENSITY_MATRIX_METHOD - - &MGRID - CUTOFF 600 - REL_CUTOFF 50 - NGRIDS 5 - &END MGRID - - &SCF - EPS_SCF 1.0E-6 - MAX_SCF 20 - &OT - PRECONDITIONER FULL_ALL - MINIMIZER DIIS - &END OT - &OUTER_SCF - MAX_SCF 5 - EPS_SCF 1.0E-6 - &END OUTER_SCF - &END SCF - - &XC - &XC_FUNCTIONAL - &PBE - SCALE_X 0.75 - &END PBE - &END XC_FUNCTIONAL - &HF - FRACTION 0.25 - !always use a short range potential < L/2 in periodic HFX - &INTERACTION_POTENTIAL - POTENTIAL_TYPE TRUNCATED - CUTOFF_RADIUS 4.5 - &END INTERACTION_POTENTIAL - &MEMORY - !maximum memory allocated to HFX ERI storage, per MPI rank - !the optimal number depends on the specifics of the computer - MAX_MEMORY 4000 - &END MEMORY +&GLOBAL + PROJECT TiO2 + RUN_TYPE CELL_OPT + PRINT_LEVEL MEDIUM +&END GLOBAL +&MOTION + &CELL_OPT + MAX_ITER 2 + &END CELL_OPT +&END MOTION +&FORCE_EVAL + STRESS_TENSOR ANALYTICAL + &DFT + BASIS_SET_FILE_NAME BASIS_ccGRB_UZH + BASIS_SET_FILE_NAME BASIS_ADMM_UZH + POTENTIAL_FILE_NAME POTENTIAL_UZH + SORT_BASIS EXP + !automatically generated RI basis set + AUTO_BASIS RI_AUX SMALL + + !enabling the ADMM2 approximation + &AUXILIARY_DENSITY_MATRIX_METHOD + METHOD BASIS_PROJECTION + ADMM_PURIFICATION_METHOD NONE + EXCH_CORRECTION_FUNC PBEX + &END AUXILIARY_DENSITY_MATRIX_METHOD + + &MGRID + CUTOFF 600 + REL_CUTOFF 50 + NGRIDS 5 + &END MGRID + + &SCF + EPS_SCF 1.0E-6 + MAX_SCF 20 + &OT + PRECONDITIONER FULL_ALL + MINIMIZER DIIS + &END OT + &OUTER_SCF + MAX_SCF 5 + EPS_SCF 1.0E-6 + &END OUTER_SCF + &END SCF + + &XC + &XC_FUNCTIONAL + &PBE + SCALE_X 0.75 + &END PBE + &END XC_FUNCTIONAL + &HF + FRACTION 0.25 + !always use a short range potential < L/2 in periodic HFX + &INTERACTION_POTENTIAL + POTENTIAL_TYPE TRUNCATED + CUTOFF_RADIUS 4.5 + &END INTERACTION_POTENTIAL + &MEMORY + !maximum memory allocated to HFX ERI storage, per MPI rank + !the optimal number depends on the specifics of the computer + MAX_MEMORY 4000 + &END MEMORY &END HF - &WF_CORRELATION - &RI_RPA - MINIMAX_QUADRATURE - QUADRATURE_POINTS 6 - !calculate EXX with ADMM, using the same HF section as in SCF - !so that the integrals can be resued without recomputing - ADMM - &HF - FRACTION 1.0 - &INTERACTION_POTENTIAL - POTENTIAL_TYPE TRUNCATED - CUTOFF_RADIUS 4.5 - &END INTERACTION_POTENTIAL - &END HF - &END RI_RPA - !enabling low-scaling - &LOW_SCALING - MEMORY_CUT 3 + &WF_CORRELATION + &RI_RPA + MINIMAX_QUADRATURE + QUADRATURE_POINTS 6 + !calculate EXX with ADMM, using the same HF section as in SCF + !so that the integrals can be resued without recomputing + ADMM + &HF + FRACTION 1.0 + &INTERACTION_POTENTIAL + POTENTIAL_TYPE TRUNCATED + CUTOFF_RADIUS 4.5 + &END INTERACTION_POTENTIAL + &END HF + &END RI_RPA + !enabling low-scaling + &LOW_SCALING + MEMORY_CUT 3 &END LOW_SCALING - &RI - !overlap RI metric is appropriate for dense systems - &RI_METRIC - POTENTIAL_TYPE IDENTITY - &END RI_METRIC - &END RI - &INTEGRALS - ERI_METHOD GPW - !Safe yet faster than default values - &WFC_GPW - CUTOFF 200 - REL_CUTOFF 40 - &END WFC_GPW - &END INTEGRALS + &RI + !overlap RI metric is appropriate for dense systems + &RI_METRIC + POTENTIAL_TYPE IDENTITY + &END RI_METRIC + &END RI + &INTEGRALS + ERI_METHOD GPW + !Safe yet faster than default values + &WFC_GPW + CUTOFF 200 + REL_CUTOFF 40 + &END WFC_GPW + &END INTEGRALS &END WF_CORRELATION - &END XC - &END DFT - &SUBSYS - &CELL - ABC 9.330 9.330 9.107 - &END CELL - &TOPOLOGY - COORD_FILE_FORMAT XYZ - COORD_FILE_NAME ./TiO2.xyz - &END TOPOLOGY - &KIND Ti - BASIS_SET ccGRB-D-q12 - BASIS_SET AUX_FIT admm-dz-q12 - POTENTIAL GTH-PBE0-q12 - &END KIND - &KIND O - BASIS_SET ccGRB-D-q6 - BASIS_SET AUX_FIT admm-dz-q6 - POTENTIAL GTH-PBE0-q6 - &END KIND - &END SUBSYS + &END XC + &END DFT + &SUBSYS + &CELL + ABC 9.330 9.330 9.107 + &END CELL + &TOPOLOGY + COORD_FILE_FORMAT XYZ + COORD_FILE_NAME ./TiO2.xyz + &END TOPOLOGY + &KIND Ti + BASIS_SET ccGRB-D-q12 + BASIS_SET AUX_FIT admm-dz-q12 + POTENTIAL GTH-PBE0-q12 + &END KIND + &KIND O + BASIS_SET ccGRB-D-q6 + BASIS_SET AUX_FIT admm-dz-q6 + POTENTIAL GTH-PBE0-q6 + &END KIND + &END SUBSYS &END FORCE_EVAL ``` @@ -336,9 +336,7 @@ There are a few importnat input parameters for low-scaling post-HF calculations: consumption of the program is divided by three (initial and final tensors are not affected, as well as the data concerning the rest of the calculation). A higher value reduces the memory footprint, but leads to performance overheads. -- `RI METRIC`: the choice of RI metric is crucial for performance in periodic calculations. - A\ - shorter ranged RI metric will generally be more efficient, while a longer ranged metric (e.g. - TC\ +- `RI METRIC`: the choice of RI metric is crucial for performance in periodic calculations. A + shorter ranged RI metric will generally be more efficient, while a longer ranged metric (e.g. TC with a cutoff radius of 1.5 Angstrom) can be more accurate. See [](#Bussy2023) for a full discussion. diff --git a/docs/methods/properties/bandstructure_gw.md b/docs/methods/properties/bandstructure_gw.md index df003c441c..0893ea185d 100644 --- a/docs/methods/properties/bandstructure_gw.md +++ b/docs/methods/properties/bandstructure_gw.md @@ -74,10 +74,8 @@ $$ \varepsilon_{n\mathbf{k}}^{G_0W_0} = \varepsilon_{n\mathbf{k}}^\text{DFT} + \ We might interpret that we remove the spurious xc contribution from DFT, $\braket{\psi_{n\mathbf{k}}| -v_\text{xc}|\psi_{n\mathbf{k}}}$, from the DFT eigenvalue -$\varepsilon_{n\mathbf{k}}^\text{DFT}$ and we add the xc contribution from -*G*0*W*0, -$\braket{\psi_{n\mathbf{k}}| +v_\text{xc}|\psi_{n\mathbf{k}}}$, from the DFT eigenvalue $\varepsilon_{n\mathbf{k}}^\text{DFT}$ and +we add the xc contribution from *G*0*W*0, $\braket{\psi_{n\mathbf{k}}| \Sigma^{G_0W_0}(\varepsilon_{n\mathbf{k}}^{G_0W_0}) |\psi_{n\mathbf{k}}}$. CP2K also allows to perform eigenvalue-selfconsistency in $G$ (ev*GW*0) and diff --git a/docs/methods/properties/optical/vibronicspec.md b/docs/methods/properties/optical/vibronicspec.md index 54a8595953..5d1afd7345 100644 --- a/docs/methods/properties/optical/vibronicspec.md +++ b/docs/methods/properties/optical/vibronicspec.md @@ -156,8 +156,8 @@ basis set, and convergence settings, across all calculations. The optimized geom the chosen computational setup, so using different parameters in vibrational analysis and spectrum calculation could mean the geometry is no longer at the true minimum for those new settings. The geometry in this tutorial is optimized using `PBE0` functional and `TZVP-MOLOPT-PBE0-GTH` basis -sets. [ADMM](#CP2K_INPUT.FORCE_EVAL.DFT.AUXILIARY_DENSITY_MATRIX_METHOD)[](#Guidon2010) -approximation is also used with `admm-dzp` basis to reduce the cost of exchange integrals. +sets. The [ADMM](#CP2K_INPUT.FORCE_EVAL.DFT.AUXILIARY_DENSITY_MATRIX_METHOD) approximation +([](#Guidon2010)) is also used with `admm-dzp` basis to reduce the cost of exchange integrals. ### 1. Vibrational modes and frequencies @@ -327,8 +327,8 @@ than the default, to ensure more accurate excitation energies. We also ask to pr we set a [THRESHOLD](#CP2K_INPUT.FORCE_EVAL.PROPERTIES.TDDFPT.PRINT.FORCES.THRESHOLD) of 0.001. This means forces are only calculated for states whose oscillator strength is above that value. Filtering out weak states helps keep the calculation efficient. You can also list specific states explicitly -with the [LIST](#CP2K_INPUT.FORCE_EVAL.PROPERTIES.TDDFPT.PRINT.FORCES.LIST) keyword (\[Strand2019\], -[](#Iannuzzi2005), \[Hehn2022\]). +with the [LIST](#CP2K_INPUT.FORCE_EVAL.PROPERTIES.TDDFPT.PRINT.FORCES.LIST) keyword +([Strand2019](https://doi.org/10.1063/1.5078682), [](#Iannuzzi2005), [](#Hehn2022)). The output file we need is `so2-TDFORCE-1_0.tdfrc` file, which contains the spectrum data and the forces in this format: @@ -425,7 +425,7 @@ calculation parameters are: - Spectrum type (absorption or fluorescence) - States to include, it can take different arguments: - "all", includes all states that have forces in TDFORCE file - - a list like \[1, 2, 5\] to explicitly give state numbers + - a list like [1, 2, 5] to explicitly give state numbers - "threshold:0.001", this option works like the THRESHOLD filter we used in the TDDFT force calculation, including only states with oscillator strength above 0.001. diff --git a/docs/methods/properties/x-ray/delta-kick.md b/docs/methods/properties/x-ray/delta-kick.md index 3a5a3a7192..1d35340591 100644 --- a/docs/methods/properties/x-ray/delta-kick.md +++ b/docs/methods/properties/x-ray/delta-kick.md @@ -92,10 +92,9 @@ efficiency the propagation parameters are set to focus only on one specific part ### Absorption spectrum Under the assumption of linear response to the perturbation,\ -the real and imaginary part of the -calculated frequency-dependent polarizability define the nature of the response. If the frequency is -at an electronic resonance, then the polarizability has an imaginary part. The polarizability is -pure real off resonances. +the real and imaginary part of the calculated frequency-dependent polarizability define the nature +of the response. If the frequency is at an electronic resonance, then the polarizability has an +imaginary part. The polarizability is pure real off resonances. From one Real-Time propagation, one can obtain three components of the polarizability tensor. For instance, applying a $\delta$-kick along $x$ provides the components $\alpha_{xx}$, $\alpha_{yx}$ diff --git a/docs/methods/properties/x-ray/tddft.md b/docs/methods/properties/x-ray/tddft.md index 90bd49ec27..87d2ba6d24 100644 --- a/docs/methods/properties/x-ray/tddft.md +++ b/docs/methods/properties/x-ray/tddft.md @@ -543,7 +543,7 @@ for 2px, 2py and 2pz. To avoid cancelling contributions, the sum of the absolute Hybrid functionals with high fraction of Hartree-Fock exchange are know to perform well for core spectroscopy. PBEh($\alpha=0.45$) and BHandHLYP have had success with this particular implementation. In periodic boundary conditions, the truncated Coulomb operator should be used (with -truncation radius \< half cell parameter). +truncation radius < half cell parameter). For appropriate description of core states, all-electron basis sets should be used for the excited atom(s). MOLOPT basis sets and pseudopotentials can be used on all other atoms. There exist core diff --git a/docs/methods/qm_mm/builtin.md b/docs/methods/qm_mm/builtin.md index 5897f93303..efeecb79bc 100644 --- a/docs/methods/qm_mm/builtin.md +++ b/docs/methods/qm_mm/builtin.md @@ -90,7 +90,7 @@ input file. We can now move on to actually running CP2K. We will first run 1000 steps of energy minimization (or fewer, depending on the convergence) with the input file `em.inp` to eliminate bad contacts. For quantities like cell size, for instance, CP2K allows you to specify your units by placing them in -brackets, for instance [TIMESTEP](#CP2K_INPUT.MOTION.MD.TIMESTEP) \[fs\] 0.5. +brackets, for instance [TIMESTEP](#CP2K_INPUT.MOTION.MD.TIMESTEP) [fs] 0.5. ```none cp2k can be run using a single process: diff --git a/docs/methods/sampling/ehrenfest.md b/docs/methods/sampling/ehrenfest.md index 473e5d23da..0019917849 100644 --- a/docs/methods/sampling/ehrenfest.md +++ b/docs/methods/sampling/ehrenfest.md @@ -89,7 +89,7 @@ the matrix in the exponential of the propagator becomes fully complex. ## Running real time time dependend DFT in CP2K To run RTP or Ehrenfest MD with CP2K, the corresponding [RUN_TYPE](#CP2K_INPUT.GLOBAL.RUN_TYPE) in -the \[GLOBAL\] (#CP2K_INPUT.GLOBAL) section has to be selected, and the [MD](#CP2K_INPUT.MOTION.MD) +the [GLOBAL](#CP2K_INPUT.GLOBAL) section has to be selected, and the [MD](#CP2K_INPUT.MOTION.MD) section has to be present to specify the time step length `TIMESTEP` and the desired number of steps (`STEPS`). It is crucial to set an appropriate time step to propagate the electronic degrees of freedom, i.e., in the order of atto-seconds. All other input parameters related to the RT-TDDFT run @@ -188,13 +188,12 @@ This equation is propagated for each $i$ electron with a time step $\delta t$: t collectively over time in a **continuous manner**. Especially, the energy evolution is continuous: the electrons cannot absorb exactly one photon at a given frequency to instantaneously go from one electronic state to another.\ -If one applies a field resonant with a given electronic transition, -the MOs involved in this transition will gradually be transformed from their initial state to the -corresponding excited state. This will happen in real-time without defining any specific electronic -transition before starting the simulation. Some preliminary calculations to determine the spectral -features of the system under study are in general useful to better define the desired properties of -the perturbing field. For core state excitations these information can be obtained by XAS -simulations. +If one applies a field resonant with a given electronic transition, the MOs involved in this +transition will gradually be transformed from their initial state to the corresponding excited +state. This will happen in real-time without defining any specific electronic transition before +starting the simulation. Some preliminary calculations to determine the spectral features of the +system under study are in general useful to better define the desired properties of the perturbing +field. For core state excitations these information can be obtained by XAS simulations. Once the RTP has started, the evolution of the electronic structure can be monitored by means of several descriptors, like the time dependent dipole moment, current density, total electronic diff --git a/docs/methods/sampling/molecular_dynamics.md b/docs/methods/sampling/molecular_dynamics.md index d2e6f1dc65..89f7241823 100644 --- a/docs/methods/sampling/molecular_dynamics.md +++ b/docs/methods/sampling/molecular_dynamics.md @@ -94,7 +94,7 @@ specific heat and are inversely proportional with sqrt(N) where N is the system A faster way to equilibrate the system is to use `LANGEVIN` as [ENSEMBLE](#CP2K_INPUT.MOTION.MD.ENSEMBLE), and use a [GAMMA](#CP2K_INPUT.MOTION.MD.LANGEVIN.GAMMA) -of 0.001 \[1/fs\] (or larger if you want to equilibrate faster). Langevin introduces a viscous +of 0.001 [1/fs] (or larger if you want to equilibrate faster). Langevin introduces a viscous dissipative force and a random forces that are in equilibrioum at the given temperature. For equilibration purposes (and not to simulate removed degrees of freedom, like a solvent), the smaller gamma the longer it takes to equilibrate, and the closer the trajectory is to an NVE trajectory, the diff --git a/docs/technologies/eigensolvers/cusolvermp.md b/docs/technologies/eigensolvers/cusolvermp.md index ecd86a4f7c..be115c1488 100644 --- a/docs/technologies/eigensolvers/cusolvermp.md +++ b/docs/technologies/eigensolvers/cusolvermp.md @@ -5,7 +5,7 @@ tools for the solution of dense linear systems and eigenvalue problems. ## Dependencies -[cuSOLVERmp] \< 0.7 +[cuSOLVERmp] < 0.7 - [CAL]: requires `libcal.\*` in the `$PATH` - [UCC]: requires `libucc.\*` and `libucs.\*` in the `$PATH` diff --git a/src/start/python/sample_force_env.py b/src/start/python/sample_force_env.py index bfb6468377..34dddde503 100755 --- a/src/start/python/sample_force_env.py +++ b/src/start/python/sample_force_env.py @@ -6,7 +6,6 @@ import numpy as np import cp2k - TEST_FILE_CONTENT = """ &FORCE_EVAL METHOD Quickstep diff --git a/tools/benchmark_plots/plot_benchmark.py b/tools/benchmark_plots/plot_benchmark.py index 8bee0bab0a..9741ff05c9 100755 --- a/tools/benchmark_plots/plot_benchmark.py +++ b/tools/benchmark_plots/plot_benchmark.py @@ -4,6 +4,7 @@ """ Make a plot of CP2K benchmark data. """ + import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker diff --git a/tools/benchmark_plots/plot_comparison.py b/tools/benchmark_plots/plot_comparison.py index bbefaca34e..15b9b53411 100755 --- a/tools/benchmark_plots/plot_comparison.py +++ b/tools/benchmark_plots/plot_comparison.py @@ -4,6 +4,7 @@ """ Make a plot of CP2K benchmark data. """ + import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker diff --git a/tools/build_utils/makedep.py b/tools/build_utils/makedep.py index 472aace329..30c049381a 100755 --- a/tools/build_utils/makedep.py +++ b/tools/build_utils/makedep.py @@ -123,9 +123,7 @@ $(LIBDIR)/{archive}{ext} : {objs} # Public modules for package {pkg} install: PUBLICFILES += {pubfiles} -""".format( - pkg=pkg, pubfiles=" ".join(mod for mod in packages[pkg]["public"]) - ) +""".format(pkg=pkg, pubfiles=" ".join(mod for mod in packages[pkg]["public"])) # write rules for executables archive_postfix = archive_ext.rsplit(".", 1)[0] diff --git a/tools/conventions/analyze_gfortran_ast.py b/tools/conventions/analyze_gfortran_ast.py index 5ff4dd949a..7a30c1f1a1 100755 --- a/tools/conventions/analyze_gfortran_ast.py +++ b/tools/conventions/analyze_gfortran_ast.py @@ -8,7 +8,6 @@ import collections from os import path from typing import Dict, TextIO, List - USE_EXCEPTIONS = ("omp_lib", "omp_lib_kinds", "lapack") # precompile regex diff --git a/tools/docker/generate_dockerfiles.py b/tools/docker/generate_dockerfiles.py index 8a202794b5..3e6eb6e41e 100755 --- a/tools/docker/generate_dockerfiles.py +++ b/tools/docker/generate_dockerfiles.py @@ -233,9 +233,7 @@ def main() -> None: # ====================================================================================== def regtest(profile: str, version: str, testopts: str = "") -> str: - return ( - install_cp2k(profile=profile, version=version) - + rf""" + return install_cp2k(profile=profile, version=version) + rf""" # Run regression tests. ARG TESTOPTS="{testopts}" COPY ./tests ./tests @@ -244,29 +242,21 @@ RUN /bin/bash -o pipefail -c " \ TESTOPTS='${{TESTOPTS}}' \ ./test_regtest.sh {profile} {version} |& tee report.log && \ rm -rf regtesting" -""" - + print_cached_report() - ) +""" + print_cached_report() # ====================================================================================== def test_build(profile: str, version: str) -> str: - return ( - install_cp2k(profile=profile, version=version) - + rf""" + return install_cp2k(profile=profile, version=version) + rf""" # Run build test. COPY ./tools/docker/scripts/test_build.sh . RUN ./test_build.sh "{profile}" "{version}" 2>&1 | tee report.log -""" - + print_cached_report() - ) +""" + print_cached_report() # ====================================================================================== def performance(profile: str) -> str: - return ( - install_cp2k(profile=profile, version="psmp") - + rf""" + return install_cp2k(profile=profile, version="psmp") + rf""" # Run performance test for {profile}. COPY ./benchmarks ./benchmarks COPY ./tools/regtesting ./tools/regtesting @@ -274,9 +264,7 @@ COPY ./tools/docker/scripts/test_performance.sh \ ./tools/docker/scripts/plot_performance.py \ ./ RUN ./test_performance.sh "{profile}" 2>&1 | tee report.log -""" - + print_cached_report() - ) +""" + print_cached_report() # ====================================================================================== @@ -311,24 +299,19 @@ RUN /bin/bash -ec "./tools/conventions/test_conventions.sh |& tee report.log" # ====================================================================================== def manual() -> str: - return ( - install_cp2k(profile="toolchain", version="psmp", revision=True) - + rf""" + return install_cp2k(profile="toolchain", version="psmp", revision=True) + rf""" # Generate manual. COPY ./docs ./docs COPY ./tools/input_editing ./tools/input_editing COPY ./tools/docker/scripts/test_manual.sh . ARG ADD_EDIT_LINKS=yes RUN ./test_manual.sh "${{ADD_EDIT_LINKS}}" 2>&1 | tee report.log -""" - + print_cached_report() - ) +""" + print_cached_report() # ====================================================================================== def precommit() -> str: - return ( - rf""" + return rf""" FROM ubuntu:24.04 # Install dependencies. @@ -343,29 +326,22 @@ COPY ./ ./ # Run precommit test. RUN ./tools/docker/scripts/test_precommit.sh 2>&1 | tee report.log -""" - + print_cached_report() - ) +""" + print_cached_report() # ====================================================================================== def test_3rd_party(name: str) -> str: - return ( - install_cp2k(profile="toolchain", version="ssmp") - + rf""" + return install_cp2k(profile="toolchain", version="ssmp") + rf""" # Run test for {name}. COPY ./tests ./tests COPY ./tools/docker/scripts/test_{name}.sh ./ RUN ./test_{name}.sh 2>&1 | tee report.log -""" - + print_cached_report() - ) +""" + print_cached_report() # ====================================================================================== def test_without_build(name: str) -> str: - return ( - rf""" + return rf""" FROM ubuntu:24.04 # Install dependencies. @@ -390,9 +366,7 @@ RUN bash -c "if [ -n "${{GIT_COMMIT_SHA}}" ] ; then echo "git:\${{GIT_COMMIT_SHA # Run test for {name}. COPY ./tools/docker/scripts/test_{name}.sh . RUN ./test_{name}.sh 2>&1 | tee report.log -""" - + print_cached_report() - ) +""" + print_cached_report() # ====================================================================================== diff --git a/tools/docker/scripts/test_precommit.sh b/tools/docker/scripts/test_precommit.sh index 56215f392c..decc11b1b4 100755 --- a/tools/docker/scripts/test_precommit.sh +++ b/tools/docker/scripts/test_precommit.sh @@ -5,7 +5,7 @@ echo -e "\n========== Starting Precommit Server ==========" cd ./tools/precommit/ || exit 1 export REVISION="unknown revision" -gunicorn --bind=:8080 --workers=1 --threads=8 --timeout=0 precommit_server:app &> /var/tmp/precommit_server.logs & +gunicorn --bind=:8080 --workers=1 --threads=8 --timeout=0 --no-control-socket precommit_server:app &> /var/tmp/precommit_server.logs & sleep 3 cat /var/tmp/precommit_server.logs diff --git a/tools/precommit/format_fortran.py b/tools/precommit/format_fortran.py index eea134b8d6..019902527a 100755 --- a/tools/precommit/format_fortran.py +++ b/tools/precommit/format_fortran.py @@ -18,7 +18,6 @@ from prettify_cp2k import replacer sys.path.insert(0, path.join(path.dirname(path.abspath(__file__)), "fprettify")) from fprettify import reformat_ffile, fparse_utils, log_exception - TO_UPCASE_RE = re.compile( r""" (?P diff --git a/tools/precommit/install_requirements.sh b/tools/precommit/install_requirements.sh index 7723d16b69..113c7ab38f 100755 --- a/tools/precommit/install_requirements.sh +++ b/tools/precommit/install_requirements.sh @@ -26,8 +26,10 @@ rm -rf /var/lib/apt/lists/* python3 -m venv /opt/venv export PATH="/opt/venv/bin:$PATH" +# TODO Add a pylock.toml file (https://peps.python.org/pep-0751/) # Install Python packages. Upgrade via: -# pip3 install black flask gunicorn mdformat-gfm cmake-format +# pip3 install black flask gunicorn cmake-format fortitude-lint \ +# mdformat mdformat-gfm mdformat_frontmatter mdformat_myst mdformat_tables # pip3 freeze > requirements.txt pip3 install --quiet -r requirements.txt diff --git a/tools/precommit/prettify_cp2k/normalizeFortranFile.py b/tools/precommit/prettify_cp2k/normalizeFortranFile.py index bf8555de9c..1392336a38 100644 --- a/tools/precommit/prettify_cp2k/normalizeFortranFile.py +++ b/tools/precommit/prettify_cp2k/normalizeFortranFile.py @@ -305,7 +305,7 @@ def parseRoutine(inFile, logger): } stream = InputStream(inFile) while True: - (jline, _, lines) = stream.nextFortranLine() + jline, _, lines = stream.nextFortranLine() if len(lines) == 0: break if FCT_RE.match(jline) or SUBR_RE.match(jline): @@ -317,7 +317,7 @@ def parseRoutine(inFile, logger): subF = open(m.group("file"), "r", encoding="utf8") subStream = InputStream(subF) while True: - (subjline, _, sublines) = subStream.nextFortranLine() + subjline, _, sublines = subStream.nextFortranLine() if not sublines: break routine["strippedCore"].append(subjline) @@ -351,7 +351,7 @@ def parseRoutine(inFile, logger): routine["result"] = routine["name"] while True: - (jline, comment_list, lines) = stream.nextFortranLine() + jline, comment_list, lines = stream.nextFortranLine() comments = "\n".join(_ for _ in comment_list) if len(lines) == 0: break @@ -422,7 +422,7 @@ def parseRoutine(inFile, logger): istart = lines interfaceDeclFile = StringIO() while True: - (jline, _, lines) = stream.nextFortranLine() + jline, _, lines = stream.nextFortranLine() if INTERFACE_END_RE.match(jline): iend = lines break @@ -481,7 +481,7 @@ def parseRoutine(inFile, logger): subF = open(m.group("file"), "r", encoding="utf8") subStream = InputStream(subF) while True: - (subjline, _, sublines) = subStream.nextFortranLine() + subjline, _, sublines = subStream.nextFortranLine() if not sublines: break routine["strippedCore"].append(subjline) @@ -498,7 +498,7 @@ def parseRoutine(inFile, logger): if logger.isEnabledFor(logging.DEBUG): traceback.print_exc() - (jline, _, lines) = stream.nextFortranLine() + jline, _, lines = stream.nextFortranLine() return routine @@ -1021,7 +1021,7 @@ def parseUse(inFile): commonUses = "" stream = InputStream(inFile) while True: - (jline, comment_list, lines) = stream.nextFortranLine() + jline, comment_list, lines = stream.nextFortranLine() comments = "\n".join(_ for _ in comment_list if _) lineNr = lineNr + len(lines) if not lines: diff --git a/tools/precommit/requirements.txt b/tools/precommit/requirements.txt index 61fcc362d7..a71111f59c 100644 --- a/tools/precommit/requirements.txt +++ b/tools/precommit/requirements.txt @@ -1,31 +1,31 @@ -black==24.3.0 -blinker==1.7.0 -click==8.1.7 +black==26.1.0 +blinker==1.9.0 +click==8.3.1 cmake-format==0.6.13 cmakelang==0.6.13 -Flask==3.0.0 +Flask==3.1.3 fortitude-lint==0.7.5 -gunicorn==23.0.0 -itsdangerous==2.1.2 +gunicorn==25.1.0 +itsdangerous==2.2.0 Jinja2==3.1.6 -linkify-it-py==2.0.2 -markdown-it-py==2.2.0 -MarkupSafe==2.1.3 -mdformat==0.7.17 -mdformat-gfm==0.3.5 -mdformat_frontmatter==2.0.1 -mdformat_myst==0.1.5 -mdformat_tables==0.4.1 -mdit-py-plugins==0.3.5 +markdown-it-py==3.0.0 +MarkupSafe==3.0.3 +mdformat==0.7.22 +mdformat-gfm==1.0.0 +mdformat_footnote==0.1.3 +mdformat_front_matters==2.0.0 +mdformat_frontmatter==2.0.10 +mdformat_myst==0.3.0 +mdformat_tables==1.0.0 +mdit-py-plugins==0.5.0 mdurl==0.1.2 -mypy-extensions==1.0.0 -packaging==23.2 -pathspec==0.11.2 -platformdirs==4.0.0 -ruamel.yaml==0.18.5 -ruamel.yaml.clib==0.2.8 -six==1.16.0 -tomli==2.0.1 -typing_extensions==4.8.0 -uc-micro-py==1.0.2 -Werkzeug==3.1.5 +mypy_extensions==1.1.0 +packaging==26.0 +pathspec==1.0.4 +platformdirs==4.9.2 +pytokens==0.4.1 +ruamel.yaml==0.19.1 +six==1.17.0 +toml==0.10.2 +wcwidth==0.6.0 +Werkzeug==3.1.6