formula2vector {GCDkit} | R Documentation |
Function counting number of individual atoms in a formula given by a simple text string.
formula2vector(formula)
formula |
character; a mineral formula |
This function converts a mineral formula given as a single character string - like.g. 'KAlSi3O8' for K-feldspar - to a vector with all atoms (per formula unit) counted. Elements can be repeated, trivalent Fe has to be denoted as 'FeIII'. Brackets can be used, like '(PO4)2'.
A named numeric vector with numbers of individual atoms.
Vojtěch Janoušek, vojtech.janousek@geology.cz
idealMineralCompositions
plComp
olComp
minComp
formula2vector("NaAlSi3O8") # Number of apfu per albite formula formula2vector("6NaAlSiO4·Na2CO3") # Cancrinite formula2vector("CaMg(CO3)2") # Dolomite formula2vector("Ca3FeIII2Si3O12") # Andradite