Python package for performance portable Ewald summation.

class parkipy.CellList(
particles,
cutoff,
box,
execution_space=None,
forces=None,
padding_factor=1,
skip_empty_cells=True,
periodicity=0,
build_nonempty_neighbors=True,
)

A class to generate cell lists given particle coordinates, a cutoff radius, and a computational box.

This class automaticaly generates a CellList upon instantiation as well as relevant counters and mappings.

Cell lists are performance portable, with target devices specified by a PyKokkos execution space object.

property am

Array module (NumPy/CuPu). Determined via self.execution_space. Read-only.

property box

The computational box side lengths. Read-only.

property cell_grid_shape

The shape of the cell grid, i.e., the total number of cells in each direction. Read-only.

property cell_size

Size of each cell. Read-only.

property counter

An array of size n containing the number of particles per cell, where n is the number of particles. Read-only.

property cutoff

The cell list cutoff radius. Read-only.

property dtype

floating point data dtype, same as particles.dtype. Read-only.

property execution_space

PyKokkos execution space. Read-only.

property force_list

If self.forces is a tuple, self.force_list is a tuple containg a cell list for each force in the tuple. Else, self.force_list is just a single force list. In either case, forces associated to “ghost” particles are set to 0.

When self.forces is an ndarray of shape (r, k, N) (batched forces), self.force_list has shape (r, k, num_nonempty_cells * cell_size) and can be indexed as force_list[:, :, jj] to retrieve all batch/channel values for the particle at list position jj.

Read-only.

property forces

List of forces for each particle. Read-only.

property nonempty_cell_index

Array of size num_cells whoes value at index i, if nonnegative, corresponds to the nonempty cell index. If the value at index i is negative, cell i is empty. If self.skip_empty_cells==False, then every cell is treated as nonempty hence self.nonempty_cell_index==self.am.arange(self.num_cells). Read-only.

property nonempty_cells

Array of the nonzero indices of self.counter. Given an nonempty cell index j, self.nonempty_cells[j] returns i, the global cell index. If self.skip_empty_cells==False, then self.num_nonempty_cells=np.arange(self.num_cells), i.e., nonempty and global cell indices are the same. Read-only.

property nonempty_neighbors

Return an array of shape (self.num_cells, 27) such that given a (global) cell index i, return the (nonempty) cell indices of it’s 27 neighboring cells. Read-only

property num_cells

The total number of cells. Read-only.

property num_nonempty_cells

The number of nonempty cells. If self.skip_empty_cells==False, then self.num_nonempty_cells=self.num_cells. Read-only.

property particle_index

Integer array such that the value of index i is the index of the particle at self.particle_list[i] in the origional array. If -1, then self.particle_list[i] is a ‘ghost particle’ and should be ignored. Read-only.

property particle_list

Particle cell list. Read-only.

property particles

The particle array used by this module. Read-only.

property periodicity

Integer 0–3 specifying which axes have periodic boundary conditions. 0 = none, 1 = x, 2 = x+y, 3 = x+y+z. Read-only.

property skip_empty_cells

Boolean flag to skip empty cells in particle (and force) cell list. Read-only.