Why is the gram no longer a function of the atomic mass number?
Unless I misunderstand the question, the gram was never defined that way.

For historical reasons the SI unit for mass is an oddity:


The base unit is not the gram, but the kilogram. This is the only case where the base unit has a prefix. The gram is defined as $\frac{1}{1000}$ of a kilogram.
The kilogram is the only remaining SI unit that is based on a man-made object, the International Prototype of the Kilogram.


At its 25th meeting in 2014, the General Conference on Weights and Measures (CGPM) has (again) declared its intention to abandon this atificial standard and link 


  the definitions of the kilogram, ampere, kelvin, and mole to exact numerical values of the
  Planck constant $h$, elementary charge $e$, Boltzmann constant k, and Avogadro constant $N_A$ [&hellip;] 


(Source)

One of the possible approaches for the redefinition of the kilogram would be a side-effect of the redefinition of the Avogadro constant with in the Avogadro project.