Skip to main content

ASE I/O plugin backed by the libextxyz C parser

Project description

ase-extxyz

ASE I/O plugin that wires the extxyz C parser into ASE's read / write machinery.

Install

pip install ase-extxyz

This pulls in extxyz (the parser, with native binary wheels) and ase.

Use

import ase.io
from ase.build import bulk

atoms = bulk('Cu') * 2
ase.io.write('out.xyz', atoms, format='cextxyz')
back = ase.io.read('out.xyz', format='cextxyz')

The plugin registers a format named cextxyz (not extxyz — that name is already taken by ASE's built-in regex-based reader). Pass format='cextxyz' explicitly; auto-detection by extension is intentionally disabled to avoid clashing with the built-in.

Streaming output during optimization / MD

For long runs you don't want to reopen the file on every step. Use ExtXYZTrajectoryWriter — it opens the libc FILE* once and writes each frame through the C writer directly:

from ase.optimize import LBFGS
from ase_extxyz.io import ExtXYZTrajectoryWriter

with ExtXYZTrajectoryWriter('opt.xyz', atoms=atoms) as traj:
    opt = LBFGS(atoms)
    opt.attach(traj, interval=1)   # opt calls traj() per step
    opt.run(fmax=1e-3)

opt.attach(traj) works because the writer is callable; traj() is equivalent to traj.write(atoms) using the atoms captured at construction.

What this is not

ase-extxyz is a thin translation layer between extxyz.Frame (a plain-Python dict + numpy dataclass) and ase.Atoms. The fast C parser lives in the extxyz package; install that alone if you don't need ASE.

License

MIT — same as extxyz.

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

ase_extxyz-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

ase_extxyz-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file ase_extxyz-0.1.0.tar.gz.

File metadata

  • Download URL: ase_extxyz-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ase_extxyz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b033086ad544e4363e42ebc2452d02bf29f452d596dcfab0070229709fcf223d
MD5 d96f64066f933a94ee035f7af7760170
BLAKE2b-256 f048f6f724f7cabe83c32a3d8b22a06b9d84fbffd2cbb40383985855dbbaf185

See more details on using hashes here.

File details

Details for the file ase_extxyz-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ase_extxyz-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ase_extxyz-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f21aa962b09aad4c8fe22ae39ec7c56c85e7d0cfb5b3bfc7bca4df2cb94838e
MD5 1fd056642c258f794508092281014ded
BLAKE2b-256 adb68f5fcf54696a103738f229a73c89401499a73c8e8f85ddc57091b858bece

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