跳转到主要内容

读写计算化学文件

项目描述

chemfiles库的Python绑定

Build Status Code coverage Documentation

Chemfiles是一个用于读取和写入分子轨迹文件的库。这些文件由您喜欢的理论化学程序创建,包含有关原子或残基名称和位置的信息。Chemfiles在这些格式之上提供抽象,并提供一致接口以加载和保存数据到这些文件。

此存储库包含chemfiles库的Python绑定。此绑定使用ctypes模块创建,直接调用chemfiles的C接口,因此与Python 2和3以及所有版本的Numpy兼容。

安装

您可以使用您喜欢的包管理器(condapip)安装预构建的Chemfiles版本,该版本支持Linux/Windows/macOS,以及Python 2.7和3。

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

源编译

如果您已经在您的计算机上安装了C++ chemfiles库的所有依赖项,则可以从源代码安装此Python模块。

# 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

使用示例

这里是chemfiles模块的一个简单用法示例。请参阅examples文件夹以获取更多示例。

from chemfiles import Trajectory, Frame

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

print(f"There are {len(frame.atoms)} atoms in the frame")
positions = frame.positions()

# Do awesome things with the positions here !

错误报告、功能请求

请报告您发现的任何错误以及您可能希望添加的任何功能,请通过github issue进行报告。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定该选择哪个,请了解有关安装包的更多信息。

源代码分发

chemfiles-0.10.4.tar.gz (3.6 MB 查看哈希)

上传时间 源代码

构建分发

chemfiles-0.10.4-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB 查看哈希)

上传时间 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 查看哈希)

上传时间 Python 2 Python 3 manylinux: glibc 2.17+ i686

chemfiles-0.10.4-py2.py3-none-macosx_11_0_arm64.whl (1.4 MB 查看哈希)

上传时间 Python 2 Python 3 macOS 11.0+ ARM64

chemfiles-0.10.4-py2.py3-none-macosx_10_9_x86_64.whl (1.5 MB 查看哈希)

上传时间 Python 2 Python 3 macOS 10.9+ x86-64

chemfiles-0.10.4-1-py2.py3-none-win_amd64.whl (1.1 MB 查看哈希)

上传时间 Python 2 Python 3 Windows x86-64

支持