Skip to content

Merge multiple --atomfile files; split gaussian_atoms.yaml#14

Merged
mlund merged 3 commits into
masterfrom
split-atomfiles-merge
Jun 19, 2026
Merged

Merge multiple --atomfile files; split gaussian_atoms.yaml#14
mlund merged 3 commits into
masterfrom
split-atomfiles-merge

Conversation

@mlund

@mlund mlund commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Form-factor definitions composed from several YAML files: repeat --atomfile (or pass a list to the Python Pripps constructor). Files merge in order; last file wins on duplicate species (logged). Merging happens before symbolic resolution, so an !Alias/!United/!Linear in one file can reference a species from another.

Also splits gaussian_atoms.yaml into an atomic/UA-only table — drops the 20 CG residue beads (duplicates of poly_amino_acid.yaml) and 8 unused residue aliases. CG consumers load poly_amino_acid.yaml (or merge it in).

Resolves the mixed-representation file from #7; supersedes #11.

Verified: cargo fmt/clippy clean, 103 Rust tests pass, maturin develop + 10 pytest pass.

Closes #7

Form-factor definitions can now be composed from several YAML files.
Repeat --atomfile (or pass several paths), or give the Python Pripps
constructor a list. Files are merged in order; on a duplicate species the
last file wins and a warning is logged. Merging happens before symbolic
resolution, so an !Alias/!United/!Linear in one file may reference a
species defined in another.

- formfactor.rs: split read_formfactors into parse_specs + finalize_specs;
  add read_formfactors_merged.
- lib.rs: add Pripps::from_yaml_files; from_yaml delegates via from_formfactors.
- cli.rs: --atomfile becomes Vec<PathBuf> (repeatable, order-preserving).
- pripps-py: Pripps(...) accepts a str or list[str].

Split gaussian_atoms.yaml into an atomic/united-atom-only table: drop the
20 coarse-grained residue beads (byte-identical duplicates of
poly_amino_acid.yaml) and 8 unused residue-level aliases, and rewrite the
header. Residue-bead consumers load poly_amino_acid.yaml (or merge it with
the atomic file). This resolves the mixed-representation file and
supersedes the rename-only approach in #11.

Closes #7
Copilot AI review requested due to automatic review settings June 18, 2026 16:21
@mlund mlund mentioned this pull request Jun 18, 2026

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.

⚠️ Not ready to approve

A newly added test writes to fixed filenames in the global temp directory, which can cause flaky failures under parallel test execution.

Pull request overview

Adds support for composing form-factor definitions from multiple YAML files (merged in order with “last file wins” on duplicate species), updates the CLI and Python bindings to accept multiple inputs, and cleans up shipped assets by splitting coarse-grained residue beads out of assets/gaussian_atoms.yaml into the dedicated residue table.

Changes:

  • Implement pre-resolution merging of multiple YAML form-factor spec files (read_formfactors_merged) and expose it via Pripps::from_yaml_files.
  • Update CLI (--atomfile/-a) and Python constructor to accept one or more form-factor files.
  • Split assets/gaussian_atoms.yaml to be atomic/UA-only and update docs/tests to use the residue table where appropriate.
File summaries
File Description
src/lib.rs Adds from_yaml_files constructor and updates a test to use the CG residue form-factor table.
src/formfactor.rs Refactors YAML loading into parse/finalize stages and adds merged multi-file loader + test.
src/cli.rs Changes --atomfile/-a to accept multiple paths and wires it to from_yaml_files.
README.md Documents multi-file merging behavior and updates the shipped form-factor table descriptions/examples.
pripps-py/src/lib.rs Allows Python Pripps(...) to accept either a single path or a list of paths.
assets/gaussian_atoms.yaml Removes CG residue beads/aliases so the file is atomic/united-atom only, with updated header guidance.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


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

Comment thread src/formfactor.rs Outdated
Comment thread README.md Outdated
given — repeat `--atomfile` (or pass several paths) on the CLI, or pass a
list to the Python constructor:

```bash

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

No need to give examples, just keep this brief

Comment thread README.md
| File | Description | Best for |
|------|-------------|----------|
| `assets/foxs_formfactors.yaml` | Cromer-Mann (Int. Tables Vol. C) atomic form factors, FoXS-compatible volumes and SASA radii | Atomic PDBs with `--excluded foxs` |
| `assets/gaussian_atoms.yaml` | Mixed table: residue single-bead polynomials plus atomic/united-atom Gaussians (CH/CH₂/NH/…) | Atomic PDBs with PepsiSAXS-style solvent models |

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Perhaps a better name is pepsi_atoms.yaml? It would be more useful to end user. But is it true?

Comment thread assets/pepsi_atoms.yaml
@@ -1,364 +1,8 @@
# Amino acid single bead approximation for atomistic scattering

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Mention origin of these values? pepsi?

- Rename gaussian_atoms.yaml -> pepsi_atoms.yaml and document provenance:
  atomic five-Gaussians are Waasmaier & Kirfel (1995); united-atom groups
  and K=4π solvent convention are PepsiSAXS (Grudinin et al. 2017). Update
  all references (tests, script, README) and link DOIs inline.
- Trim the README "Merging multiple files" section per review.
- Use tempfile::tempdir() in the merge test to avoid fixed temp-file names
  colliding under parallel test runs.
@mlund

mlund commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

Addressed in 21580ec:

  • Renamed gaussian_atoms.yamlpepsi_atoms.yaml and documented provenance. Confirmed the atomic five-Gaussians are the Waasmaier & Kirfel (1995) parametrization (valid sinθ/λ ∈ [0,6] Å⁻¹, matching the qrange), used with PepsiSAXS united-atom groups and the K=4π convention. Header + README updated, DOIs linked inline; all references updated.
  • README merging section trimmed to be brief (dropped the examples).
  • Merge test now uses tempfile::tempdir() instead of fixed temp filenames, so it won't collide under parallel runs.

cargo fmt/clippy clean, 103 Rust tests + 10 pytest pass.

@mlund
mlund merged commit 4b6a1a7 into master Jun 19, 2026
1 check passed
@mlund
mlund deleted the split-atomfiles-merge branch June 19, 2026 08:02
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.

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

2 participants