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.1.tar.gz (7.6 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.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ase_extxyz-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 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.1.tar.gz
Algorithm Hash digest
SHA256 100b91f1e4b30f3fd0a7e0180fd450c6ff5f113338a120cd1252f6fc186a6341
MD5 0e7424ddc390b616e50bcb98db4509b4
BLAKE2b-256 1d375674ad43b92aa56ea001c970afe9bc54b579cd7523519e7efea402080610

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ase_extxyz-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 429a7daff5274006c21fa8b35277739cdc12fa503bc764bd6c9c59f8bde3f2ce
MD5 512c236ecb536e896cc00328b75ec7ee
BLAKE2b-256 dbcb55abc02d06154861db42d63d110de70d25b238be1fd07dd73e2f14efe276

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