new subroutine in pot_lpcm_cav_k.F to write to file. not tested