Skip to content

Commit

Permalink
Tests: original mol in converter.molecules_from_xyz()
Browse files Browse the repository at this point in the history
  • Loading branch information
alongd committed Oct 28, 2024
1 parent 8cddbe2 commit a7d2c7e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions arc/species/converter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3370,6 +3370,28 @@ def test_molecules_from_xyz(self):
self.assertEqual(b_mol.multiplicity, 1)
self.assertFalse(any(atom.radical_electrons for atom in b_mol.atoms))

c2h5no2_xyz = """O 0.62193295 1.59121319 -0.58381518
N 0.43574593 0.41740669 0.07732982
O 1.34135576 -0.35713755 0.18815532
C -0.87783860 0.10001361 0.65582554
C -1.73002357 -0.64880063 -0.38564362
H -1.37248469 1.00642547 0.93625873
H -0.74723653 -0.51714586 1.52009245
H -1.23537748 -1.55521250 -0.66607681
H -2.68617014 -0.87982825 0.03543830
H -1.86062564 -0.03164117 -1.24991054"""
original_molecule = Molecule(smiles='CC[N+](=O)[O-]')
s_mol, b_mol = converter.molecules_from_xyz(converter.str_to_xyz(c2h5no2_xyz),
multiplicity=1,
charge=0,
original_molecule=original_molecule,
)
self.assertEqual(s_mol.get_net_charge(), 0)
self.assertEqual(b_mol.get_net_charge(), 0)
self.assertIn('[N+]', b_mol.to_smiles())
self.assertIn('[O-]', b_mol.to_smiles())
self.assertIn('=O', b_mol.to_smiles())

def test_unsorted_xyz_mol_from_xyz(self):
"""Test atom order conservation when xyz isn't sorted with heavy atoms first"""
n3h5 = ARCSpecies(label='N3H5', xyz=self.xyz8['str'], smiles='NNN')
Expand Down

0 comments on commit a7d2c7e

Please sign in to comment.