Structural control over the formation of calcium carbonate mineral phases in biomineralization