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.
  • Loading branch information
kfir4444 committed Oct 2, 2023
1 parent eff3a0a commit 0d33ff3
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 @@ -1260,6 +1260,21 @@ def cut_species_based_on_atom_indices(species: List["ARCSpecies"], bdes: List[Tu

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

def cuts_on_cycle_of_labeled_mol(spc: 'ARCSpecies')-> bool:
"""A helper function determining whether or not the scission site opens a cycle.
Expand Down

0 comments on commit 0d33ff3

Please sign in to comment.