Splitting con files

Trajectory Splitting

rgpycrumbs eon con-splitter

Splits a multi-step trajectory file (.traj, .con, etc.) into individual .con files for a single specified path.

This script reads a trajectory file, which may contain multiple NEB optimization steps (paths), and extracts only the frames corresponding to a single specified path.

It writes each frame of that path into a separate .con file (e.g., ipath_000.con, ipath_001.con, …).

It also generates a text file (default: ‘ipath.dat’) that lists the absolute paths of all created .con files.

This utility extracts specific optimization steps and applies physical chemistry refinements such as centering, cell overrides, and structural alignment (RMSD minimization).

Usage

rgpycrumbs eon con-splitter [OPTIONS] NEB_TRAJECTORY_FILE

Options

--mode <mode>

Validation mode: ‘neb’ (strict multiples) or ‘normal’ (flexible).

Options:

neb | flex

--output-dir <output_dir>

Directory to save output files. Defaults to the input filename stem.

--images-per-path <images_per_path>

Required Number of images in a single NEB path (e.g., 7). [REQUIRED]

--path-index <path_index>

Index of the NEB path to extract (0-based). Use -1 for the last path.

Default:

-1

--center, --no-center

Center the atomic coordinates around the origin.

--box-diagonal <box_diagonal>

Override the unit cell dimensions (Å) during processing.

Default:

25.0, 25.0, 25.0

--align-type <align_type>

Alignment: ‘all’ (every image), ‘endpoints’ (reactant/product), or ‘none’.

Options:

none | all | endpoints

--use-ira

Enable Iterative Reordering and Alignment (requires ira_mod).

--ira-kmax <ira_kmax>

kmax factor for the IRA matching algorithm.

--path-list-filename <path_list_filename>

Name of the file listing the generated .con absolute paths.

Arguments

NEB_TRAJECTORY_FILE

Required argument

Usage

To split a trajectory file:

rgpycrumbs eon con-splitter neb_final_path.con -o initial_images

This creates a directory named initial_images containing ipath_000.con, ipath_001.con, etc., along with an ipath.dat file listing their paths which feeds into eOn via:

[Nudged Elastic Band]
initial_path_in = ipath.dat
minimize_endpoints_for_ipath = False

Refinement Strategies

Structural Alignment

The --align-type option removes non-physical translational and rotational degrees of freedom that often accumulate during optimization.

all

Aligns every intermediate image to the reactant. This creates a visually smooth trajectory but can occasionally introduce artifacts if the reaction path involves significant curvature.

endpoints

Aligns only the reactant and product. This ensures consistent boundary conditions while preserving the relative internal coordinates of the intermediate images as optimized.

Iterative Reordering and Alignment (IRA)

When using --use-ira, the script handles atom index permutations. In complex NEB optimizations (especially those involving surface diffusion or molecular dissociations), atom indices in the output trajectory may not match the reactant’s order. IRA finds the optimal mapping and alignment simultaneously so that the resulting .con files maintain a consistent atom numbering scheme across the entire path.

Centering and Unit Cell Management

The --center flag translates the center of mass of each image to the origin. Use --box-diagonal to override the simulation cell dimensions (e.g., 20 20 20), which ensures all generated images share an identical vacuum box for eOn calculations.

Initial Path Generation from Generic Files

We may also generate valid starting points for an eOn NEB calculation from a generic .xyz file or any ASE compatible input. For instance, for a two-image trajectory, to convert a reactant/product pair into the required eOn format while fixing coordinate and mapping issues:

python -m rgpycrumbs.cli eon con-splitter --images-per-path 2 initial.xyz --box-diagonal 25 25 25 --center --align-type endpoints --use-ira --ira-kmax 1.8

This approach ensures that the reactant and product share an identical vacuum box, center of mass, and atom indexing before the NEB optimization begins.

Troubleshooting

“No images found in input file”

**Problem:** The script reports no structures in the input trajectory.

**Solution:**

  1. Verify the input file format is valid:

    head -20 input.con
    
  2. Check that the file contains multiple images (look for repeated headers)

  3. For .xyz files, ensure the first line is the atom count

“Atom count mismatch between images”

**Problem:** Different images have different numbers of atoms.

**Solution:**

  1. Verify all images in the trajectory have the same atom count

  2. If using IRA (--use-ira), ensure --ira-kmax is appropriate for your system

  3. Check for missing atoms in the input file

IRA alignment fails

**Problem:** The IRA algorithm cannot find a consistent atom mapping.

**Solution:**

  1. Increase --ira-kmax (default 1.8) for more flexible matching

  2. Try --align-type endpoints instead of all

  3. For surface systems, ensure the slab atoms are in consistent order

Output images have wrong box size

**Problem:** Generated .con files have incorrect unit cell dimensions.

**Solution:**

  1. Use --box-diagonal to explicitly set cell dimensions:

    rgpycrumbs eon con-splitter input.con --box-diagonal 25 25 25
    
  2. Check that the input trajectory has valid cell information

eOn reports “initialpath.innot found”

**Problem:** eOn cannot find the generated path file.

**Solution:**

  1. Verify the output directory was created:

    ls -la initial_images/
    
  2. Check that ipath.dat exists and contains valid paths

  3. Ensure the eOn input file references the correct path:

    [Nudged Elastic Band]
    initial_path_in = initial_images/ipath.dat
    

API Reference

For developer details and source code see rgpycrumbs.eon.con_splitter.