Skip to content

Conversation

@RobertaPascazio
Copy link

Summary

If the two images only differ by periodicity (e.g., the coordinates of the working ion in the two images are (x,y,z) and (x+a,y,z)), pymatgen/analysis/diffusion/neb/pathfinder.py crashes because it can't interpolate between the endpoints, causing a ValueError.

This fix catches the exception and avoids crashing in get_images_and_relax.

Checklist

  • All linting and tests passed in pre-commit.

@esoteric-ephemera
Copy link
Owner

Sorry missed this, can you take a look at the fallback to linear interpolation here and let me know if you think that's suitable?

@RobertaPascazio
Copy link
Author

RobertaPascazio commented Jan 7, 2026

So two things:

  1. interpolate does not work on periodic sites, it's a Structure property. the correct script would be:
    except ValueError:
        # NEBPathfinder can fail, fall back to linear interpolation if that occurs
        all_images = pf_struct_ini.interpolate(
            pf_struct_fin, nimages=n_images + 1, autosort_tol=0.5
        )
  1. Unfortunately running interpolate on two "periodic" structures returns the same structure n_images times (I tried it and checked the working ion coordinates).

@esoteric-ephemera
Copy link
Owner

Makes sense to me - added a missing continue to your change. Take a look and I'll merge once you OK it

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.

2 participants