OrbToMultiplicity

OrbToMultiplicity(orb) tries to interpret the string orb as an atomic orbital and returns the multiplicity of the state (spin included).

Input

  • orb : String that can be interpreted as an atomic orbital (i.e. orb ends on “s”, “p”, “12”, “32”, “1/2”, “3/2”, or the like)

Output

  • mult : Interger value of the multiplicity of the orbital

Example

Input

Example.Quanty
OrbList = {"1s","2s","2p","3s","3p","3d","4s","4p","4d","4f","5s","5p","5d","5f","5g","6s","6p","6d","6f","6g","6h","7s","7p","7d","7f","7g","8s","8p","8d","8f","9s","9p","9d","10s","10p","11s","Noodles","Mind the Gap","Barely Used","Stuff","Hug","Test","1s12","2s12","1s1/2","2s1/2","2p1/2","2p3/2","Saturday 5/2","Ephebus 7/2","Nose-in-Fridge 9/2"} 
 
for key,orb in pairs(OrbList) do
    print("Multiplicity of \""..orb.."\": "..OrbToMultiplicity(orb))
end

Result

Multiplicity of "1s": 2
Multiplicity of "2s": 2
Multiplicity of "2p": 6
Multiplicity of "3s": 2
Multiplicity of "3p": 6
Multiplicity of "3d": 10
Multiplicity of "4s": 2
Multiplicity of "4p": 6
Multiplicity of "4d": 10
Multiplicity of "4f": 14
Multiplicity of "5s": 2
Multiplicity of "5p": 6
Multiplicity of "5d": 10
Multiplicity of "5f": 14
Multiplicity of "5g": 18
Multiplicity of "6s": 2
Multiplicity of "6p": 6
Multiplicity of "6d": 10
Multiplicity of "6f": 14
Multiplicity of "6g": 18
Multiplicity of "6h": 22
Multiplicity of "7s": 2
Multiplicity of "7p": 6
Multiplicity of "7d": 10
Multiplicity of "7f": 14
Multiplicity of "7g": 18
Multiplicity of "8s": 2
Multiplicity of "8p": 6
Multiplicity of "8d": 10
Multiplicity of "8f": 14
Multiplicity of "9s": 2
Multiplicity of "9p": 6
Multiplicity of "9d": 10
Multiplicity of "10s": 2
Multiplicity of "10p": 6
Multiplicity of "11s": 2
Multiplicity of "Noodles": 2
Multiplicity of "Mind the Gap": 6
Multiplicity of "Barely Used": 10
Multiplicity of "Stuff": 14
Multiplicity of "Hug": 18
 
Could not interpret orbital "Test" as either relativistic or non-relativistic atomic orbital, returning -1.
Multiplicity of "Test": -1
Multiplicity of "1s12": 2
Multiplicity of "2s12": 2
Multiplicity of "1s1/2": 2
Multiplicity of "2s1/2": 2
Multiplicity of "2p1/2": 2
Multiplicity of "2p3/2": 4
Multiplicity of "Saturday 5/2": 6
Multiplicity of "Ephebus 7/2": 8
Multiplicity of "Nose-in-Fridge 9/2": 10

Table of contents

Print/export