Point

1. Introduction

A point is a position in three dimensions. This module stores the set of points at which the position-dependent kernels evaluate, as a num × 3 matrix, together with the date at which that matrix last changed.

Kernels that cache results depending on the positions compare their own date with the date of the points, and recompute only when the coordinates have moved. The electron module embeds such a set in each walker: setting the electron coordinates fills it with all the walkers' electrons, and copies the current walker's points into the context point.

The set is not tied to the electrons: a caller can place points on any grid, the integration grid of a DFT code for instance, and ask for the orbitals there. The Jastrow factor does not read them: it reads the points that the walkers carry.

2. Context

2.1. Data structure

The following data is stored in the context:

Variable Type Description
num int64_t Total number of points
date uint64_t Last modification date of the coordinates
coord qmckl_matrix num × 3 matrix

The matrix is stored in Fortran order, so the x coordinates of the num points come first, followed by their y and then their z coordinates. A kernel that walks along one component reads contiguous memory.

2.2. Access functions

Access functions return QMCKL_SUCCESS when the data has been retrieved, and QMCKL_INVALID_CONTEXT when the context is not a valid context. On success the variable the caller points to holds the requested data; on failure it is left untouched.

2.2.1. Number of points

C
qmckl_exit_code qmckl_get_point_num (const qmckl_context context, int64_t* const num);

Returns the number of points stored in the context.

2.2.2. Point coordinates

C
qmckl_exit_code qmckl_get_point(const qmckl_context context,
                                const char transp,
                                double* const coord,
                                const int64_t size_max);

Returns the point coordinates into coord, which must be able to hold size_max doubles; the call fails when size_max is smaller than 3 * point_num. With transp == 'N' the coordinates come as consecutive (x,y,z) triplets; any other value of transp returns the layout the context stores, with all the x first. When no point has been set, the call returns QMCKL_NOT_PROVIDED.

2.3. Initialization functions

The context owns the matrix of coordinates: it is allocated the first time points are set, or reallocated when their number changes, and overwritten in place otherwise.

Points are set with qmckl_set_point, which also updates the date of the points. The call fails when num is not positive, when size_max is smaller than 3*num, when transp is neither 'N' nor 'T', and when coord is a null pointer. Here, num is the number of points to set.

C
qmckl_exit_code qmckl_set_point (qmckl_context context,
                                 const char transp,
                                 const int64_t num,
                                 const double* coord,
                                 const int64_t size_max);

It copies a sequence of num points (x,y,z) into the context. With transp == 'N', coord holds the points as consecutive (x,y,z) triplets; with transp == 'T', it holds them in the layout the context stores, with all the x first, then all the y, then all the z.