1
0
mirror of https://github.com/TREX-CoE/fparser.git synced 2024-10-02 06:21:08 +02:00

elements to the periodic table added; class expanded; american british taken care of

This commit is contained in:
Ravindra Shinde 2021-02-25 10:06:23 +01:00
parent 29b4f422dd
commit 14a34e7902
3 changed files with 97 additions and 8 deletions

View File

@ -23,6 +23,7 @@ MODULE keywords
use iso_fortran_env
use periodic_table, only: atom_t, element
implicit none

View File

@ -1,12 +1,30 @@
module periodic_table
! Enter licence information here
! Licence information ends here
!
! Note. The elemental data is taken from the NIST website (https://physics.nist.gov/PhysRefData/Handbook/periodictable_a.htm)
! The data tabulated in this file is only for the most abundant isotope only.
module periodic_table
public :: element, atom_t
private :: i1, sp
integer, parameter :: sp = kind(1.0)
integer, parameter :: i1 = kind(int1)
type :: atom_t
character(len=20) :: name
character(len=3) :: symbol
integer :: znuclear
real :: atomic_mass
real(kind=sp) :: atomic_mass ! in amu
character(len=20) :: name
character(len=3) :: symbol
integer(kind=i1) :: znuclear
integer(kind=i1) :: isotope = 1 ! currently supports only the most abundant
! future plans
! covalent_radii
! ground state term symbol
! total spin
! magnetic moment
end type atom_t
contains
@ -17,9 +35,79 @@ module periodic_table
select case(sym)
case("hydrogen", "Hydrogen", "H", "1")
atom = atom_t(name="hydrogen", symbol="H", atomic_mass=1.00794, znuclear=1)
atom = atom_t(name="hydrogen", symbol="H", atomic_mass=1.007825, znuclear=1)
case("helium", "Helium", "He", "2")
atom = atom_t(name="helium", symbol="He", atomic_mass=4.00260, znuclear=2)
case("lithium", "Lithium", "Li", "3")
atom = atom_t(name="lithium", symbol="Li", atomic_mass=7.016003, znuclear=3)
case("beryllium", "Beryllium", "Be", "4")
atom = atom_t(name="beryllium", symbol="Be", atomic_mass=9.012182, znuclear=4)
case("boron", "Boron", "B", "5")
atom = atom_t(name="boron", symbol="B", atomic_mass=11.009305, znuclear=5)
case("carbon", "Carbon", "C", "6")
atom = atom_t(name="carbon", symbol="C", atomic_mass=12.000000, znuclear=6)
case("nitrogen", "Nitrogen", "N", "7")
atom = atom_t(name="nitrogen", symbol="N", atomic_mass=14.003074, znuclear=7)
case("oxygen", "Oxygen", "O", "8")
atom = atom_t(name="oxygen", symbol="O", atomic_mass=15.994915, znuclear=8)
case("fluorine", "Fluorine", "F", "9")
atom = atom_t(name="fluorine", symbol="F", atomic_mass=18.9984032, znuclear=9)
case("neon", "Neon", "Ne", "10")
atom = atom_t(name="neon", symbol="Ne", atomic_mass=19.992435, znuclear=10)
case("sodium", "Sodium", "Na", "11")
atom = atom_t(name="sodium", symbol="Na", atomic_mass=22.989767, znuclear=11)
case("magnesium", "Magnesium", "Mg", "12")
atom = atom_t(name="magnesium", symbol="Mg", atomic_mass=23.985042, znuclear=12)
case("aluminum", "Aluminum", "aluminium", "Aluminium", "Al", "13")
atom = atom_t(name="aluminum", symbol="Al", atomic_mass=26.981540, znuclear=13)
case("silicon", "Silicon", "Si", "14")
atom = atom_t(name="silicon", symbol="Si", atomic_mass=27.976927, znuclear=14)
case("phosphorus", "Phosphorus", "P", "15")
atom = atom_t(name="phosphorus",symbol="P", atomic_mass=30.973762, znuclear=15)
case("sulfur", "Sulfur", "sulphur", "Sulphur", "S", "16")
atom = atom_t(name="sulfur", symbol="S", atomic_mass=31.972070, znuclear=16)
case("chlorine", "Chlorine", "Cl", "17")
atom = atom_t(name="chlorine", symbol="Cl", atomic_mass=34.968852, znuclear=17)
case("argon", "Argon", "Ar", "18")
atom = atom_t(name="argon", symbol="Ar", atomic_mass=39.962384, znuclear=18)
case default
error stop "Unknown element or symbol"
error stop "Unknown element's atomic number or symbol"
end select
return
end function

View File

@ -9,7 +9,7 @@ program trial_reading
type(atom_t) :: atom1
atom1 = element("Hydrogen")
atom1 = element("sulfur")
print*, "atom info name ", atom1%name
print*, "atom info symbol ", atom1%symbol