rugnux: --no-refine-solvent keeps the solvent as given in the refinement
The refinement of a placed model (and --mode refine) builds no waters and relabels no ion; the solvent audit is still made. ProcessConfig::refine_solvent carries it to RefinementSettings::solvent, and RugnuxCommandLine gives it back. The broker's live mode exposes no refinement switch at all (--no-refine has none either), so none is added there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVeDQqN9qRD57vnShzTC37
This commit is contained in:
1 parent
0adc7e0f3e
commit
93919bedc3
7 files changed
+24
-3
No files matched your search
+4
-2
@@ -99,8 +99,10 @@ rugnux -o myrun --model model.pdb dataset_master.h5 # or with --model
|
||||
A model is told from the images by its contents (PDB, or mmCIF with atoms), gzipped or not. After
|
||||
merging it is **placed** — as a rigid body, or by molecular replacement where that does not place it or
|
||||
the model is a prediction (AlphaFold, ModelCIF) — then **refined** against the merge (restrained,
|
||||
maximum likelihood; seconds on a GPU, typically minutes on the CPU; `--no-refine` skips it), and the
|
||||
run writes the maps (σ<sub>A</sub>-weighted 2mFo−DFc / mFo−DFc), the placed and refined model, and
|
||||
maximum likelihood; seconds on a GPU, typically minutes on the CPU; `--no-refine` skips it) with
|
||||
its solvent rebuilt - waters added at difference peaks and removed from negative density, ions relabelled
|
||||
where their surroundings say so (`--no-refine-solvent` keeps the solvent as given, also with
|
||||
`--mode refine`; the solvent audit is made either way), and the run writes the maps (σ<sub>A</sub>-weighted 2mFo−DFc / mFo−DFc), the placed and refined model, and
|
||||
the blobs of difference density the model does not explain. R-work / R-free are in the report.
|
||||
|
||||
The model **does not change processing decisions**: the merge, its space group and resolution are
|
||||
|
||||
@@ -60,7 +60,8 @@ struct RefinementSettings {
|
||||
double max_weight = 1.0 / 8; // the positions' X-ray weight at most, times the balanced one
|
||||
bool riding_hydrogens = true; // the dictionary's hydrogens added, riding on their parents
|
||||
// Waters added at the difference map's peaks and removed where the maps no longer hold them, between refinements
|
||||
// (SolventBuild.h), to SOLVENT_BUILD_D_MIN.
|
||||
// (SolventBuild.h), to SOLVENT_BUILD_D_MIN; off (rugnux --no-refine-solvent) the solvent stays as given and is
|
||||
// only audited.
|
||||
bool solvent = true;
|
||||
bool gpu = true;
|
||||
size_t nthreads = 1;
|
||||
|
||||
@@ -269,6 +269,9 @@ struct ProcessConfig {
|
||||
// On in the rugnux CLI (--no-refine turns it off), the viewer and the broker's live mode: giving a model is the
|
||||
// opt-in.
|
||||
bool refine = false;
|
||||
// With `refine`: waters built and removed and ions relabelled between refinements (RefinementSettings::solvent);
|
||||
// off (--no-refine-solvent) the solvent stays as given, its audit still made.
|
||||
bool refine_solvent = true;
|
||||
|
||||
// --finalist-ledger: report-only symmetry evidence table (and the twin-immune zones), folded from
|
||||
// a merge of its own in P1 that only this flag makes.
|
||||
|
||||
@@ -88,6 +88,8 @@ std::string RugnuxCommandLine(const ProcessConfig &config,
|
||||
add(config.force_mr ? "--mr" : "--model", config.model->name);
|
||||
if (config.model && !config.refine)
|
||||
args.emplace_back("--no-refine");
|
||||
if (config.model && config.refine && !config.refine_solvent)
|
||||
args.emplace_back("--no-refine-solvent");
|
||||
}
|
||||
if (config.start_image != 0)
|
||||
add("-s", std::to_string(config.start_image));
|
||||
|
||||
@@ -5097,6 +5097,7 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
|
||||
TimingMark mark(logger, "refinement");
|
||||
RefinementSettings settings;
|
||||
settings.nthreads = static_cast<size_t>(config_.nthreads);
|
||||
settings.solvent = config_.refine_solvent;
|
||||
settings.gpu_resident_bytes = rsm && rsm->OnGPU() ? rsm->DeviceBytes() : 0;
|
||||
// A cut (the broker's deadline or cancel, Ctrl+C) cuts a running refinement short, keeping what it has
|
||||
settings.cancel = cancelled_.RunFlag();
|
||||
|
||||
@@ -259,6 +259,7 @@ void print_usage() {
|
||||
std::cout << " --model <file> After merging, validate vs this atomic model: R-free, sigma_A-weighted 2mFo-DFc/mFo-DFc maps, the model as placed (written beside them), and - where the merge kept the Bijvoet split - an anomalous difference map with the strongest anomalous scatterers named by the atom they sit on. PDB or mmCIF, gzipped or not, recognised by content rather than by extension. A prediction (AlphaFold or ModelCIF, pLDDT in the B column), or an experimental structure the rigid body does not place against its null, is placed by molecular replacement instead (see --mr). A model that is placed is then refined against the merge it was placed on - each chain as a rigid body and one B per residue, then every atom's position and B restrained by the dictionary carried in rugnux against a maximum-likelihood target, the X-ray weight chosen by R-free within geometry bounds, then waters added at difference-map peaks with a hydrogen-bond partner and removed from negative difference density (to 2.8 A, up to three rounds, each kept where it lowers R-free) - and the unexplained blobs of its difference map are listed: <prefix>_refined_model.cif, <prefix>_refined_maps.mtz, <prefix>_blobs.json, REFINE_ keys in the report. R_WORK, R_FREE and every other key stay those of the model as placed; the refinement decides nothing about the processing. It costs seconds on a GPU and typically 2-15 minutes on the CPU (no GPU, or --no-gpu); --no-refine skips it" << std::endl;
|
||||
std::cout << " --mr <file> As --model, but placed by molecular replacement straight away, without the rigid-body placement first: as many copies as the cell holds, in every space group the merge cannot tell apart and in the twin hypothesis' subgroup. A prediction is trimmed to the residues of pLDDT 70 and above, and where the AlphaFold DB's predicted-aligned-error JSON sits beside it under its own name it is cut into rigid domains; any other PDB or mmCIF is taken as an experimental structure, its polymer only (no waters, ligands, hydrogens or alternative conformers). Which of the two it is is read from the file. It may relabel the enantiomorph of the answer, and a different space group it chooses is written beside the answer as <prefix>_mr.mtz/.cif with the placed model <prefix>_mr_model.pdb. --mode mx only" << std::endl;
|
||||
std::cout << " --no-refine Do not refine the placed model (for debugging): by default a model that --model or --mr places is refined (see --model)" << std::endl;
|
||||
std::cout << " --no-refine-solvent Refine the placed model with its solvent as given: no waters built or removed, no ion relabelled (the solvent audit, REFINE_SOLVENT_ keys and <prefix>_solvent.json, is still made). Also with --mode refine" << std::endl;
|
||||
std::cout << " --export-unmerged Write <prefix>_unmerged.mtz, an unmerged MTZ (POINTLESS column layout) of the integrated observations, for aimless / pointless / careless. On by default, whenever there is an output prefix. On a rotation run the partials of each reflection are summed into one full, written at the batch its rocking curve is centred on, with the summed rocking-curve fraction in FRACTIONCALC; an event that caught less of its rocking curve than --min-captured-fraction (or --min-partiality) is not written, exactly as in the merge, since a full is what the reading program is told these rows are. Intensities carry the deterministic per-reflection corrections and nothing else - Lorentz and polarization in the LP column, the sensor's angle-dependent efficiency in QE and the flight path's attenuation in FLIGHT, so raw counts are I / LP * QE * FLIGHT - while the partiality is not divided out and the per-image scale is not applied at all, since those programs scale the data themselves. Written in --mode mx and --mode scale, and with --no-merge" << std::endl;
|
||||
std::cout << " --no-export-unmerged Do not write <prefix>_unmerged.mtz. It is the largest file a run produces, so a run whose observations are not going to another scaling program - a regression battery, say - can skip writing it" << std::endl;
|
||||
std::cout << " --export-unmerged-partials Write <prefix>_unmerged_partials.mtz, the same observations with each partial as its own row (one batch per image) flagged for the reading program to sum, instead of summed here. Off by default and independent of --export-unmerged; both can be written in one run" << std::endl;
|
||||
@@ -349,6 +350,7 @@ enum {
|
||||
OPT_CRYSTFEL_GEOMETRY,
|
||||
OPT_MR,
|
||||
OPT_NO_REFINE,
|
||||
OPT_NO_REFINE_SOLVENT,
|
||||
OPT_EXPORT_UNMERGED,
|
||||
OPT_NO_EXPORT_UNMERGED,
|
||||
OPT_EXPORT_UNMERGED_PARTIALS,
|
||||
@@ -426,6 +428,7 @@ static option long_options[] = {
|
||||
{"crystfel-geometry", required_argument, nullptr, OPT_CRYSTFEL_GEOMETRY},
|
||||
{"mr", required_argument, nullptr, OPT_MR},
|
||||
{"no-refine", no_argument, nullptr, OPT_NO_REFINE},
|
||||
{"no-refine-solvent", no_argument, nullptr, OPT_NO_REFINE_SOLVENT},
|
||||
{"refine-score-only", no_argument, nullptr, OPT_REFINE_SCORE_ONLY},
|
||||
{"refine-d-min", required_argument, nullptr, OPT_REFINE_D_MIN},
|
||||
{"export-unmerged", no_argument, nullptr, OPT_EXPORT_UNMERGED},
|
||||
@@ -1061,6 +1064,7 @@ static int RunRugnux(int argc, char **argv, bool no_gpu) {
|
||||
std::string model_pdb; // --model: PDB to validate merged intensities against (R-free + maps)
|
||||
std::string mr_model; // --mr: --model, placed by molecular replacement straight away
|
||||
bool refine_model = true; // --no-refine: a placed model is refined unless it is given
|
||||
bool refine_solvent = true; // --no-refine-solvent: the refinement builds waters and relabels ions
|
||||
bool refine_score_only = false; // --refine-score-only
|
||||
double refine_d_min = 0; // --refine-d-min
|
||||
bool export_unmerged = true; // on by default; --no-export-unmerged turns it off
|
||||
@@ -1308,6 +1312,9 @@ static int RunRugnux(int argc, char **argv, bool no_gpu) {
|
||||
case OPT_NO_REFINE:
|
||||
refine_model = false;
|
||||
break;
|
||||
case OPT_NO_REFINE_SOLVENT:
|
||||
refine_solvent = false;
|
||||
break;
|
||||
case OPT_REFINE_SCORE_ONLY:
|
||||
refine_score_only = true;
|
||||
break;
|
||||
@@ -1891,6 +1898,7 @@ static int RunRugnux(int argc, char **argv, bool no_gpu) {
|
||||
settings.nthreads = static_cast<size_t>(nthreads);
|
||||
settings.gpu = !no_gpu;
|
||||
settings.score_only = refine_score_only;
|
||||
settings.solvent = refine_solvent;
|
||||
const RefineOnlyResult refined = RunRefineOnly(std::move(data), model->structure, refine_d_min, settings,
|
||||
logger);
|
||||
if (!refined.refinement.ok)
|
||||
@@ -3636,6 +3644,7 @@ static int RunRugnux(int argc, char **argv, bool no_gpu) {
|
||||
config.model = model;
|
||||
config.force_mr = !mr_model.empty();
|
||||
config.refine = refine_model; // a placed model is refined unless --no-refine
|
||||
config.refine_solvent = refine_solvent;
|
||||
// When merging, the merged reflections (.mtz/.cif) are the wanted output; skip the large
|
||||
// _process.h5 unless explicitly requested. Without merging, the _process.h5 is the only output.
|
||||
std::optional<ProcessFileSink> sink;
|
||||
|
||||
@@ -344,6 +344,9 @@ TEST_CASE("RugnuxCommandLine_Full", "[process]") {
|
||||
CHECK(RugnuxCommandLine(config, x, "in.h5", "", false).find("--no-refine") != std::string::npos);
|
||||
config.refine = true;
|
||||
CHECK(RugnuxCommandLine(config, x, "in.h5", "", false).find("--no-refine") == std::string::npos);
|
||||
config.refine_solvent = false;
|
||||
CHECK(RugnuxCommandLine(config, x, "in.h5", "", false).find("--no-refine-solvent") != std::string::npos);
|
||||
config.refine_solvent = true;
|
||||
config.force_mr = true;
|
||||
const std::string mr_cmd = RugnuxCommandLine(config, x, "in.h5", "", false);
|
||||
CHECK(mr_cmd.find("--mr model.cif") != std::string::npos);
|
||||
|
||||
Reference in new issue
Block a user