  This paper provides a theoretical and numerical approach to show existence,
uniqueness, and the numerical determination of metalenses refracting radiation
with energy patterns. The theoretical part uses ideas from optimal transport
and for the numerical solution we study and implement a damped Newton algorithm
to solve the semi discrete problem. A detailed analysis is carried out to solve
the near field one source refraction problem and extensions to the far field
are also mentioned.
