Skip to content

My patches may2026#25

Open
ingcoder wants to merge 3 commits into
graeter-group:mainfrom
ingcoder:my-patches-may2026
Open

My patches may2026#25
ingcoder wants to merge 3 commits into
graeter-group:mainfrom
ingcoder:my-patches-may2026

Conversation

@ingcoder
Copy link
Copy Markdown

Problem
Running colbuilder with PYD (trivalent) crosslinks in geometry mode produced two categories of failures:

~20/45 martinize2 calls failed — the cap_pdb() function detected NME-capped chain ends but still passed -cter NME to martinize2, asking it to cap chains that were already capped. This caused martinize2 to error on those models.

Trivalent crosslinks were not detected — itp_.make_topology() was called with model_id when it needed cnt_model. The crosslink lookup reads the merged CG PDB as {cnt_model}.merge.pdb, so passing the wrong counter meant the merge file was never found and crosslink bonds were silently skipped.

Additionally, the final system .top listed #include "col_N.itp" for all N from 0 to total model count, even when some models failed or were skipped, causing GROMACS to fail on missing include files.

Changes

martini.py
cap_pdb(): if all chains already end in NME, set cter=none instead of cter=NME. Prevents double-capping.
cap_pdb(): restore proper N-terminus detection (ACE, GLN, or default ACE) instead of always none.
itp_.make_topology(): pass cnt_model (output file counter) instead of model_id. Fixes crosslink detection from merge file.
write_system_topology(): only #include topology files that were actually written, using the output counter, not the fibril model ID. Prevents GROMACS missing-include errors when models are skipped.

amber.py
write_itp(): match both Protein and Protein_chain_A when extracting the topology block from GROMACS output. GROMACS renamed this in version 2023+.

colbuilder.py
Move stage imports (build_sequence, build_geometry_anywhere, build_topology) from module level into the functions that use them. Prevents import errors at startup when optional dependencies are missing.

pyproject.toml
Bump numpy to >=1.26 (required for Python 3.12).
Pin vermouth==0.9.6 to newer version

Testing
Verified against a full rattus norvegicus fibril build with N_PYD_C_PYD trivalent crosslinks:
martinize2 failure rate dropped from ~20/45 to 0
Trivalent PYD crosslink bonds, angles and dihedrals present in all col_N.itp files
Final system .top includes only successfully built topology files

ingcoder added 3 commits May 27, 2026 15:01
- martini.py: set cter=none when chains already end in NME (fixes ~20/45 martinize2 failures)
- martini.py: pass cnt_model not model_id for merge-file lookup (fixes trivalent crosslink detection)
- amber.py: match 'Protein' or 'Protein_chain_A' for GROMACS version compat
- colbuilder.py: defer stage imports to avoid startup import errors
- pyproject.toml: numpy>=1.26 (Python 3.12), vermouth==0.9.6 (match reference run)
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.

1 participant