Phase engineering of nanomaterials