add option to write structures into files with a given prefix