From 95132593a45dd378303b2c345bf0008c8430a705 Mon Sep 17 00:00:00 2001 From: Clemens Vonrhein Date: Fri, 22 May 2026 12:57:35 +0200 Subject: [PATCH] fix(metadata): restore TlsGroup tensor initialization Restores NAN initialization of TlsGroup::T, ::L, and ::S that was removed during the Doxygen documentation PR series (#414). The original code initialized these tensors to NAN so that the mmCIF writer (number_or_qmark in src/to_mmcif.cpp) would emit "?" (unset) for empty TLS groups. With the initializers removed: - SMat33 T, L hold undefined values - Mat33 S defaults to identity matrix (1,0,0;0,1,0;0,0,1) A TlsGroup that is instantiated but only partially populated (e.g., origin and selections set, tensors not yet computed) would now write garbage numbers for T/L and a misleading identity matrix for S into mmCIF output, where downstream refinement programs would read them as valid tensor data. The earlier fix commit 2c1b0c51 restored the analogous initialization in RefinementInfo::aniso_b but missed the TlsGroup tensors. --- include/gemmi/metadata.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gemmi/metadata.hpp b/include/gemmi/metadata.hpp index 5d8a40ab..83afbccd 100644 --- a/include/gemmi/metadata.hpp +++ b/include/gemmi/metadata.hpp @@ -117,9 +117,9 @@ struct TlsGroup { std::string id; ///< TLS group identifier string std::vector selections; ///< Chain/residue ranges in this group Position origin; ///< Origin of libration and screw axes (x, y, z) - SMat33 T; ///< Translation tensor (Ų) - SMat33 L; ///< Libration tensor (rotational, radians²) - Mat33 S; ///< Screw rotation tensor (radians/Ångström) + SMat33 T = {NAN, NAN, NAN, NAN, NAN, NAN}; ///< Translation tensor (Ų) + SMat33 L = {NAN, NAN, NAN, NAN, NAN, NAN}; ///< Libration tensor (rotational, radians²) + Mat33 S = Mat33{NAN}; ///< Screw rotation tensor (radians/Ångström) }; /// @brief Refinement statistics for a resolution shell or overall data.