write Green's function