Metadata-Version: 2.4
Name: membrane_curvature
Version: 2.0.0
Summary: MDAnalysis tool to calculate membrane curvature from MD simulations.
Author-email: Estefania Barreto-Ojeda <estefania@ojeda-e.com>
Maintainer-email: Estefania Barreto-Ojeda <estefania@ojeda-e.com>
License-Expression: GPL-3.0-or-later
Project-URL: Documentation, https://membrane-curvature.readthedocs.io/en/latest/
Project-URL: Code, https://github.com/MDAnalysis/membrane-curvature
Project-URL: Changelog, https://github.com/MDAnalysis/membrane-curvature/blob/main/CHANGELOG.rst
Project-URL: Issues, https://github.com/MDAnalysis/membrane-curvature/issues
Keywords: python,biophysics,molecular-dynamics,molecular-simulation,analysis,trajectory-analysis
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Topic :: Scientific/Engineering
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23.0
Requires-Dist: mdanalysis>=2.4.0
Dynamic: license-file

# MembraneCurvature

[![Powered by MDAnalysis](https://img.shields.io/badge/powered%20by-MDAnalysis-orange.svg?logoWidth=16&logo=data:image/x-icon;base64,AAABAAEAEBAAAAEAIAAoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJD+XwCY/fEAkf3uAJf97wGT/a+HfHaoiIWE7n9/f+6Hh4fvgICAjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACT/yYAlP//AJ///wCg//8JjvOchXly1oaGhv+Ghob/j4+P/39/f3IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJH8aQCY/8wAkv2kfY+elJ6al/yVlZX7iIiI8H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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIQAAANwAAADtAAAA7QAAAMAAABUMAJn9gwCe/e0Aj/2LAP//AQAAAAAAAAAA)](https://www.mdanalysis.org)
[![GitHub Actions Status](https://github.com/MDAnalysis/membrane-curvature/workflows/CI/badge.svg)](https://github.com/MDAnalysis/membrane-curvature/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/MDAnalysis/membrane-curvature/branch/main/graph/badge.svg)](https://codecov.io/gh/MDAnalysis/membrane-curvature/branch/main)
[![docs](https://readthedocs.org/projects/membrane-curvature/badge/?version=latest)](https://mdanalysismembrane-curvature.readthedocs.io/en/latest/index.html)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
[![License](https://img.shields.io/github/license/MDAnalysis/membrane-curvature?color=yellow)](https://github.com/MDAnalysis/membrane-curvature/blob/main/LICENSE)

[![Python versions](https://img.shields.io/pypi/pyversions/membrane-curvature)](https://pypi.org/project/membrane-curvature/)
[![PyPI](https://img.shields.io/pypi/v/membrane-curvature)](https://pypi.org/project/membrane-curvature/)
[![Conda version](https://anaconda.org/conda-forge/membrane-curvature/badges/version.svg)](https://anaconda.org/conda-forge/membrane-curvature)

![](https://github.com/MDAnalysis/membrane-curvature/blob/main/docs/_static/mc-logo-whitebg-EBO.png?raw=true)

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`:

```bash
pip install membrane-curvature
```

Or to install from source:

```bash
git clone https://github.com/MDAnalysis/membrane-curvature.git
cd membrane-curvature
python -m pip install -e .
```

### With conda

MembraneCurvature is available via `conda`:

```bash
conda install -c conda-forge membrane-curvature
```

Or to install from source:

```bash
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:

```bash
conda install -c conda-forge MDAnalysisTests MDAnalysisData
```

or via `pip`:

```bash
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:

```python
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][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:

```bash
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:

```bash
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:

```bash
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][GSoC]
project with [MDAnalysis] and it is linked to a [Code of Conduct][code_of_conduct].


[GSoC]: https://summerofcode.withgoogle.com/
[MDAnalysis]: https://www.mdanalysis.org
[code_of_conduct]: https://www.mdanalysis.org/conduct/
[Installation]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/getting_started.html#installation
[Installing development dependencies with pip]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/getting_started.html#installing-development-dependencies-with-pip
[Fourier]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/api/surface_methods/fourier_surface.html
[binning]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/api/surface_methods/binning_surface.html
[binning-nearest]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/api/surface_methods/binning_nearest_surface.html
[Usage]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/source/pages/Usage.html
[License]: https://github.com/MDAnalysis/membrane-curvature/blob/main/LICENSE
[documentation]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/index.html#
[Visualization]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/source/pages/Visualization.html
[Algorithm]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/source/pages/Algorithm.html
[API]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/api/membrane_curvature.html
[Tutorials]: https://mdanalysismembrane-curvature.readthedocs.io/en/latest/source/pages/Tutorials.html
[MDAnalysisTests]: https://github.com/MDAnalysis/mdanalysis/wiki/UnitTests
[MDAnalysisData]: https://www.mdanalysis.org/MDAnalysisData/
[pre-commit]: https://pre-commit.com
[Ruff]: https://docs.astral.sh/ruff/
[uv]: https://docs.astral.sh/uv/
[Contributing]: https://github.com/MDAnalysis/membrane-curvature/blob/main/.github/CONTRIBUTING.md
[AI_policy]: https://github.com/MDAnalysis/mdanalysis/blob/develop/AI_POLICY.md
