Skip to content

Sba formfactors#5

Merged
mlund merged 25 commits into
masterfrom
sba_formfactors
Jun 16, 2026
Merged

Sba formfactors#5
mlund merged 25 commits into
masterfrom
sba_formfactors

Conversation

@IVinterbladh

Copy link
Copy Markdown
Collaborator
  • Removed incorrect Amino acid form factors from Single_beads.yaml
  • Added yaml-files for the polynomial form factor for the amino acid and matrini3 beads. Both with and without excluded solvent in addition to pure excluded solvent models.
  • Added a new excluded solvent method where a polynomial form factor from the yaml-file is used.
  • Updated python notebook for plotting results.

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

This PR adds support for polynomial form-factor tables (including a new “polynomial” excluded-volume model) and updates the structure atom-kind resolution to support residue-scoped coarse-grained names, alongside new/updated test datasets and form-factor assets.

Changes:

  • Added a new excluded-volume model (ExcludedVolume::Polynomial) that reads per-kind excluded-volume form factors from a dedicated YAML table.
  • Updated structure atom-kind lookup to prefer residue-scoped keys (RES_ATOM) before falling back to united-atom and atom-name-only lookup (with unit tests).
  • Added/updated polynomial form-factor YAML/CSV assets and supplemental test/example inputs (lysozyme XYZ, batch fitting script, README updates).

Reviewed changes

Copilot reviewed 22 out of 25 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/lysozyme/lyzexp.dat Adjusts lysozyme experimental data header/comment line.
tests/lysozyme/6lyz.xyz Adds an XYZ structure file for lysozyme test/example usage.
src/structure.rs Adds residue-scoped atom-kind resolution with tests.
src/solvent/polynomial_excluded.rs Implements polynomial excluded-volume dummy generation from a separate YAML table (+ tests).
src/solvent/mod.rs Wires the new ExcludedVolume::Polynomial variant into solvent dummy generation and scaling.
src/cli.rs Adds CLI support for --excluded polynomial and an optional --excluded-atomfile path.
README.md Documents the new excluded-volume option and excluded_atomfile parameter in Python examples/tables.
pripps-py/src/lib.rs Exposes excluded_atomfile and the polynomial excluded model in the Python bindings.
pripps-py/examples/batch_sba_sasbdb.py Adds a batch-fitting helper script for SASBDB cache entries using the polynomial excluded-volume model.
assets/single_bead.yaml Updates/removes incorrect single-bead form factors and reorganizes amino-acid bead definitions.
assets/poly_martini_excl.yaml Adds Martini polynomial excluded-volume form-factor table (YAML).
assets/poly_martini_excl.csv Adds Martini polynomial excluded-volume coefficients source (CSV).
assets/poly_martini_atomic.yaml Adds Martini polynomial atomic form-factor table (YAML).
assets/poly_martini_atomic.csv Adds Martini polynomial atomic coefficients source (CSV).
assets/poly_martini_atev.yaml Adds Martini polynomial ATEV form-factor table (YAML).
assets/poly_martini_atev.csv Adds Martini polynomial ATEV coefficients source (CSV).
assets/poly_excl.yaml Adds amino-acid polynomial excluded-volume form-factor table (YAML).
assets/poly_excl.csv Adds amino-acid polynomial excluded-volume coefficients source (CSV).
assets/poly_atomic.yaml Adds amino-acid polynomial atomic form-factor table (YAML).
assets/poly_atev.yaml Adds amino-acid polynomial ATEV form-factor table (YAML).
assets/poly_atev.csv Adds amino-acid polynomial ATEV coefficients source (CSV).

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

