// SPDX-FileCopyrightText: 2025 Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include #include #include "scale_merge/FrenchWilson.h" #include "../common/UnitCell.h" #include "../symmetry/gemmi/symmetry.hpp" /// Metadata needed to write a meaningful mmCIF reflection file. struct MmcifMetadata { // Required UnitCell unit_cell{}; std::string space_group_name; // e.g. "P 21 21 21" int space_group_number = 1; // Optional but recommended std::string data_block_name = "jfjoch"; // CIF data_ std::string detector_name; // e.g. "JUNGFRAU 4M" std::optional wavelength_A; // incident wavelength std::optional detector_distance_mm; std::optional sample_temperature_K; std::optional sample_name; std::optional software_version; // jfjoch version string std::optional source; std::optional beamline; }; /// Write a PDBx/mmCIF reflection file (containing _refln loop with F/sigmaF/I/sigmaI) /// to the given output stream. /// /// The file follows the conventions expected by CCP4/CCTBX/Phenix for /// structure-factor mmCIF files. void WriteMmcifReflections(std::ostream& out, const std::vector& reflections, const MmcifMetadata& meta); /// Convenience overload that writes to a file path. /// Throws std::runtime_error on I/O failure. void WriteMmcifReflections(const std::string& path, const std::vector& reflections, const MmcifMetadata& meta);