added coherence function calc_g12