Skip to main content

No project description provided

Project description

Duello logo

DOI:10.26434/chemrxiv-2025-0bfhd Zenodo Open In Colab


Duello
Virial Coefficient and Dissociation Constant Estimation for Rigid Macromolecules


Introduction

Duello is a tool to calculate the potential of mean force (PMF) between two rigid bodies, performing a statistical mechanical average over inter-molecular orientations using subdivided icosahedrons. For each mass center separation, R, the static contribution to the partition function, $\mathcal{Z}(R) = \sum_{\mathbf{\Omega}} e^{-V(R,\mathbf{\Omega})/k_BT}$, is explicitly evaluated to obtain the potential of mean force, $w(R) = -k_BT \ln \mathcal{Z}(R)$ and the thermally averaged energy,

$$ U(R) = \frac{\sum V(R,\mathbf{\Omega}) e^{-V(R,\mathbf{\Omega})/k_BT}} {\mathcal{Z}(R)} $$

where $V(R,\mathbf{\Omega})$ is the total inter-body interaction energy and $\mathbf{\Omega}$ represents a 5D angular space (e.g. two spherical coordinates for each body plus a dihedral angle around the connection line).

The osmotic second virial coefficient, which has dimensions of volume, reports on exactly two-body interactions:

$$ \begin{align} B_2 & = -\frac{1}{16\pi^2} \int_{\mathbf{\Omega}} \int_0^{\infty} \left ( e^{-V(R,\mathbf{\Omega})/k_BT} - 1 \right ) R^2 dR d\mathbf{\Omega}\ & = -2\pi \int_0^{\infty} \left ( e^{-w(R)/k_BT} -1 \right )R^2 dR \ & = B_2^{hs} -2\pi \int_{\sigma}^{\infty} \left ( e^{-w(R)/k_BT} -1 \right )R^2 dR\ \end{align} $$

where $B_2^{hs} = 2\pi\sigma^3/3$ is the hard-sphere contribution and $\sigma$ is a distance of closest approach where $w(R\lt \sigma)=\infty$ is assumed. For systems with net attractive interactions, the dissociation constant, $K_d$, can be estimated by,

$$ K_d^{-1} = 2 N_A\left (B_2^{hs} - B_2\right ) $$

Image

Installation

Binary packages are available through PyPI.org:

pip install duello

If you have a Rust toolchain installed, you may alternatively build and install from source:

cargo install --git https://github.com/mlund/duello

Usage

The command-line tool duello does the 6D scanning and calculates the angularly averaged potential of mean force, w(R), which is used to derive the 2nd virial coefficient and two-body dissociation constant, $K_d$. The two input structures should be in .xyz format and all particle names must be defined in the topology file under atoms. The topology also defines the particular pair-potential to use, see below. Note that a Coulomb/Yukawa potential is automatically added and should hence not be specified in the topology. Coulomb is evaluated analytically (no cutoff) in all backends, while short-range potentials (e.g. AshbaughHatch, WCA) are splined for GPU/SIMD backends.

duello scan \
    --mol1 cppm-p18.xyz \
    --mol2 cppm-p18.xyz \
    --rmin 37 --rmax 50 --dr 0.5 \
    --top topology.yaml \
    --resolution 0.8 \
    --cutoff 50 \
    --molarity 0.05 \
    --temperature 298.15 \
    --backend auto \
    --grid "type=powerlaw2,size=500,shift=true"

Spline Grid Options

The --grid option controls interpolation of short-range pair potentials (GPU/SIMD backends). The --cutoff sets the spline range in angstroms; it should cover the SR potential (e.g. AshbaughHatch cutoff) but does not affect the analytical Coulomb/Yukawa evaluation.

Key Values Default Description
type powerlaw2, invr2 powerlaw2 Grid spacing (invr2 avoids sqrt in eval)
size integer 500 Number of grid points
shift true, false true Shift energy to zero at cutoff
energy_cap float or none none Cap repulsive wall (kJ/mol) for f32 precision

Example: --grid "type=invr2,size=1000,shift=false,energy_cap=50"

Backend Performance

The program is written in Rust and attempts to use either GPU or all available CPU cores. The following backends are available, with performance measured on the Calvados3 lysozyme example (2.4M poses, 128 atoms per molecule, Apple M4):

Backend Description Poses/ms Speedup
reference Exact potentials (validation) 48 1.0x
simd NEON (aarch64) / AVX2 (x86) 131 2.7x
gpu wgpu compute shaders 1065 22x

The auto backend (default) selects GPU if available, otherwise SIMD. GPU and SIMD backends use cubic Hermite splines for short-range potentials and evaluate Coulomb/Yukawa analytically without cutoff.

Atom Scan

For simulations involving a rigid body and mobile atoms (e.g. ions), the full 6D scan is unnecessary. The atom-scan subcommand computes a 3D table (R, theta, phi) of interaction energies between a rigid body and a single test atom type, using Yukawa electrostatics and short-range pair potentials from the topology:

duello atom-scan \
    --mol1 4lzt.xyz \
    --atom Na \
    --rmin 2.0 --rmax 60 --dr 0.5 \
    --top topology.yaml \
    --resolution 0.5 \
    --cutoff 150 \
    --molarity 0.02 \
    --output atom_table.bin.gz

The output is a flat binary table (Table3DFlat) that can be loaded for fast lookup with barycentric interpolation on the icosphere mesh.

Preparing PDB files

