Efficient method to count and generate compact protein lattice conformations