API Documentation

class mbuild_cell_list.CellList(box, n_cells=[3, 3, 3], periodicity=[True, True, True], box_min=[0.0, 0.0, 0.0])[source]

Cell list compatible with mbuild Compounds. The cell list can be constructed based on either the center of mass of a Compound or based on the position of the particles contained within a Compound.

property box

Returns the box information used to initialize the cell list. :returns: box – An mbuild Box. :rtype: mb.Box

cell_containing(xyz)[source]

Return the cell that contains a given point in 3d space.

Parameters

xyz (np.ndarray, shape=(3), dtype=float)

Returns

c – The cell containing the point

Return type

int

property cell_sizes

Returns a numpy array of the size of cells in each direction. :returns: cell_sizes – A numpy array of the size of the cells of cells in each x,y, and z direction. :rtype: np.array, dtype=float

empty_cells()[source]

Remove all members from the cell list.

insert_compound_particles(compound, wrap_pbc=False)[source]

This will look at the lowest level of the hierarchy of an mbuild Compound (i.e., the particles) and insert them into the cell list.

Parameters
  • compound (mb.Compound) – An mbuild Compound whose particles will be inserted into the cell list.

  • wrap_pbc (bool, default=False) – If True, particle positions outside of the box bounds will be wrapped to the other side based on defined periodicity.

insert_compound_position(compound, wrap_pbc=False)[source]

This will insert an mbuild Compound into the cell list based upon the center-of-mass of the Compound (i.e., compound.pos).

Parameters
  • compound (mb.Compound) – An mbuild Compound that will be inserted into the cell list.

  • wrap_pbc (bool, default=False) – If True, particle positions outside of the box bounds will be wrapped to the other side based on defined periodicity.

members(c)[source]

Returns all members of a given cell.

Parameters

c (int) – The cell of interest.

Returns

members – A list of all compounds that are within the cell.

Return type

list, dtype=mb.Compound

property n_cells

Returns a numpy array of the number of cells in each direction. :returns: n_cells – A numpy array of the number of cells in each x,y, and z direction. :rtype: np.array, dtype=int

property n_cells_total

Returns the total number of cells in each direction. :returns: n_cells_total – The total number of cells in the cell list. :rtype: int

neighbor_members(c)[source]

Returns members of all neighboring cells.

Parameters

c (int) – The cell of interest.

Returns

members – A list of all compounds that are within the cell.

Return type

list, dtype=mb.Compound

neighbor_members_and_min_image_shift(c)[source]

Returns a list that contains members of all neighboring cells and how to shift those members to create a minimum image reconstruction relative to the cell of interest.

Parameters

c (int) – The cell of interest.

Returns

(members, shift) – A list of all compounds that are within the cell.

Return type

list, dtype=[mb.Compound, np.array shape=(3)]

property periodicity

Returns the periodicity in each direction. :returns: periodicity – The periodicity in each direction. :rtype: np.array, dtype=bool