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.
If a structure contains hydrogens and
remove_hydrogensis not explicitly set to False in thesimulatorobject, ttsim3d removes hydrogen atoms from theatom_positions_zyxtensor. However, MOSAICS does not remove the corresponding hydrogens fromself.template_iterator.structure_df.As a result, the template iterator can yield atom indices that no longer exist in the Simulator, resulting in an
IndexErrorwhen those atoms are marked for removal.I implemented a local fix in
MosaicsManager.from_yaml(). Ifremove_hydrogensis True (or the parameter is omitted, since that is the default behavior), the mmdf-generatedstructure_dfis 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.