add PH optimization script