Skip to content

Fix off-by-one in 1-indexed loops in core/ (split 1/4 of #707)#730

Open
lyskov-ai wants to merge 1 commit into
RosettaCommons:mainfrom
lyskov-ai:fix/off-by-one-core
Open

Fix off-by-one in 1-indexed loops in core/ (split 1/4 of #707)#730
lyskov-ai wants to merge 1 commit into
RosettaCommons:mainfrom
lyskov-ai:fix/off-by-one-core

Conversation

@lyskov-ai

Copy link
Copy Markdown
Contributor

Summary

One of four PRs splitting #707 (originally a single 35-file off-by-one batch) into coherent, per-subsystem pieces, so each can be reviewed and its regression-test impact assessed independently. #707 is being closed in favor of these four. The split is deliberate — the individual diffs are below the usual bundling threshold — because the changes are behavior-affecting and the maintainer asked to isolate regression-test impact per subsystem.

This PR: core/ (5 files).

Each loop uses for ( Size i = 1; i < container.size(); ++i ) (or < pose.size() / < nheavyatoms() / < upstream.size()) and the body uses i as a direct 1-indexed accessor — pose.residue(i), vec[i], xyz(i) — so the last element is silently skipped. Changed < to <= to include it.

  • core/energy_methods/RNA_LJ_BaseEnergy.cc — RNA neighbor scan
  • core/io/pose_to_sfr/PoseToStructFileRepConverter.cc — SS-element enumeration; a 1-residue SS element at the C-terminus was dropped
  • core/pack/interaction_graph/SurfacePotential.cc ×3 — neighbor count, surface-energy sum
  • core/pose/rna/util.cc — heavy-atom contact scan
  • core/select/residue_selector/JumpUpstreamSelector.cc — subset assignment; diverged from sibling JumpDownstreamSelector, which already uses <=

Regression tests

None of the changed regression tests reported for #707 (enzdes, inverse_rotamer_remodel, ligand_dock_cholesterol, mp_f19_relax, mpil_load_implicit_lipids, pose_sewing, unfolded_state_energy_calc) fall in this subsystem, so this PR is expected to be inert with respect to that set. CI will confirm.

Split from RosettaCommons#707 (subsystem: core/). Each loop uses
'for ( Size i = 1; i < container.size(); ++i )' (or < pose.size() /
< nheavyatoms() / < upstream.size()) and the body uses i as a direct
1-indexed accessor, so the last element is silently skipped. Changed
< to <= to include it.

- energy_methods/RNA_LJ_BaseEnergy.cc  (RNA neighbor scan)
- io/pose_to_sfr/PoseToStructFileRepConverter.cc  (SS-element enumeration; a
  1-residue SS element at the C-terminus was dropped)
- pack/interaction_graph/SurfacePotential.cc x3  (neighbor count, surface
  energy sum)
- pose/rna/util.cc  (heavy-atom contact scan)
- select/residue_selector/JumpUpstreamSelector.cc  (subset assignment;
  diverged from sibling JumpDownstreamSelector, which already uses <=)

@roccomoretti roccomoretti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, pending an update to the SurfacePotential unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants