Theoretical study of magnetic properties of ammonia molecule in nonuniform magnetic field