Calculating many-body Green's function