| Crates.io | xyz-convert |
| lib.rs | xyz-convert |
| version | 0.1.1 |
| created_at | 2025-06-13 07:35:08.999393+00 |
| updated_at | 2025-06-13 08:04:29.20354+00 |
| description | Fast Rust implementation of XYZ file fixing and trajectory conversion utilities |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1711169 |
| size | 104,717 |
A fast Rust implementation of XYZ file fixing and trajectory conversion utilities. This crate provides efficient tools for processing molecular dynamics trajectory files.
Add this to your Cargo.toml:
[dependencies]
xyz-convert = "0.1"
Build the binary:
cargo build --release
The executable will be available at target/release/xyz-convert
# Basic conversion
xyz-convert input.xyz reference.inp output.traj
# With additional options
xyz-convert input.xyz reference.inp output.traj \
--index "0:1000" \
--velocities velocities.xyz \
--ener simulation.ener \
--stress-folder stress_files/ \
--wrap \
--verbose
# Fix corrupted XYZ files during conversion
xyz-convert input.xyz reference.inp output.traj --fix
# With additional options
xyz-convert input.xyz reference.inp output.traj \
--fix \
--velocities velocities.xyz \
--verbose
use xyz_convert::{fix_xyz_file, convert_to_trajectory};
// Fix XYZ file
fix_xyz_file("input.xyz", "output.traj", 1000)?;
// Convert to trajectory (from Rust code, you'd build the options differently)
convert_to_trajectory("pos.xyz", "reference.inp", "output.traj", None)?;
fix_xyzFixes corrupted XYZ files by:
Parameters:
input_path: Path to the input XYZ fileoutput_path: Path for the fixed output file (any ASE-compatible format)trim_every: Number of images to process before trimming cache (default: 1000)convert_to_trajConverts XYZ files to trajectory format with additional metadata:
Parameters:
input_path: Path to the input XYZ filereference_path: Path to reference file for cell informationoutput_path: Path for the output trajectory fileoptions: Dictionary with optional parameters:
index: Index slice string (default: ":")velocities_path: Path to velocities XYZ fileenergy_path: Path to .ener filestress_folder: Path to folder with stress tensor fileswrap_atoms: Whether to wrap atoms to unit cell (default: false)verbose: Enable verbose output (default: false)The Rust implementation provides significant performance improvements over the original Python version:
This crate uses the fastatomstruct crate for efficient atomic structure I/O operations.
This project includes a comprehensive GitLab CI/CD pipeline that:
For detailed information about the CI/CD setup, see docs/CI_CD.md.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT license.