vesin_c Module

This is a Fortran interface to the C-API of vesin, from the header vesin.h.



Enumerations

enum, bind(c)

Enumerators

enumerator:: VesinUnknownDevice = 0

Unknown device, used for default initialization and to indicate no allocated data.

enumerator:: VesinCPU = 1

CPU device

Description

Device on which the data can be


Interfaces

interface

Compute a neighbor list.

The data is returned in a VesinNeighborList. For an initial call, the VesinNeighborList should be default-initalized. The VesinNeighborList can be re-used across calls to this functions to re-use memory allocations, and once it is no longer needed, users should call vesin_free to release the corresponding memory.

  • public function vesin_neighbors(points, n_points, box, periodic, device, options, neighbors, error_message) result(status) bind(c, name="vesin_neighbors")

    Arguments

    Type IntentOptional Attributes Name
    real(kind=c_double), intent(in) :: points(3,n_points)

    Positions of all points in the system;

    integer(kind=c_size_t), value :: n_points

    Number of elements in the points array

    real(kind=c_double), intent(in) :: box(3,3)

    Bounding box for the system. If the system is non-periodic, this is ignored. This should contain the three vectors of the bounding box, one vector per column of the matrix.

    logical(kind=c_bool), value :: periodic

    Is the system using periodic boundary conditions?

    integer(kind=c_int), value :: device

    Device where the points and box data is allocated.

    type(VesinOptions), value :: options

    Options for the calculation

    type(VesinNeighborList) :: neighbors

    A type(VesinNeighborList) instance, that will be used to store the computed list of neighbors.

    type(c_ptr), intent(in) :: error_message

    A type(c_ptr) to a null-terminated char* containing the error message of this function if any.

    Return Value integer(kind=c_int)

    Non-zero integer upon error; zero otherwise.

interface

Free all allocated memory inside a VesinNeighborList, according to it's device.

  • public subroutine vesin_free(neighbors) bind(C, name="vesin_free")

    Arguments

    Type IntentOptional Attributes Name
    type(VesinNeighborList) :: neighbors

Derived Types

type, public, bind(c) ::  VesinOptions

Used for storing Vesin options.

Components

Type Visibility Attributes Name Initial
real(kind=c_double), public :: cutoff = 0.0_c_double

Spherical cutoff, only pairs below this cutoff will be included

logical(kind=c_bool), public :: full

Should the returned neighbor list be a full list (include both i -> j and j -> i pairs) or a half list (include only i -> j)?

logical(kind=c_bool), public :: sorted = .false.

Should the neighbor list be sorted? If yes, the returned pairs will be sorted using lexicographic order.

logical(kind=c_bool), public :: return_shifts = .false.

Should the returned VesinNeighborList contain shifts?

logical(kind=c_bool), public :: return_distances = .false.

Should the returned VesinNeighborList contain distances?

logical(kind=c_bool), public :: return_vectors = .false.

Should the returned VesinNeighborList contain vector?

type, public, bind(c) ::  VesinNeighborList

Used as return type from vesin_neighbors().

Read more…

Components

Type Visibility Attributes Name Initial
integer(kind=c_size_t), public :: length = 0_c_size_t

Number of pairs in this neighbor list

integer(kind=c_int), public :: device = VesinUnknownDevice

Device used for the data allocations

type(c_ptr), public :: pairs = c_null_ptr

Array of pairs (storing the indices of the first and second point in the pair), containing length elements.

type(c_ptr), public :: shifts = c_null_ptr

Array of box shifts, one for each pair. This is only set if options.return_pairs was true during the calculation.

type(c_ptr), public :: distances = c_null_ptr

Array of pair distance (i.e. distance between the two points), one for each pair. This is only set if options.return_distances was true during the calculation.

type(c_ptr), public :: vectors = c_null_ptr

Array of pair vector (i.e. vector between the two points), one for each pair. This is only set if options.return_vector was true during the calculation.