added partition support in create_lattice function