Skip to content

feat: add APBS electrostatic surface demo#2

Merged
FridrichMethod merged 3 commits into
mainfrom
feat/apbs-surface-demo
Jun 26, 2026
Merged

feat: add APBS electrostatic surface demo#2
FridrichMethod merged 3 commits into
mainfrom
feat/apbs-surface-demo

Conversation

@FridrichMethod

Copy link
Copy Markdown
Owner

Summary

Adds an APBS electrostatic surface demo, computed with the real APBS Poisson-Boltzmann solver and rendered in the same style as the existing surface demo.

  • scripts/apbs/prepare_apbs.sh — pipeline: download 2EWN → isolate chain A → pdb2pqr (AMBER charges/radii) → apbs (linearised PBE, 0.150 M NaCl, pdie 2.0 / sdie 78.54) → potential map 2ewn.dx (units kT/e).
  • scripts/demos/apbs.pml — loads the .pqr + .dx, colours the molecular surface by potential over [-5, 0, 5] kT/e (ramp_new / surface_color), mirroring the mdpp/examples/apbs viz scripts. Uses an explicit set_view copied from surface.pml so both demos share the same camera.
  • CI (render-demos.yml) — installs apbs + pdb2pqr, runs prepare_apbs.sh before the render loop.
  • .gitignore — ignores generated APBS artifacts (.pqr / .dx / .in / .pdb, the 67 MB map regenerates in CI) and the APBS scratch file io.mc.
  • README — new APBS demo section.

Test plan

  • Reproduced CI locally (conda pymol-open-source, apbs 3.4.1, pdb2pqr 3.7.1); committed PNG is byte-identical to the CI render.
  • render-demos workflow passes green on the branch (real APBS solve runs in CI: Global net ELEC energy = 3.07e+05 kJ/mol).
  • Camera verified to match demo_surface.png.

Render a vacuum electrostatic potential surface for 2ewn (E. coli biotin
repressor) using util.protein_vacuum_esp (protein contact potential mode),
mirroring the existing surface demo's structure prep. Adds scripts/demos/
apbs.pml, the rendered assets/demo_apbs.png, and a README section.
Replace the vacuum-ESP approximation with a true Poisson-Boltzmann
electrostatics pipeline:

- scripts/apbs/prepare_apbs.sh: pdb2pqr (AMBER charges/radii) -> apbs
  (linearised PBE, 0.150 M NaCl) -> potential map (.dx, kT/e) for 2ewn
  chain A.
- scripts/demos/apbs.pml: load the .pqr + .dx and colour the molecular
  surface by potential over -5..+5 kT/e (ramp_new/surface_color), mirroring
  the mdpp examples/apbs viz scripts.
- CI: install apbs + pdb2pqr and run prepare_apbs.sh before rendering.
- gitignore generated APBS artifacts (.pqr/.dx/.in/.pdb) and the apbs
  solver scratch file io.mc.
Replace orient with the explicit set_view matrix copied from
scripts/demos/surface.pml so both demos share the same viewpoint
(orient on the pqr atom set diverged: added hydrogens, no ligand).
Copilot AI review requested due to automatic review settings June 26, 2026 01:55
@FridrichMethod FridrichMethod merged commit 3310bba into main Jun 26, 2026
1 check passed
@FridrichMethod FridrichMethod deleted the feat/apbs-surface-demo branch June 26, 2026 01:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an APBS-based electrostatic surface demo to the PyMOL demos set, including a script to generate APBS inputs/outputs and CI updates to generate artifacts before rendering.

Changes:

  • Add a new PyMOL demo (scripts/demos/apbs.pml) that colors a molecular surface by APBS potential from a .dx map.
  • Add an APBS preparation pipeline script (scripts/apbs/prepare_apbs.sh) to download a PDB, generate .pqr/.in, run APBS, and normalize outputs.
  • Update CI, .gitignore, and README to include the new APBS demo and its generated artifacts.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/demos/apbs.pml New demo script that loads .pqr/.dx and renders an electrostatic surface PNG.
scripts/apbs/prepare_apbs.sh New generator pipeline to produce the APBS input/output artifacts used by the demo.
.github/workflows/render-demos.yml Installs APBS + PDB2PQR and runs the generator before rendering demos in CI.
.gitignore Ignores generated APBS artifacts and a scratch file.
README.md Adds the new APBS demo image to the Demos section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to +26
echo "[apbs-prep] downloading ${PDB_ID}..."
curl -sSL -o "${PDB_ID}.pdb" "https://files.rcsb.org/download/${PDB_ID^^}.pdb"
Comment on lines +23 to +24
pdb2pqr_bin="$(command -v pdb2pqr30 || command -v pdb2pqr)"

Comment on lines +38 to +40
sed -i "s#write pot dx ${PDB_ID}.pqr#write pot dx ${PDB_ID}#" "${PDB_ID}.in"
sed -i "s#^ lpbe# ion charge +1 conc 0.150 radius 2.0\n ion charge -1 conc 0.150 radius 2.0\n lpbe#" \
"${PDB_ID}.in"
Comment thread scripts/demos/apbs.pml
ramp_new 2ewn_esp, 2ewn_potential, [-5, 0, 5], [red, white, blue]
set surface_color, 2ewn_esp, 2ewn

# set the view (same camera as scripts/demos/surface.pml)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants