(git:6344619)
Loading...
Searching...
No Matches
qs_kpoint_operators.F File Reference

Go to the source code of this file.

Data Types

type  qs_kpoint_operators::kpoint_operator_context_type
 Caller-owned assembly context for one driver call. Created and released in the same driver routine and passed to helpers as an argument; never stored on the host kpoint_type. Components are private and touched only by this module. More...

Modules

module  qs_kpoint_operators
 Assembly of real and complex k-point operators from real-space DBCSR matrices. Outputs use the distribution of the k-point group; real operators transfer one part only. The module splits this work into a start step and a finish step. One process can start many operators before it finishes any of them. The STANDARD k-point driver uses this order. The routines start, finish and get are collective over the environment-wide communicator. Every rank must call the same sequence of service calls. A context references its host kpoint environment without owning it, so it must not outlive that environment. An explicitly prepared, immutable operator batch can instead be built from bounded context-owned real-space snapshots inside each group. The public round and output-ownership contracts stay the same. Start/finish/get/prepare are not thread safe: serialize them, because their collective communication tolerates no concurrent service call. A separate context per thread only keeps the scratch from aliasing.

Functions/Subroutines

subroutine qs_kpoint_operators::kpoint_operator_densify (ctx, rsmat, matrix_row, ik, grid, use_grid)
 Transform and densify one operator using the context-owned workspaces and routing plans.
subroutine, public qs_kpoint_operators::kpoint_operator_context_create (ctx, kpoints, ao_ao_fm, nspin)
 Create an empty operator context. The context owns no buffers after this call; they are created on first use and released with the context.
subroutine, public qs_kpoint_operators::kpoint_operator_context_release (ctx)
 Release the context together with every buffer it created. Call once, at the exit of the routine that created the context. Every started instance must be idle at this point. The call aborts when a transfer is still in flight, because nothing would ever wait for its MPI requests.
subroutine, public qs_kpoint_operators::kpoint_operator_prepare (ctx, rsmat, slot, prepared, matrix_row, target)
 Prepare an immutable operator slot for group-local assembly. Refresh after the source values change, with every instance idle. Other prepared slots and structural routing remain valid. Without matrix_row, capture one row per instance spin; with matrix_row, store one row shared by all instance spins. Failure clears this slot on all ranks and retains the existing transfer fallback.
subroutine, public qs_kpoint_operators::kpoint_operator_work_size (ctx, nentry)
 Size per-worker phase scratch for direct assembly into a solver matrix.
subroutine, public qs_kpoint_operators::kpoint_operator_evaluate (ctx, ispin, slot, ik, phase, target, fm_re, fm_im)
 Evaluate an immutable prepared operator with exclusively caller-owned output and scratch. Prepare/refresh/release remain collective and serialized. Evaluate contains no MPI, DBCSR lookup, window update or nested OpenMP region. Source blocks must stay unchanged.
subroutine, public qs_kpoint_operators::kpoint_operator_start (ctx, ikp, ispin, rsmat, slot, grid, use_grid, matrix_row)
 Start one operator for one global round and spin. The service walks all groups with a k point in this round; groups without one still participate in the transfers. Every rank must iterate through the maximum local k-point count. Finish every started instance with kpoint_operator_finish. The first start also creates the slot bookkeeping of the context. Collective over the environment-wide communicator: every rank must call the same sequence of service calls.
subroutine, public qs_kpoint_operators::kpoint_operator_finish (ctx, ikp, ispin, slot, cmat, fm_re)
 Finish one started instance: build its prepared group-local operator, or merge received parts into cmat (real part first, overwrite then add) and reclaim the send side on every group. The slot returns to idle. Collective over the environment-wide communicator: every rank must call the same sequence of service calls.
subroutine, public qs_kpoint_operators::kpoint_operator_get (ctx, ikp, ispin, rsmat, cmat, fm_re, fm_im, mat_re, mat_im, matrix_row, slot, grid)
 Assemble one operator for one global round and spin in one call: run the single-group transfer of the service for every group and finish it immediately, through transfer states local to this call. The persistent slot machinery stays with start and finish. Exactly one output flavor must be present: cmat receives the complex operator (real part overwrites, imaginary part adds) through the context buffer; the fm pair receives the two parts separately, transferred directly into fm_re and fm_im on the owning group (any distribution: the general copy redistributes); or the dbcsr pair receives the two parts as block-cyclic matrices built by the service, replacing the caller-side copy_fm_to_dbcsr_bc detour. The dbcsr matrices must be freshly initialized (dbcsr_init_p) and the cmat flavor must share the distribution of the k-point group. Collective over the environment-wide communicator: every rank must call the same sequence of service calls.
subroutine, public qs_kpoint_operators::kpoint_operator_get_local (matrix_rs, kpoints, kp, ispin, cache_re, cache_im, matrix_re, matrix_im)
 Read an operator inside a group-local OT loop, after collective cache preparation. One group retains the sparse transform and distribution required by OT's DBCSR kernels. Multiple groups read their owned cache; no world collective may occur in this loop.
subroutine, public qs_kpoint_operators::kpoint_operator_get_all (kpoints, ao_ao_fm, rsmat, slot, cmat, matrix_row)
 Fill caller-owned matrices for one operator row, including independent history snapshots. Prepare and fallback transfers are collective. Prepared one-rank groups evaluate k points concurrently, with no MPI or matrix allocation/refcounts inside the worker loop.
subroutine, public qs_kpoint_operators::kpoint_operator_store (kpoints, ao_ao_fm, matrix_ks, matrix_s, matrix_t)
 Prepare owned split-FM operators for OT without entering an SCF eigensolver. H (or the initialization density) retains all source spins; S/T are built only once. Outputs survive the transient context. Compatible cache storage is reused, values refreshed.

Variables

integer, parameter, public qs_kpoint_operators::kpoint_slot_ks = 1
integer, parameter, public qs_kpoint_operators::kpoint_slot_s = 2
integer, parameter, public qs_kpoint_operators::kpoint_slot_t = 3
integer, parameter, public qs_kpoint_operators::kpoint_spin_free = 1
 Row of rsmat that carries the spin-free operator image. S and T carry no spin copies: drivers launch one instance per spin of their loop and read this same row in every instance.
integer, parameter qs_kpoint_operators::rs_batch_size = 4