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.3

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.3.tar.gz (47.6 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.3-py3-none-any.whl (53.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for atomorph-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d51b842f0605a6c5f3c9826084ab5c9fb5bac444ce4dd5ef58f97e027d8fb951
MD5 90b6bb18792d668cbf2febd6ca245048
BLAKE2b-256 72cb4050e3855f6627d70257311a56fc7e9ceefb0cca00e67612aa3e0f1cb673

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for atomorph-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 86c87a1de1c8379248bf56347b9bf44519bd288e7ca657d950a5599b8812de2f
MD5 e829da1196e823cc0f11a94d7d244a26
BLAKE2b-256 b6113e2cd1c426844999422d5988fe7634c8f774e4bbe73b90859982b047745e

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