Skip to content

Commit 313460c

Browse files
committed
Added order_xyz_by_atom_map to converter
1 parent 493c626 commit 313460c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

arc/species/converter.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,3 +2392,21 @@ def generate_bond_length_initial_guess(atom_r_coord, r_value, atom_a_coord, atom
23922392
direction = np.random.uniform(-1.0, 1.0, 3) # Random direction
23932393
direction /= np.linalg.norm(direction) # Normalize to unit vector
23942394
return np.array(atom_r_coord) + r_value * direction
2395+
2396+
def order_xyz_by_atom_map(xyz: dict,
2397+
atom_map: list,
2398+
) -> dict:
2399+
"""
2400+
Order xyz coordinates according to the atom map.
2401+
2402+
Args:
2403+
xyz (dict): The xyz coordinates.
2404+
atom_map (list): The atom map.
2405+
2406+
Returns:
2407+
dict: The ordered xyz coordinates.
2408+
"""
2409+
symbols = [xyz['symbols'][i] for i in atom_map]
2410+
isotopes = [xyz['isotopes'][i] for i in atom_map] if 'isotopes' in xyz else None
2411+
coords = [xyz['coords'][i] for i in atom_map]
2412+
return xyz_from_data(coords=coords, symbols=symbols, isotopes=isotopes)

0 commit comments

Comments
 (0)