Skip to content

Export a refined band as VASP frame folders for ElecTrace - #87

Merged
Austin243 merged 1 commit into
mainfrom
feat/electrace-export
Nov 7, 2026
Merged

Austin243 merged 1 commit into
mainfrom
feat/electrace-export

Conversation

@Austin243

Copy link
Copy Markdown
Owner

Adds reactionflow export-electrace <pathway> --out <folder>, which lays out one refined band for ElecTrace. Until now each band was laid out by a project script, as prepare_electrace.py did for the ACN density runs.

reactionflow export-electrace runs/<trajectory>/pathways/<occurrence> --out band-dft

band-dft gets:

  • one folder per image (00, 01, ...), each holding only a POSCAR;
  • electrace.toml, which reads the folders as one NEB path with atom_identity = "index". It sets pressure_gpa for an NPT band, so that ElecTrace compares H = E + PV at the band's pressure, the same enthalpy as barrier_eV (since Use the enthalpy for barriers at a stated pressure ElecTrace#23). focus_atoms lists the atoms of the bonds that differ between the band's two ends;
  • reactionflow.json, with the pathway's result.json, the changed bonds as atom IDs and as POSCAR indices, and atom_ids, the stable ID of the atom at each POSCAR index.

Next, run the calculations and descriptor analyses in the frame folders (by hand or with ElecTrace's workflow), then electrace analyze band-dft/electrace.toml.

Design choices

  • Atom order. ReactionFlow keeps bonds by stable atom ID. Every image is sorted by element in one stable order, so each species is one POSCAR block and an atom has the same index in every frame. Focus atoms are mapped through that order.
  • No energies in VASP files. The model's energies and enthalpies stay in reactionflow.json, so ElecTrace never mixes MLIP energies with those of the calculations run on the frames.
  • No new acceptance gate. A band that did not converge or failed its saddle check is still exported, and its status and saddle-check status are printed and recorded.
  • Refusals. The export refuses:
    • a band whose images do not share their atoms and order;
    • an image with no cell;
    • an output folder that is not empty, so DFT results are never overwritten;
    • an event refined in steps, which has no band of its own. The message names its step-N folders, and each step exports with its own bonds.

Checks

Tested on a fresh run of examples/xtb (GFN2-xTB, 20 ps), which gave seven saddle_validated O–H–O proton-transfer bands:

  • Every frame holds its image's atoms in the recorded order. Each element is one block (C H O), and no selective dynamics are written.
  • The focus atoms are H3, O11 and O12. Those O–H distances go 1.00 → 1.71 Å and 1.72 → 1.00 Å across the band.
  • ElecTrace loads the configuration, and electrace analyze runs on the exported folder. With no descriptors or energies yet, it warns about exactly that.
  • No OUTCAR or OSZICAR is written, and the NVT band has no pressure_gpa.
  • On copies of the band, edited for each case:
    • an NPT copy writes and loads pressure_gpa = 35.0;
    • a ci_neb_failed copy exports with its status reported;
    • a stepwise copy points to step-1, and step-1 exports with the same focus atoms;
    • images with a shifted atom order, a zero cell, or a non-empty --out are refused.
  • All seven bands of the run export.
  • ruff check, ruff format --check, pytest (356 passed, 25 skipped) and python -m build pass.

reactionflow export-electrace <pathway> --out <folder> writes one numbered
folder per image of a band, each with only a POSCAR, plus an electrace.toml and
a reactionflow.json. The configuration reads the folders as one NEB path with
index atom identity, sets pressure_gpa for an NPT band so that ElecTrace
compares the same enthalpy as barrier_eV, and lists the atoms of the bonds that
differ between the band's ends as focus atoms. ReactionFlow keeps bonds by
stable atom ID, so those are mapped through the written atom order;
reactionflow.json records that order with the pathway's result.json.

Every image is sorted by element in the same stable order, so each species is
one POSCAR block and an atom keeps its index. A band whose images do not share
their atoms and order, or that has no cell, is refused, as is an output folder
that is not empty. Constraints and the model's energies are not written, so
ElecTrace reads only the energies of the calculations run on the frames. A band
that did not converge or failed its saddle check is exported with its status
printed. An event refined in steps points to its step-N folders, which export
with their own bonds.
@Austin243
Austin243 merged commit 83086e5 into main Nov 7, 2026
4 checks passed
@Austin243
Austin243 deleted the feat/electrace-export branch November 7, 2026 17:07
Austin243 added a commit that referenced this pull request Nov 7, 2026
The README's paragraph on commands for finished output keeps both additions: check reports a band's
residual forces, and export-electrace lays a band out as VASP frame folders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant