Refactored to fix possible errors due to 0*ln(0) in h() and s()
Fixed tests of cell potentials