Files
Jungfraujoch/writer/WriteRugnuxFiles.h
T
leonarski_fandClaude Opus 5.5 5028aac0ee jfjoch_writer: a placed-model block that describes no model is refused; END log line back to verbose
WritePlacedModel was handed the result of find_spacegroup_by_name unchecked,
and PlacedModelStructure indexed every per-atom vector by atom_name's length.
A malformed block from the wire could crash the writer. Now the per-atom
vectors must all have atom_name's length and aniso must be empty or six per
atom (PlacedModelStructure throws otherwise), and an unknown data space group
is an error; WriteRugnuxResultFiles logs either and writes nothing for the
model, as it already did for an MTZ table WriteMtz refuses.

StreamWriter: "Received end message" is logged only with -v again, exactly as
before this branch. The wall-clock times of the rugnux files are still logged
where they are written, which only happens when the END carries them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 18:13:12 +02:00

34 lines
1.6 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 three 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). 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);