Comment thread tests/lysozyme/lyzexp.dat Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread src/solvent/polynomial_excluded.rs Outdated
Comment thread pripps-py/examples/batch_sba_sasbdb.py
Comment thread pripps-py/examples/batch_sba_sasbdb.py
Comment thread pripps-py/examples/batch_sba_sasbdb.py Outdated
IVinterbladh and others added 3 commits May 29, 2026 14:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread assets/poly_atev.csv Outdated
Comment thread pripps-py/examples/testing_single-bead_approximation.ipynb
Comment thread assets/poly_excl.csv Outdated
Comment thread tests/lysozyme/sba_fit.pdf Outdated
IVinterbladh and others added 15 commits June 12, 2026 14:48
…f the same file as the atomistic form factors and not a separate file. Code changed accordingly such that the excluded solvent form factors will be called from the same file as the others.
…ady had it)and added such that all three have the same scaling to experimental data
…nts from the model when using the grid version
Polynomial excluded volume reads `excluded_solvent` from the per-bead
entries in the main atom file, so the separate `excluded_atomfile` /
`--excluded-atomfile` parameter is dead surface area. Remove it from the
CLI args and from all three pyo3 model constructors plus the
`solvent_from_kwargs` helper. Drop the now-orphaned `log` dependency in
pripps-py (its only direct use was the deprecation warning).

Also:
- polynomial_excluded: defer the `kind_name` lookup into the error path
- structure: collapse nested `if let` into a let-chain (clippy)
…ders

The "polynomial" excluded-volume model named an incidental form-factor
representation rather than its mechanism: it reads an explicit per-kind
`excluded_solvent` form factor from the table (which need not be a
polynomial), unlike the geometry-derived Fraser/FoXS/Grid/Voronoi
variants. Rename the model to `PerKind` across the enum, CLI
(`--excluded per-kind`), Python bindings (`excluded="per-kind"`), the
module file (`per_kind_excluded.rs`), and README. The per-kind
`excluded_solvent` field name is unchanged.

Also clarify the poly_ asset header comments: the plain files keep the
excluded solvent as a separate, fittable `excluded_solvent` term
(`--excluded per-kind`), while the `_combined` files fold it into a
single form factor (`--excluded disabled`). Fix stale CSV provenance
lines to reference the current file names.
The PerKind rename of the excluded-volume model broke the example
references to the old `excluded="polynomial"` string. Update the batch
script and the notebook source cell to `excluded="per-kind"`.

Also rename the cryptic batch_sba_sasbdb.py to
batch_single_bead_fit_sasbdb.py (matching the notebook's spelled-out
"single-bead") and expand SBA/SASBDB in its docstring.
@mlund

mlund commented Jun 16, 2026

Copy link
Copy Markdown
Owner

@IVinterbladh assets/gaussian_atoms.yaml (renamed from single_bead.yaml) actually holds two different representations in one file:

  • 20 coarse-grained residue beads (ALA…VAL) as !Polynomial form factors over qrange: [0.0, 0.75] — i.e. single-bead-approximation entries.
  • the full atomic / united-atom set (N, C, O, H, CH, CH₂, CH₃, …) as !Gaussian / !Alias / !United over qrange: [0.0, 6.0].

So both the filename gaussian_atoms and the header comment # Amino acid single bead approximation for atomistic scattering are a bit misleading — the file is neither purely Gaussian atoms nor purely single-bead.

Could you either split it into separate atomistic and CG-bead files, or at least pick a name that covers both and rewrite the header comment to describe the two parts? Just flagging so the asset names stay self-explanatory.

@mlund mlund added the enhancement New feature or request label Jun 16, 2026
Comment thread assets/gaussian_atoms.yaml
mlund added 2 commits June 16, 2026 20:28
The `excluded_solvent` form-factor field was shown in the YAML example
and the model/shipped-files tables but never explained: add a property-
table row and a paragraph describing that it is a second form factor for
the displaced bulk solvent, read only by the `per-kind` excluded-volume
model. Also add a `!Linear` example to the YAML snippet so every model
in the supported-models table is illustrated.
List all seven shipped YAML assets (was three): add stovgaard2010,
poly_martini, and both `_combined` variants, pair each `per-kind` file
with its `combined` counterpart, and correct the gaussian_atoms entry to
note it is a mixed residue-polynomial + atomic-Gaussian table.
@mlund
mlund merged commit f9fae8f into master Jun 16, 2026
1 check passed
@mlund
mlund deleted the sba_formfactors branch June 16, 2026 18:33
mlund pushed a commit that referenced this pull request Jun 17, 2026
These two classes arrived from master (PR #5) after the original
docstring commit, so they lacked the class-level `__doc__` that Pripps
and MultipoleModel already carry. Mirror the same description.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants