Skip to main content

A tool for converting atomic structure files

Project description

Atomorph

English | 中文

Atomorph

Atomorph is a tool for converting and manipulating atomic structure files. It supports conversions between various file formats, as well as handling atomic constraints.

Current Version: 1.0.4

Features

  • Support for multiple file formats (VASP, XYZ, EXTXYZ, etc.)
  • Multi-frame structure file processing
  • Atomic constraints (fixed layers, specific elements, specific indices)
  • Atom sorting
  • Parallel processing
  • Batch conversion of multiple files
  • Directory traversal with pattern matching
  • Both command-line and Python API interfaces
  • Simplified command syntax with aliases
  • Detailed logging and error handling
  • Comprehensive documentation with bilingual support

Installation

pip install atomorph

Usage

Command-line Usage

Basic conversion (with short command):

atomorph c input.xyz output.vasp

Specify formats:

atomorph convert input.xyz output.vasp -if xyz -of vasp

Fix specific elements (with short parameters):

atomorph c input.xyz output.vasp -c "elements:C,H"

Sort atoms ascending (with short parameters):

atomorph c input.xyz output.vasp -s asc

Custom element order (with short parameters):

atomorph c input.xyz output.vasp -e "Si,O,H"

Batch Conversion

Convert all POSCAR files in a directory:

atomorph b input_dir/ output_dir/ -p POSCAR -of xyz

Convert with recursive search:

atomorph batch input_dir/ output_dir/ -p "*.vasp" -of xyz

Merge all structures into one file:

atomorph b input_dir/ output_dir/ -p POSCAR -of xyz -m

Python API Usage

from atomorph import StructureConverter, batch_convert

# Basic conversion
converter = StructureConverter()
converter.convert(
    input_path="input.xyz",
    output_path="output.vasp"
)

# Batch conversion
batch_convert(
    input_dir="input_dir/",
    output_dir="output_dir/",
    pattern="POSCAR",
    output_format="xyz"
)

# Merge all structures into one file
batch_convert(
    input_dir="input_dir/",
    output_dir="output_dir/",
    pattern="*.vasp",
    output_format="xyz",
    merge_output=True
)

Version History

See CHANGELOG.md for a complete version history.

License

MIT


Atomorph 中文说明

Atomorph是一个用于转换和操作原子结构文件的工具,支持多种文件格式间的转换,以及原子约束的处理。

当前版本: 1.0.3

特性

  • 支持多种文件格式转换(VASP, XYZ, EXTXYZ等)
  • 支持多帧结构文件处理
  • 支持原子约束(固定层、指定元素、指定索引)
  • 支持原子排序
  • 支持并行处理
  • 支持批量转换多个文件
  • 支持使用模式匹配遍历目录
  • 命令行和Python API两种使用方式
  • 简化的命令语法和别名
  • 详细的日志和错误处理
  • 全面的双语文档支持

安装

pip install atomorph

使用方法

命令行使用

基本转换(使用简短命令):

atomorph c input.xyz output.vasp

指定格式:

atomorph convert input.xyz output.vasp -if xyz -of vasp

固定特定元素(使用简短参数):

atomorph c input.xyz output.vasp -c "elements:C,H"

按升序排序原子(使用简短参数):

atomorph c input.xyz output.vasp -s asc

自定义元素顺序(使用简短参数):

atomorph c input.xyz output.vasp -e "Si,O,H"

批量转换

转换目录中的所有POSCAR文件:

atomorph b input_dir/ output_dir/ -p POSCAR -of xyz

递归搜索并转换文件:

atomorph batch input_dir/ output_dir/ -p "*.vasp" -of xyz

将所有结构合并为一个文件:

atomorph b input_dir/ output_dir/ -p POSCAR -of xyz -m

Python API使用

from atomorph import StructureConverter, batch_convert

# 基本转换
converter = StructureConverter()
converter.convert(
    input_path="input.xyz",
    output_path="output.vasp"
)

# 批量转换
batch_convert(
    input_dir="input_dir/",
    output_dir="output_dir/",
    pattern="POSCAR",
    output_format="xyz"
)

# 合并所有结构为一个文件
batch_convert(
    input_dir="input_dir/",
    output_dir="output_dir/",
    pattern="*.vasp",
    output_format="xyz",
    merge_output=True
)

版本历史

完整的版本历史请参见CHANGELOG.md

许可证

MIT

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

atomorph-1.0.5.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

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

atomorph-1.0.5-py3-none-any.whl (53.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: atomorph-1.0.5.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for atomorph-1.0.5.tar.gz
Algorithm Hash digest
SHA256 54780586767fcf4e3e86e8e90348819ac1092dd424166b6bde3e672e1e239a03
MD5 43be0426ea2db5cdcf8c1851c3499768
BLAKE2b-256 6c36cd9d2e62086d87f98c40d9721ac495396fa13b94a39668daa5aeb9eb4e1a

See more details on using hashes here.

File details

Details for the file atomorph-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: atomorph-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 53.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for atomorph-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a7029d811f8f71838f3f60675b5a52ab287ddb53883a8924751634b28c923739
MD5 ba5aaf00f47fbde6f9ef0d6319a12d85
BLAKE2b-256 5877cf7bcf81feef15b3698fd9391e0dcf2dba9b6649d69729751473605f3b32

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