energyvec_phase function added