Metadata-Version: 2.4
Name: openmm-nonbonded-slicing
Version: 0.3.0
Summary: An OpenMM plugin for slicing nonbonded interactions
Home-page: https://github.com/craabreu/openmm-nonbonded-slicing
Author: Charlles Abreu
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: openmm<8.5,>=8.4.0.post2
Provides-Extra: cuda12
Requires-Dist: openmm-nonbonded-slicing-cuda-12==0.3.0; platform_system == "Linux" and extra == "cuda12"
Provides-Extra: cuda13
Requires-Dist: openmm-nonbonded-slicing-cuda-13==0.3.0; platform_system == "Linux" and extra == "cuda13"
Dynamic: author
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

OpenMM Nonbonded Slicing Plugin
===============================

[![Linux](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/Linux.yml/badge.svg)](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/Linux.yml)
[![MacOS](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/MacOS.yml/badge.svg)](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/MacOS.yml)
[![Doc](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/Doc.yml/badge.svg)](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/Doc.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

This [OpenMM] plugin contains the **SlicedNonbondedForce** class, a variant of OpenMM's [NonbondedForce].
By partitioning all particles among $n$ disjoint subsets, the total potential energy becomes a linear
combination of contributions from pairs of subsets like

```math
E = \sum_{I=0}^{n-1} \sum_{J=I}^{n-1} \left( \lambda^{vdW}_{I,J}E^{vdW}_{I,J}+\lambda^{elec}_{I,J}E^{elec}_{I,J} \right)
```

where each slice is defined by subsets $I$ and $J$, superscripts _vdW_ and _elec_ denote van
der Waals and electrostatic contributions, $E_{I,J}$ is the potential energy of all particle pairs
formed by one particle in subset $I$ and one in subset $J$, and $\lambda_{I,J}$ is a scaling parameter.

By default, all scaling parameters are constant and equal to 1. However, the user can turn selected
scaling parameters into variables and store their values in [Context] global parameters. Derivatives
with respect to these variables can be requested and used, for instance, to report individual energy
slice contributions or sums thereof via [getState] with option `getParameterDerivatives=True`.

Documentation
=============

Documentation for this plugin is available at [Github Pages](https://craabreu.github.io/openmm-nonbonded-slicing/).
It includes the Python API and the theory for slicing lattice-sum energy contributions.

Installation
============

The plugin is distributed on [conda-forge]:

```bash
mamba install -c conda-forge openmm-nonbonded-slicing
```

Instructions for building from source are in the [documentation](https://craabreu.github.io/openmm-nonbonded-slicing/).

Usage
=====

```py
import openmm as mm
import nonbondedslicing as nbs
system = mm.System()
force = nbs.SlicedNonbondedForce(2)
system.addForce(force)
```


[NonbondedForce]:       http://docs.openmm.org/latest/api-python/generated/openmm.openmm.NonbondedForce.html
[Context]:              http://docs.openmm.org/latest/api-python/generated/openmm.openmm.Context.html
[getState]:             http://docs.openmm.org/latest/api-python/generated/openmm.openmm.Context.html#openmm.openmm.Context.getState
[OpenMM]:               https://openmm.org
[conda-forge]:          https://anaconda.org/conda-forge/openmm-nonbonded-slicing
