Skip to content

GFN-FF: --grad can produce NaN/exploding gradients for exactly collinear/degenerate linear fragments (CO₂); tiny perturbation removes NaNs #1384

@flucket

Description

@flucket

When running GFN-FF with --grad in a periodic calculation, I observe unstable Cartesian gradients for physically valid geometries. In cases where a linear fragment such as CO₂ is written in an exactly degenerate configuration (perfectly collinear to machine precision, with identical coordinate components along one axis), the energy evaluation succeeds but the gradient either becomes NaN (|dE/dxyz| = NaN) or grows extremely large and unstable.

This behavior is reproducible. Using a periodic input where the CO₂ atoms have exactly identical coordinates along one direction triggers the issue. If I modify only the CO₂ coordinates by an extremely small amount (on the order of 1e-13–1e-6 Å for one atom), breaking exact degeneracy, the same calculation produces a finite gradient. No other part of the input, lattice, or options is changed.

This suggests that the GFN-FF gradient evaluation does not robustly handle exactly degenerate linear geometries in periodic setups and likely encounters singular or near-singular expressions during gradient construction. I am attaching two periodic inputs that differ only by this tiny perturbation, along with the corresponding outputs.

Please note that the GOOD.coord file, coordinates happen to "work" though after further testing the differences between coordinates must be much greater than the one I provided. Please change the coordinates to 7.11856172839506 16.36350000000000 5.19848888888936 C
7.11856172839506 17.52350000000000 5.19858888888936 O
7.11856172839506 15.20350000000000 5.19868888888936 O

stuff.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmedThis report has not yet been confirmed by the developers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions