Skip to main content

Pure-Python post-processing package for molecular dynamics trajectories

Project description

FishMol

A pure-Python package for post-processing molecular dynamics trajectories.

                  Welcome!                    ▄▄█▀                  FishMol
                                          ▄▄███▀                 version 0.0.1
      ○                                ▄▄█████▀                          ○
           ○                        ▄▄████████▄                         /
                                ▄▄▄████████████▄                    ○--○
         ○                ▄▄▄████████████████████▄▄                     \ 
                    ▄▄▄██████▀███████████████████████▄▄                  ○--○           ▄
                ▄▄████████████ ██████████████████████████▄▄             /           ▄▄█▀
         ○   ▄█████████████████ ████████████████████████████▄▄         ○         ▄███▀
          ▄██████████▀▀▀████████ ██████████████████████████████▄▄             ▄█████▀
         ▄████████▀   ○  ▀███████ █████████████████████████████████▄▄      ▄▄█████▀
         ■▄███████▄      ▄███████ █████████████████████████████████████▄▄▄███████▀
          ▀█████████▄▄▄█████████ ███████████████████████████████████████████████
            ▀██████████████████ ████████████████████████████████████████████████▄
              ▀██████████████▀▄███████████████████████████████████▀▀▀▀▀████████████▄
                ▀▀█████████▀▄███████████████████████████████▀▀           ▀▀████████▀
                   ▀▀█████▄████████████████████████▀▀▀▀██▀                 ▀▀████▀
                        ▀▀▀█████████████████▀▀▀▀        ▀■                    ▀█▀
                             ▀▀▀███████▀▀
                                 ▀████
                                    ▀▀▄                Contact: Lei.Lei@durham.ac.uk

Features

  • Trajectory I/O — fast memory-mapped reading of extended XYZ files; write filtered trajectories back to disk
  • PBC-aware geometry — distances, angles, dihedrals, and vectors under the minimum image convention for triclinic cells
  • Molecule recognition — automatic clustering of atoms into molecules via a covalent-radius bonding graph
  • Distribution functions — radial (RDF), angular (ADF), dihedral (DDF), and combined 2-D (CDF) distribution functions
  • MSD & diffusion — FFT-based mean square displacement; self-diffusion coefficient via the Einstein relation
  • Diffusion anisotropy — spherical projection of 1-D MSD to map the directional diffusion surface; Voronoi channel assignment
  • Hydrogen bonds — frame-by-frame H-bond recognition with distance + angle criteria; biexponential lifetime from autocorrelation
  • Vector Reorientation Dynamics — Legendre polynomial autocorrelation (l = 1, 2, 3) with KWW stretched-exponential fitting
  • Dimer analysis — dimer lifetime–displacement distribution function (DLDDF)
  • Visualisation — interactive 3-D viewer embedded in Jupyter via the ASE backend

Requirements

Installation

From PyPI (recommended)

pip install fishmol

To include the optional 3-D visualisation backend (ASE):

pip install fishmol[vis]

Verify the installation:

fishmol

From source

For the latest development version or to contribute:

git clone https://github.com/Lei-Lei-alpha/fishmol.git
cd fishmol
pip install -e ".[vis]"   # omit [vis] if you don't need visualisation
fishmol

Quick Start

from fishmol import trj, funcs

# Define the simulation cell (lattice vectors as rows, in Å)
cell = [
    [21.2944,  0.0000,  0.0000],
    [-4.6030, 20.7909,  0.0000],
    [-0.9719, -1.2106, 15.1054],
]

# Load a trajectory (5 fs timestep, all frames)
traj = trj.Trajectory(timestep=5, data="trajectory.xyz", index=":", cell=cell)

# Calibrate centre-of-mass drift, wrap into box
traj.calib().wrap2box()

# Compute radial distribution function between O and H atoms
o_idx = [i for i, s in enumerate(traj.frames[0].symbs) if s == "O"]
h_idx = [i for i, s in enumerate(traj.frames[0].symbs) if s == "H"]
rdf = funcs.RDF(traj, at_g1=o_idx, at_g2=h_idx, nbins=200, range=(0.0, 8.0))
results = rdf.calculate(plot=True)

Documentation

Full worked examples are in the online documentation:

Notebook Description
Trajectory I/O Reading, viewing, calibrating, wrapping, writing, and filtering trajectories; automatic molecule recognition
MSD & Diffusion Coefficient FFT-based MSD, Einstein relation, unit conversion, dual-axis MSD/D plot
Diffusion Anisotropy Spherical MSD projection, 3-D anisotropy surface, Voronoi channel analysis
Hydrogen Bond Lifetime H-bond recognition, geometry heatmap, biexponential lifetime fitting
Vector Reorientation Dynamics Legendre autocorrelation (l = 1–3), KWW fitting, O–H and C–C bond examples

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

fishmol-0.1.0a1.tar.gz (76.6 kB view details)

Uploaded Source

Built Distribution

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

fishmol-0.1.0a1-py3-none-any.whl (65.7 kB view details)

Uploaded Python 3

File details

Details for the file fishmol-0.1.0a1.tar.gz.

File metadata

  • Download URL: fishmol-0.1.0a1.tar.gz
  • Upload date:
  • Size: 76.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for fishmol-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 f4b4e98f7416fe386b46bab9ed2a8d8ce2f59d815998be19cd5b0b498027b67f
MD5 264f6405a7fc3c83238913a6d5785922
BLAKE2b-256 423f48beec39fe9231bab433951118ad7dfaa0ef0919c22a7f96ff02a1991775

See more details on using hashes here.

File details

Details for the file fishmol-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: fishmol-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 65.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for fishmol-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e1d82002e7ffa4db6278d777bbfacd35f17efdb14992e003267748f7ecc1c78
MD5 8077b416e6d604ca7a751e70580334e7
BLAKE2b-256 43a920aca3b2284ab183ef7507303aaa812600b3b3c32fefe63b3fa92fe40c6f

See more details on using hashes here.

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