Simulating the size distribution and chemical composition of ultrafine particles during nucleation events