pemsley/coot/model-building
Claude Code and agent skill by pemsley/coot
- community
Checking that the SKILL.md file is still in the repository.
Best Practices for Model-Building Tools and Refinement
Install
npx vskill@latest install pemsley/coot/model-buildingSKILL.md
Key Lessons from Chain A Refinement Session
Workflow Checklist - Follow This for Model-Building and Refinement
Best practices for fixing any issue:
- ☐ ALWAYS recentre first — every time you move to a new residue or problem, call this BEFORE anything else:
coot.set_go_to_atom_chain_residue_atom_name(chain, resno, "CA") or coot.set_rotation_centre(x, y, z) for a map position. The user is watching the screen. If you switch targets without recentring, they will be looking at the wrong place while you work elsewhere. This is confusing and unacceptable.
- ☐ Check current metrics (Rama/correlation/overlaps)
- ☐ Make checkpoint if trying something experimental
- ☐ Apply fix
- ☐ Re-check metrics to confirm improvement
- ☐ If worse, restore checkpoint
Jiggle Fitting a Whole Chain
When to use jiggle fitting
Use fit_chain_to_map_by_random_jiggle_and_blur() when a whole chain needs to be placed or re-placed in the map — before any residue-level refinement. Note, however, that the fit is only local. If the whole chain is (say) 10 or more Angstroms away from the real position, then fit_chain_to_map_by_random_jiggle_and_blur() will not work. The per-residue density correlation graph is the key diagnostic: if the mean correlation across the whole chain is near zero with high variance (many residues below 0.4, many negative), the chain is in the wrong place and jiggle fitting is the right first step.
Do not attempt residue-level fixes (rotamers, pepflips, refinement) until the chain is correctly placed. Those tools cannot recover a globally misplaced chain.
Diagnosing misplacement from the correlation graph
Before jiggling, always get a fresh per-residue correlation to use as a true baseline:
Interpretation:
- Mean > 0.7, few residues below 0.4 → chain is well-placed, proceed to residue-level work
- Mean 0.4–0.7, moderate number below 0.4 → chain placed but needs refinement
- Mean near zero, high variance, many negative → chain is in the wrong place, jiggle fit first
Why negative correlations occur in cryo-EM maps: cryo-EM maps are Fourier-based (no F000 term), so the mean density is zero. Negative density exists between atomic features as a mathematical consequence of the reconstruction — not a physical reality. A misplaced chain within the molecular envelope samples this real structured signal (both positive peaks and negative troughs) from the wrong part of the map, producing scattered correlations around zero. This is distinct from sitting in solvent, which gives low-magnitude, low-variance correlations.
Running the jiggle fit
Set the refinement map first, then use the blur variant for cryo-EM:
Return values: the function returns a score (higher = better fit) or a large negative number (e.g. −100, −999) when it cannot improve on the current placement. These large negative returns are not errors — they mean the current position is already a local optimum, or the function had difficulty scoring. Do not treat them as failures without checking the actual correlation afterwards.
Blur factor guidance: the blur smooths the map by a something like a Fourier filter, effectively low-pass filtering it. A higher blur factor produces a smoother map with broader features, which helps the chain find the correct region before fine-grained fitting. For cryo-EM maps, blur factors of 100–200 are typical starting points.
Confirming the result
Always re-run the per-residue correlation after jiggling and compare to the baseline:
A successful jiggle fit for a correctly placed chain should bring the mean correlation above 0.6, with most residues above 0.7. Remaining poor-fitting residues in loop regions are expected and addressed by subsequent residue-level refinement.
Visualising the before/after result
Use the coot-inline-graphs skill to render a before/after bar chart with secondary structure overlays. Fetch secondary structure from PDBe (/api/pdb/entry/secondary_structure/{pdb_id}) rather than relying solely on Coot's header secondary structure detection, which may miss strands — particularly single- residue assignments and short strands in nanobody/VHH-type folds.
Complete workflow summary
Refinement Best Practices
1. Make Checkpoints Before Model Changes
CRITICAL: Always create a checkpoint before making significant model changes.
Use make_backup_checkpoint() before any operation that might need to be reverted:
- Adding/deleting residues
- Adding ligands or waters
- Major refinement operations
- Any experimental model building
Why checkpoints are better than undo:
apply_undo()only steps back one operation at a time- Checkpoints let you jump back to a specific point
- Named checkpoints are self-documenting
- Multiple checkpoints allow comparing different approaches
MANDATORY: Complete Validation Workflow
CRITICAL: You MUST check ALL validation metrics before AND after EVERY fix.
Fixing only one problem (e.g., Ramachandran) while leaving others (rotamer, density fit) is a FAILED fix. A residue is only "fixed" when ALL metrics are acceptable.
Before fixing ANY residue:
- ALWAYS center on it:
coot.set_go_to_atom_chain_residue_atom_name(chain, resno, "CA") - ALWAYS check ALL of these:
- Ramachandran probability (from
all_molecule_ramachandran_score_py) - Rotamer score (from
rotamer_graphs_py) - Density correlation - both all-atom and side-chain (from
map_to_model_correlation_stats_per_residue_range_py) - Atom overlaps involving this residue (from
molecule_atom_overlaps_py)
After fixing ANY residue:
- ALWAYS re-check ALL the same metrics, Sometime residues/issues are just
not fixable (that's what makes refinement and model-building tricky).
- Try to make the following true (but knowing that it might not actually be possible)
- Ramachandran probability > 0.02 (preferably > 0.1)
- Rotamer score > 1.0% (preferably > 5%)
- Density correlation > 0.7 (all-atom and side-chain, preferably > 0.8)
- No severe clashes (< 2.0 Å cubed overlap volume)
If ANY metric is still bad after your first fix:
- MUST try additional fixes:
- Bad rotamer →
auto_fit_best_rotamer(), and try experiment with following that up
with refine_residues_py() for that residue and its upstream and downstream neighbours (if any).
- Poor density fit → try alternative rotamers, check for missing atoms
- Persistent clashes → refine with the addition of spatial neighbours using
residues_near_residue_py()
- NEVER declare a residue "fixed" based on only one metric improving
- ALWAYS re-validate after each additional fix
Acceptable Reasons to Stop (without perfect metrics):
- You've tried multiple approaches and documented them
- The best achievable metrics are still recorded
- You've created checkpoints to compare approaches
- You explain why the residue remains problematic (e.g., poor density, crystal contact)
Example of CORRECT Workflow
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingmcp/docs/skills/model-building/SKILL.md
Popularity
- Repository stars
- 162
- Repository forks
- 59
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 14 May 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/pemsley/coot/model-building)