Trajectory transformations — lipyphilic.transformations.transformations

This module contains methods for applying on-the-fly trajectory transformations with MDAnalysis.

Fix membranes broken across periodic boundaries

The callable class CentreMembrane can be used to fix a membrane split across periodic boundaries and then center it in the unit cell. The membrane is iteratively shifted along a dimension until it is no longer split across periodic boundaries. It is then moved it to the center of the box in this dimension.

The on-the-fly transformation can be added to your trajectory after loading it with MDAnalysis:

import MDAnalysis as mda
import lipyphilic as lpp

u = mda.Universe("production.tpr", "production.xtc")

ag = u.select_atoms("resname DPPC DOPC CHOL")

u.trajectory.add_transformations(lpp.transformations.CentreMembrane(ag))

This will center a DPPC/DOPC/cholesterol membrane in \(z\) every time a new frame is loaded into memory by MDAnalysis, such as when you iterate over the trajectory:

for ts in u.trajectory:

    # do some nice analysis with your centered membrane

Note

ag should be an AtomGroup that contains all atoms in the membrane.