Claude/improve structty visualization q42 vo - #3
Merged
LunaJang merged 14 commits intoMar 6, 2026
Merged
Conversation
Performance fix: - Catmull-Rom spline now skips H/S atoms (StructureMaker geometry is already dense; applying 4 sub-steps to each helix stripe point was the main bottleneck — up to 20x more draw_line calls than before) - Helix axial steps reduced to max(8, residues/2): smooth with 16 stripes, avoids O(residues * circle_steps) blowup on long helices Secondary structure colors (active with --structure / -s flag): - Alpha helix: bright red (ncurses color 196 / #ff0000) - Beta sheet: bright yellow (ncurses color 226 / #ffff00) - Applied on top of any color mode (protein/chain/rainbow) - Screenshots (PNG via C key) also use these colors https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
Performance: replace std::string chainID with char in RenderPoint, eliminating 49K+ string constructions per frame during clear_screen and thousands of string copies in draw_line/z-buffer. Reduce finalPoints.reserve from 800K to 50K. Replace setcchar/mvadd_wch in print_screen_braille with direct UTF-8 mvaddstr, avoiding wchar_t machinery entirely. Colors: change color pair numbers from 200/201 (out of range on systems with COLOR_PAIRS=64) to 41/42, ensuring alpha helix (red) and beta sheet (yellow) colors actually appear in both --structure mode and default display. https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
The sheet ribbon loop computed line_steps = pair_len / 0.05f where pair_len is a Ca-Ca distance in Angstroms (~3.8 Å), generating 76 intermediate points per Ca-Ca bond per stripe. With 13 stripes and a 10-residue sheet this produced ~8,900 atoms vs ~96 for an equivalent helix, causing a 90× overhead. The renderer's draw_line already interpolates between consecutive atoms, so sub-sampling inside StructureMaker is wasteful. Use exactly 2 points per pair (start and end); the renderer handles smoothing. https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
- Helix: replaced cylinder-with-stripes with a spiral ribbon that actually winds around the helix axis (3.6 residues/turn). The ribbon consists of 7 parallel lines so it has visible width. Radius increased 2.5→3.5 Å. - Sheet: increased ribbon width from ±0.42 Å to ±2.4 Å by changing sheet_step 0.07→0.40, making the beta-strand ribbon clearly visible. - Colors: in --structure mode, coil/loop atoms are now rendered in mid-gray (color 244) instead of keeping their chain/protein color. This makes the bright-red helix and bright-yellow sheet stand out unambiguously against the gray backbone. https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
- Sheet color: yellow (226) → bright blue (33) so helix (red) and sheet (blue) are clearly distinct - Helix ribbon: ribbon_half_width 1.5→0.8 Å, ribbon_lines 3→2 (5 lines instead of 7) — thinner coil - Sheet ribbon: width 6→4, sheet_step 0.40→0.28 → total ~2.2 Å width instead of 4.8 Å — less bulky strand https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
- Helix: bright red (196) → gold-orange (214, #FFAF00) - Sheet: bright blue (33) → cornflower blue (75, #5FAFFF) Orange vs blue is safe for red-green color blindness (deuteranopia/ protanopia) and looks more pleasant than red/blue - Info panel: suppress protein/chain coloring when --structure is active so panel names stay neutral white and don't compete with SS colors - Camera.cpp: keep helix/sheet RGBA mapping in sync (was stale at 196/226) https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
- Panel: always color protein/chain names per mode (protein/chain coloring was incorrectly suppressed when -s was on) - Viewport: in structure mode, only H/S atoms get the SS color overrides; coil/loop atoms keep whatever color the current mode (protein/chain/rainbow) already assigned — gray pair 43 is gone - Remove now-unused init_pair(43) for mid-gray coil https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
…UNRAINBOW
- Screen.cpp: helix/sheet color override now only fires in "protein" mode;
chain and rainbow modes display their own palette colours for all atoms
- Palette.hpp: redesigned UNRAINBOW (40→20 entries) to eliminate every colour
that clashed with the fixed SS pairs:
removed yellows (220, 226, 190, 214/gold = exact helix colour),
removed blues (21, 27, 33, 39, 45, 51, 75 = exact sheet colour)
New set spans red / orange-red / magenta / violet / purple / green /
mint / chartreuse / teal / pink / coral — all clearly distinct from the
gold-orange helix and cornflower-blue sheet markers
https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
Helix ribbon: - radius 3.5 → 2.5 Å (narrower cylinder) - ribbon_lines 2 → 1 (5 stripes → 3 stripes) - ribbon_half_width 0.8 → 0.5 Å SS colors (protein mode only): - helix: gold-orange (214) → white (231) — not present in UNRAINBOW - sheet: cornflower (75) → bright cyan (51) — not present in UNRAINBOW Both choices avoid any clash with the 20-color UNRAINBOW palette. File limit: MAX_STRUCT_NUM and parameter guard 6 → 9 https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
- Helix color reverted to 214 (yellow-gold) — user preferred this - UNRAINBOW: replaced 5 red/orange entries (196, 202, 160, 204, 203) with white (231) and four gray levels (252, 249, 246, 243) so they no longer clash with the yellow-gold helix or cyan sheet markers https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
In default (protein) mode with -s active, coil/loop atoms now get medium gray (pair 43, xterm-246 ~148,148,148) instead of the protein's vivid UNRAINBOW colour. This makes the yellow-gold helix and cyan sheet clearly pop against a neutral background. Chain and rainbow modes are unaffected. https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
…s mode - Default mode: each protein keeps its vivid UNRAINBOW color on all atoms - Default + -s: H/S atoms keep their vivid protein color; coil/loop atoms get medium gray (pair 43, xterm-246) to make the structured regions pop - Chain/rainbow modes: no SS override at all (unchanged) Remove unused yellow-gold (pair 41) and cyan (pair 42) init_pairs. https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
Pair ID layout: 1-9 protein vivid (olive, turquoise, navy, purple, pink, coral, brown, orange, red) 11-19 protein dim — same hues, darker; used for coil in protein+-s mode 21-35 chain colors — same 9 + teal, lime, magenta, gold, lavender, salmon 41 yellow helix (protein+-s only) 42 cyan sheet (protein+-s only) 51-70 rainbow Behavior: - Default mode: each protein gets its own vivid named color - Default + -s: H=yellow, S=cyan, coil=dimmed variant of that protein's color - Chain mode: 15-color named sequence, no SS override - Rainbow mode: unchanged, no SS override Remove UNRAINBOW; update Screen, Camera, Panel to use new pair ranges. https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
Remove -w/--width and -h/--height CLI options. Screen size is now automatically detected from the terminal using getmaxyx() after initscr(), so the visualization always fills the user's terminal. https://claude.ai/code/session_01LaPVogs2SPnVqeSSbd2ux6
LunaJang
added a commit
that referenced
this pull request
Apr 14, 2026
…tion-q42VO Claude/improve structty visualization q42 vo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.