Skip to content

SIGSEGV in Klopman-Ohno Coulomb gradient (klopmanohno.f90) for large systems (>400 atoms) after successful SCF convergence #1412

Description

@baixingle

Description

xTB 6.7.1 (edcfbbe) consistently crashes with SIGSEGV during gradient computation for large systems (~426 atoms), immediately after successful SCF convergence. The crash occurs in the Klopman-Ohno Coulomb integral code (klopmanohno.f90), regardless of method (GFN1/GFN2), solvent model, or parallelization settings.

Environment

  • xTB version: 6.7.1 (edcfbbe), compiled 2024-07-22 with ifort
  • OS: Linux (CentOS 7, x86_64)
  • Installation: pre-compiled binary from GitHub releases

Steps to Reproduce

  1. Prepare a 426-atom system (Bi-water interface, 64 Bi + 362 water molecules)
  2. Run a single-point or optimization calculation:
xtb input.xyz --gfn1 --parallel 1 2>&1

SCF converges normally after ~60-80 iterations
4. SIGSEGV occurs during gradient computation
Test Matrix
Config
SCF
Result
GFN1, no solvent, serial
✅ converged in 80 iters
SIGSEGV
GFN1 + ALPB water, serial
✅ converged in 61 iters
SIGSEGV
GFN1 + ALPB water, 64 threads
✅ converged
SIGSEGV
GFN2, no solvent, serial
✅ converged
SIGSEGV
GFN2 + ALPB water, 64 threads
❌ crashes during init
SIGSEGV (init)
Same input, 330-atom water box
✅
✅ No crash
Stack Trace
Copy code to clipboard
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source
xtb                000000000046E88A  Unknown               Unknown  Unknown
xtb                0000000002D1BD40  Unknown               Unknown  Unknown
xtb                0000000000E16DFD  xtb_coulomb_klopm         508  klopmanohno.f90
xtb                0000000002C45313  Unknown               Unknown  Unknown
xtb                0000000002BFEF40  Unknown               Unknown  Unknown
xtb                0000000002BCBB08  Unknown               Unknown  Unknown
xtb                0000000000E16B63  xtb_coulomb_klopm         508  klopmanohno.f90
xtb                0000000000E13B64  xtb_coulomb_klopm         460  klopmanohno.f90
xtb                0000000000C2F0DA  xtb_scf_mp_scf_.A         798  scf_module.F90
xtb                00000000008FFEAF  xtb_xtb_calculato         258  calculator.f90
xtb                0000000000438C70  xtb_prog_main_mp_         687  main.F90
xtb                0000000000450EA2  MAIN__                     57  primary.f90
Key Observations
• SCF always converges — the crash only happens when computing gradients
• Crash point: klopmanohno.f90 lines 460 and 508 (Klopman-Ohno Coulomb integral derivatives)
• Not caused by: solvent model (happens without GBSA/ALPB), OpenMP threading (happens serial), stack size (ulimit -s unlimited doesn't help), UHF or electronic temperature
• System size threshold: 330-atom system works fine; 426-atom system triggers the bug
• GFN-FF works perfectly on the same system (different code path, no Klopman-Ohno integrals)
• SCF output is normal with reasonable energies (~ -849 Eh for GFN1, ~ -849 Eh with ALPB)
Suspected Cause
Array dimension mismatch in klopmanohno.f90 — likely a fixed-size allocatable or stack array that overflows when the number of atom pairs exceeds a threshold around 400 atoms during gradient evaluation. The integral evaluation during SCF uses a different code path that doesn't hit the same limit.
Workaround
Use GFN-FF for large systems (> ~350 atoms), or reduce system size below the threshold for GFN1/GFN2 calculations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions