Coupled wave method with modified boundary conditions for diffraction grating calculations. (9th March 2020)