diff --git a/docs/ACKNOWLEDGEMENT.md b/docs/ACKNOWLEDGEMENT.md index d2d4598be..fe71ad8d9 100644 --- a/docs/ACKNOWLEDGEMENT.md +++ b/docs/ACKNOWLEDGEMENT.md @@ -706,7 +706,7 @@ resolution: E. A. Merritt, "To B or not to B: a question of resolution?" (2012), with more displacement parameters and one with fewer, the R-factor ratio test of W. C. Hamilton, "Significance tests on the crystallographic R factor" (1965), Acta Cryst. 18, 502-510 (DOI not verified), decides first, over a range of restraint weights as Merritt (2012) applies it, with PDB-REDO's (Joosten et al. 2012, above) -95%/30% rule and its bound of 18 reflections per atom for a U per atom; its F point is from E. Paulson, +95%/30% rule; its F point is from E. Paulson, "An approximate normalization of the analysis of variance distribution" (1942), Ann. Math. Statist. 13, 233-235 [doi:10.1214/aoms/1177731608](https://doi.org/10.1214/aoms/1177731608). diff --git a/docs/CPU_DATA_ANALYSIS_REFINEMENT.md b/docs/CPU_DATA_ANALYSIS_REFINEMENT.md index 14876ac72..f2c541579 100644 --- a/docs/CPU_DATA_ANALYSIS_REFINEMENT.md +++ b/docs/CPU_DATA_ANALYSIS_REFINEMENT.md @@ -449,7 +449,7 @@ listed first - on a ladder, the tighter geometry - is kept otherwise). The trial reflections from where the weights ended; on 49 refinements of 33 structures neither the cuts' rule nor leaving out the U weight $\times 4$ changed a choice taken. A trial displaces the one before it (the first: where the weights ended) only where its geometry is within bounds - and the free set prefers it: the free set tests the parameters a model adds, so the choice is made on the evidence of each run, not at a resolution (Merritt 2012). Between a model with more displacement parameters (TLS over a B per atom, a U per atom over either) and one with fewer, Hamilton's R-ratio test decides first, as Merritt (2012) and PDB-REDO apply it: the larger passes where its R-work is below the smaller's by more than the ratio $\sqrt{b/(n-m)\,F_{b,n-m,0.05} + 1}$, $n$ the working reflections, $m$ its displacement parameters (the positions are held) and $b$ the extra ones (Hamilton 1965; the F point by Paulson's approximation). The restraints are credited as $wR$ observations, $w$ unknown: each model's is scanned from 0 to the bound at which its restraints take every parameter they restrain off its count (Merritt's $N_\mathrm{atoms}/R$ for a B per atom, $6N_\mathrm{atoms}/R$ for a U per atom), six values each, independently. The larger model is taken where it passes more than 95% of the 36 tests, the smaller where it passes fewer than 30%, and in between the free set decides as everywhere else (PDB-REDO falls back on Z(R-free) and the R-free - R-work gap at fixed cut-offs instead; the paired rule is the one every other free-set choice here uses). A U per atom is tried only above 18 working reflections per refinable atom, PDB-REDO's bound. + and the free set prefers it: the free set tests the parameters a model adds, so the choice is made on the evidence of each run, not at a resolution (Merritt 2012). Between a model with more displacement parameters (TLS over a B per atom, a U per atom over either) and one with fewer, Hamilton's R-ratio test decides first, as Merritt (2012) and PDB-REDO apply it: the larger passes where its R-work is below the smaller's by more than the ratio $\sqrt{b/(n-m)\,F_{b,n-m,0.05} + 1}$, $n$ the working reflections, $m$ its displacement parameters (the positions are held) and $b$ the extra ones (Hamilton 1965; the F point by Paulson's approximation). The restraints are credited as $wR$ observations, $w$ unknown: each model's is scanned from 0 to the bound at which its restraints take every parameter they restrain off its count (Merritt's $N_\mathrm{atoms}/R$ for a B per atom, $6N_\mathrm{atoms}/R$ for a U per atom), six values each, independently. The larger model is taken where it passes more than 95% of the 36 tests, the smaller where it passes fewer than 30%, and in between the free set decides as everywhere else, the larger model then with its R-free lower outright rather than within the tie (the burden of the evidence is on the parameters it adds; PDB-REDO falls back on Z(R-free) and the R-free - R-work gap at fixed cut-offs instead, and the paired rule is the one every other free-set choice here uses). A U per atom is tried wherever it is affordable: where the working reflections outnumber the parameters of the model with it counted unrestrained, nine per atom with the positions as Merritt counts them - the end of the range of weights at which Hamilton's test can be taken at all - rather than above a fixed number of reflections per atom. The refined U are written as ANISOU and the TLS groups as `_pdbx_refine_tls*` and `REMARK 3` (`REFINE_ADP_MODEL`, `REFINE_ANISO_ATOMS`, `REFINE_TLS_GROUPS`). It is decided after the solvent build (ยง15.10), on the model with its solvent: a water a round put in refines a U of its own in the per-atom trial as every refinable atom does, and no diff --git a/image_analysis/structure_refinement/Refinement.cpp b/image_analysis/structure_refinement/Refinement.cpp index e118c2fbb..ca17fdff9 100644 --- a/image_analysis/structure_refinement/Refinement.cpp +++ b/image_analysis/structure_refinement/Refinement.cpp @@ -143,8 +143,6 @@ double HamiltonPassFraction(const RefinementWeightTrial &large, const Refinement // tests (HamiltonPassFraction), the smaller where it passes fewer than the other, and the free set's choice between // (as PDB-REDO; Joosten et al. 2012). constexpr double HAMILTON_LARGER = 0.95, HAMILTON_SMALLER = 0.30; -// A U per atom is tried only above this many working reflections per refinable atom (as PDB-REDO; Joosten et al. 2012). -constexpr double U_MIN_REFLECTIONS_PER_ATOM = 18; // Every other step is taken on the work-set target (WorkTarget) where it lowers it by more than this, relative. constexpr double TARGET_TOLERANCE = 1e-4; // The rounds of RefineOnce's weight and displacement-model choice (4b.): the first from the model as given, each @@ -4314,11 +4312,14 @@ RefinementResult RefineOnce(const gemmi::Structure &placed, const std::vector hyps = AdpHypotheses(ctx, topo, own_tls); const double w = state.trial.weight, adp = state.trial.adp_weight > 0 ? state.trial.adp_weight : adp_w0; - // a U per atom only where the data are many times its parameters + // a U per atom only where it is affordable: where the working reflections outnumber the parameters of the + // model with it, the positions and the six U of every atom, counted unrestrained (Merritt (2012) counts + // the positions with them) - the end of the range of restraint weights where Hamilton's test can be taken + // at all int atoms_b = 0; for (int i : refinable) atoms_b += !ctx.atoms[i]->is_hydrogen(); - const bool u_tried = result.n_work > U_MIN_REFLECTIONS_PER_ATOM * atoms_b; + const bool u_tried = result.n_work > 9 * atoms_b; // the U weight balanced on the model with every refinable atom given a U double u_w0 = adp; if (u_tried) { @@ -4430,12 +4431,13 @@ RefinementResult RefineOnce(const gemmi::Structure &placed, const std::vector b.adp_parameters; const double pass = larger ? HamiltonPassFraction(t, b, result.n_work) : HamiltonPassFraction(b, t, result.n_work); - bool takes = displaces(t, b); + bool takes = displaces(t, b) && (!larger || t.r_free < b.r_free); if (t.adp_parameters != b.adp_parameters && (pass > HAMILTON_LARGER || pass < HAMILTON_SMALLER)) takes = t.within_bounds && (!b.within_bounds || (pass > HAMILTON_LARGER) == larger); logger.Info("Refinement, displacements: {} against {}: the larger passes {:.0f}% of Hamilton's tests{}",