A mineral is, broadly speaking, a solid chemical compound that occurs naturally in pure form. Minerals are most commonly associated with rocks due to the presence of minerals within rocks. These rocks may consist of one type of mineral, or may be an aggregate of two or more different types of minerals, spacially segregated into distinct phases. Compounds that occur only in living beings are usually excluded, but some minerals are often biogenic (such as calcite) and/or are organic compounds in the sense of chemistry (such as mellite). Moreover, living beings often synthesize inorganic minerals (such as hydroxylapatite) that also occur in rocks.
In geology and mineralogy, the term "mineral" is usually reserved for mineral species: crystalline compounds with a fairly well-defined chemical composition and a specific crystal structure. Minerals without a definite crystalline structure, such as opal or obsidian, are then more properly called mineraloids. If a chemical compound may occur naturally with different crystal structures, each structure is considered different mineral species. Thus, for example, quartz and stishovite are two different minerals consisting of the same compound, silicon dioxide.