extract_forceconstants fails with Bad operation Z singlets (exit code 4) on x86_64/Linux for defected supercell structures that work
correctly on ARM64/macOS, using identical input files and TDEP version. The root cause is that lo_sqtol = 1E-10 in konstanter.f90 is too
tight for the floating-point arithmetic differences between architectures and BLAS implementations.
Environment
Fails on:
- Architecture: x86_64 Linux (Docker container)
- Compiler: gfortran 15.2.0 (conda-forge)
- BLAS: OpenBLAS 0.3.32 (pthreads, conda-forge)
- TDEP version: 1.2 (current main branch)
Works on:
- Architecture: ARM64 macOS (Apple Silicon, Mac Mini)
- Compiler: gfortran 13.4.0 (conda-forge)
- BLAS: OpenBLAS 0.3.18 (openmp, conda-forge)
How to reproduce
- Create a 6×6×6 BCC supercell with 1 vacancy (215 atoms) using primitive BCC lattice vectors
- Use the 215-atom cell as both infile.ucposcar and infile.ssposcar
- Use a lattice parameter that differs from the one the structure was originally generated with (e.g., temperature-dependent lattice
parameters for BCC: a = 3.61093 Å at 1300K instead of the equilibrium a = 3.642 Å)
- Run extract_forceconstants -rc2 6.0 -rc3 -1 -U0
The error occurs at line 979 of lo_symmetry_of_interactions_nullspace.f90:
ERROR
exit code 4: symmetry error
Bad operation Z singlets
occurs in file: lo_symmetry_of_interactions_nullspace.f90
occurs on line: 979
Key observations:
- The same input files work on ARM64 but fail on x86_64
- Perfect cells (216 atoms) work on both architectures — only defected cells (215 atoms) fail
- Smaller defected cells (e.g., 53-atom Mo) work on both — only the larger 215-atom Zr cell fails
- Changing rc2 or using --norotational/--nohuang/--nohermitian does not help
- The original equilibrium lattice parameter (a = 3.642 Å) works on both architectures; only modified lattice parameters trigger the error
Root cause
The check at line 978 of lo_symmetry_of_interactions_nullspace.f90:
if ( norm2(m1-m2) .gt. lo_sqtol ) then
call lo_stop_gracefully(['Bad operation Z singlets'], ...)
uses lo_sqtol = lo_tol**2 = 1E-10 (defined in konstanter.f90 line 113-115). The coefficient matrices m1 and m2 are computed via matmul
(line 976), which is dispatched to BLAS. For large defected cells with non-equilibrium lattice parameters, the accumulated floating-point
rounding from BLAS matmul on x86_64 OpenBLAS exceeds 1E-10, while on ARM64 it stays just below.
Fix
Changing lo_tol from 1E-5 to 1E-4 in konstanter.f90 line 113:
! Before:
real(flyt), parameter :: lo_tol=1E-5_flyt
! After:
real(flyt), parameter :: lo_tol=1E-4_flyt
This changes lo_sqtol from 1E-10 to 1E-8, providing sufficient headroom for cross-architecture floating-point differences while remaining
physically meaningful (distances within 1E-4 Å are effectively zero for atomic structures).
After recompiling with this change, all defected Zr calculations complete successfully on x86_64.
Suggestion
Consider either:
- Relaxing lo_tol to 1E-4 as the default, or
- Making the tolerance a runtime parameter (e.g., --symprec flag) so users can adjust it without recompiling, or
- Using a relative tolerance (scaled by the matrix norm) instead of an absolute one for the nullspace checks
Thank you for developing and maintaining TDEP!
extract_forceconstants fails with Bad operation Z singlets (exit code 4) on x86_64/Linux for defected supercell structures that work
correctly on ARM64/macOS, using identical input files and TDEP version. The root cause is that lo_sqtol = 1E-10 in konstanter.f90 is too
tight for the floating-point arithmetic differences between architectures and BLAS implementations.
Environment
Fails on:
Works on:
How to reproduce
parameters for BCC: a = 3.61093 Å at 1300K instead of the equilibrium a = 3.642 Å)
The error occurs at line 979 of lo_symmetry_of_interactions_nullspace.f90:
ERROR
exit code 4: symmetry error
Bad operation Z singlets
occurs in file: lo_symmetry_of_interactions_nullspace.f90
occurs on line: 979
Key observations:
Root cause
The check at line 978 of lo_symmetry_of_interactions_nullspace.f90:
if ( norm2(m1-m2) .gt. lo_sqtol ) then
call lo_stop_gracefully(['Bad operation Z singlets'], ...)
uses lo_sqtol = lo_tol**2 = 1E-10 (defined in konstanter.f90 line 113-115). The coefficient matrices m1 and m2 are computed via matmul
(line 976), which is dispatched to BLAS. For large defected cells with non-equilibrium lattice parameters, the accumulated floating-point
rounding from BLAS matmul on x86_64 OpenBLAS exceeds 1E-10, while on ARM64 it stays just below.
Fix
Changing lo_tol from 1E-5 to 1E-4 in konstanter.f90 line 113:
! Before:
real(flyt), parameter :: lo_tol=1E-5_flyt
! After:
real(flyt), parameter :: lo_tol=1E-4_flyt
This changes lo_sqtol from 1E-10 to 1E-8, providing sufficient headroom for cross-architecture floating-point differences while remaining
physically meaningful (distances within 1E-4 Å are effectively zero for atomic structures).
After recompiling with this change, all defected Zr calculations complete successfully on x86_64.
Suggestion
Consider either:
Thank you for developing and maintaining TDEP!