Repository navigation
Add open-source Amber ff14SB + OpenFF Sage parametrization for protein systems - #63
Conversation
Implementation Plan — Amber ff14SB + OpenFF Sage for
|
| File | Change |
|---|---|
mdfactory/models/parametrization.py |
AmberConfig (pinned FF/water validator, Sage fields, a helper that returns the matching SmirnoffConfig), union tag amber |
mdfactory/models/input.py |
"amber" in the Literal, allowed_parametrizations and the default-config map; the merge_all/chains validator applies to Amber too |
mdfactory/models/species.py |
FF-neutral native-species error message |
mdfactory/parametrize.py |
native_forcefield_dir short-circuit in parametrize_smirnoff_gromacs; Sage branch, [ defaults ] check and collision check in generate_gromacs_topology_with_protein; generic comments |
mdfactory/utils/topology_utilities.py |
[ defaults ] parse/compare helper; atom-type collision helper (reuses _atomtype_signature) |
mdfactory/utils/setup_utilities.py |
native_atom_names plus the charmm_native_atom_names alias; docstring update |
mdfactory/build.py |
build_proteinbox accepts AmberConfig; parametrizer selection helper used by build_protein_mixedbox; version gate call in _prepare_protein; _finalize_protein_build passes the parametrization |
mdfactory/setup/protein.py |
GROMACS version parsing and gate, the min-version table, run_pdb2gmx type hint |
mdfactory/run_schedules/__init__.py, run_schedules.yaml, run_schedules/gromacs/proteinbox_amber/*.mdp |
optional parametrization selection; Amber schedule |
mdfactory/orchestration/apps.py, simulate.py (and the stage/script call site) |
optional min-version check in the grompp script, with the requirement derived from the sim dir topology |
pyproject.toml, pixi.lock |
gmx / gmx-cuda features and environments |
examples/proteinbox/*, examples/protein_mixedbox/* |
Amber YAML and CSV examples |
docs/content/docs/user-guide/parametrization.mdx, installation.mdx |
Amber route and the GROMACS ≥ 2026 note |
| tests (below) | new and extended tests |
Testing approach
All of the following are mocked: no real gmx and no CGenFF. They run under -k "not build". Tests assert contracts (selected files, raised errors, presence of settings), not incidental exact output.
tests/test_proteinbox.pyAmberConfig: defaults, frozen, rejects a non-amber14sb force field and a non-tip3p water model.BuildInputwithamberfor both protein types, as YAML-style dict and through CSV row parsing. Rejected for non-protein types._prepare_protein/ version gate with a mockedgmx --version:2026.3-conda_forgepasses;2024.3raises before the pdb2gmx subprocess is called;- the CHARMM config never calls the gate.
run_pdb2gmxwithAmberConfigpasses-ff amber14sb -water tip3p, reusing_patch_pdb2gmx. TheHIEprotonation is passed through unchanged (no CHARMM alias).- Version-string parser:
2026.3-conda_forge,2024.3,2026.0-dev-…,2026-beta1, and garbage, which raises a clear error.
tests/test_protein_mixedbox.pyparametrize_smirnoff_gromacs(..., native_forcefield_dir=fake_ff): water and Na⁺/Cl⁻ returntip3p.itp/ions_tip3p.itpwithparameter_itp=None, and no SMIRNOFF cache directory is created. Done with a fake ff dir undertmp_pathand a temporarysettings.parameter_store.- Parametrizer selection helper:
CharmmConfiggives cgenff +parametrize_cgenff_gromacs;AmberConfiggives smirnoff +parametrize_smirnoff_gromacswith the native dir bound. TestCompositeTopologyextended with fixture Sage_params.itpfiles and a fake amberff_dir:- a matching
[ defaults ](0.833333 vs 0.83333333333333333) is dropped and the Sage atom types are present inextra_params.itp; - a mismatching
[ defaults ](e.g.fudgeQQ 1.0or comb-rule 3) raises; - an atom-type name collision with an FF type raises;
- an inter-file conflicting duplicate raises;
validate_cgenff_atomtype_compatibilityis not called (monkeypatched to raise);- small-molecule ITPs are included before the water include;
- mixed CGenFF + SMIRNOFF raises.
- a matching
topology_atom_namesfor a Sage solute ITP returns the ITP atom names.native_atom_namesand the alias.TestExampleFilesloads the new Amber examples.TestRunSchedule: Amber selection returnsproteinbox_amberfiles whose parsed mdp (via the existing mdp parser) has the six Sage-style settings. The default (no parametrization) still returns the CHARMM files.
tests/test_orchestration_*(simulate/script tests)- The grompp script includes the version check only when a minimum is given.
- The requirement is derived from a topology including
amber14sb.ff/forcefield.itp(2026) and from a CHARMM topology (none). - One cheap bash test runs the generated detection and check snippet with a fake
gmxonPATHprinting2024.3; it must exit non-zero with the message. A fake printing2026.3must pass.
- Real-GROMACS test (opt-in): skipped unless
gmx≥ 2026 is on PATH, and named withbuildso CI skips it. It runspdb2gmxamber14sb on a tiny peptide fixture plus a Sage solute composite topology andgrompp -maxwarn 0with the Amberem.mdp. - E2E (cluster,
cpu/gpupartitions, scratch dirmdfactory_e2e/): the two lysozyme Amber examples through build andmdfactory simulate(EM/NVT/NPT/short MD), plus a check with the 2024.3 module that the gate fires. The results go in a PR progress comment.
Risks and open questions
- GPU build. The conda-forge
nompi_cuda2026.3 build has not been tested on thegpu(l40s) nodes; driver and CUDA compatibility is unknown. Fallback: run GPU e2e with an env-local build, or report CPU-only and keep the GPU criterion open. - Which
gmxthe jobs see.$GMX_BINdetection prefersgmxon PATH, so the job must activate the pixi env (worker_init/ SLURM preamble, related to issue 22). If a modulegmx_mpiwins, the new gate makes this fail early instead of silently, which satisfies the criterion. But the e2e run needs the env activated, and the plan must document how. - Sage
[ atomtypes ]column format inside a protein topology. Interchange writes a different column layout from amber14sb'sffnonbonded.itp. grompp parses per line, and the SMIRNOFF mixedbox path already relies on this, but it is only proven by the real-gmx test and e2e. - Atom-type collisions between two Sage species that share a resname (
<RESNAME>_<i>). The new collision check turns this into a clear error. The real fix (unique type naming) belongs to issue 61. - SMIRNOFF cache key ignores
charge_method/water_model. This is a pre-existing problem; the Amber path shares the cache with plainsmirnoffbuilds that use the same offxml. Out of scope (issue 61); mentioned in the docs note. - Net charge. Sage solutes are neutral for ethanol. Charged solutes with
neutralize: falserely on the existingallow_net_chargegrompp path, which is unchanged. - LEaP improper reordering vs the OpenMM prep stage. No difference for lysozyme in the spike. Unusual residues could differ, but only in the restrained prep stages. Accepted.
- pixi lock churn. Adding features re-solves the lock. Keeping
gromacsout ofdefault/devlimits the impact on CI.
Out of scope
- ff19SB / OPC / OPC3;
- the SMIRNOFF ff14SB port;
- ParmEd/Interchange OpenMM→GROMACS conversion;
- the 2024.3 cluster module;
- the nomenclature/config refactor (issue 61);
- generated mdp schedules (issue 62);
- aligning the OpenMM prep nonbonded settings;
- the
lnpmdp directory, issue 55, and the CHARMMMET1tdb bug.
Plan created by mach6
Progress UpdateAll deliverables from the plan are implemented, and the end-to-end runs have passed, on CPU and on GPU. Implementation
Deviations from the plan
E2E resultsThe runs used no CGenFF/SILCSBIO configuration. Scratch directory:
Topology of the lysozyme + ethanol build. It includes, in order:
Related findings (not fixed, out of scope)
Commit: Progress tracked by mach6 |
Unverified Review Candidates — Pending AssessmentReview round: 1
CriticalNone. ImportantNone. Suggestions
Strengths
Other notes (below threshold, not candidates): the stored Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review AssessmentFindings comment: #63 (comment) Review round: 1 — Reviewed commit: ce2a170 Classifications
Additional notes
Action PlanNo merge blockers. Assessment by mach6 |
ce2a170 to
d4b0395
Compare
Closes #60
Adds an open-source parametrization route (
parametrization: amber) forproteinboxandprotein_mixedboxthat needs no CGenFF/SILCSBIO license:amber14sb.ffviapdb2gmx.It also adds a GROMACS ≥ 2026 version gate (build and simulate time), a run schedule with Sage-style nonbonded settings, and pixi GROMACS 2026 environments.
Stacked on PR #59 (
feature/protein-mixedbox).Implementation plan posted as a comment below.