(git:6250c82)
Loading...
Searching...
No Matches
grid_task_list.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* CP2K: A general program to perform molecular dynamics simulations */
3/* Copyright 2000-2026 CP2K developers group <https://cp2k.org> */
4/* */
5/* SPDX-License-Identifier: BSD-3-Clause */
6/*----------------------------------------------------------------------------*/
7#ifndef GRID_TASK_LIST_H
8#define GRID_TASK_LIST_H
9
10#include <stdbool.h>
11
12#include "../offload/offload_buffer.h"
15
16typedef void grid_task_list;
17
18/*******************************************************************************
19 * \brief Allocates a task list which can be passed to grid_collocate_task_list.
20 *
21 * \param orthorhombic Whether simulation box is orthorhombic.
22 * \param ntasks Number of tasks, ie. length of the task list.
23 * \param nlevels Number of grid levels.
24 * \param natoms Number of atoms.
25 * \param nkinds Number of atomic kinds.
26 * \param nblocks Number of local matrix blocks.
27 * \param block_offsets Offset of each block within the buffer (zero based).
28 * \param atom_positions Position of the atoms.
29 * \param atom_kinds Mapping from atom to atomic kind (one based).
30 * \param basis_sets Mapping from atomic kind to basis sets.
31 *
32 * The following params are given for each task:
33 *
34 * \param level_list Index of grid level (one based).
35 * \param iatom_list Index of first atom (one based).
36 * \param jatom_list Index of second atom (one based).
37 * \param iset_list Index of first set (one based).
38 * \param jset_list Index of second set (one based).
39 * \param ipgf_list Index of first exponent (one based).
40 * \param jpgf_list Index of second exponent (one based).
41 * \param border_mask_list Bit-pattern determining border regions to exclude.
42 * \param block_num_list Index into the block_offsets array (one based).
43 * \param radius_list Radius where Gaussian becomes smaller than threshold.
44 * \param rab_list Vector between atoms, encodes the virtual image.
45 *
46 * The following params are given for each grid level:
47 *
48 * \param npts_global Number of global grid points in each direction.
49 * \param npts_local Number of local grid points in each direction.
50 * \param shift_local Number of points local grid is shifted wrt global grid
51 * \param border_width Width of halo region in grid points in each direction.
52 * \param dh Incremental grid matrix.
53 * \param dh_inv Inverse incremental grid matrix.
54 *
55 * \param task_list Handle to the created task list.
56 *
57 * \author Ole Schuett
58 ******************************************************************************/
59void grid_create_task_list(
60 const bool orthorhombic, const int ntasks, const int nlevels,
61 const int natoms, const int nkinds, const int nblocks,
62 const int block_offsets[nblocks], const double atom_positions[natoms][3],
63 const int atom_kinds[natoms], const grid_basis_set *basis_sets[nkinds],
64 const int level_list[ntasks], const int iatom_list[ntasks],
65 const int jatom_list[ntasks], const int iset_list[ntasks],
66 const int jset_list[ntasks], const int ipgf_list[ntasks],
67 const int jpgf_list[ntasks], const int border_mask_list[ntasks],
68 const int block_num_list[ntasks], const double radius_list[ntasks],
69 const double rab_list[ntasks][3], const int npts_global[nlevels][3],
70 const int npts_local[nlevels][3], const int shift_local[nlevels][3],
71 const int border_width[nlevels][3], const double dh[nlevels][3][3],
72 const double dh_inv[nlevels][3][3], grid_task_list **task_list);
73
74/*******************************************************************************
75 * \brief Deallocates given task list, basis_sets have to be freed separately.
76 * \author Ole Schuett
77 ******************************************************************************/
78void grid_free_task_list(grid_task_list *task_list);
79
80/*******************************************************************************
81 * \brief Collocate all tasks of in given list onto given grids.
82 *
83 * \param task_list Task list to collocate.
84 * \param func Function to be collocated, see grid_prepare_pab.h
85 * \param nlevels Number of grid levels.
86 *
87 * The remaining params are given for each grid level:
88 *
89 * \param npts_local Number of local grid points in each direction.
90 * \param pab_blocks Buffer that contains the density matrix blocks.
91 * \param grids The output grid array to collocate into.
92 *
93 * \author Ole Schuett
94 ******************************************************************************/
95void grid_collocate_task_list(const grid_task_list *task_list,
96 const enum grid_func func, const int nlevels,
97 const int npts_local[nlevels][3],
98 const offload_buffer *pab_blocks,
99 offload_buffer *grids[nlevels]);
100
101/*******************************************************************************
102 * \brief Integrate all tasks of in given list from given grids.
103 *
104 * \param task_list Task list to collocate.
105 * \param compute_tau When true then <nabla a| V | nabla b> is computed.
106 * \param natoms Number of atoms.
107 * \param nlevels Number of grid levels.
108 *
109 * The remaining params are given for each grid level:
110 *
111 * \param npts_local Number of local grid points in each direction.
112 * \param grids Grid array to integrate from.
113 *
114 * \param pab_blocks Optional density blocks, needed for forces and virial.
115 *
116 * \param hab_blocks Output buffer with the Hamiltonian matrix blocks.
117 * \param forces Optional output forces, requires pab_blocks.
118 * \param virial Optional output virials, requires pab_blocks.
119 *
120 * \author Ole Schuett
121 ******************************************************************************/
122void grid_integrate_task_list(
123 const grid_task_list *task_list, const bool compute_tau, const int natoms,
124 const int nlevels, const int npts_local[nlevels][3],
125 const offload_buffer *pab_blocks, const offload_buffer *grids[nlevels],
126 offload_buffer *hab_blocks, double forces[natoms][3], double virial[3][3]);
127
128#endif
129
130// EOF
grid_func
static void const int const int const int const int const int const double const int const int const int npts_local[3]
void grid_task_list
Internal representation of a basis set.
Internal representation of a buffer.