added correct Bloch-mode length to write potential file