gibbs c function, with python wrapper