Implemented the proper boundary conditions for the available potential
energy