Skip to content

Hydrogen handling inconsistency between ttsim3d and MOSAICS #11

Description

@pcbve1

If a structure contains hydrogens and remove_hydrogens is not explicitly set to False in the simulator object, ttsim3d removes hydrogen atoms from the atom_positions_zyx tensor. However, MOSAICS does not remove the corresponding hydrogens from self.template_iterator.structure_df.

As a result, the template iterator can yield atom indices that no longer exist in the Simulator, resulting in an IndexError when those atoms are marked for removal.

I implemented a local fix in MosaicsManager.from_yaml(). If remove_hydrogens is True (or the parameter is omitted, since that is the default behavior), the mmdf-generated structure_df is filtered to remove hydrogen atoms and its index is reset before the template iterator is created. This keeps the DataFrame synchronized with the Simulator.

This issue may be encountered when using crystal structures or templates containing ligands, drugs, or other molecules with explicit hydrogen atoms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions