-
Notifications
You must be signed in to change notification settings - Fork 0
Crash on Placement when include-input-conformation is Enabled #29
Description
Description:
A critical bug causes the application to crash during the side-chain placement workflow whenever the include-input-conformation option is set to true. The error message consistently points to a failure in place_rotamer_on_system, indicating that a Rotamer template is missing a required anchor atom (e.g., 'CA').
This issue arises from a flaw in the data handling pipeline for rotamers extracted from the input MolecularSystem:
-
Rotamer Extraction: When
include-input-conformationis enabled, theRotamerLibrary::include_system_conformationsfunction is called. This function correctly clones atoms from the input system to create newRotamerobjects representing the initial side-chain conformations. -
Missing Parameterization: The core of the problem is that these newly extracted
Rotamerobjects are never parameterized. They are added directly to theRotamerLibrary. As a result, all atoms within these rotamers retain their defaultAtomRoleofOther. -
Downstream Failure: Later in the workflow (e.g., during EL energy calculation or clash resolution), the
place_rotamer_on_systemfunction receives one of these unparameterized rotamers. When it attempts to find anchor atoms for alignment, its filter foratom.role == AtomRole::Backbonefails because all atoms have theOtherrole. This leads to an empty set of backbone atoms and triggers the "Anchor atom not found" error, causing the crash.
This bug effectively renders the include-input-conformation feature unusable and prevents workflows that rely on sampling the native conformation.
Tasks:
-
Phase 1: Refactor
include_system_conformationsto Accept Parameterizer (scream-core/src/core/rotamers/library.rs)- Modify the signature of
RotamerLibrary::include_system_conformationsto accept a reference to theParameterizer. - Inside the function, after a
Rotameris successfully extracted from the system, immediately callparameterizer.parameterize_rotameron it. This ensures that its atoms are assigned the correct roles (Backbone,Sidechain) and physicochemical properties before it is added to the library.
- Modify the signature of
-
Phase 2: Update Workflow to Pass Parameterizer (
scream-core/src/workflows/place.rs)- In the main
place::runworkflow, locate the call torotamer_library.include_system_conformations. - Ensure this call happens after the
Parameterizerhas been instantiated. - Pass the created
parameterizerinstance into the function call to satisfy the new signature.
- In the main
-
Phase 3: Enhance Robustness of Rotamer Extraction
- In
extract_rotamer_from_system, implement a robust "consuming pool" logic for handling atoms with duplicate names that may appear in both anchor and sidechain topology lists (e.g., Proline). This should mirror the logic already present inassign_protein_roles_from_pool. - Add a final self-check at the end of
extract_rotamer_from_systemto ensure all required anchor atoms have been successfully extracted into the newRotamerobject, preventing the creation of corrupt templates.
- In