# \[ANN\] Mendeleev.jl - accessing chemical elements data

**URL:** https://discourse.julialang.org/t/ann-mendeleev-jl-accessing-chemical-elements-data/89804
**Category:** Package Announcements
**Tags:** physics, chemistry
**Created:** [November 5, 2022, 10:01am UTC](https://discourse.julialang.org/t/ann-mendeleev-jl-accessing-chemical-elements-data/89804 "2022-11-05T10:01:17Z")
**Posts on this page:** 1
**Showing post:** 12

<div class="post-metadata">

### Author: ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)
#### Post date: [November 13, 2022, 6:46pm UTC](https://discourse.julialang.org/t/ann-mendeleev-jl-accessing-chemical-elements-data/89804/12 "2022-11-13T18:46:37Z")

</div>

> [@juliohm](#):
>
> I will probably need PeriodicTable.jl for basic stoichiometry, nothing sophisticated.

Actually that’s apparently the only (visible, i.e in a registered package) use of the PeriodicTable: Stoichiometry and the fancy indexing. As these functionalities are the most used, I’ve decided to split out a separate minimalistic package from Mendeleev, with these functionalities only, no dependencies, no extra data etc… Then however I couldn’t resist a temptation to add some sugar onto these bare-bones. The package is already fully functional and to be registered after adding tests, documentation etc.

```julia
using ChemElementsBB

K = chem_els["potassium"]
Ca = chem_els[:Ca]
P = chem_els[15] # three ways of indexing similar to PeriodicTable
O = chem_els.O # one more (Mendeleev)

julia> O
Oxygen (O) - element 8, m=15.999

julia> K / (K + Ca + P + 4*O)
0.22451440791379498

```

Macro to create element-named-variables (doing in effect the same as the code above).

```julia
using ChemElementsBB
@import_els K Ca P O

julia> K
Potassium (K) - element 19, m=39.0983

@import_els O:Ca

julia> F
Fluorine (F) - element 9, m=18.998403163

```

On this basis another separate package for chemical formulas is feasible, along the lines of [ChemEquations.jl](https://discourse.julialang.org/t/ann-chemequations-jl-write-and-balance-chemical-equations-elegantly-and-efficiently/44153). The usage then could be like

```julia
julia> K/cf"KCaPO4"
0.22451440791379498

```

---

_[View the full topic](https://discourse.julialang.org/t/ann-mendeleev-jl-accessing-chemical-elements-data/89804)._
