Skip to content

Commit 074f042

Browse files
committed
add more tests
1 parent a22ba18 commit 074f042

File tree

2 files changed

+72
-7
lines changed

2 files changed

+72
-7
lines changed

pyxtal/XRD_indexer.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def get_seeds(spg, hkls, two_thetas):
339339

340340

341341
def get_cell_from_multi_hkls(spg, hkls, two_thetas, long_thetas=None, wave_length=1.54184,
342-
tolerance=0.05, use_seed=True, min_score=0.99):
342+
tolerance=0.05, use_seed=True, min_score=0.999):
343343
"""
344344
Estimate the cell parameters from multiple (hkl, two_theta) inputs.
345345
The idea is to use the Bragg's law and the lattice spacing formula to estimate the lattice parameters.
@@ -457,7 +457,8 @@ def get_cell_from_multi_hkls(spg, hkls, two_thetas, long_thetas=None, wave_lengt
457457
#xtal.from_seed('pyxtal/database/cifs/JVASP-62168.cif') # 52s -> 16s
458458
#xtal.from_seed('pyxtal/database/cifs/JVASP-98225.cif') # P21/c -> 33s -> 12s
459459
#xtal.from_seed('pyxtal/database/cifs/JVASP-50935.cif') # Pm -> 45s -> 7.6s
460-
xtal.from_seed('pyxtal/database/cifs/JVASP-28565.cif') # 207s -> 91s -> 80s -> 72s
460+
#xtal.from_seed('pyxtal/database/cifs/JVASP-28565.cif') # 207s -> 91s -> 80s -> 72s
461+
xtal.from_seed('pyxtal/database/cifs/JVASP-42300.cif') # 178s
461462
#xtal.from_seed('pyxtal/database/cifs/JVASP-47532.cif') #
462463
#xtal.from_seed('pyxtal/database/cifs/JVASP-28634.cif', tol=1e-4) # P21/c -> 33s -> 12s
463464
#xtal.from_seed('pyxtal/database/cifs/JVASP-97915.cif', tol=1e-4) # P21/c -> 33s -> 12s
@@ -471,27 +472,33 @@ def get_cell_from_multi_hkls(spg, hkls, two_thetas, long_thetas=None, wave_lengt
471472
print(xrd.by_hkl(N_max=10))
472473

473474
# Get the a list of hkl guesses and sort them by d^2
475+
if spg >= 195:
476+
min_score = 0.96
477+
else:
478+
min_score = 0.999
479+
474480
if spg >= 16:
475481
guesses = xtal.group.generate_hkl_guesses(2, 3, 5, max_square=29, total_square=40, verbose=True)
476482
else:
477483
if spg in [5, 8, 12, 15]:
478-
guesses = xtal.group.generate_hkl_guesses(3, 3, 6, max_square=38, total_square=40, verbose=True)
484+
guesses = xtal.group.generate_hkl_guesses(3, 3, 5, max_square=29, total_square=40, verbose=True)
479485
else:
480-
#guesses = xtal.group.generate_hkl_guesses(3, 3, 4, max_square=29, total_square=35, verbose=True)
481-
guesses = xtal.group.generate_hkl_guesses(3, 3, 3, max_square=15, total_square=36, verbose=True)
486+
guesses = xtal.group.generate_hkl_guesses(3, 3, 4, max_square=29, total_square=35, verbose=True)
487+
#guesses = xtal.group.generate_hkl_guesses(3, 3, 3, max_square=15, total_square=36, verbose=True)
488+
482489
guesses = np.array(guesses)
483490
print("Total guesses:", len(guesses))
484491
sum_squares = np.sum(guesses**2, axis=(1,2))
485492
sorted_indices = np.argsort(sum_squares)
486493
guesses = guesses[sorted_indices]
487-
if len(guesses) > 200000: guesses = guesses[:200000]
494+
if len(guesses) > 500000: guesses = guesses[:500000]
488495
#guesses = np.array([[[2, 0, 0], [1, 1, 0], [0, 1, 1], [0, 0, 2]]])
489496
#guesses = np.array([[[2, 0, 0], [1, 1, 0], [0, 0, 2], [2, 0, -2]]])
490497
#guesses = np.array([[[0, 0, -1], [1, 1, 0], [1, 1, -1], [0, 2, -5]]])
491498

492499
# Check the quality of each (hkl, 2theta) solutions
493500
N_add = 5
494-
N_batch = 20
501+
N_batch = 10
495502
cell2 = np.sort(np.array(xtal.lattice.encode()))
496503
if spg <= 15 and cell2[3] > 90: cell2[3] = 180 - cell2[3]
497504
cells_all = np.reshape(cell2, (1, len(cell2)))
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#############################################################
2+
# ______ _ _ _ #
3+
# (_____ \ \ \ / / | | #
4+
# _____) ) _ \ \/ / |_ ____| | #
5+
# | ____/ | | | ) (| _)/ _ | | #
6+
# | | | |_| |/ /\ \ |_( (_| | |___ #
7+
# |_| \__ /_/ \_\___)__|_|_____) #
8+
# (____/ #
9+
#---------------------(version 1.1.1)--------------------#
10+
# A Python package for random crystal generation #
11+
# url: https://github.com/qzhu2017/pyxtal #
12+
# @Zhu's group at U. North Carolina at Charlotte #
13+
#############################################################
14+
data_from_pyxtal
15+
16+
_symmetry_space_group_name_H-M 'C2'
17+
_symmetry_Int_Tables_number 5
18+
_symmetry_cell_setting monoclinic
19+
_cell_length_a 5.592144
20+
_cell_length_b 8.755606
21+
_cell_length_c 8.787107
22+
_cell_angle_alpha 90.000000
23+
_cell_angle_beta 108.553375
24+
_cell_angle_gamma 90.000000
25+
_cell_volume 407.879123
26+
27+
loop_
28+
_symmetry_equiv_pos_site_id
29+
_symmetry_equiv_pos_as_xyz
30+
1 'x, y, z'
31+
2 '-x, y, -z'
32+
3 'x+1/2, y+1/2, z'
33+
4 '-x+1/2, y+1/2, -z'
34+
35+
loop_
36+
_atom_site_label
37+
_atom_site_type_symbol
38+
_atom_site_symmetry_multiplicity
39+
_atom_site_fract_x
40+
_atom_site_fract_y
41+
_atom_site_fract_z
42+
_atom_site_occupancy
43+
Li Li 4 0.830291 0.999932 0.660557 1
44+
Li Li 4 0.669936 0.750048 0.839888 1
45+
Mn Mn 2 0.000000 0.000001 0.000000 1
46+
Mn Mn 4 0.663968 0.000011 0.327931 1
47+
Cr Cr 4 0.665334 0.249997 0.830654 1
48+
Cr Cr 2 0.000000 0.250000 0.500000 1
49+
O O 4 0.680300 0.024376 0.831902 1
50+
O O 2 0.000000 0.781644 0.000000 1
51+
O O 4 0.672387 0.220546 0.326212 1
52+
O O 2 0.000000 0.025582 0.500000 1
53+
O O 4 0.848388 0.975618 0.168090 1
54+
O O 2 0.000000 0.218356 0.000000 1
55+
O O 4 0.346165 0.779478 0.673784 1
56+
O O 2 0.000000 0.474422 0.500000 1
57+
#END
58+

0 commit comments

Comments
 (0)