Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samwaseda committed Apr 22, 2024
1 parent 9ea3c99 commit 040836f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyiron_atomistics/sphinx/base.py
Expand Up @@ -183,7 +183,7 @@ def id_pyi_to_spx(self):
def id_spx_to_pyi(self):
if self.structure is None:
raise ValueError("Structure not set")
return np.argsort(id_pyi_to_spx)
return np.argsort(self.id_pyi_to_spx)

@property
def plane_wave_cutoff(self):
Expand Down
11 changes: 9 additions & 2 deletions tests/sphinx/test_base.py
Expand Up @@ -109,8 +109,15 @@ def tearDownClass(cls):
)

def test_id_pyi_to_spx(self):
self.assertEqual(len(self.sphinx.id_pyi_to_spx), len(self.sphinx.structure))
self.assertEqual(len(self.sphinx.id_spx_to_pyi), len(self.sphinx.structure))
spx = self.project.create_job("Sphinx", "check_order")
elements = ["Fe", "C", "Ni", "Fe"]
x = np.random.random((len(elements), 3))
c = np.eye(3)
spx.structure = Atoms(elements=elements, positions=x, cell=c)
self.assertTrue(np.all(spx.id_spx_to_pyi == [1, 0, 3, 2]))
self.assertTrue(
np.all(spx.id_pyi_to_spx[spx.id_spx_to_pyi] == np.arange(len(elements)))
)

def test_potential(self):
self.assertEqual(['Fe_GGA'], self.sphinx.list_potentials())
Expand Down

0 comments on commit 040836f

Please sign in to comment.