updated average density code so that it is more like an rdf from the metal (sort of)