def expand_structure(structure, radius=10): """expand the structure to include more atoms. For each atom in the original structure, ensure that around it a raidus of 10 angstrom there are atoms in the structure. Keep the index for atoms in the original structure Return: a expanded structure with index for the original structure fixed """ species = structure.species coords = structure.cart_coords molecule = Molecule(species, coords) a = structure.lattice.matrix[0] b = structure.lattice.matrix[1] c = structure.lattice.matrix[2] ni = max(int(10 / norm(a)), 1) nj = max(int(10 / norm(b)), 1) nk = max(int(10 / norm(c)), 1) for i in range(-ni, ni + 1): for j in range(-nj, nj + 1): for k in range(-nk, nk + 1): if i == 0 and j == 0 and k == 0: continue for site in structure.sites: specie = site.specie coords = site.coords + i * a + j * b + k * c molecule.append(specie, coords) return molecule