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)
This commit is contained in:
leonarski_f committed 2026-10-26 15:50:40 +01:00
1 parent 2461d67e14
commit 2e296e6bed
13 files changed
+282 -36

No files matched your search

+22
View File
@@ -630,6 +630,25 @@ inline void CBOR_ENC(CborEncoder &encoder, const char* key, const PlacedModelMes
cborErr(cbor_encoder_close_container(&encoder, &mapEncoder));
}
inline void CBOR_ENC(CborEncoder &encoder, const char* key, const DensityBlobsMessage &b) {
CborEncoder mapEncoder;
cborErr(cbor_encode_text_stringz(&encoder, key));
cborErr(cbor_encoder_create_map(&encoder, &mapEncoder, CborIndefiniteLength));
CBOR_ENC(mapEncoder, "kind", b.kind);
CBOR_ENC(mapEncoder, "x", b.x);
CBOR_ENC(mapEncoder, "y", b.y);
CBOR_ENC(mapEncoder, "z", b.z);
CBOR_ENC(mapEncoder, "peak_sigma", b.peak_sigma);
CBOR_ENC(mapEncoder, "volume", b.volume);
CBOR_ENC(mapEncoder, "score", b.score);
CBOR_ENC(mapEncoder, "nearest_atom", b.nearest_atom);
CBOR_ENC(mapEncoder, "nearest_atom_distance", b.nearest_atom_distance);
CBOR_ENC(mapEncoder, "polar_contacts", b.polar_contacts);
CBOR_ENC(mapEncoder, "metal_contacts", b.metal_contacts);
CBOR_ENC(mapEncoder, "anomalous_sigma", b.anomalous_sigma);
cborErr(cbor_encoder_close_container(&encoder, &mapEncoder));
}
// Add encoder for LatticeMessage
inline void CBOR_ENC(CborEncoder &encoder, const char* key, const LatticeMessage &val) {
CborEncoder mapEncoder;
@@ -977,6 +996,9 @@ void CBORStream2Serializer::SerializeSequenceEnd(const EndMessage& message) {
CBOR_ENC(mapEncoder, "merged", message.merged);
CBOR_ENC(mapEncoder, "map_coefficients", message.map_coefficients);
CBOR_ENC(mapEncoder, "placed_model", message.placed_model);
CBOR_ENC(mapEncoder, "refined_model", message.refined_model);
CBOR_ENC(mapEncoder, "refined_map_coefficients", message.refined_map_coefficients);
CBOR_ENC(mapEncoder, "blobs", message.blobs);
cborErr(cbor_encoder_close_container(&encoder, &mapEncoder));