finish the part that calculates density of states
the results seem OK