def supercell(self, scale_mat):
"""
Get the supercell of the origin gcell
scale_mat is similar as H matrix in superlattice generator
"""
# return self.__class__(...)
sarr_lat = np.matmul(scale_mat, self.lattice)
# coor_conv_pos = np.matmul(self.positions, self.lattice)
# o_conv_pos = np.matmul(coor_conv_pos, np.linalg.inv(scale_mat))
o_conv_pos = np.matmul(self.positions, np.linalg.inv(scale_mat))
o_pos = self.get_frac_from_mat(scale_mat)
l_of_positions = [i for i in map(lambda x: x+o_pos, list(o_conv_pos))]
pos = np.concatenate(l_of_positions, axis=0)
n = scale_mat.diagonal().prod()
numbers = np.repeat(self.numbers, n)
return self.__class__(sarr_lat, pos, numbers)
评论列表
文章目录