Polymath, mineralogist, and 'Patriarch of Independence' who steered Dom Pedro I toward Brazilian sovereignty in 1822 and championed the abolition of slavery.