Nucleation and polymorphic precipitation of carbonate minerals