Files
Jungfraujoch/writer/RugnuxResultBlocks.cpp
T
leonarski_f b00c668e3a
Build Packages / Create release (push) Successful in 8s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m11s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 10m32s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 18m26s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 22m11s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 23m32s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 25m36s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 27m28s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 28m10s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 28m10s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 29m24s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 21m45s
Build Packages / Generate python client (push) Successful in 31s
Build Packages / Build documentation (push) Successful in 1m21s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 24m2s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 29m25s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 30m27s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 27m12s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 32m20s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 33m36s
Build Packages / Unit tests (push) Successful in 2h7m18s
Build Packages / Validation Battery (push) Successful in 33m19s
v1.0.0-rc.179 (#90)
* Rugnux: Stills processing needs only the unit cell and space group beyond what the file records - detector distance, beam centre, tilt, panel placement, saturation level, gain and polarisation plane are found from the images - and is up to twice as fast.
* Rugnux: Stills can be indexed without a GPU, with a CPU implementation of the fast-feedback indexer (macOS, computers without a GPU).
* Rugnux: Rotation and stills data are integrated in the detector's own units with one gain model, improving data from CCD detectors.
* Web frontend: The Rugnux live page shows the placed model with its electron density and anomalous difference map in a Mol* viewer.

Reviewed-on: #90
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
2026-10-24 14:52:29 +02:00

58 lines
2.8 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#include "RugnuxResultBlocks.h"
#include <sstream>
#include <gemmi/to_cif.hpp> // write_cif_block_to_stream
#include <gemmi/to_mmcif.hpp> // make_mmcif_block
PlacedModelMessage PlacedModelFromStructure(const gemmi::Structure &st, const UnitCell &cell,
const std::string &data_space_group_name) {
PlacedModelMessage p;
p.name = st.name;
p.unit_cell = cell;
p.space_group_name = data_space_group_name;
p.model_space_group_name = st.spacegroup_hm;
bool has_aniso = false;
for (const gemmi::Model &m : st.models)
for (const gemmi::Chain &ch : m.chains)
for (const gemmi::Residue &r : ch.residues)
for (const gemmi::Atom &a : r.atoms) {
p.model_number.push_back(m.num);
p.chain.push_back(ch.name);
p.residue_name.push_back(r.name);
p.seq_num.push_back(*r.seqid.num);
p.icode.push_back(static_cast<uint8_t>(r.seqid.icode));
p.het_flag.push_back(static_cast<uint8_t>(r.het_flag));
p.subchain.push_back(r.subchain);
p.entity_id.push_back(r.entity_id);
p.label_seq.push_back(r.label_seq.value);
p.atom_name.push_back(a.name);
p.element.push_back(a.element.name());
p.altloc.push_back(static_cast<uint8_t>(a.altloc));
p.charge.push_back(a.charge);
p.x.push_back(a.pos.x);
p.y.push_back(a.pos.y);
p.z.push_back(a.pos.z);
p.b_iso.push_back(a.b_iso);
p.occupancy.push_back(a.occ);
p.aniso.insert(p.aniso.end(), {a.aniso.u11, a.aniso.u22, a.aniso.u33,
a.aniso.u12, a.aniso.u13, a.aniso.u23});
has_aniso = has_aniso || a.aniso.nonzero();
}
if (!has_aniso)
p.aniso.clear();
// Everything of the model but its coordinates (and what goes with them: cell, symmetry, scale), as the mmCIF
// categories gemmi writes, for the writer to put back on _model.cif.
gemmi::MmcifOutputGroups groups(true);
groups.atoms = groups.cell = groups.symmetry = groups.scale = groups.atom_type = groups.origx = false;
// _entry.id would otherwise be made up from the name, which the block carries anyway.
groups.entry = st.info.count("_entry.id") > 0;
std::ostringstream os;
gemmi::cif::write_cif_block_to_stream(os, gemmi::make_mmcif_block(st, groups));
p.metadata_mmcif = os.str();
return p;
}