diff --git a/arc/mapping/engine.py b/arc/mapping/engine.py index acc6573ebe..82bfa96f6a 100644 --- a/arc/mapping/engine.py +++ b/arc/mapping/engine.py @@ -1287,3 +1287,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