48 lines
1.7 KiB
C++
48 lines
1.7 KiB
C++
// SPDX-FileCopyrightText: 2025 Paul Scherrer Institute
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <ostream>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <optional>
|
|
|
|
#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_<name>
|
|
std::string detector_name; // e.g. "JUNGFRAU 4M"
|
|
std::optional<float> wavelength_A; // incident wavelength
|
|
std::optional<float> detector_distance_mm;
|
|
std::optional<float> sample_temperature_K;
|
|
std::optional<std::string> sample_name;
|
|
std::optional<std::string> software_version; // jfjoch version string
|
|
|
|
std::optional<std::string> source;
|
|
std::optional<std::string> 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<FrenchWilsonReflection>& 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<FrenchWilsonReflection>& reflections,
|
|
const MmcifMetadata& meta); |