Producing thin layers of samples on a substrate