Skip to main content

PyXYZ – A Python Library for Conformer Ensemble Manipulation

Project description

PyXYZ - A Python Library for Conformer Ensemble Manipulation

Introduction

pyxyz is a Python library written in C++ using Pybind11. This library provides several operations that can be performed on an ensemble of molecular conformations stored in the XYZ format. Typically, programs for conformational search provide results in the form of XYZ files, which need to be converted to input files for subsequent quantum chemical optimization. Before doing this, one might want to perform the following operations before generating the input files:

  • Discard conformations with excessively high energy
  • Remove duplicates
  • Check for the preservation of geometry constraints and discard structures where they are violated
  • Analyze the ensemble and identify weak interactions (hydrogen bonds, etc.) that can form in the molecule. The identified contacts can be included in additional runs of the conformational search with constraints to better explore the possibilities of these interactions.

One of the biggest strengths of the pyxyz library is its ability to accurately compute the RMSD by considering all molecular graph automorphisms. This means that the calculation takes into account the equivalence of atoms, allowing for a more precise measurement of geometry similarity. For each identified automorphism, the library utilizes the Kabsch algorithm to compute RMSD. With pyxyz, you can trust that your RMSD calculations are taking into account all relevant information for a more accurate result.

The pyxyz library allows solving these problems in a few lines of Python code. This library is also useful for analyzing XYZ files obtained from various molecular simulations, such as optimizations, scans, IRC, etc. Here is a basic example of how to use pyxyz:

pip install pyxyz24
from pyxyz import Confpool, KC2H

p = Confpool()
p.include_from_file("initial_set.xyz")
print(f"Initial number of conformers = {p.size}")

n_del = 0
p["Energy"] = lambda m: float(m.descr.strip())
p.sort("Energy")
n_del += p.upper_cutoff("Energy", 10.0 * KC2H)
p.generate_connectivity(0, mult=1.3, ignore_elements=[], sdf_name='connectivity_check.sdf')
niso = p.generate_isomorphisms()
print(f"Number of isomorphisms = {niso}")

rmsd_status = p.rmsd_filter(0.2, energy_threshold=1.0 * KC2H, energy_key='Energy', mirror_match=True, print_status=False)
n_del += rmsd_status['DelCount']
print(f"{n_del} conformers were filtered in total")
newp = Confpool()
newp.include_subset(p, [rmsd_status["MinRMSD_pairA"], rmsd_status["MinRMSD_pairB"]])
newp.save("rmsd_value_test.xyz")
print(f"The minimal accepted rmsd was {rmsd_status['MinRMSD']}")
print(f"Number of conformers after filtering = {p.size}")
p.save('full_set.xyz')

For an example of extensive RMSD filtering see the example notebook.

The library also provides functionality for analyzing geometric features of the conformations.

Documentation

pipeline status

Available here

Links

Gitlab home page

PyPi page

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

pyxyz24-1.0.5.tar.gz (1.8 MB view details)

Uploaded Source

File details

Details for the file pyxyz24-1.0.5.tar.gz.

File metadata

  • Download URL: pyxyz24-1.0.5.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for pyxyz24-1.0.5.tar.gz
Algorithm Hash digest
SHA256 763d73af72c17b93b84127705456d8cafb9ee2f582c434715a3f55bf854fa166
MD5 337c14c79f16d33e560dfd1f9d6b66fc
BLAKE2b-256 76cc943416cbbfce7d4b73a6576c2279f4d9c3ee3ab3ff30955d7a55a232cabe

See more details on using hashes here.

Supported by

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