On the design of Dammann gratings