htmd.projections.metricshell module

class htmd.projections.metricshell.MetricShell(sel1, sel2, numshells=4, shellwidth=3, pbc=True, gap=None, truncate=None)

Bases: htmd.projections.metricdistance.MetricDistance

Calculates the density of atoms around other atoms.

The MetricShell class calculates the density of a set of interchangeable atoms in concentric spherical shells around some other atoms. Thus it can treat identical molecules (like water or ions) and calculate summary values like the changes in water density around atoms. It produces a n-by-s dimensional vector where n the number of atoms in the first selection and s the number of shells around each of the n atoms.

Parameters:
  • sims (numpy.ndarray of Sim objects or single Molecule object) – A simulation list generated by the simlist function, or a Molecule object
  • sel1 (str) – Atom selection string for the first set of atoms around which the shells will be calculated. See more here
  • sel2 (str) – Atom selection string for the second set of atoms whose density will be calculated in shells around sel1. See more here
  • numshells (int, optional) – Number of shells to use around atoms of sel1
  • shellwidth (int, optional) – The width of each concentric shell in Angstroms
  • pbc (bool, optional) – Set to false to disable distance calculations using periodic distances
  • gap (int, optional) – Not functional yet
  • truncate (float, optional) – Set all distances larger than truncate to truncate
  • skip (int) – Skip every skip frames of the trajectories
  • update – Not functional yet
Returns:

data – Returns a MetricData object containing the metrics calculated

Return type:

MetricData object

copy()

Produces a deep copy of the object

getMapping(mol)

Returns the description of each projected dimension.

Parameters:mol (Molecule object) – A Molecule object which will be used to calculate the descriptions of the projected dimensions.
Returns:map – A DataFrame containing the descriptions of each dimension
Return type:DataFrame object
project(mol)

Project molecule.

Parameters:
  • mol (Molecule) – A Molecule object to project.
  • kwargs – Do not use this argument. Only used for backward compatibility. Will be removed in later versions.
Returns:

data – An array containing the projected data.

Return type:

np.ndarray