Skip to main content

Read and write chemistry trajectory files

Project description

Python binding for the chemfiles library

Chemfiles is a library for reading and writing molecular trajectory files. These files are created by your favorite theoretical chemistry program, and contains information about atomic or residues names and positions. Chemfiles offers abstraction on top of these formats, and a consistent interface for loading and saving data to these files.

This repository contains the Python binding for the chemfiles library. This binding is created with the ctypes module, calling directly the C interface of chemfiles, and thus is compatible with Python 2 and 3, and with all versions of Numpy.

Installation

You can use your favorite package manager (conda or pip) to install pre-built versions of Chemfiles, that support Linux/Windows/macOS, and Python 2.7 and 3.

# Using pip
pip install chemfiles
# Using conda
conda install -c conda-forge chemfiles

Source compilation

You can install this python module from sources if you have all the dependencies of the C++ chemfiles library installed on your computer.

# To get the latest development version:
git clone https://github.com/chemfiles/chemfiles.py
cd chemfiles.py
git submodule update --init
# Install development dependencies
pip install -r dev-requirements.txt
# Install chemfiles
pip install .
# Optionally run the test suite
tox

Usage example

Here is a simple usage example for the chemfiles module. Please see the examples folder for other examples.

from chemfiles import Trajectory, Frame

trajectory = Trajectory("filename.xyz")
frame = trajectory.read()

print("There are {} atoms in the frame".format(frame.natoms()))
positions = frame.positions()

# Do awesome things with the positions here !

Bug reports, feature requests

Please report any bug you find and any feature you may want as a github issue.

Project details


Download files

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

Files for chemfiles, version 0.9.3
Filename, size File type Python version Upload date Hashes
Filename, size chemfiles-0.9.3-py2.py3-none-macosx_10_9_x86_64.whl (3.3 MB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size chemfiles-0.9.3-py2.py3-none-manylinux1_i686.whl (3.3 MB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size chemfiles-0.9.3-py2.py3-none-manylinux1_x86_64.whl (3.4 MB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size chemfiles-0.9.3-py2.py3-none-win32.whl (2.3 MB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size chemfiles-0.9.3-py2.py3-none-win_amd64.whl (2.5 MB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size chemfiles-0.9.3.tar.gz (4.0 MB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page