The following uses pdb2xyz to create a coarse grained XYZ file and Calvados topology for Duello:

pip install pdb2xyz
pdb2xyz -i 4lzt.pdb -o 4lzt.xyz --pH 7.0 --sidechains
duello scan \
  -1 4lzt.xyz -2 4lzt.xyz \
  --rmin 24 --rmax 80 --dr 0.5 \
  --resolution 0.6 \
  --top topology.yaml \
  --molarity 0.05

If pdb2xyz gives errors, you may be able to correct your PDB file with pdbfixer.

Examples

Ready-to-run script examples are provided in the scripts/ directory:

Command Description
scripts/cppm.sh Spherical, multipolar particles using the CPPM model
scripts/calvados3.sh Two coarse grained lysozyme molecules w. Calvados3 interactions

Interaction models

Each macromolecule is represented by a rigid constellation of beads with properties defined under atoms in the topology file. The inter-molecular energy, $V(R,\Omega)$ is calculated by summing all pairwise interactions between beads using a customizable pair potential, $u_{ij}$. If needed, different pair-potentials can be explicitly defined for specific atom pairs.

The provided examples illustrate the following schemes:

  • Screened Coulomb + AshbaughHatch, for the Calvados model.
  • Screened Coulomb + WeeksChandlerAndersen for the CPPM model.

Many more pair-potentials are available through the interatomic library, e.g. LennardJones, HardSphere etc.

Warning: The electrostatic term (Coulomb/Yukawa) is always automatically added and should therefore not be specified in the topology.

Development

This is for development purposes only and details how to create and publish a binary package on pypi.org.

Create pip package using Maturin via a Docker image:

Run this on MacOS, linux (x86 and arm) to get all architectures:

docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin:v1.11.5 publish -u __token__ -p PYPI_TOKEN

For local Maturin installs, follow the steps below.

pip install ziglang pipx
pipx install maturin # on ubuntu; then restart shell
maturin publish -u __token__ -p PYPI_TOKEN --target=x86_64-unknown-linux-gnu --zig

MacOS targets can be generated without --zig using the targets x86_64-apple-darwin and aarch64-apple-darwin.

rustup target list
rustup target add x86_64-apple-darwin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

duello-0.3.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

duello-0.3.0-py3-none-win_amd64.whl (4.1 MB view details)

Uploaded Python 3Windows x86-64

duello-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

duello-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

duello-0.3.0-py3-none-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

duello-0.3.0-py3-none-macosx_10_12_x86_64.whl (3.4 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file duello-0.3.0.tar.gz.

File metadata

  • Download URL: duello-0.3.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for duello-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d97e67940541ccdcae05c78102eb0a9e24220e316c137029da369c6b5ea8cf72
MD5 7c72ea3d19e3828a123b1a85c21c8951
BLAKE2b-256 79b4608a6b86faaac34f8ea81233ceabf560a574735cc2b8e5f63d2136f7d45c

See more details on using hashes here.

Provenance

The following attestation bundles were made for duello-0.3.0.tar.gz:

Publisher: pypi.yml on mlund/duello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file duello-0.3.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: duello-0.3.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 4.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for duello-0.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 42c1832d7b3a7b9877a9c852adf20c77a3ff849eb7703cf16cd6784809be862b
MD5 c14637f0975016584267665a41a303bd
BLAKE2b-256 37c7751d659acff0a1c8dcc1dedd1ac28e55fc8e2c3ae489108f2c297ec63675

See more details on using hashes here.

Provenance

The following attestation bundles were made for duello-0.3.0-py3-none-win_amd64.whl:

Publisher: pypi.yml on mlund/duello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file duello-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for duello-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ba3a202211e36b0fc82559c9d3e5e970a70545c7f4224b3d7459e4a6d43cc6c
MD5 ecc03aa68f459d055402a3b21d824c74
BLAKE2b-256 cb62e98f27ed316d156c276a4e36771130db988840b1f22d42d106be773f8431

See more details on using hashes here.

Provenance

The following attestation bundles were made for duello-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: pypi.yml on mlund/duello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file duello-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for duello-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9b24159aa27f8434a2fa96ca920d67854622f32c8ef2f9ba02321d76df464fbf
MD5 961f3671580c33c90714b5da3c0a1571
BLAKE2b-256 303894d5b0cc8384b02c0f36e7b6081eaa985468849cb61edb1135b3a6d854af

See more details on using hashes here.

Provenance

The following attestation bundles were made for duello-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: pypi.yml on mlund/duello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file duello-0.3.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for duello-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22a5612bb45a279b97b14d3583c6469d4b6e41ae33d5eb53ad7f7ae58de2f6fa
MD5 711363ad89cb8811cb78af44233113d5
BLAKE2b-256 0eff763a1093bc1e83e4c76acce65754003424f9454d3e98b1924b5e27d0f017

See more details on using hashes here.

Provenance

The following attestation bundles were made for duello-0.3.0-py3-none-macosx_11_0_arm64.whl:

Publisher: pypi.yml on mlund/duello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file duello-0.3.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for duello-0.3.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4ae2690878ba6517aeed48c46022676d61103cd40b9bf1cde67a65240ac011c7
MD5 7024b38eff1ce3cdabb95931a4ffb9f1
BLAKE2b-256 8af5278c669dc378770b47b429113dbc968395065339085e0e5808c8d6a0f7db

See more details on using hashes here.

Provenance

The following attestation bundles were made for duello-0.3.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: pypi.yml on mlund/duello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page