chemboxR
chemboxR.Rmd
Using get_elements()
The get_elements
function will strip a molecule into its
base elements along with the count of each element within the molecule
and create a dataframe. In order to do this, call the function and pass
the molecule as a string such as:
get_elements("C2H4")
#> element count
#> 1 C 2
#> 2 H 4
You can also call multiples of one element such as:
get_elements("(C2H4)5")
#> element count
#> 1 C 10
#> 2 H 20
get_elements('Al2(SO4)3')
#> element count
#> 1 Al 2
#> 2 S 3
#> 3 O 12
get_elements('LiH2')
#> element count
#> 1 Li 1
#> 2 H 2
Using is_valid()
This function will check if the molecule is chemically viable and
will output a Boolean response of True
or
False
. To use this function, call it and pass a molecule as
a string:
# Calcium carbonate (a common salt)
is_valid('Al2(SO4)3')
#> [1] TRUE
# Sodium hydroxide (a common base)
is_valid('NaOH')
#> [1] TRUE
# Carbonic acid (a common acid)
is_valid('H2CO3')
#> [1] TRUE
Using get_molec_props()
This function will output a dataframe of properties of each element that a molecule contains. To use this function call it and pass a molecule as a string:
get_molec_props('NaOH')
#> Symbol Element AtomicNumber AtomicMass Density AtomicRadius Config
#> 1 H Hydrogen 1 1.00800 8.988e-05 53 1s1
#> 2 O Oxygen 8 15.99900 1.429e-03 48 [He] 2s2 2p4
#> 3 Na Sodium 11 22.98977 9.710e-01 190 [Ne] 3s1
#> ShellConfig OxiStates
#> 1 1,,,,,, 1
#> 2 2,6,,,,, -2
#> 3 2,8,1,,,, 1
get_molec_props('CaCl3')
#> Symbol Element AtomicNumber AtomicMass Density AtomicRadius Config
#> 1 Ca Calcium 20 40.078 1.540000 194 [Ar] 4s2
#> 2 Cl Chlorine 17 35.450 0.003214 79 [Ne] 3s2 3p5
#> ShellConfig OxiStates
#> 1 2,8,8,2,,, 2
#> 2 2,8,7,,,, -1,1,3,5,7
get_molec_props('Al2(SO4)3(C2H4)5')
#> Symbol Element AtomicNumber AtomicMass Density AtomicRadius Config
#> 1 Al Aluminium 13 26.98154 2.698e+00 118 [Ne] 3s2 3p1
#> 2 C Carbon 6 12.01100 2.267e+00 67 [He] 2s2 2p2
#> 3 H Hydrogen 1 1.00800 8.988e-05 53 1s1
#> 4 O Oxygen 8 15.99900 1.429e-03 48 [He] 2s2 2p4
#> 5 S Sulfur 16 32.06000 2.067e+00 88 [Ne] 3s2 3p4
#> ShellConfig OxiStates
#> 1 2,8,3,,,, 3
#> 2 2,4,,,,, -4,-3,-2,-1,0,1,2,3,4
#> 3 1,,,,,, 1
#> 4 2,6,,,,, -2
#> 5 2,8,6,,,, -2,2,4,6
Using get_combustion_equation()
This function will output the molecules that result from the combustion of a specified molecule in a dataframe. To use this function, call it and pass the molecule as a string:
get_combustion_equation('C2H4')
#> C2H4 O2 CO2 H2O
#> 1 1 3 2 2
get_combustion_equation('C4H6')
#> C4H6 O2 CO2 H2O
#> 1 2 11 8 6
get_combustion_equation('C5H12')
#> C5H12 O2 CO2 H2O
#> 1 1 8 5 6