Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
38c9594
ao_tc_eff_map: cast the AO cache index in ior() to 32 bits (pre-exist…
scemama Dec 1, 2026
318941b
ao_tc_eff_map: move the stray use sizet into the subroutine body, j1 …
scemama Dec 1, 2026
ebf3f50
ao_tc_eff_map: move the stray use sizet into the subroutine body, j2 …
scemama Dec 1, 2026
16bb415
ao_tc_eff_map: pass size_t literals to compute_ao_tc_sym_two_e_pot_jl…
scemama Dec 1, 2026
e07857e
bi_ort_ints: declare n_points4 shared in the DEFAULT(NONE) dgemm regi…
scemama Dec 1, 2026
b7e81dc
bi_ortho_mos: down-cast n_core_orb at the dgemm k argument (pre-exist…
scemama Dec 1, 2026
591cbbe
non_hermit_dav: use sizet inside bi_ortho_gram_schmidt (pre-existing,…
scemama Dec 1, 2026
d693cee
non_hermit_dav: use sizet in the three hand-written procedures of pro…
scemama Dec 1, 2026
7340201
tc_scf: log results through the yyjson API (pre-existing, from 5a721280)
scemama Dec 1, 2026
7b603f4
Restore stable degenerate TC eigenspace rotation
matteo-peria Aug 31, 2026
bbcc0af
Share QMCkl gradient work in bounded grid blocks
matteo-peria Nov 13, 2026
5d0d46a
Repair TC-SCF DIIS history with circular buffer
matteo-peria Nov 13, 2026
3844b32
Repair TC-SCF level-shift retries
matteo-peria Nov 16, 2026
5cee809
Bound QMCkl TC-SCF integration batches
matteo-peria Nov 17, 2026
2b0285b
Balance TC-SCF left/right orbital scales
matteo-peria Nov 17, 2026
aaaeea5
Order scaling module before its QP provider
matteo-peria Nov 17, 2026
97e976c
Fix Intel Fortran OpenMP critical-name conflict
matteo-peria Nov 18, 2026
8bb658b
Fix double counting of explicit three-electron terms in the TC-SCF Fo…
matteo-peria Nov 21, 2026
3644c92
Restore incoming TC-SCF orbitals when level-shift retries fail to imp…
matteo-peria Nov 21, 2026
c79b381
Verify TC orbital rescaling in wider precision
matteo-peria Nov 22, 2026
5ec43dd
Stop TC-SCF on the orbital residual in orthonormal AO coordinates
matteo-peria Nov 22, 2026
5f3f1ff
Compute save-memory TC gradient integrals in a single pass
matteo-peria Dec 1, 2026
32a670e
non_h_ints_mu: re-apply the size_t conventions to the ported PR #439 …
scemama Dec 1, 2026
69cab55
tc_scf: re-apply the yyjson logging on top of the ported rh_tcscf_dii…
scemama Dec 1, 2026
2189441
tc_scf: pass cholesky_ao_num to dgemm through a 32-bit temporary (pre…
scemama Dec 1, 2026
c38c29b
ci: compile the plugin layer
scemama Dec 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Compile the plugin layer.
#
# The plugins are not part of the default build and no other workflow installs
# them, so a plugin module can stay uncompilable for months: between the size_t
# conversion (PR #437) and the yyjson rewrite (5a721280) the TC closure
# accumulated ten defects that only surfaced when someone built it by hand
# (2026-12-01, PR #440). This job is what would have caught the first of them.
#
# The list lives in ci/plugins.txt; `qp plugins install` resolves the NEED
# closure, so the file lists leaves, not every module.
name: QP Plugins

on:
push:
branches:
- qp3
pull_request:
branches:
- qp3
workflow_dispatch:

concurrency:
group: plugins-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:

plugins:
name: Compilation (plugins)
runs-on: ubuntu-24.04
timeout-minutes: 60

steps:
- uses: actions/checkout@v3

- name: Restore dependency cache
uses: actions/cache@v3
with:
key: qp2-config
fail-on-cache-miss: false
path: |
include/
lib/
lib64/
libexec/
restore-keys: qp2-

- name: Install dependencies
run: |
sudo apt update
sudo apt install -y --fix-missing --no-install-recommends \
gfortran gcc liblapack-dev libblas-dev wget python3 make m4 pkg-config

- name: Install Rust toolchain
run: rustup toolchain install 1.92.0 --profile minimal --component rustfmt,clippy

- name: Configuration
run: |
# Same recipe as the Compilation job: the cache is an
# optimization, every package is installed explicitly, so a cache
# miss only costs time. configure also initializes the submodules
# (git submodule update --init --recursive).
if ! ls lib/libz.* >/dev/null 2>&1; then
./configure -i zlib || :
fi
./configure -i ninja || :
./configure -i docopt || :
./configure -i resultsFile || :
./configure -i bats || :
./configure -i trexio-nohdf5 || :
./configure -i qmckl || :
./configure -i simple_gpu || :
./configure -i libcint || :
./configure -c ./config/gfortran_debug.cfg -b ninja

- name: Core compilation
run: bash -c "source quantum_package.rc ; exec ninja"

- name: Install the plugins listed in ci/plugins.txt
run: |
source quantum_package.rc
# Several names in one call; it installs the NEED closure and
# runs `qp_create_ninja update` (graph + EZFIO interfaces).
qp plugins install $(grep -v '^#' ci/plugins.txt | tr '\n' ' ')
echo "installed: $(qp plugins list -i | tr '\n' ' ')"

- name: Compile the plugin closure
run: |
source quantum_package.rc
set -o pipefail
# Cold-tree race, rehearsed 2026-12-01: IRPF90's per-module graph
# declares no .mod outputs, and one program stub edge has no
# dependency that would build the sizet.mod it reads, so a cold
# module can compile the stub before sizet.f90. A serial retry
# cannot fix it (ninja runs independent edges in graph order even
# at -j1, and a parallel re-run is a fresh coin flip).
# Keep going instead: -k 0 builds every other edge of the module,
# so the .mod producers are done before the pass that compiles the
# stub. The wrapper's "Compiling all modules" edge is itself a
# sub-ninja that does not inherit -k 0, hence the direct call.
# TODO: fix the IRPF90 stub edge and delete this cascade.
ninja -k 0 2>&1 | tee -a plugin-build.log || true
ninja -f config/build.ninja -k 0 2>&1 | tee -a plugin-build.log || true
for dir in src/*/IRPF90_temp ; do
( cd "$dir" && ninja -k 0 ; ninja -k 0 ) >>plugin-build.log 2>&1 || true
done
ninja 2>&1 | tee -a plugin-build.log

- name: No integer-kind mismatch at a call boundary
# gfortran only warns on an INTEGER(8)/INTEGER(4) mismatch across a call
# boundary (implicit interface) and silently reads 32 bits of a 64-bit
# actual. The conventions forbid the mix, so make the warning fatal for
# the code this job compiles.
run: |
if grep -n -i "type mismatch" plugin-build.log ; then
echo "::error::integer kind mismatch across a call boundary"
exit 1
fi

- name: Unit tests (tc_scf)
run: |
source quantum_package.rc
cd plugins/local/tc_scf/tests
ninja # builds test_diis_history (its build.ninja default)
./test_diis_history
# tests/build.ninja has no target for the biorthogonal test
# (upstream gap): compile it here instead of editing a ported file.
gfortran -O0 -g -fcheck=all -I. -J. -c ../biorthogonal_scaling.f90 -o biorthogonal_scaling.o
gfortran -O0 -g -fcheck=all -I. -J. test_biorthogonal_scaling.f90 \
biorthogonal_scaling.o -llapack -lblas -o test_biorthogonal_scaling
./test_biorthogonal_scaling
cd "$QP_ROOT"
./src/tc_scf/diis_history_qp_test # IRPF90-level integration of the same module

- name: Report the first errors on failure
if: failure()
run: |
git status --porcelain | head -40
echo
grep -n -E "Error:|error:|FAILED:" plugin-build.log | head -40 || true
16 changes: 16 additions & 0 deletions ci/plugins.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Plugins built by .github/workflows/plugins.yml.
#
# `qp plugins install` resolves each name's NEED closure, so listing the leaves
# is enough: tc_scf non_h_ints_mu non_hermit_dav => 12 modules today
# (ao_many_one_e_ints ao_tc_eff_map bi_ort_ints bi_ortho_mos jastrow
# non_h_ints_mu non_hermit_dav ortho_three_e_ints qmckl spher_harm
# tc_keywords tc_scf).
#
# Grow this list toward every directory in plugins/local as the remaining
# breakage is fixed. Today these two still write through the JSON API deleted
# in 5a721280, so they are not listed:
# plugins/local/fci_tc_bi/fci_tc_bi_ortho.irp.f
# plugins/local/cipsi_tc_bi_ortho/write_cipsi_json.irp.f
tc_scf
non_h_ints_mu
non_hermit_dav
18 changes: 9 additions & 9 deletions plugins/local/ao_tc_eff_map/map_integrals_eff_pot.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
!DIR$ FORCEINLINE
call map_get(ao_tc_sym_two_e_pot_map, idx, integral)
ii = l-ao_tc_sym_two_e_pot_cache_min
ii = ior( ishft(ii,6), k-ao_tc_sym_two_e_pot_cache_min)
ii = ior( ishft(ii,6), j-ao_tc_sym_two_e_pot_cache_min)
ii = ior( ishft(ii,6), i-ao_tc_sym_two_e_pot_cache_min)
ii = ior( ishft(ii,6), int(k-ao_tc_sym_two_e_pot_cache_min, 4))
ii = ior( ishft(ii,6), int(j-ao_tc_sym_two_e_pot_cache_min, 4))
ii = ior( ishft(ii,6), int(i-ao_tc_sym_two_e_pot_cache_min, 4))
ao_tc_sym_two_e_pot_cache(ii) = integral
enddo
enddo
Expand Down Expand Up @@ -118,9 +118,9 @@ double precision function get_ao_tc_sym_two_e_pot(i, j, k, l, map) result(result
! tmp = 0.d0
else
ii = l-ao_tc_sym_two_e_pot_cache_min
ii = ior(ii, k-ao_tc_sym_two_e_pot_cache_min)
ii = ior(ii, j-ao_tc_sym_two_e_pot_cache_min)
ii = ior(ii, i-ao_tc_sym_two_e_pot_cache_min)
ii = ior(ii, int(k-ao_tc_sym_two_e_pot_cache_min, 4))
ii = ior(ii, int(j-ao_tc_sym_two_e_pot_cache_min, 4))
ii = ior(ii, int(i-ao_tc_sym_two_e_pot_cache_min, 4))
if (iand(ii, -64) /= 0) then
!DIR$ FORCEINLINE
call two_e_integrals_index(i, j, k, l, idx)
Expand All @@ -129,9 +129,9 @@ double precision function get_ao_tc_sym_two_e_pot(i, j, k, l, map) result(result
tmp = tmp
else
ii = l-ao_tc_sym_two_e_pot_cache_min
ii = ior( ishft(ii,6), k-ao_tc_sym_two_e_pot_cache_min)
ii = ior( ishft(ii,6), j-ao_tc_sym_two_e_pot_cache_min)
ii = ior( ishft(ii,6), i-ao_tc_sym_two_e_pot_cache_min)
ii = ior( ishft(ii,6), int(k-ao_tc_sym_two_e_pot_cache_min, 4))
ii = ior( ishft(ii,6), int(j-ao_tc_sym_two_e_pot_cache_min, 4))
ii = ior( ishft(ii,6), int(i-ao_tc_sym_two_e_pot_cache_min, 4))
tmp = ao_tc_sym_two_e_pot_cache(ii)
endif
endif
Expand Down
4 changes: 2 additions & 2 deletions plugins/local/ao_tc_eff_map/providers_ao_eff_pot.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
! parallel-do because its result is already in the map (the
! pt2_omp pattern).
allocate ( buffer_i(ao_num*ao_num), buffer_value(ao_num*ao_num) )
call compute_ao_tc_sym_two_e_pot_jl(1,1,n_integrals,buffer_i,buffer_value)
call compute_ao_tc_sym_two_e_pot_jl(1_size_t,1_size_t,n_integrals,buffer_i,buffer_value)
call insert_into_ao_tc_sym_two_e_pot_map(n_integrals,buffer_i,buffer_value)
accu = accu + n_integrals
deallocate ( buffer_i, buffer_value )
Expand All @@ -75,7 +75,7 @@
allocate ( buffer_i_t(ao_num*ao_num), buffer_value_t(ao_num*ao_num) )
!$OMP DO SCHEDULE(DYNAMIC,1)
do l=2,ao_num
call compute_ao_tc_sym_two_e_pot_jl(1,l,n_integrals,buffer_i_t,buffer_value_t)
call compute_ao_tc_sym_two_e_pot_jl(1_size_t,l,n_integrals,buffer_i_t,buffer_value_t)
!$OMP CRITICAL
call insert_into_ao_tc_sym_two_e_pot_map(n_integrals,buffer_i_t,buffer_value_t)
accu = accu + n_integrals
Expand Down
3 changes: 2 additions & 1 deletion plugins/local/ao_tc_eff_map/two_e_1bgauss_j1.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,11 @@ double precision function env_gauss_2e_j1_schwartz(i, j, k, l)
! ---

subroutine get_cxcycz_j1( dim1, cx, cy, cz &
use sizet
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )

use sizet

include 'utils/constants.include.F'

implicit none
Expand Down
3 changes: 2 additions & 1 deletion plugins/local/ao_tc_eff_map/two_e_1bgauss_j2.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ double precision function env_gauss_2e_j2_schwartz(i, j, k, l)
! ---

subroutine get_cxcycz_j2( dim1, cx, cy, cz &
use sizet
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )

use sizet

include 'utils/constants.include.F'

implicit none
Expand Down
2 changes: 1 addition & 1 deletion plugins/local/bi_ort_ints/three_body_ijmk.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
!$OMP PARALLEL &
!$OMP DEFAULT (NONE) &
!$OMP PRIVATE (k, i, j, m, n, ipoint, tmp_loc_1, tmp_loc_2, tmp_2d, tmp1, tmp2) &
!$OMP SHARED (mo_num, n_points_final_grid, &
!$OMP SHARED (mo_num, n_points_final_grid, n_points4, &
!$OMP mos_l_in_r_array_transp, mos_r_in_r_array_transp, &
!$OMP int2_grad1_u12_bimo_t, final_weight_at_r_vector, &
!$OMP tmp_aux_1, tmp_aux_2, &
Expand Down
2 changes: 1 addition & 1 deletion plugins/local/bi_ortho_mos/bi_density.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
!
END_DOC
PROVIDE mo_r_core_coef mo_l_core_coef
call dgemm( 'N', 'T', ao_num, ao_num, n_core_orb, 1.d0 &
call dgemm( 'N', 'T', ao_num, ao_num, int(n_core_orb, 4), 1.d0 &
, mo_l_core_coef, size(mo_l_core_coef, 1), mo_r_core_coef, size(mo_r_core_coef, 1) &
, 0.d0, TCSCF_bi_ort_core_dm_ao, size(TCSCF_bi_ort_core_dm_ao, 1) )
! factor two because it is the total DM
Expand Down
108 changes: 108 additions & 0 deletions plugins/local/non_h_ints_mu/jast_deriv_utils_vect.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,114 @@ subroutine get_grad1_u12_withsq_r1_seq(ipoint, n_grid2, resx, resy, resz, res)

! ---

subroutine get_grad1_u12_withsq_qmckl_block(ipoint_first, n_grid1, n_grid2, resx, resy, resz, res)

BEGIN_DOC
! QMCkl gradient for a contiguous block of r1 grid points.
! The shared QMCkl context is updated once, outside OpenMP regions.
END_DOC

use sizet
use qmckl

implicit none
integer(size_t), intent(in) :: ipoint_first, n_grid1, n_grid2
double precision, intent(out) :: resx(n_grid2,n_grid1), resy(n_grid2,n_grid1)
double precision, intent(out) :: resz(n_grid2,n_grid1), res (n_grid2,n_grid1)

integer(size_t) :: i_grid1, ipoint, jpoint
integer(size_t) :: k, n_points
double precision :: dx, dy, dz, fac_en
double precision, allocatable :: rij(:,:,:), gl(:,:,:)
integer(qmckl_exit_code) :: rc

PROVIDE qmckl_ctx_jastrow
PROVIDE elec_num
PROVIDE final_grid_points final_grid_points_extra

n_points = n_grid1 * n_grid2
allocate(rij(3,2,n_points), gl(2,4,n_points))

k = 0_size_t
do i_grid1 = 1, n_grid1
ipoint = ipoint_first + i_grid1 - 1
do jpoint = 1, n_grid2
k = k + 1_size_t
rij(1:3,1,k) = final_grid_points (1:3,ipoint)
rij(1:3,2,k) = final_grid_points_extra(1:3,jpoint)
enddo
enddo

rc = qmckl_set_electron_coord(qmckl_ctx_jastrow, 'N', n_points, rij, 6_size_t*n_points)
if(rc /= QMCKL_SUCCESS) then
print *, irp_here, 'qmckl error in set_electron_coord'
rc = qmckl_check(qmckl_ctx_jastrow, rc)
stop -1
endif

rc = qmckl_get_jastrow_champ_factor_ee_gl(qmckl_ctx_jastrow, gl, 8_size_t*n_points)
if(rc /= QMCKL_SUCCESS) then
print *, irp_here, 'qmckl error in fact_ee_gl'
rc = qmckl_check(qmckl_ctx_jastrow, rc)
stop -1
endif

k = 0_size_t
do i_grid1 = 1, n_grid1
do jpoint = 1, n_grid2
k = k + 1_size_t
resx(jpoint,i_grid1) = gl(1,1,k)
resy(jpoint,i_grid1) = gl(1,2,k)
resz(jpoint,i_grid1) = gl(1,3,k)
enddo
enddo

rc = qmckl_get_jastrow_champ_factor_een_gl(qmckl_ctx_jastrow, gl, 8_size_t*n_points)
if(rc /= QMCKL_SUCCESS) then
print *, irp_here, 'qmckl error in fact_een_gl'
rc = qmckl_check(qmckl_ctx_jastrow, rc)
stop -1
endif

k = 0_size_t
do i_grid1 = 1, n_grid1
do jpoint = 1, n_grid2
k = k + 1_size_t
resx(jpoint,i_grid1) = resx(jpoint,i_grid1) + gl(1,1,k)
resy(jpoint,i_grid1) = resy(jpoint,i_grid1) + gl(1,2,k)
resz(jpoint,i_grid1) = resz(jpoint,i_grid1) + gl(1,3,k)
enddo
enddo

rc = qmckl_get_jastrow_champ_factor_en_gl(qmckl_ctx_jastrow, gl, 8_size_t*n_points)
if(rc /= QMCKL_SUCCESS) then
print *, irp_here, 'qmckl error in fact_en_gl'
rc = qmckl_check(qmckl_ctx_jastrow, rc)
stop -1
endif

fac_en = 1.d0 / dble(elec_num - 1)
k = 0_size_t
do i_grid1 = 1, n_grid1
do jpoint = 1, n_grid2
k = k + 1_size_t
dx = resx(jpoint,i_grid1) + fac_en * gl(1,1,k)
dy = resy(jpoint,i_grid1) + fac_en * gl(1,2,k)
dz = resz(jpoint,i_grid1) + fac_en * gl(1,3,k)
resx(jpoint,i_grid1) = dx
resy(jpoint,i_grid1) = dy
resz(jpoint,i_grid1) = dz
res (jpoint,i_grid1) = dx*dx + dy*dy + dz*dz
enddo
enddo

deallocate(rij, gl)

return
end

! ---

subroutine grad1_j12_r1_seq(r1, n_grid2, gradx, grady, gradz)
use sizet

Expand Down
Loading
Loading