Skip to main content

MembraneCurvature

Powered by MDAnalysis GitHub Actions Status codecov docs Ruff ty License

Python versions PyPI Conda version

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 three different methods via the surface_method parameter: 'fourier' (default), 'binning', or 'binning_nearest'.
  • Calculate mean and Gaussian curvature from the derived surface.
  • Choose where curvature is evaluated with the curvature_on parameter: 'per_frame', to get per-frame curvature maps, or 'average_surface', to get curvature from the time-averaged surface.
  • Control the surface calculation for the binning methods with two optional parameters:
    • padding: periodic edge padding to reduce finite difference artifacts.
    • fft_filter: a brick-wall FFT filter to remove high-frequency noise from the averaged surface.

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

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

Basic usage

MembraneCurvature requires at least two inputs: a universe and an atom selection. The universe is the object with coordinates and trajectory information, and the atom selection is the atoms of reference to derive the surface from.

The following example shows how to run MembraneCurvature with the default surface method (Fourier) using the PO4 beads in the upper leaflet as atoms of reference to derive curvature:

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 all default values
curvature_upper_leaflet = MembraneCurvature(universe,
                                            select='resid 1-225 and name PO4',
                                            ).run()

average_surface = curvature_upper_leaflet.results.average_z_surface

mean_upper_leaflet = curvature_upper_leaflet.results.average_mean

gaussian_upper_leaflet = curvature_upper_leaflet.results.average_gaussian

MembraneCurvature supports three surface methods: Fourier, binning, and binning-nearest. Each method has its own set of parameters that can be used to control the surface calculation. For more examples on how to run MembraneCurvature using the different surface methods, please check 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!

MembraneCurvature follows the MDAnalysis AI Policy. As a scientific software package, contributions should show real understanding of the code and the science. Please read the Contributing page before opening a pull request. Pull requests that are evidently LLM-generated may be closed at the maintainers' discretion.

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 (includes tests and docs).
  • 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
uv run pre-commit install

By syncing the dev group with uv, all the development dependencies are installed. 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.

To run the hooks manually without committing:

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.

Metadata

Release files for membrane-curvature 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for membrane-curvature 2.0.0
File Size Uploaded Provenance Actions
membrane_curvature-2.0.0.tar.gz 4.3 MB With provenance Details for membrane_curvature-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for membrane-curvature 2.0.0
File Interpreter ABI Platform Actions
membrane_curvature-2.0.0-py3-none-any.whl Python 3 none any Details for membrane_curvature-2.0.0-py3-none-any.whl

Total release size: 8.5 MB

Release files / membrane_curvature-2.0.0.tar.gz

Download URL membrane_curvature-2.0.0.tar.gz
Size 4.3 MB
Tags Source
SHA-256 checksum
How to use checksums
94bf0a230bbace87303ee0a41eeaf658558f0ec92ea3b7b1e19c6375784bd445
BLAKE2b-256 checksum
How to use checksums
8ed06a2db41d9538d30972e27774cc266a78e10b9da20c56132c63ec824816f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / membrane_curvature-2.0.0-py3-none-any.whl

Download URL membrane_curvature-2.0.0-py3-none-any.whl
Size 4.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
704f6d4ae2c4b341c77ce928aa28995858c96eed9d1eb36308aba7f30a0bae3c
BLAKE2b-256 checksum
How to use checksums
22aa1856c9fbef227f23a45af4e0f25e4cd1903b273a2a0f7565aa280bef8194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for membrane-curvature 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for membrane_curvature-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page