Skip to content

Topology.add_molecule has undefined behavior if given an existing molecule with different atom indexing #434

@j-wags

Description

@j-wags

Describe the bug
If the user passes a re-indexed version of a molecule which is already in a Topology toTopology.add_molecule, the molecule that is added is indexed in the same order as the original. This can lead to system creation errors down the line if the user plans to use the coordinates from the reindexed molecule.

To Reproduce

        ff = ForceField('test_forcefields/smirnoff99Frosst.offxml')

        molecules = [Molecule.from_file(get_data_file_path('molecules/ethanol.sdf')),
                     Molecule.from_file(get_data_file_path('molecules/ethanol_reordered.sdf'))]
        top = Topology.from_molecules(molecules)
        omm_system = ff.create_openmm_system(top)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions