Skip to content

Commit e6cfbd9

Browse files
committed
test speed for v0.4.0
1 parent 10aa38c commit e6cfbd9

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

pyxtal/test_all.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_list_wyckoff_combinations(self):
4646
def test_spg_symmetry(self):
4747
N_polar, N_centro, N_chiral = 0, 0, 0
4848
for sg in range(1, 231):
49-
g = Group(sg)
49+
g = Group(sg, quick=True)
5050
pg, polar, centro, chiral =g.point_group, g.polar, g.inversion, g.chiral
5151
#pg, polar, centro, chiral = get_point_group(sg)
5252
if polar:
@@ -64,7 +64,7 @@ def test_ferroelectric(self):
6464
pairs = [(4, 1), (187, 4), (222, 5)]
6565
for pair in pairs:
6666
(sg, N) = pair
67-
self.assertTrue(len(Group(sg).get_ferroelectric_groups()) == N)
67+
self.assertTrue(len(Group(sg, quick=True).get_ferroelectric_groups()) == N)
6868

6969
def test_check_compatible(self):
7070
self.assertTrue(Group(225).check_compatible([64, 28, 24]) == (True, True))
@@ -73,12 +73,9 @@ def test_check_compatible(self):
7373
self.assertTrue(Group(19).check_compatible([6]) == (False, False))
7474

7575
def test_search_supergroup_paths(self):
76-
paths = Group(59).search_supergroup_paths(139, 2)
76+
paths = Group(59, quick=True).search_supergroup_paths(139, 2)
7777
self.assertTrue(paths == [[71, 139], [129, 139], [137, 139]])
7878

79-
#def test_search_subgroup_paths(self):
80-
# self.assertTrue(Group(139).search_supergroup_paths(59) == [[71, 59], [129, 59], [137, 59]])
81-
8279
def test_get_splitters(self):
8380
s = pyxtal()
8481
s.from_seed(cif_path+'3-G139.cif')
@@ -136,7 +133,6 @@ def test_long(self):
136133
['I4_132', 98], #1-3
137134
["P3_112", 5], #1-3
138135
["P6_422", 21], #1-3
139-
#["P4_332", 96], #1-3
140136
)
141137
for para in paras:
142138
name, H = para
@@ -203,7 +199,7 @@ def test_multi(self):
203199
"BTO-Amm2": [65, 123, 221],
204200
"NaSb3F10": [186, 194],
205201
"NaSb3F10": [176, 194],
206-
"MPWO": [59, 71, 139, 225],
202+
#"MPWO": [59, 71, 139, 225],
207203
}
208204
for cif in data.keys():
209205
s = pyxtal()
@@ -364,7 +360,8 @@ def test_get_wyckoff(self):
364360
get_wyckoffs(i, organized=True)
365361

366362
def test_is_equivalent(self):
367-
wp = Group(15)[0]
363+
g = Group(15)
364+
wp = g[0]
368365
a = [ 0.10052793, 0.12726851, 0.27405404]
369366
b = [-0.10052642, -0.12726848, -0.27405526]
370367
c = [ 0.60052642, 0.62726848, 0.27405526]
@@ -375,7 +372,7 @@ def test_is_equivalent(self):
375372
self.assertTrue(wp.is_equivalent(d,a))
376373
self.assertFalse(wp.is_equivalent(a,e))
377374

378-
wp = Group(15)[1]
375+
wp = g[1]
379376
a = [ 0.00, 0.127, 0.254]
380377
b = [-0.01, -0.127, -0.250]
381378
self.assertTrue(wp.is_equivalent(a,b))
@@ -884,14 +881,11 @@ def test_alternative(self):
884881
strucs = s.get_alternatives()
885882
for struc in strucs:
886883
pmg_s2 = struc.to_pymatgen()
887-
#if not sm.StructureMatcher().fit(pmg_s1, pmg_s2):
888-
# print(struc)
889-
# print(s)
890884
self.assertTrue(sm.StructureMatcher().fit(pmg_s1, pmg_s2))
891885

892886
def test_wyc_sets(self):
893-
for i in range(1,229):
894-
res = Group(i).get_alternatives()['No.']
887+
for i in range(1, 229):
888+
res = Group(i, quick=True).get_alternatives()['No.']
895889

896890
if __name__ == "__main__":
897891
unittest.main()

0 commit comments

Comments
 (0)