sample code for cube lattice