net_charge_of_cubes

subvolume_charge.net_charge_of_cubes(ag, cube_lengths, box=None, mean=True)[source]

Get the net charges of cubic subvolumes.

Divide the simulation box into as many cubic subvolumes of the given cube lengths as possible and calculate the net charge of all Atoms inside these subvolumes.

Parameters:
  • ag (MDAnalysis.core.groups.AtomGroup) – MDAnalysis AtomGroup or, UpdatingAtomGroup whose Atoms should be assigned to cubic subvolumes. The net charge of a given subvolume is calculated as the sum of the charges of all atoms that lie within this subvolume.

  • cube_lengths (array_like) – List of cube lengths to use.

  • box (array_like, optional) – The unit cell dimensions of the system, which must be provided in the same format as returned by MDAnalysis.coordinates.timestep.Timestep.dimensions: [lx, ly, lz, alpha, beta, gamma]. If None, the dimensions of the current Timestep are used. This function can only handle orthogonal simulation boxes.

  • mean (bool, optional) – If True, return the average net charge for each considered cube length. If False, the net charges of all cubic subvolumes with the same cube length are summed up and the sums are returned for each considered cube length.

Returns:

  • cube_charges (numpy.ndarray) – 1-dimensional array containing the averaged or summed (depends on the value of mean) net charges of the cubic subvolumes for all considered cube lengths.

  • cube_charges_squared (numpy.ndarray) – 1-dimensional array containing the avarage or sum (depends on the value of mean) of the squared net charges of the cubic subvolumes for all considered cube lengths.

  • cube_nums (numpy.ndarray) – 1-dimensional array of dtype numpy.uint64 containing the number of cubic subvolumes into which the simulation box was divided for each considered cube length.

  • atm_nums (numpy.ndarray) – 1-dimensional array of dtype numpy.uint64 containing the sum of the number of atoms in all cubic subvolumes for each considered cube length.