This release is a pre-release and may not be stable for production use.
MembraneCurvature
MembraneCurvature is an MDAnalysis MDAKit to calculate membrane curvature from Molecular Dynamics simulations.
Features
With MembraneCurvature you can:
- Derive 2D surface profiles from MD simulations using an atom selection as reference with two
different methods: binning or Fourier.
- With optional brick-wall FFT filter on averaged surface maps (binning method only).
- Calculate the mean and Gaussian curvatures of the derived surfaces.
- Get per-frame or averaged results for surface, mean and Gaussian curvature.
- Live a happier life.
Installation
MembraneCurvature is available via pip and conda. Please refer to the Installation section in the Getting Started Documentation page for detailed installation instructions.
With pip
Via pip
MembraneCurvature is available via pip:
pip install membrane-curvature
Or to install from source:
git clone https://github.com/MDAnalysis/membrane-curvature.git
cd membrane-curvature
python -m pip install -e .
With conda
MembraneCurvature is available via conda:
conda install -c conda-forge membrane-curvature
Or to install from source:
git clone https://github.com/MDAnalysis/membrane-curvature.git
cd membrane-curvature
conda env create -f devtools/conda-envs/environment.yaml
conda activate membrane-curvature
python -m pip install -e .
Some of the examples included in the MembraneCurvature documentation use test data from MDAnalysisTests and MDAnalysisData. To install these dependencies with conda, run:
conda install -c conda-forge MDAnalysisTests MDAnalysisData
or via pip:
pip install --upgrade MDAnalysisTests MDAnalysisData
Usage
With the Fourier method
This is a quick example on how to run MembraneCurvature with the default surface method (Fourier):
import MDAnalysis as mda
from membrane_curvature import MembraneCurvature
from MDAnalysis.tests.datafiles import Martini_membrane_gro
universe = mda.Universe(Martini_membrane_gro)
# run with the default surface_method - Fourier
curvature_upper_leaflet = MembraneCurvature(universe,
select='resid 1-225 and name PO4'
).run()
# extract average mean surface
average_surface = curvature_upper_leaflet.results.average_z_surface
# extract average mean curvature
mean_upper_leaflet = curvature_upper_leaflet.results.average_mean
# extract average Gaussian curvature
gaussian_upper_leaflet = curvature_upper_leaflet.results.average_gaussian
In this example, we use the PO4 beads in the upper leaflet as reference to derive a surface and calculate its respective mean and Gaussian curvature.
To access the per-frame arrays for the example above, use results.z_surface[<frame_id>], results.mean[<frame_id>], and results.gaussian[<frame_id>]:
# to access the surface for the first frame
surface_first_frame = curvature_upper_leaflet.results.z_surface[0]
# access the mean curvature for the last frame
mean_last_frame = curvature_upper_leaflet.results.mean[-1]
# access the Gaussian curvature for the frame 10
gaussian_frame_10 = curvature_upper_leaflet.results.gaussian[10]
With the binning method
The same example run with the binning surface method looks like:
import MDAnalysis as mda
from membrane_curvature import MembraneCurvature
from MDAnalysis.tests.datafiles import Martini_membrane_gro
universe = mda.Universe(Martini_membrane_gro)
# run with the binning surface_method with FFT filtering
curvature_upper_leaflet_binning = MembraneCurvature(universe,
select='resid 1-225 and name PO4',
surface_method='binning',
n_x_bins=8,
n_y_bins=8,
fft_filter='auto',
wrap=True).run()
# extract average surface
mean_upper_leaflet_binning = curvature_upper_leaflet_binning.results.average_z_surface
# extract average mean curvature
mean_upper_leaflet_binning = curvature_upper_leaflet_binning.results.average_mean
# extract average Gaussian curvature
gaussian_upper_leaflet_binning = curvature_upper_leaflet_binning.results.average_gaussian
[!WARNING]
FFT filtering is only available with
surface_method='binning'. Per-frameresults.z_surface,results.mean, andresults.gaussianare not FFT-filtered.
Note that the FFT filter runs once on the temporal mean of z_surface. Per-frame results.z_surface, results.mean, and results.gaussian are not FFT-filtered. With filtering enabled, results.average_z_surface, results.average_mean, and results.average_gaussian are computed from the filtered average height.
[!WARNING]
Brick-wall mask in $|q|$. Check the Algorithm page for more details on empty bins, periodic boundaries, and manual $q_{low} > 0$ caveats.
Alternatively, to get the raw time average of the surface without filtering, pass fft_filter=None:
import MDAnalysis as mda
from membrane_curvature import MembraneCurvature
from MDAnalysis.tests.datafiles import Martini_membrane_gro
universe = mda.Universe(Martini_membrane_gro)
# run with the binning surface_method without FFT filtering
curvature_upper_leaflet_binning = MembraneCurvature(universe,
select='resid 1-225 and name PO4',
surface_method='binning',
n_x_bins=8,
n_y_bins=8,
fft_filter=None,
wrap=True).run()
# extract average surface
mean_upper_leaflet_binning = curvature_upper_leaflet_binning.results.average_z_surface
# extract average mean curvature
mean_upper_leaflet_binning = curvature_upper_leaflet_binning.results.average_mean
# extract average Gaussian curvature
gaussian_upper_leaflet_binning = curvature_upper_leaflet_binning.results.average_gaussian
You can find more examples on how to run MembraneCurvature in the Usage page. To plot results from MembraneCurvature please check the Visualization page.
Documentation
To help you get the most out of MembraneCurvature, we have documentation available where you can find:
- The standard API documentation.
- Quick examples of how to run MembraneCurvature in the Usage page.
- Detailed explanation of the Algorithm implemented in MembraneCurvature.
- Examples on how to plot the results obtained from MembraneCurvature in the Visualization page.
- Detailed Tutorials to run MembraneCurvature in membrane-only and membrane-protein systems.
Contributing
Contributions are very welcome!
If you are interested in contributing to MembraneCurvature, installation of the development dependencies is required.
There are three dependency groups defined in pyproject.toml:
dev: development tools (includestestsanddocs).tests: testing dependencies.docs: documentation build dependencies (e.g. Sphinx, themes).
Note that by installing the dev group, the tests and docs dependency groups are also installed.
We recommend using uv as a development environment for MembraneCurvature. To set up a uv dev environment, clone the repository and move to the root directory:
git clone https://github.com/MDAnalysis/membrane-curvature.git
cd membrane-curvature
To create a new uv environment and install the dependencies included in the dev group, run:
uv sync --group dev
MembraneCurvature uses pre-commit hooks to run quick checks
before commits such as whitespace cleanup, TOML/YAML validation, and Ruff linting/formatting.
Using these hooks is highly encouraged because it helps catch common issues early and
keeps pull requests easier to review. By syncing the dev group, the pre-commit hooks are installed automatically.
To run the pre-commit hooks manually, with uv:
uv run pre-commit run --all-files
For instructions on how to create a development environment with pip, see the Installing development dependencies with pip page.
For more information on how to contribute to MembraneCurvature, see the Contributing page.
Interested in becoming a maintainer? We welcome your passion and expertise to help shape and grow this open-source project! Please contact estefania@ojeda-e.com for more details.
License
Source code included in this project is available in the GitHub repository https://github.com/MDAnalysis/membrane-curvature under the GNU General Public License v3 (see LICENSE).
MembraneCurvature was developed as a Google Summer of Code 2021 project with MDAnalysis and it is linked to a Code of Conduct.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file membrane_curvature-2.0.0rc6.tar.gz.
File metadata
- Download URL: membrane_curvature-2.0.0rc6.tar.gz
- Upload date:
- Size: 4.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb63a604e591826ffc991971829f3bd30a7f2304ef13b5284dacece1cdffd7bf
|
|
| MD5 |
3ed240fa16aec91d246f5f76462ddcb3
|
|
| BLAKE2b-256 |
24614d6a1dedafd90a2544e933a6c3c0ef5c909d1f0332baa1cdf91a01e12cf4
|
Provenance
The following attestation bundles were made for membrane_curvature-2.0.0rc6.tar.gz:
Publisher:
deploy.yaml on MDAnalysis/membrane-curvature
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
membrane_curvature-2.0.0rc6.tar.gz -
Subject digest:
bb63a604e591826ffc991971829f3bd30a7f2304ef13b5284dacece1cdffd7bf - Sigstore transparency entry: 1928815806
- Sigstore integration time:
-
Permalink:
MDAnalysis/membrane-curvature@db30081195c26238dd5472b298b42a580cd55807 -
Branch / Tag:
refs/tags/v2.0.0rc6 - Owner: https://github.com/MDAnalysis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@db30081195c26238dd5472b298b42a580cd55807 -
Trigger Event:
release
-
Statement type:
File details
Details for the file membrane_curvature-2.0.0rc6-py3-none-any.whl.
File metadata
- Download URL: membrane_curvature-2.0.0rc6-py3-none-any.whl
- Upload date:
- Size: 4.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a02beece163b90719e77e2eb96c0092a1c5f219d7a1977ee0cf1eafac98151d1
|
|
| MD5 |
98b1e0d706125d750932ff5db3e6d25d
|
|
| BLAKE2b-256 |
daa5a7775826aa014f9dad7ba55245291d8e30de1f75110fc66ea170acd4570a
|
Provenance
The following attestation bundles were made for membrane_curvature-2.0.0rc6-py3-none-any.whl:
Publisher:
deploy.yaml on MDAnalysis/membrane-curvature
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
membrane_curvature-2.0.0rc6-py3-none-any.whl -
Subject digest:
a02beece163b90719e77e2eb96c0092a1c5f219d7a1977ee0cf1eafac98151d1 - Sigstore transparency entry: 1928815896
- Sigstore integration time:
-
Permalink:
MDAnalysis/membrane-curvature@db30081195c26238dd5472b298b42a580cd55807 -
Branch / Tag:
refs/tags/v2.0.0rc6 - Owner: https://github.com/MDAnalysis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@db30081195c26238dd5472b298b42a580cd55807 -
Trigger Event:
release
-
Statement type: