Skip to content

Commit

Permalink
Added copy_species_list_for_mapping function
Browse files Browse the repository at this point in the history
This due to issue #675, this function also moved the atom indices when copying.(#675)
  • Loading branch information
kfir4444 committed Sep 22, 2023
1 parent e905dcb commit 4f9e11d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions arc/mapping/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,3 +1291,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

0 comments on commit 4f9e11d

Please sign in to comment.