MembraneCurvature
- Author:
Estefania Barreto-Ojeda
- Year:
2021
- Copyright:
GNU Public License v3
MembraneCurvature is the main analysis class
for calculating mean and Gaussian curvature from atom selections.
It derives a height surface from the selected reference atoms using either the
"fourier" method (default) or the "binning" method, then evaluates
curvature on the resulting surface. The specific operations used to derive
the surface depend on the method selected by the user
in the parameter surface_method.
The set of required parameters to run MembraneCurvature varies depending
on the selected surface_method:
Fourier method:
Required parameters are the maximum Fourier mode indices
fourier_mandfourier_n(Default:2). Optional parameters include a singular-value cutoff for the Fourier fit via truncated SVD withfourier_rcond.Binning method:
Required parameters are the number of bins in the x and y directions
n_x_binsandn_y_bins. Optionalwrapparameter to control whether to wrap the coordinates exceeding the simulation box dimensions.
Mean curvature is calculated in units of Å -1 and Gaussian curvature in units of Å -2.
- class membrane_curvature.base.MembraneCurvature(universe, select='all', n_x_bins=100, n_y_bins=100, x_range=None, y_range=None, wrap=None, surface_method='fourier', fourier_m=2, fourier_n=2, fourier_rcond=None, fft_filter='auto', **kwargs)[source]
- Parameters:
universe (Universe or AtomGroup) – An MDAnalysis Universe object.
select (str or iterable of str, optional.) – The selection string of an atom selection to use as a reference to derive a surface.
wrap (bool or None, optional) – Apply coordinate wrapping with
wrap(). Defaults toTrueforsurface_method='binning'and must be omitted or explicitly set toFalseforsurface_method='fourier'.n_x_bins (int, optional, default: 100) – Number of bins in grid in the x dimension.
n_y_bins (int, optional, default: 100) – Number of bins in grid in the y dimension.
x_range (tuple of (float, float), optional, default: (0, universe.dimensions[0])) – Range of coordinates (min, max) in the x dimension.
y_range (tuple of (float, float), optional, default: (0, universe.dimensions[1])) – Range of coordinates (min, max) in the y dimension.
surface_method ({‘binning’, ‘fourier’}, optional) –
fourier(default) fits a periodic Fourier sum to atom positions at each frame and evaluates Monge-gauge curvature from analytic derivatives on the same bin grid (bin centers).binningderives the surface by creating a grid and assigning atoms to bins. It usesnumpy.gradient()for derivatives.fourier_m (int, optional) – Maximum Fourier mode index in
xwhensurface_method='fourier'. Default2.fourier_n (int, optional) – Maximum Fourier mode index in
ywhensurface_method='fourier'. Default2.fourier_rcond (float, optional) – Singular-value cutoff for the Fourier fit via truncated SVD with
_solve_design_least_squares_svd()whensurface_method='fourier'. The cutoff is interpreted as a relative threshold on singular values.fft_filter (None,
'auto', or dict, optional) – Brick-wall filter on the binned height field whensurface_method='binning'. Default'auto'(low-pass(0, 0.5 * q_Nyq)from bin widths). PassNoneto disable. Pass{'q': (q_low, q_high)}for custom bounds in rad/Å. For average maps: time-average ofz_surface, filter once, then curvature on that filtered height. Per-frame arrays are not FFT-filtered. Ignored forsurface_method='fourier'.
- Variables:
results.z_surface (ndarray) – Per-frame height field from the atom selection (unfiltered when
fft_filteris used with surface_method=’binning’). Shape (n_frames, n_x_bins, n_y_bins).results.mean (ndarray) – Per-frame mean curvature associated with the surface. Array of shape (n_frames, n_x_bins, n_y_bins)
results.gaussian (ndarray) – Per-frame Gaussian curvature associated with the surface. Array of shape (n_frames, n_x_bins, n_y_bins)
results.average_z_surface (ndarray) – Average of the array elements in z_surface. With binning and
fft_filterenabled, this is the FFT-filtered temporal mean ofz_surface, not the mean of per-frame filtered surfaces. Each array has shape (n_x_bins, n_y_bins)results.average_mean (ndarray) – Average of the array elements in mean_curvature. With binning and
fft_filterenabled, curvature of the filtered time-averaged height (not the time average of per-frameresults.mean). Each array has shape (n_x_bins, n_y_bins)results.average_gaussian (ndarray) – Average of the array elements in gaussian_curvature. With binning and
fft_filterenabled, curvature of the filtered time-averaged height (not the time average of per-frameresults.gaussian). Each array has shape (n_x_bins, n_y_bins)
- Raises:
ValueError – If
n_x_binsorn_y_binsis not a positive integer (seevalidate_positive_bin_counts()), if the selection is empty, ifsurface_methodis not one of'binning'or'fourier', or, whensurface_method='fourier', iffourier_m/fourier_nare negative or the selection has fewer atoms than Fourier parameters, ifwrap=Truewithsurface_method='fourier', or if a manualfft_filterdict is passed withsurface_method='fourier'.
See also
wrapWrap/unwrap the atoms of a given AtomGroup in the unit cell.
Notes
Fourier surface method (default)
surface_method='fourier'usesfourier_m = fourier_n = 2as default. Do not modify the default values unless you need shorter wavelengths. Since the method performs periodic boundary conditions by itself,wrapdefaults toFalseand is not required.Binning mode
The binning routine does not apply periodic wrapping itself;
MembraneCurvaturecallsAtomGroup.wrap()whensurface_method='binning'andwrap=True. When using binning,wrapdefaults toTrueif not provided. Omitwrapor passwrap=Truefor raw trajectories so atoms are packed into the unit cell before binning. Run withwrap=Falsefor preprocessed trajectories that have already applied periodic boundary conditions. For membrane-protein systems without position restraints, preprocessing should include rotational and translational fitting around the protein.For more details on when to use
wrap=True, check the Usage page.For any method of choice, the derived surface and calculated curvatures are available in the
resultsattributes.The attribute
average_z_surfacecontains the time-averaged derived surface. Whenfft_filteris set, the brick-wall filter is applied to that averaged surface.The attributes
average_meanandaverage_gaussiancontain mean and Gaussian curvature maps for analysis and plotting; withfft_filteron binning surfaces they are curvatures of the filtered average height, not the time average of per-frame curvatures.Example
You can pass a universe containing your selection of reference:
import MDAnalysis as mda from membrane_curvature.base import MembraneCurvature u = mda.Universe(coordinates, trajectory) mc = MembraneCurvature(u).run() surface = mc.results.average_z_surface mean_curvature = mc.results.average_mean gaussian_curvature = mc.results.average_gaussian
The respective 2D curvature plots can be obtained using the matplotlib package for data visualization via
contourf()orimshow().For specific examples visit the Usage page. Check the Visualization page for more examples to plot MembraneCurvature results using
contourf()andimshow().