Skip to content

Commit ffced3a

Browse files
committed
fix test data
1 parent 003ef41 commit ffced3a

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

python/pyabacus/tests/test_cell.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,26 @@ def test_initialization(self):
4141
self.assertEqual(cell.precision, 1e-8)
4242
np.testing.assert_array_equal(cell.lattice, np.eye(3))
4343

44-
# TODO: fix the test
45-
# def test_from_stru_file(self):
46-
# """Test loading structure from STRU file."""
47-
# cell = Cell.from_file(self.stru_file)
48-
# self.assertTrue(cell._built)
49-
50-
# # Verify basic structure information
51-
# self.assertEqual(len(cell.species), 2)
52-
# self.assertEqual(cell.species, ['Zn', 'O'])
53-
54-
# # Check lattice parameters and vectors from the actual STRU file
55-
# self.assertEqual(cell.lattice_constant, 6.1416) # From STRU file
56-
57-
# scaled_lattice = cell.lattice * cell.lattice_constant
58-
# expected_lattice = np.array([
59-
# [6.1416, 0.0, 0.0],
60-
# [-3.0708, 5.31902656, 0.0],
61-
# [0.0, 0.0, 9.82656]
62-
# ])
63-
# np.testing.assert_array_almost_equal(scaled_lattice, expected_lattice)
44+
45+
def test_from_stru_file(self):
46+
"""Test loading structure from STRU file."""
47+
cell = Cell.from_file(self.stru_file)
48+
self.assertTrue(cell._built)
49+
50+
# Verify basic structure information
51+
self.assertEqual(len(cell.species), 2)
52+
self.assertEqual(cell.species, ['Zn', 'O'])
53+
54+
# Check lattice parameters and vectors from the actual STRU file
55+
self.assertEqual(cell.lattice_constant, 6.1416) # From STRU file
56+
57+
scaled_lattice = cell.lattice * cell.lattice_constant
58+
expected_lattice = np.array([
59+
[6.1416, 0.0, 0.0],
60+
[-3.0708, 5.3186256, 0.0],
61+
[0.0, 0.0, 9.82656]
62+
])
63+
np.testing.assert_array_almost_equal(scaled_lattice, expected_lattice)
6464

6565
def test_from_xyz_file(self):
6666
"""Test loading structure from XYZ file."""

0 commit comments

Comments
 (0)