added potential calculation