made calc_densitiy consistent with the rest of the programs.