1import phono3py 2import numpy as np 3 4 5def test_agno2(agno2_cell): 6 ph3 = phono3py.load(unitcell=agno2_cell, 7 supercell_matrix=[1, 1, 1]) 8 ph3.generate_displacements() 9 duplicates_ref = [ 10 [106, 22], [220, 80], [252, 81], [221, 96], [253, 97], 11 [290, 142], [348, 244], [364, 245], [349, 276], [365, 277], 12 [119, 0], [261, 0], [229, 0], [260, 0], [228, 0]] 13 np.testing.assert_equal(duplicates_ref, ph3.dataset['duplicates']) 14 15 16def test_nacl_pbe(nacl_pbe): 17 ph3 = nacl_pbe 18 ph3.generate_displacements() 19 duplicates_ref = [[77, 41]] 20 ph3.dataset['duplicates'] 21 np.testing.assert_equal(duplicates_ref, ph3.dataset['duplicates']) 22 23 pairs_ref = [0, 0, 0, 1, 0, 2, 0, 3, 0, 6, 24 0, 7, 0, 8, 0, 9, 0, 16, 0, 17, 25 0, 18, 0, 19, 0, 32, 0, 33, 0, 40, 26 0, 41, 0, 42, 0, 43, 0, 46, 0, 47, 27 0, 48, 0, 49, 0, 52, 0, 53, 32, 0, 28 32, 1, 32, 8, 32, 9, 32, 10, 32, 11, 29 32, 14, 32, 15, 32, 16, 32, 17, 32, 20, 30 32, 21, 32, 32, 32, 33, 32, 34, 32, 35, 31 32, 38, 32, 39, 32, 40, 32, 41, 32, 48, 32 32, 49, 32, 50, 32, 51] 33 pairs = [] 34 for first_atoms in ph3.dataset['first_atoms']: 35 n1 = first_atoms['number'] 36 n2s = np.unique([second_atoms['number'] 37 for second_atoms in first_atoms['second_atoms']]) 38 pairs += [[n1, n2] for n2 in n2s] 39 # print("".join(["%d, " % i for i in np.array(pairs).ravel()])) 40 41 np.testing.assert_equal(pairs_ref, np.array(pairs).ravel()) 42