Skip to main content

Read and write computational chemistry files

Project description

Python binding for the chemfiles library

Build Status Code coverage Documentation

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.


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
git submodule update --init
# Install development dependencies
pip install -r dev-requirements.txt
# Install chemfiles
pip install .
# Optionally run the test suite

Usage example

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

from chemfiles import Trajectory, Frame

trajectory = Trajectory("")
frame =

print(f"There are {len(frame.atoms)} atoms in the frame")
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.

Source Distribution

chemfiles-0.10.4.tar.gz (3.6 MB view hashes)

Uploaded Source

Built Distributions

chemfiles-0.10.4-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view hashes)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ x86-64

chemfiles-0.10.4-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (1.8 MB view hashes)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ i686

chemfiles-0.10.4-py2.py3-none-macosx_11_0_arm64.whl (1.4 MB view hashes)

Uploaded Python 2 Python 3 macOS 11.0+ ARM64

chemfiles-0.10.4-py2.py3-none-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded Python 2 Python 3 macOS 10.9+ x86-64

chemfiles-0.10.4-1-py2.py3-none-win_amd64.whl (1.1 MB view hashes)

Uploaded Python 2 Python 3 Windows x86-64

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