Skip to content

Commit

Permalink
Extended hardcoded triplet [O][O] perception to [S][S] as well
Browse files Browse the repository at this point in the history
  • Loading branch information
alongd committed Dec 7, 2024
1 parent 84898ee commit 80b4d57
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions arc/species/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1380,12 +1380,14 @@ def molecules_from_xyz(xyz: Optional[Union[dict, str]],
return None, None
xyz = check_xyz_dict(xyz)

if xyz['symbols'] == ('O', 'O') and multiplicity != 1:
coords = np.asarray(xyz['coords'], dtype=np.float32)
vector = coords[0] - coords[1]
if float(np.dot(vector, vector) ** 0.5) < 1.4:
# Special case for O2 triplet
return Molecule(smiles='[O][O]'), Molecule(smiles='[O][O]')
if len(xyz['symbols']) == 2:
for element, bond_length in zip(['O', 'S'], [1.4, 2.1]):
if xyz['symbols'] == (element, element) and multiplicity != 1:
coords = np.asarray(xyz['coords'], dtype=np.float32)
vector = coords[0] - coords[1]
if float(np.dot(vector, vector) ** 0.5) < bond_length:
# Special case for O2 and S2 triplet
return Molecule(smiles=f'[{element}][{element}]'), Molecule(smiles=f'[{element}][{element}]')

# 1. Generate a molecule with no bond order information with atoms ordered as in xyz.
mol_graph = MolGraph(symbols=xyz['symbols'], coords=xyz['coords'])
Expand Down

0 comments on commit 80b4d57

Please sign in to comment.