diff --git a/arc/mapping/engine.py b/arc/mapping/engine.py index f8880c8b6a..917c06485b 100644 --- a/arc/mapping/engine.py +++ b/arc/mapping/engine.py @@ -1286,3 +1286,18 @@ def cut_species_based_on_atom_indices(species: List["ARCSpecies"], bdes: List[Tu break return species + + +def copy_species_list_for_mapping(species: List["ARCSpecies"]) -> List["ARCSpecies"]: + """ + A helper function for copying the species list for mapping. Also keeps the atom indices when copying. + Args: + species (List[ARCSpecies]): The species list to be copied. + Returns: + List[ARCSpecies]: The copied species list. + """ + copies = [spc.copy() for spc in species] + for copy, spc in zip(copies, species): + for atom1, atom2 in zip(copy.mol.atoms, spc.mol.atoms): + atom1.label = atom2.label + return copies