Files
Jungfraujoch/writer/WriteRugnuxFiles.h
T
leonarski_f 2e296e6bed jfjoch_writer: the live refinement's model, maps and blobs are written beside the master file
In broker live mode the refined model, its map coefficients and the difference-map blobs stayed in
the broker for the viewer routes and were lost at the next run. They now go to the writer in the END
message as the placed model and maps already do - EndMessage::refined_model (PlacedModelMessage),
refined_map_coefficients (MtzTable) and blobs (DensityBlobsMessage, one vector per field) - and the
writer writes <prefix>_refined_model.cif (+ .pdb), <prefix>_refined_maps.mtz and <prefix>_blobs.json,
the names the CLI gives them. The blobs' JSON is made by one function (DensityBlobsJson) that the CLI
now writes through as well, so the two files are byte-identical. Optional CBOR fields, no version bump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
(cherry picked from commit c65220d96a96d2b1897f3c6632c94f9379b670a3)
2026-10-26 15:50:40 +01:00

38 lines
1.9 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <string>
#include "gemmi/model.hpp"
#include "../common/JFJochMessages.h"
class Logger;
// The files rugnux writes beside its merged output, made from the structured END-message blocks
// (common/JFJochMessages.h), so that jfjoch_writer can write them with no analysis library. rugnux
// writes its own MTZ files through the same function.
// An MTZ file from its table. Throws where the table does not describe one: a column with another number
// of rows than the first, a column or a batch naming a dataset the table does not have, a batch header that
// is not 29 + 156 long, or a space group gemmi does not know.
void WriteMtz(const MtzTable &table, const std::string &filename);
// The model the block describes, for WritePlacedModel (writer/WriteModel.h). Throws where the block
// describes none: a per-atom field with another number of entries than atom_name, or aniso neither empty
// nor six per atom.
gemmi::Structure PlacedModelStructure(const PlacedModelMessage &model);
// The text of <prefix>_blobs.json. Throws where a field has another number of entries than kind.
std::string DensityBlobsJson(const DensityBlobsMessage &blobs);
// The files above, from whichever blocks `end` carries, at <file_prefix>.mtz, _maps.mtz and _model.cif
// (WritePlacedModel adds _model.pdb where a PDB can hold the cell), and the refinement's
// _refined_model.cif (.pdb), _refined_maps.mtz and _blobs.json. Each is written under a temporary name and
// renamed into place. An existing file is replaced only with `overwrite`; otherwise it is kept and the
// new one is not written.
void WriteRugnuxResultFiles(const EndMessage &end, const std::string &file_prefix, bool overwrite,
Logger &logger);