Energy and Chemical Cycling in Ecosystems