density
#
- biotite.structure.density(atoms, selection=None, delta=1.0, bins=None, density=False, weights=None)[source]#
Compute the density of the selected atoms.
This creates a 3d histogram over the coordinates of selected atoms. By default, the grid for the histogram is built based on the coordinates of the given atoms with an even gridspacing of delta in all three dimensions. Alternatively, a custom grid can be used.
- Parameters:
- atomsAtomArray or AtomArrayStack or ndarray, shape=(n,3) or shape=(m,n,3)
The density is calculated based on these atoms. Alternatively, the coordinates can be directly provided as ndarray.
- selectionndarray, dtype=bool, shape=(n,), optional
Boolean mask for atoms to calculate the density only on a set of atoms.
- deltafloat, optional
Distance between grid points for density calculation (in Å).
- binsint or sequence of scalars or str, optional
Bins for the RDF.
If bins is an int, it defines the number of bins.
If bins is a sequence, it defines the bin edges, ignoring the actual coordinates of the atoms selection.
If bins is a string, it defines the function used to calculate the bins.
See
numpy.histogramdd()
for further details.- densityboolean, optional
If False, the number of samples in each bin is returned. Otherwise, returns the probability density function of each bin. See
numpy.histogramdd()
for further details.- weights: ndarray, shape=(n,) or shape=(m,n), optional
An array of values to weight the contribution of n atoms in m models. If the shape is (n,), the weights will be interpreted as per atom. A shape of (m,n) allows to additionally weight atoms on a per model basis.
- Returns:
- Hndarray, dtype=float
The threedimensional histogram of the selected atoms. The histogram takes the atoms in all models into account. The length of the histogram depends on atoms coordinates and delta, or the supplied bins input parameter.
- edgeslist of ndarray, dtype=float
A list containing the 3 arrays describing the bin edges.