Merge multiple --atomfile files; split gaussian_atoms.yaml#14
Conversation
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
There was a problem hiding this comment.
⚠️ 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 viaPripps::from_yaml_files. - Update CLI (
--atomfile/-a) and Python constructor to accept one or more form-factor files. - Split
assets/gaussian_atoms.yamlto 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.
| given — repeat `--atomfile` (or pass several paths) on the CLI, or pass a | ||
| list to the Python constructor: | ||
|
|
||
| ```bash |
There was a problem hiding this comment.
No need to give examples, just keep this brief
| | 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 | |
There was a problem hiding this comment.
Perhaps a better name is pepsi_atoms.yaml? It would be more useful to end user. But is it true?
| @@ -1,364 +1,8 @@ | |||
| # Amino acid single bead approximation for atomistic scattering | |||
There was a problem hiding this comment.
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.
|
Addressed in 21580ec:
|
Form-factor definitions composed from several YAML files: repeat
--atomfile(or pass a list to the PythonPrippsconstructor). Files merge in order; last file wins on duplicate species (logged). Merging happens before symbolic resolution, so an!Alias/!United/!Linearin one file can reference a species from another.Also splits
gaussian_atoms.yamlinto an atomic/UA-only table — drops the 20 CG residue beads (duplicates ofpoly_amino_acid.yaml) and 8 unused residue aliases. CG consumers loadpoly_amino_acid.yaml(or merge it in).Resolves the mixed-representation file from #7; supersedes #11.
Verified:
cargo fmt/clippyclean, 103 Rust tests pass,maturin develop+ 10 pytest pass.Closes #7