FPGA based coprocessor to calculate the energy of bipolar systems