Optimization in the preparation of Solar Cell Materials