From 86c85ee30f120a90aeb3fa0734f6956bea11112f Mon Sep 17 00:00:00 2001 From: Timotej Bernat Date: Mon, 1 Jul 2024 15:39:23 -0600 Subject: [PATCH 1/3] Added mol ID salt to molecule hash to permit unique ID numbers for chemically-identical Molecules in a Topology --- openff/interchange/interop/lammps/export/export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openff/interchange/interop/lammps/export/export.py b/openff/interchange/interop/lammps/export/export.py index e633a9681..98dfb8929 100644 --- a/openff/interchange/interop/lammps/export/export.py +++ b/openff/interchange/interop/lammps/export/export.py @@ -294,7 +294,7 @@ def _write_atoms(lmp_file: IO, interchange: Interchange, atom_type_map: dict): atom_map[atom_index] = atom for molecule_index, molecule in enumerate(interchange.topology.molecules): - molecule_hash = molecule.ordered_connection_table_hash() + molecule_hash = f'{molecule_index}_{molecule.ordered_connection_table_hash()}' # salt with mol ID to allow chemically-identical Molecules to be labelled with distinct IDs) molecule_map[molecule_hash] = molecule_index for atom in molecule.atoms: atom_molecule_map[atom] = molecule_hash From a26e09fd0879a23a2eec37c64808c2382a1a06d3 Mon Sep 17 00:00:00 2001 From: Timotej Bernat Date: Mon, 1 Jul 2024 15:43:39 -0600 Subject: [PATCH 2/3] Added hashing of salted mol string for greatest consistency with prior implementation --- openff/interchange/interop/lammps/export/export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openff/interchange/interop/lammps/export/export.py b/openff/interchange/interop/lammps/export/export.py index 98dfb8929..a4c42cd8a 100644 --- a/openff/interchange/interop/lammps/export/export.py +++ b/openff/interchange/interop/lammps/export/export.py @@ -294,7 +294,7 @@ def _write_atoms(lmp_file: IO, interchange: Interchange, atom_type_map: dict): atom_map[atom_index] = atom for molecule_index, molecule in enumerate(interchange.topology.molecules): - molecule_hash = f'{molecule_index}_{molecule.ordered_connection_table_hash()}' # salt with mol ID to allow chemically-identical Molecules to be labelled with distinct IDs) + molecule_hash = hash(f'{molecule_index}_{molecule.ordered_connection_table_hash()}') # salt with mol ID to allow chemically-identical Molecules to be labelled with distinct IDs) molecule_map[molecule_hash] = molecule_index for atom in molecule.atoms: atom_molecule_map[atom] = molecule_hash From dec84f509f78186a411cf4d256bf046bfe4ee2e8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 21:48:41 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- openff/interchange/interop/lammps/export/export.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openff/interchange/interop/lammps/export/export.py b/openff/interchange/interop/lammps/export/export.py index a4c42cd8a..220344a80 100644 --- a/openff/interchange/interop/lammps/export/export.py +++ b/openff/interchange/interop/lammps/export/export.py @@ -294,7 +294,9 @@ def _write_atoms(lmp_file: IO, interchange: Interchange, atom_type_map: dict): atom_map[atom_index] = atom for molecule_index, molecule in enumerate(interchange.topology.molecules): - molecule_hash = hash(f'{molecule_index}_{molecule.ordered_connection_table_hash()}') # salt with mol ID to allow chemically-identical Molecules to be labelled with distinct IDs) + molecule_hash = hash( + f"{molecule_index}_{molecule.ordered_connection_table_hash()}" + ) # salt with mol ID to allow chemically-identical Molecules to be labelled with distinct IDs) molecule_map[molecule_hash] = molecule_index for atom in molecule.atoms: atom_molecule_map[atom] = molecule_hash