33import unittest
44
55import numpy as np
6- from context import dpdata
6+
7+ from dpdata .formats .cp2k .cell import cell_to_low_triangle
78
89
910class TestCellToLowTriangle (unittest .TestCase ):
1011 def test_func1 (self ):
11- cell_1 = dpdata . cp2k . cell . cell_to_low_triangle (
12+ cell_1 = cell_to_low_triangle (
1213 6 , 6 , 6 , np .pi * 1 / 2 , np .pi * 1 / 2 , np .pi * 1 / 2
1314 )
1415 cell_2 = np .asarray ([[6 , 0 , 0 ], [0 , 6 , 0 ], [0 , 0 , 6 ]])
@@ -17,7 +18,7 @@ def test_func1(self):
1718 self .assertAlmostEqual (cell_1 [ii , jj ], cell_2 [ii , jj ], places = 6 )
1819
1920 def test_func2 (self ):
20- cell_1 = dpdata . cp2k . cell . cell_to_low_triangle (
21+ cell_1 = cell_to_low_triangle (
2122 6 , 6 , 6 , np .pi * 1 / 3 , np .pi * 1 / 3 , np .pi * 1 / 3
2223 )
2324 cell_2 = np .asarray (
@@ -28,7 +29,7 @@ def test_func2(self):
2829 self .assertAlmostEqual (cell_1 [ii , jj ], cell_2 [ii , jj ], places = 6 )
2930
3031 def test_func3 (self ):
31- cell_1 = dpdata . cp2k . cell . cell_to_low_triangle (
32+ cell_1 = cell_to_low_triangle (
3233 6 , 7 , 8 , np .pi * 133 / 180 , np .pi * 84 / 180 , np .pi * 69 / 180
3334 )
3435 cell_2 = np .asarray (
@@ -45,21 +46,17 @@ def test_func3(self):
4546
4647 def test_func4 (self ):
4748 with self .assertRaises (Exception ) as c :
48- dpdata .cp2k .cell .cell_to_low_triangle (
49- 0.1 , 6 , 6 , np .pi * 1 / 2 , np .pi * 1 / 2 , np .pi * 1 / 2
50- )
49+ cell_to_low_triangle (0.1 , 6 , 6 , np .pi * 1 / 2 , np .pi * 1 / 2 , np .pi * 1 / 2 )
5150 self .assertTrue ("A==0.1" in str (c .exception ))
5251
5352 def test_func5 (self ):
5453 with self .assertRaises (Exception ) as c :
55- dpdata .cp2k .cell .cell_to_low_triangle (
56- 6 , 6 , 6 , np .pi * 3 / 180 , np .pi * 1 / 2 , np .pi * 1 / 2
57- )
54+ cell_to_low_triangle (6 , 6 , 6 , np .pi * 3 / 180 , np .pi * 1 / 2 , np .pi * 1 / 2 )
5855 self .assertTrue ("alpha" in str (c .exception ))
5956
6057 def test_func6 (self ):
6158 with self .assertRaises (Exception ) as c :
62- dpdata . cp2k . cell . cell_to_low_triangle (
59+ cell_to_low_triangle (
6360 6 , 7 , 8 , np .pi * 153 / 180 , np .pi * 84 / 180 , np .pi * 69 / 180
6461 )
6562 self .assertTrue ("lz^2" in str (c .exception ))
0 commit comments