LeafletFinder

Classes

class lipyds.leafletfinder.leafletfinder.LeafletFinder(universe: Union[MDAnalysis.core.groups.AtomGroup, MDAnalysis.core.universe.Universe], select: Optional[str] = 'all', select_tailgroups: Optional[str] = None, cutoff: float = 40, pbc: bool = True, method: str = 'spectralclustering', n_leaflets: int = 2, **kwargs)[source]

Identify atoms in the same leaflet of a lipid bilayer.

You can use a predefined method (“graph”, “spectralclustering”). Alternatively, you can pass in your own function as a method.

Parameters
  • universe (Universe or AtomGroup) – Atoms to apply the algorithm to

  • select (str) – A Universe.select_atoms() selection string for atoms that define the lipid head groups, e.g. universe.atoms.PO4 or “name PO4” or “name P*”

  • cutoff (float (optional)) – cutoff distance for computing distances (for the spectral clustering method) or determining connectivity in the same leaflet (for the graph method). In spectral clustering, it just has to be suitably large to cover a significant part of the leaflet, but lower values increase computational efficiency. Please see the optimize_cutoff() function for help with values for the graph method. A cutoff is not used for the “center_of_geometry” method.

  • pbc (bool (optional)) – If False, does not follow the minimum image convention when computing distances

  • method (str or function (optional)) – method to use to assign groups to leaflets. Choose “graph” for GraphMethod; “spectralclustering” for SpectralClusteringMethod;

  • **kwargs – Passed to method

Variables
  • universe (Universe) –

  • select (str) – Selection string

  • selection (AtomGroup) – Atoms that the analysis is applied to

  • residues (ResidueGroup) – residues that the analysis is applied to

  • headgroups (List of AtomGroup) – Atoms that the analysis is applied to, grouped by residue.

  • pbc (bool) – Whether to use PBC or not

  • leaflet_indices_by_size (list of list of indices) – List of residue indices in each leaflet. This is the index of residues in residues, not the canonical resindex attribute from MDAnalysis. Leaflets are sorted by size such that the largest leaflet is first.

  • leaflet_residues_by_size (list of ResidueGroup) – List of ResidueGroups in each leaflet. Leaflets are sorted by size such that the largest leaflet is first.

  • leaflet_atoms_by_size (list of AtomGroup) – List of AtomGroups in each leaflet. Leaflets are sorted by size such that the largest leaflet is first.

  • leaflet_indices (list of list of indices) – List of residue indices in each leaflet. This is the index of residues in residues, not the canonical resindex attribute from MDAnalysis.

  • leaflet_residues (list of ResidueGroup) – List of ResidueGroups in each leaflet. The leaflets are sorted by z-coordinate so that the lower-most leaflet is first.

  • leaflet_atoms (list of AtomGroup) – List of AtomGroups in each leaflet. The leaflets are sorted by z-coordinate so that the lower-most leaflet is first.

run()[source]

Actually run the analysis.

This is its own function to avoid repeating expensive setup in __init__ when it’s called on every frame.

write_selection(filename, mode='w', format=None, **kwargs)[source]

Write selections for the leaflets to filename.

The format is typically determined by the extension of filename (e.g. “vmd”, “pml”, or “ndx” for VMD, PyMol, or Gromacs).

See MDAnalysis.selections.base.SelectionWriter for all options.