def test_o22(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-1, 1], [-1, 1], [-1, 1], [-1, 2], [-1, 2], [-1, 2], [3, 3], [3, 4], [3, 4]] trans = [[ j - 1 for j in i ] for i in [[1, 2, 3, 4, 5, 6, 7, 8, 9], [2, 3, 1, 5, 6, 4, 8, 9, 7], [3, 1, 2, 6, 4, 5, 9, 7, 8], [4, 5, 6, 7, 8, 9, 1, 2, 3], [5, 6, 4, 8, 9, 7, 2, 3, 1], [6, 4, 5, 9, 7, 8, 3, 1, 2], [7, 8, 9, 1, 2, 3, 4, 5, 6], [8, 9, 7, 2, 3, 1, 5, 6, 4], [9, 7, 8, 3, 1, 2, 6, 4, 5]]] rots = [[[0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3]], [[0, 1, 2, 8, 6, 7, 4, 5, 3], [2, 1, 0, 3]], [[0, 2, 1, 4, 3, 5, 8, 7, 6], [0, 3, 2, 1]], [[0, 2, 1, 6, 8, 7, 3, 5, 4], [2, 3, 0, 1]], [[0, 7, 5, 6, 4, 2, 3, 1, 8], [1, 0, 3, 2]], [[0, 7, 5, 8, 3, 1, 4, 2, 6], [3, 0, 1, 2]], [[0, 5, 7, 4, 6, 2, 8, 1, 3], [1, 2, 3, 0]], [[0, 5, 7, 3, 8, 1, 6, 2, 4], [3, 2, 1, 0]]] (narrows, arrow_types, Concs) = how_many_arrows(col) agroup = a_group(trans, rots) out = 4504 self.assertEqual(polya(Concs, agroup, arrowings=arrow_types), out)
def test_3g_3(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 6 col = [[1, 1], [1, 2], [1, 3], [1, 4]] trans = [[ j - 1 for j in i ] for i in [[1, 2, 3, 4], [2, 1, 4, 3], [3, 4, 1, 2], [4, 3, 2, 1]]] rots = [[[j - 1 for j in i] for i in t] for t in [[[1, 2, 3, 4], [1, 2, 3, 4, 5, 6]], [[1, 4, 3, 2], [1, 3, 2, 4, 6, 5]], [[1, 2, 3, 4], [4, 2, 3, 1, 5, 6]], [[1, 4, 3, 2], [4, 3, 2, 1, 6, 5]], [[1, 2, 3, 4], [1, 5, 3, 4, 2, 6]], [[1, 4, 3, 2], [1, 3, 5, 4, 6, 2]], [[1, 2, 3, 4], [4, 5, 3, 1, 2, 6]], [[1, 4, 3, 2], [4, 3, 5, 1, 6, 2]], [[1, 2, 3, 4], [1, 2, 6, 4, 5, 3]], [[1, 4, 3, 2], [1, 6, 2, 4, 3, 5]], [[1, 2, 3, 4], [4, 2, 6, 1, 5, 3]], [[1, 4, 3, 2], [4, 6, 2, 1, 3, 5]], [[1, 2, 3, 4], [1, 5, 6, 4, 2, 3]], [[1, 4, 3, 2], [1, 6, 5, 4, 3, 2]], [[1, 2, 3, 4], [4, 5, 6, 1, 2, 3]], [[1, 4, 3, 2], [4, 6, 5, 1, 3, 2]]]] (narrows, arrow_types, Concs) = how_many_arrows(col) agroup = a_group(trans, rots) out = 792 self.assertEqual(polya(Concs, agroup, arrowings=arrow_types), out)
def test_2(self): from phenum.phonons import how_many_arrows tcol = [[-1, 1], [1, 1], [1, 1]] out = (2,1,[1,2]) self.assertEqual(how_many_arrows(tcol),out)
def test_4(self): from phenum.phonons import how_many_arrows tcol = [[-1, 4], [-1, 4], [-1, 4], [-1, 4], [-1, 4], [-1, 2], [-1, 2], [-1, 2], [-1, 1], [-1, 3], [-1, 5], [-1, 6], [-1, 7], [1, 1], [1, 2], [1, 5]] out = (3,3,[5,3,1,1,1,1,1,1,1,1]) self.assertEqual(how_many_arrows(tcol),out)
def test_8(self): from phenum.phonons import how_many_arrows tcol = [[-1, 2], [-1, 2], [-1, 2], [-1, 2], [-1, 2], [-1, 2], [-1, 1], [-1, 3], [-1, 4], [1, 2], [1, 2], [1, 3], [1, 3], [1, 1]] out = (5, 3, [6, 1, 1, 1, 2, 2, 1]) self.assertEqual(how_many_arrows(tcol), out)
def test_8(self): from phenum.phonons import how_many_arrows tcol = [[-1, 2], [-1, 2], [-1, 2], [-1, 2], [-1, 2], [-1, 2], [-1, 1], [-1, 3], [-1, 4], [1, 2], [1, 2], [1, 3], [1, 3], [1, 1]] out = (5,3,[6,1,1,1,2,2,1]) self.assertEqual(how_many_arrows(tcol),out)
def test_o10(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 2], [-1, 2], [-1, 2], [-1, 2], [-1, 2], [3, 3], [3, 4]] trans = [[j - 1 for j in i] for i in [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2], [4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 2, 1], [5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4], [6, 5, 8, 7, 10, 9, 12, 11, 2, 1, 4, 3], [7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6], [8, 7, 10, 9, 12, 11, 2, 1, 4, 3, 6, 5], [9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8], [10, 9, 12, 11, 2, 1, 4, 3, 6, 5, 8, 7], [11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [12, 11, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9]]] rots = [[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3]], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [2, 1, 0, 3]], [[0, 1, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3], [0, 3, 2, 1]], [[0, 1, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3], [2, 3, 0, 1]]] (narrows, arrow_types, Concs) = how_many_arrows(col) agroup = a_group(trans, rots) out = 13896 self.assertEqual(polya(Concs, agroup, arrowings=arrow_types), out)
def test_2(self): from phenum.phonons import how_many_arrows tcol = [[-1, 1], [1, 1], [1, 1]] out = (2, 1, [1, 2]) self.assertEqual(how_many_arrows(tcol), out)
def test_pg(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 6 col = [[-1, 1], [-1, 1], [-1, 1], [-1, 2], [-1, 2], [-1, 2], [-1, 2], [1, 1], [1, 1]] trans = [[ j - 1 for j in i ] for i in [[1, 2, 3, 4, 5, 6, 7, 8, 9], [3, 1, 2, 6, 4, 5, 9, 7, 8], [2, 3, 1, 5, 6, 4, 8, 9, 7], [7, 8, 9, 1, 2, 3, 4, 5, 6], [9, 7, 8, 3, 1, 2, 6, 4, 5], [8, 9, 7, 2, 3, 1, 5, 6, 4], [4, 5, 6, 7, 8, 9, 1, 2, 3], [6, 4, 5, 9, 7, 8, 3, 1, 2], [5, 6, 4, 8, 9, 7, 2, 3, 1]]] rots = [[[j - 1 for j in i] for i in t] for t in [[[1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, 6]], [[3, 6, 9, 2, 5, 8, 1, 4, 7], [3, 4, 2, 1, 5, 6]], [[9, 8, 7, 6, 5, 4, 3, 2, 1], [2, 1, 4, 3, 5, 6]], [[7, 4, 1, 8, 5, 2, 9, 6, 3], [4, 3, 1, 2, 5, 6]], [[1, 4, 7, 2, 5, 8, 3, 6, 9], [3, 4, 1, 2, 6, 5]], [[9, 6, 3, 8, 5, 2, 7, 4, 1], [4, 3, 2, 1, 6, 5]], [[7, 8, 9, 4, 5, 6, 1, 2, 3], [1, 2, 4, 3, 6, 5]], [[3, 2, 1, 6, 5, 4, 9, 8, 7], [2, 1, 3, 4, 6, 5]]]] (narrows, arrow_types, Concs) = how_many_arrows(col) agroup = a_group(trans, rots) out = 663 self.assertEqual(polya(Concs, agroup, arrowings=arrow_types), out)
def test_10(self): from phenum.phonons import how_many_arrows tcol = [[-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 2]] out = (0, 0, [18, 1]) self.assertEqual(how_many_arrows(tcol), out)
def test_10(self): from phenum.phonons import how_many_arrows tcol = [[-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 2]] out = (0,0,[18,1]) self.assertEqual(how_many_arrows(tcol),out)
def test_4(self): from phenum.phonons import how_many_arrows tcol = [[-1, 4], [-1, 4], [-1, 4], [-1, 4], [-1, 4], [-1, 2], [-1, 2], [-1, 2], [-1, 1], [-1, 3], [-1, 5], [-1, 6], [-1, 7], [1, 1], [1, 2], [1, 5]] out = (3, 3, [5, 3, 1, 1, 1, 1, 1, 1, 1, 1]) self.assertEqual(how_many_arrows(tcol), out)
def test_o21(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-1,1],[-1,1],[-1,2],[-1,2],[-1,2],[3,3],[3,4],[3,4]] trans =[[j - 1 for j in i] for i in[[1, 2, 3, 4, 5, 6, 7, 8], [2, 1, 4, 3, 6, 5, 8, 7], [3, 4, 5, 6, 7, 8, 1, 2], [4, 3, 6, 5, 8, 7, 2, 1], [5, 6, 7, 8, 1, 2, 3, 4], [6, 5, 8, 7, 2, 1, 4, 3], [7, 8, 1, 2, 3, 4, 5, 6], [8, 7, 2, 1, 4, 3, 6, 5]]] rots = [[[0,1,2,3,4,5,6,7],[0,1,2,3]],[[0,1,2,3,4,5,6,7],[2,1,0,3]],[[0,1,6,7,4,5,2,3],[0,3,2,1]],[[0,1,6,7,4,5,2,3],[2,3,0,1]]] (narrows,arrow_types,Concs) = how_many_arrows(col) agroup = a_group(trans,rots) out = 3808 self.assertEqual(polya(Concs,agroup,arrowings=arrow_types),out)
def test_3e_1(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 6 col = [[-1, 1], [-1, 2], [1, 3], [1, 3], [1, 4], [1, 4]] trans = [[j-1 for j in i] for i in [[1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 1], [3, 4, 5, 6, 1, 2], [4, 5, 6, 1, 2, 3], [5, 6, 1, 2, 3, 4], [6, 1, 2, 3, 4, 5]]] rots = [[[j-1 for j in i] for i in t] for t in [[[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6]], [[1, 2, 3, 4, 5, 6], [4, 2, 3, 1, 5, 6]], [[1, 2, 3, 4, 5, 6], [1, 5, 3, 4, 2, 6]], [[1, 2, 3, 4, 5, 6], [4, 5, 3, 1, 2, 6]], [[1, 6, 5, 4, 3, 2], [1, 2, 6, 4, 5, 3]], [[1, 6, 5, 4, 3, 2], [4, 2, 6, 1, 5, 3]], [[1, 6, 5, 4, 3, 2], [1, 5, 6, 4, 2, 3]], [[1, 6, 5, 4, 3, 2], [4, 5, 6, 1, 2, 3]]]] (narrows,arrow_types,Concs) = how_many_arrows(col) agroup = a_group(trans,rots) out = 6876 self.assertEqual(polya(Concs,agroup,arrowings=arrow_types),out)
def test_pg(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 6 col = [[-1,1],[-1,1],[-1,1],[-1,2],[-1,2],[-1,2],[-1,2],[1,1],[1,1]] trans = [[j - 1 for j in i] for i in [[1,2,3,4,5,6,7,8,9], [3,1,2,6,4,5,9,7,8], [2,3,1,5,6,4,8,9,7],[7,8,9,1,2,3,4,5,6], [9,7,8,3,1,2,6,4,5], [8,9,7,2,3,1,5,6,4], [4,5,6,7,8,9,1,2,3], [6,4,5,9,7,8,3,1,2], [5,6,4,8,9,7,2,3,1]]] rots = [[[j - 1 for j in i] for i in t] for t in [[[1,2,3,4,5,6,7,8,9],[1,2,3,4,5,6]], [[3,6,9,2,5,8,1,4,7],[3,4,2,1,5,6]], [[9,8,7,6,5,4,3,2,1],[2,1,4,3,5,6]], [[7,4,1,8,5,2,9,6,3],[4,3,1,2,5,6]], [[1,4,7,2,5,8,3,6,9],[3,4,1,2,6,5]], [[9,6,3,8,5,2,7,4,1],[4,3,2,1,6,5]], [[7,8,9,4,5,6,1,2,3],[1,2,4,3,6,5]], [[3,2,1,6,5,4,9,8,7],[2,1,3,4,6,5]]]] (narrows,arrow_types,Concs) = how_many_arrows(col) agroup = a_group(trans,rots) out = 663 self.assertEqual(polya(Concs,agroup,arrowings=arrow_types),out)
def test_p1(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-1,1],[-1,2],[0,3],[0,4]] trans = [[0,1,2,3],[1,0,3,2],[2,3,0,1],[3,2,1,0]] rots = [[[0,1,2,3],[0,1,2,3]],[[0,1,2,3],[2,1,0,3]],[[0,1,2,3],[0,3,2,1]],[[0,1,2,3],[2,3,0,1]],[[0,3,2,1],[1,0,3,2]],[[0,3,2,1],[3,0,1,2]],[[0,3,2,1],[1,2,3,0]],[[0,3,2,1],[3,2,1,0]]] (narrows,arrow_types,Concs) = how_many_arrows(col) agroup = a_group(trans,rots) out = 18 self.assertEqual(polya(Concs,agroup,arrowings=arrow_types),out)
def test_p2(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-3,1],[-3,1],[-3,1],[-3,2],[3,3],[3,3],[3,3],[3,4]] trans = [[0,1,2,3,4,5,6,7],[1,0,3,2,5,4,7,6],[2,3,4,5,6,7,0,1],[3,2,5,4,7,6,1,0],[4,5,6,7,0,1,2,3],[5,4,7,6,1,0,3,2],[6,7,0,1,2,3,4,5],[7,6,1,0,3,2,5,4]] rots = [[[0,1,2,3,4,5,6,7],[0,1,2,3]],[[0,1,2,3,4,5,6,7],[2,1,0,3]],[[0,1,6,7,4,5,2,3],[0,3,2,1]],[[0,1,6,7,4,5,2,3],[2,3,0,1]]] (narrows,arrow_types,Concs) = how_many_arrows(col) agroup = a_group(trans,rots) out = 9568 self.assertEqual(polya(Concs,agroup,arrowings=arrow_types),out)
def test_p4(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-1, 3], [-1, 2], [-1, 3], [1, 1]] trans = [[0, 1, 2, 3], [1, 2, 3, 0], [2, 3, 0, 1], [3, 0, 1, 2]] rots = [[[0, 1, 2, 3], [0, 1, 2, 3]], [[0, 1, 2, 3], [2, 1, 0, 3]], [[0, 3, 2, 1], [0, 3, 2, 1]], [[0, 3, 2, 1], [2, 3, 0, 1]]] (narrows, arrow_types, Concs) = how_many_arrows(col) agroup = a_group(trans, rots) out = 5 self.assertEqual(polya(Concs, agroup, arrowings=arrow_types), out)
def test_toy_2(self): from phenum.grouptheory import a_group_gen from phenum.phonons import how_many_arrows, how_many_arrows col = [[-1, 1], [1, 2]] trans = [[0, 1], [1, 0]] rots = [[[0, 1], [0, 1, 2, 3, 4, 5]], [[1, 0], [2, 3, 0, 1, 5, 4]], [[1, 0], [2, 1, 0, 3, 5, 4]], [[0, 1], [0, 3, 2, 1, 5, 4]]] dim = 6 (narrows, arrow_types, Concs) = how_many_arrows(col) agroup = a_group_gen(trans, rots) out = 3 self.assertEqual(polya(Concs, agroup, arrowings=arrow_types), out)
def test_toy_2(self): from phenum.grouptheory import a_group_gen from phenum.phonons import how_many_arrows, how_many_arrows col = [[-1,1],[1,2]] trans = [[0,1],[1,0]] rots = [[[0,1],[0,1,2,3,4,5]],[[1,0],[2,3,0,1,5,4]],[[1,0],[2,1,0,3,5,4]], [[0,1],[0,3,2,1,5,4]]] dim = 6 (narrows,arrow_types,Concs) = how_many_arrows(col) agroup = a_group_gen(trans,rots) out = 3 self.assertEqual(polya(Concs,agroup,arrowings=arrow_types),out)
def test_p2(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-3, 1], [-3, 1], [-3, 1], [-3, 2], [3, 3], [3, 3], [3, 3], [3, 4]] trans = [[0, 1, 2, 3, 4, 5, 6, 7], [1, 0, 3, 2, 5, 4, 7, 6], [2, 3, 4, 5, 6, 7, 0, 1], [3, 2, 5, 4, 7, 6, 1, 0], [4, 5, 6, 7, 0, 1, 2, 3], [5, 4, 7, 6, 1, 0, 3, 2], [6, 7, 0, 1, 2, 3, 4, 5], [7, 6, 1, 0, 3, 2, 5, 4]] rots = [[[0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3]], [[0, 1, 2, 3, 4, 5, 6, 7], [2, 1, 0, 3]], [[0, 1, 6, 7, 4, 5, 2, 3], [0, 3, 2, 1]], [[0, 1, 6, 7, 4, 5, 2, 3], [2, 3, 0, 1]]] (narrows, arrow_types, Concs) = how_many_arrows(col) agroup = a_group(trans, rots) out = 9568 self.assertEqual(polya(Concs, agroup, arrowings=arrow_types), out)
def test_r1(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-1,1],[-1,2],[0,3],[0,4]] trans = [[0,1,2,3],[1,0,3,2],[2,3,0,1],[3,2,1,0]] rots = [[[0,1,2,3],[0,1,2,3]],[[0,1,2,3],[2,1,0,3]],[[0,1,2,3],[0,3,2,1]],[[0,1,2,3],[2,3,0,1]],[[0,3,2,1],[1,0,3,2]],[[0,3,2,1],[3,0,1,2]],[[0,3,2,1],[1,2,3,0]],[[0,3,2,1],[3,2,1,0]]] (narrows,arrow_types,Concs) = how_many_arrows(col) temp_agroup = a_group(trans,rots) agroup = [] print("ta",temp_agroup) for i in temp_agroup: sites = [j+1 for j in i[0]] ars = [j+1 for j in i[1]] agroup.append([sites,ars]) print("a",agroup) out = 18 self.assertEqual(polya(Concs,agroup,arrowings=arrow_types),out)
def test_r2(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-1,1],[-1,2],[0,3],[0,4]] trans = [[0,1,2,3],[1,0,3,2],[2,3,0,1],[3,2,1,0]] rots = [[[0,1,2,3],[0,1,2,3]],[[0,1,2,3],[2,1,0,3]],[[0,1,2,3],[0,3,2,1]],[[0,1,2,3],[2,3,0,1]],[[0,3,2,1],[1,0,3,2]],[[0,3,2,1],[3,0,1,2]],[[0,3,2,1],[1,2,3,0]],[[0,3,2,1],[3,2,1,0]]] (narrows,arrow_types,Concs) = how_many_arrows(col) Concs = [1] temp_agroup = a_group(trans,rots) agroup = [] for i in temp_agroup: sites = [j+1 for j in i[0]] ars = [j+1 for j in i[1]] agroup.append([sites,ars]) out = 18 with pytest.raises(ValueError): polya(Concs,agroup,arrowings=arrow_types)
def test_r1(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-1, 1], [-1, 2], [0, 3], [0, 4]] trans = [[0, 1, 2, 3], [1, 0, 3, 2], [2, 3, 0, 1], [3, 2, 1, 0]] rots = [[[0, 1, 2, 3], [0, 1, 2, 3]], [[0, 1, 2, 3], [2, 1, 0, 3]], [[0, 1, 2, 3], [0, 3, 2, 1]], [[0, 1, 2, 3], [2, 3, 0, 1]], [[0, 3, 2, 1], [1, 0, 3, 2]], [[0, 3, 2, 1], [3, 0, 1, 2]], [[0, 3, 2, 1], [1, 2, 3, 0]], [[0, 3, 2, 1], [3, 2, 1, 0]]] (narrows, arrow_types, Concs) = how_many_arrows(col) temp_agroup = a_group(trans, rots) agroup = [] print("ta", temp_agroup) for i in temp_agroup: sites = [j + 1 for j in i[0]] ars = [j + 1 for j in i[1]] agroup.append([sites, ars]) print("a", agroup) out = 18 self.assertEqual(polya(Concs, agroup, arrowings=arrow_types), out)
def test_r2(self): from phenum.grouptheory import a_group from phenum.phonons import how_many_arrows, how_many_arrows dim = 4 col = [[-1, 1], [-1, 2], [0, 3], [0, 4]] trans = [[0, 1, 2, 3], [1, 0, 3, 2], [2, 3, 0, 1], [3, 2, 1, 0]] rots = [[[0, 1, 2, 3], [0, 1, 2, 3]], [[0, 1, 2, 3], [2, 1, 0, 3]], [[0, 1, 2, 3], [0, 3, 2, 1]], [[0, 1, 2, 3], [2, 3, 0, 1]], [[0, 3, 2, 1], [1, 0, 3, 2]], [[0, 3, 2, 1], [3, 0, 1, 2]], [[0, 3, 2, 1], [1, 2, 3, 0]], [[0, 3, 2, 1], [3, 2, 1, 0]]] (narrows, arrow_types, Concs) = how_many_arrows(col) Concs = [1] temp_agroup = a_group(trans, rots) agroup = [] for i in temp_agroup: sites = [j + 1 for j in i[0]] ars = [j + 1 for j in i[1]] agroup.append([sites, ars]) out = 18 with pytest.raises(ValueError): polya(Concs, agroup, arrowings=arrow_types)
def _polya_out(args): """Generates the 'polya.out' files for the cell sizes specified in 'lattice.in' (or other specified input file). Args: args (dict): The command line inputs. """ from phenum.HNFs import get_HNFs from phenum.grouptheory import get_sym_group from phenum.symmetry import get_concs_for_size from phenum.io_utils import read_lattice import phenum.phonons as pb from phenum.polyaburnside import polya params = read_lattice(args["lattice"]) for s in range(params["sizes"][0], params["sizes"][1]+1): # get HNFs hnfs = get_HNFs(s,params["lat_vecs"],params["basis_vecs"],3) out = open(args["outfile"]+"."+str(s), 'w+') # find the concentrations available for the desired cell sizes. c_list = get_concs_for_size(s, params["nspecies"], params["is_crestricted"], len(params["basis_vecs"]), params["concs"]) # We need to write the concs in c_list to the output file. out.write('{0: <28}'.format("# HNF")) for conc in c_list: out.write("{0: <50}".format(':'.join(map(str, conc)))) out.write('{0: <50}\n'.format("Total")) a_concs = pb.get_arrow_concs(params) conc_totals = [0 for i in range(len(c_list))] for thnf in hnfs: hnf = [thnf[0][0],thnf[1][0],thnf[1][1],thnf[2][0],thnf[2][1],thnf[2][2]] out.write(" {0: <26}".format(' '.join(map(str, hnf)))) sym_g = get_sym_group(params["lat_vecs"],params["basis_vecs"],thnf,3) agroup = [] len_sym_g = len(sym_g.perm.site_perm) for i in range(len_sym_g): agroup.append([sym_g.perm.site_perm[i],sym_g.perm.arrow_perm[i]]) # we need to loop over the concentrations and find the # number of arrangements possible for each cell size total = 0 for iconc, conc in enumerate(c_list): if len(conc) > 0: decorations = pb.arrow_concs(conc,a_concs) # we need to know the concentrations of the # species with and without arrows, we also need to # know the number of arrows and their species so # we can undo the previous step later (n_arrows,arrow_types,concs_w_arrows) = pb.how_many_arrows(decorations) # now find the number of unique arrangements using Polya. if arrow_types != 0 or n_arrows !=0: total_num = polya(concs_w_arrows,agroup,arrowings=arrow_types) else: total_num = polya(conc, agroup) out.write("{0: <50d}".format(total_num)) total += total_num conc_totals[iconc] += total_num out.write('{0: <10d}\n'.format(total)) out.write("# " + ''.join(['-' for i in range(len(c_list)*10 + 10 + 30)]) + '\n') out.write("{0: <28}".format(" 0 0 0 0 0 0")) for ctotal in conc_totals: out.write("{0: <50d}".format(ctotal)) out.write("{0: <50d}\n".format(sum(conc_totals))) out.close()
def _polya_out(args): """Generates the 'polya.out' files for the cell sizes specified in 'lattice.in' (or other specified input file). Args: args (dict): The command line inputs. """ from phenum.HNFs import get_HNFs from phenum.grouptheory import get_sym_group from phenum.symmetry import get_concs_for_size from phenum.io_utils import read_lattice import phenum.phonons as pb from phenum.polyaburnside import polya params = read_lattice(args["lattice"]) for s in range(params["sizes"][0], params["sizes"][1] + 1): # get HNFs hnfs = get_HNFs(s, params["lat_vecs"], params["basis_vecs"], 3) out = open(args["outfile"] + "." + str(s), 'w+') # find the concentrations available for the desired cell sizes. c_list = get_concs_for_size(s, params["nspecies"], params["is_crestricted"], len(params["basis_vecs"]), params["concs"]) # We need to write the concs in c_list to the output file. out.write('{0: <28}'.format("# HNF")) for conc in c_list: out.write("{0: <50}".format(':'.join(map(str, conc)))) out.write('{0: <50}\n'.format("Total")) a_concs = pb.get_arrow_concs(params) conc_totals = [0 for i in range(len(c_list))] for thnf in hnfs: hnf = [ thnf[0][0], thnf[1][0], thnf[1][1], thnf[2][0], thnf[2][1], thnf[2][2] ] out.write(" {0: <26}".format(' '.join(map(str, hnf)))) sym_g = get_sym_group(params["lat_vecs"], params["basis_vecs"], thnf, 3) agroup = [] len_sym_g = len(sym_g.perm.site_perm) for i in range(len_sym_g): agroup.append( [sym_g.perm.site_perm[i], sym_g.perm.arrow_perm[i]]) # we need to loop over the concentrations and find the # number of arrangements possible for each cell size total = 0 for iconc, conc in enumerate(c_list): if len(conc) > 0: decorations = pb.arrow_concs(conc, a_concs) # we need to know the concentrations of the # species with and without arrows, we also need to # know the number of arrows and their species so # we can undo the previous step later (n_arrows, arrow_types, concs_w_arrows) = pb.how_many_arrows(decorations) # now find the number of unique arrangements using Polya. if arrow_types != 0 or n_arrows != 0: total_num = polya(concs_w_arrows, agroup, arrowings=arrow_types) else: total_num = polya(conc, agroup) out.write("{0: <50d}".format(total_num)) total += total_num conc_totals[iconc] += total_num out.write('{0: <10d}\n'.format(total)) out.write("# " + ''.join(['-' for i in range(len(c_list) * 10 + 10 + 30)]) + '\n') out.write("{0: <28}".format(" 0 0 0 0 0 0")) for ctotal in conc_totals: out.write("{0: <50d}".format(ctotal)) out.write("{0: <50d}\n".format(sum(conc_totals))) out.close()