diff --git a/rmgpy/constants.py b/rmgpy/constants.py index 3b546d97d6b..39242a6024a 100644 --- a/rmgpy/constants.py +++ b/rmgpy/constants.py @@ -39,26 +39,29 @@ The constants defined in this module are listed in the table below: .. table:: Physical constants defined in the :mod:`rmgpy.constants` module + +Values updated November 2025 using exact values (when available) sourced from https://arxiv.org/pdf/2409.03787 ======================= =================== =========================================================== ============================================================ Symbol Constant Value Description ======================= =================== =========================================================== ============================================================ - :math:`E_\mathrm{h}` :data:`E_h` :math:`4.35974434 \times 10^{-18} \ \mathrm{J}` Hartree energy - :math:`F` :data:`F` :math:`96485.3365 \ \mathrm{C/mol}` Faraday constant - :math:`G` :data:`G` :math:`6.67384 \times 10^{-11} \ \mathrm{m^3/kg \cdot s^2}` Newtonian gravitational constant - :math:`N_\mathrm{A}` :data:`Na` :math:`6.02214179 \times 10^{23} \ \mathrm{mol^{-1}}` Avogadro constant - :math:`R` :data:`R` :math:`8.314472 \ \mathrm{J/mol \cdot K}` gas law constant - :math:`a_0` :data:`a0` :math:`5.2917721092 \times 10^{-11} \ \mathrm{m}` Bohr radius - :math:`c` :data:`c` :math:`299792458 \ \mathrm{m/s}` speed of light in a vacuum - :math:`e` :data:`e` :math:`1.602176565 \times 10^{-19} \ \mathrm{C}` elementary charge - :math:`g` :data:`g` :math:`9.80665 \ \mathrm{m/s^2}` standard acceleration due to gravity - :math:`h` :data:`h` :math:`6.62606896 \times 10^{-34} \ \mathrm{J \cdot s}` Planck constant - :math:`\hbar` :data:`hbar` :math:`1.054571726 \times 10^{-34} \ \mathrm{J \cdot s}` reduced Planck constant - :math:`k_\mathrm{B}` :data:`kB` :math:`1.3806504 \times 10^{-23} \ \mathrm{J/K}` Boltzmann constant - :math:`m_\mathrm{e}` :data:`m_e` :math:`9.10938291 \times 10^{-31} \ \mathrm{kg}` electron rest mass - :math:`m_\mathrm{n}` :data:`m_n` :math:`1.674927351 \times 10^{-27} \ \mathrm{kg}` neutron rest mass - :math:`m_\mathrm{p}` :data:`m_p` :math:`1.672621777 \times 10^{-27} \ \mathrm{kg}` proton rest mass - :math:`m_\mathrm{u}` :data:`amu` :math:`1.660538921 \times 10^{-27} \ \mathrm{kg}` atomic mass unit + :math:`E_\mathrm{h}` :data:`E_h` :math:`4.3597447222060 \times 10^{-18} \ \mathrm{J}` Hartree energy + :math:`F` :data:`F` :math:`96 48533212 \ldots \ \mathrm{C/mol}` Faraday constant (exact) + :math:`G` :data:`G` :math:`6.67430 \times 10^{-11} \ \mathrm{m^3/kg \cdot s^2}` Newtonian gravitational constant + :math:`N_\mathrm{A}` :data:`Na` :math:`6.02214076 \times 10^{23} \ \mathrm{mol^{-1}}` Avogadro constant (exact) + :math:`R` :data:`R` :math:`8.314462618 \ldots \ \mathrm{J/mol \cdot K}` gas law constant (exact) + :math:`a_0` :data:`a0` :math:`5.29177210544 \ldots \times 10^{-11} \ \mathrm{m}` Bohr radius + :math:`c` :data:`c` :math:`299792458 \ \mathrm{m/s}` speed of light in a vacuum (exact) + :math:`e` :data:`e` :math:`1.602176634 \times 10^{-19} \ \mathrm{C}` elementary charge (exact) + :math:`g` :data:`g` :math:`9.80665 \ \mathrm{m/s^2}` standard acceleration due to gravity (exact) + :math:`h` :data:`h` :math:`6.62607015 \times 10^{-34} \ \mathrm{J \cdot s}` Planck constant (exact) + :math:`\hbar` :data:`hbar` :math:`1.054571817 \times 10^{-34} \ \mathrm{J \cdot s}` reduced Planck constant (exact) + :math:`k_\mathrm{B}` :data:`kB` :math:`1.380649 \times 10^{-23} \ \mathrm{J/K}` Boltzmann constant (exact) + :math:`m_\mathrm{e}` :data:`m_e` :math:`9.1093837139 \times 10^{-31} \ \mathrm{kg}` electron rest mass + :math:`m_\mathrm{n}` :data:`m_n` :math:`1.67492750056 \times 10^{-27} \ \mathrm{kg}` neutron rest mass + :math:`m_\mathrm{p}` :data:`m_p` :math:`1.67262192595 \times 10^{-27} \ \mathrm{kg}` proton rest mass + :math:`M_\mathrm{u}` :data:`M_u` :math:`1.0000000010531 \times 10^{-3} \ \mathrm{kg/mol}` molar mass constant + :math:`m_\mathrm{u}` :data:`amu` :math:`1.66053906892 \times 10^{-27} \ \mathrm{kg}` atomic mass unit :math:`\pi` :data:`pi` :math:`3.14159 \ldots` ======================= =================== =========================================================== ============================================================ @@ -68,53 +71,57 @@ ################################################################################ -#: The Hartree energy :math:`E_\mathrm{h}` in :math:`\mathrm{J}` -E_h = 4.35974434e-18 +#: :math:`\pi = 3.14159 \ldots` +pi = float(math.pi) #: The Avogadro constant :math:`N_\mathrm{A}` in :math:`\mathrm{mol^{-1}}` -Na = 6.02214179e23 +Na = 6.02214076e23 -#: The gas law constant :math:`R` in :math:`\mathrm{J/mol \cdot K}` -R = 8.314472 - -#: The Bohr radius :math:`a_0` in :math:`\mathrm{m}` -a0 = 5.2917721092e-11 +#: The Avogadro constant :math:`N_\mathrm{A}` in :math:`\mathrm{mol^{-1}}` +Mu = 1.0000000010531e-3 -#: The atomic mass unit in :math:`\mathrm{kg}` -amu = 1.660538921e-27 +#: The Boltzmann constant :math:`k_\mathrm{B}` in :math:`\mathrm{J/K}` +kB = 1.380649e-23 #: The speed of light in a vacuum :math:`c` in :math:`\mathrm{m/s}` c = 299792458 #: The elementary charge :math:`e` in :math:`\mathrm{C}` -e = 1.602176565e-19 +e = 1.602176634e-19 #: The Planck constant :math:`h` in :math:`\mathrm{J \cdot s}` -h = 6.62606896e-34 +h = 6.62607015e-34 #: The reduced Planck constant :math:`\hbar` in :math:`\mathrm{J \cdot s}` -hbar = 1.054571726e-34 +hbar = h / (2 * pi) -#: The Boltzmann constant :math:`k_\mathrm{B}` in :math:`\mathrm{J/K}` -kB = 1.3806504e-23 +#: The gas law constant :math:`R` in :math:`\mathrm{J/mol \cdot K}` +R = kB * Na + +#: Vacuum permittivity +epsilon_0 = 8.8541878188e-12 + +#: The Bohr radius :math:`a_0` in :math:`\mathrm{m}` +a0 = 5.29177210544e-11 + +#: The Hartree energy :math:`E_\mathrm{h}` in :math:`\mathrm{J}` +E_h = e**2 / (4 * pi * epsilon_0 * a0) + +#: Faradays Constant F in C/mol +F = Na * e + +#: The atomic mass unit in :math:`\mathrm{kg}` +amu = Mu / Na #: The mass of an electron :math:`m_\mathrm{e}` in :math:`\mathrm{kg}` -m_e = 9.10938291e-31 +m_e = 9.1093837139e-31 #: The mass of a neutron :math:`m_\mathrm{n}` in :math:`\mathrm{kg}` -m_n = 1.674927351e-27 +m_n = 1.67492750056e-27 #: The mass of a proton :math:`m_\mathrm{p}` in :math:`\mathrm{kg}` -m_p = 1.672621777e-27 - -#: :math:`\pi = 3.14159 \ldots` -pi = float(math.pi) +m_p = 1.67262192595e-27 -#: Faradays Constant F in C/mol -F = 96485.3321233100184 - -#: Vacuum permittivity -epsilon_0 = 8.8541878128 ################################################################################ diff --git a/rmgpy/molecule/element.py b/rmgpy/molecule/element.py index 6ec975fcf94..6cd3c1bdc84 100644 --- a/rmgpy/molecule/element.py +++ b/rmgpy/molecule/element.py @@ -168,161 +168,134 @@ def get_element(value, isotope=-1): ################################################################################ -# Declare an instance of each element (1 to 112) # The variable names correspond to each element's symbol # The elements are sorted by increasing atomic number and grouped by period +#Taken from https://iupac.qmul.ac.uk/AtWt/ (IUPAC 2023, accessed November 2025) +#The molar mass constant Mu = 1.0000000010531e-3 kg/mol was used to convert from dimensionaless atomic weights to kg/mol. # Recommended IUPAC nomenclature is used throughout (including 'aluminium' and # 'caesium') # electron -e = Element(-1, 'e', 'electron' , 5.486e-7) +e = Element(-1, 'e', 'electron' , 5.485799090441e-7) # Surface site X = Element(0, 'X', 'surface_site' , 0.0) # Period 1 -# Hydrogen -H = Element(1, 'H' , 'hydrogen' , 0.001007971) # assuming 99.9855% 1_H, 0.0145% 2_H; see https://applets.kcvs.ca/IPTEI/pdf-elements/hydrogen.pdf -D = Element(1, 'H' , 'deuterium' , 0.0020141017781, 2, 'D') # see https://applets.kcvs.ca/IPTEI/pdf-elements/hydrogen.pdf -T = Element(1, 'H' , 'tritium' , 0.003016049, 3, 'T') -He = Element(2, 'He', 'helium' , 0.004002601) # see https://applets.kcvs.ca/IPTEI/pdf-elements/helium.pdf +H = Element(1, 'H' , 'hydrogen' , 0.00100802000106) +D = Element(1, 'H' , 'deuterium' , 0.00201410177818, 2, 'D') +T = Element(1, 'H' , 'tritium' , 0.00301604928, 3, 'T') +He = Element(2, 'He', 'helium' , 0.00400260220422) # Period 2 -Li = Element(3, 'Li', 'lithium' , 0.006941) -Be = Element(4, 'Be', 'beryllium' , 0.009012182) -B = Element(5, 'B', 'boron' , 0.010811) -C = Element(6, 'C' , 'carbon' , 0.01201064) # assuming 1.06% 13_C, 98.94% 12_C; see https://applets.kcvs.ca/IPTEI/pdf-elements/carbon.pdf -C13= Element(6, 'C' , 'carbon-13' , 0.013003354, 13, 'CI') # see https://applets.kcvs.ca/IPTEI/pdf-elements/carbon.pdf -N = Element(7, 'N' , 'nitrogen' , 0.01400686) # assuming 0.3795% 15_N, 99.9855% 14_N; see https://applets.kcvs.ca/IPTEI/pdf-elements/nitrogen.pdf -O = Element(8, 'O' , 'oxygen' , 0.0159994) # assuming 99.7572% 16_O2, 0.2045% 18_O2, 0.0384% 17_O2; see https://applets.kcvs.ca/IPTEI/pdf-elements/oxygen.pdf -O18= Element(8, 'O' , 'oxygen-18' , 0.017999159613, 18, 'OI') # see https://applets.kcvs.ca/IPTEI/pdf-elements/oxygen.pdf -F = Element(9, 'F' , 'fluorine' , 0.018998403163) # see https://applets.kcvs.ca/IPTEI/pdf-elements/fluorine.pdf -Ne = Element(10, 'Ne', 'neon' , 0.02018005) # see https://applets.kcvs.ca/IPTEI/pdf-elements/neon.pdf +Li = Element(3, 'Li', 'lithium' , 0.00694600000731) +Be = Element(4, 'Be', 'beryllium' , 0.00901218315949) +B = Element(5, 'B' , 'boron' , 0.01081200001139) +C = Element(6, 'C' , 'carbon' , 0.01201120001265) +C13= Element(6, 'C' , 'carbon-13' , 0.0130033548352, 13, 'C13') +N = Element(7, 'N' , 'nitrogen' , 0.01400710001475) +N15= Element(7, 'N' , 'nitrogen-15' , 0.0150001088994, 15, 'N15') +O = Element(8, 'O' , 'oxygen' , 0.01599910001685) +O17= Element(8, 'O' , 'oxygen-17' , 0.0169991317575, 17, 'O17') +O18= Element(8, 'O' , 'oxygen-18' , 0.0179991596135, 18, 'O18') +F = Element(9, 'F' , 'fluorine' , 0.01899840318251) +Ne = Element(10, 'Ne', 'neon' , 0.02017976002125) # Period 3 -Na = Element(11, 'Na', 'sodium' , 0.022989770) -Mg = Element(12, 'Mg', 'magnesium' , 0.0243050) -Al = Element(13, 'Al', 'aluminium' , 0.026981538) -Si = Element(14, 'Si', 'silicon' , 0.0280855) -P = Element(15, 'P' , 'phosphorus' , 0.030973761998) # see https://applets.kcvs.ca/IPTEI/pdf-elements/phosphorus.pdf -S = Element(16, 'S' , 'sulfur' , 0.0320725) # assuming 0.7630% 33_S, 4.3650% 34_S, 0.0158% 36_S, 94.8562% 32_S; see https://applets.kcvs.ca/IPTEI/pdf-elements/sulfur.pdf -Cl = Element(17, 'Cl', 'chlorine' , 0.03545214) # assuming 24.2% 37_Cl, 75.8% 35_Cl; see https://applets.kcvs.ca/IPTEI/pdf-elements/chlorine.pdf -Ar = Element(18, 'Ar', 'argon' , 0.0398775) # assuming 1.04% 36_Ar, 2.165% 38_Ar, 96.795% 40_Ar; see https://applets.kcvs.ca/IPTEI/pdf-elements/argon.pdf +Na = Element(11, 'Na', 'sodium' , 0.02298976930621) +Mg = Element(12, 'Mg', 'magnesium' , 0.0243052000256) +Al = Element(13, 'Al', 'aluminium' , 0.02698153845841) +Si = Element(14, 'Si', 'silicon' , 0.02808510002958) +P = Element(15, 'P' , 'phosphorus' , 0.03097376203112) +S = Element(16, 'S' , 'sulfur' , 0.03206200003376) +Cl = Element(17, 'Cl', 'chlorine' , 0.03545100003733) +Ar = Element(18, 'Ar', 'argon' , 0.03995160004207) # Period 4 -K = Element(19, 'K' , 'potassium' , 0.0390983) -Ca = Element(20, 'Ca', 'calcium' , 0.040078) -Sc = Element(21, 'Sc', 'scandium' , 0.044955910) -Ti = Element(22, 'Ti', 'titanium' , 0.047867) -V = Element(23, 'V' , 'vanadium' , 0.0509415) -Cr = Element(24, 'Cr', 'chromium' , 0.0519961) -Mn = Element(25, 'Mn', 'manganese' , 0.054938049) -Fe = Element(26, 'Fe', 'iron' , 0.055845) -Co = Element(27, 'Co', 'cobalt' , 0.058933200) -Ni = Element(28, 'Ni', 'nickel' , 0.0586934) -Cu = Element(29, 'Cu', 'copper' , 0.063546) -Zn = Element(30, 'Zn', 'zinc' , 0.065409) -Ga = Element(31, 'Ga', 'gallium' , 0.069723) -Ge = Element(32, 'Ge', 'germanium' , 0.07264) -As = Element(33, 'As', 'arsenic' , 0.07492160) -Se = Element(34, 'Se', 'selenium' , 0.07896) -Br = Element(35, 'Br', 'bromine' , 0.079904) -Kr = Element(36, 'Kr', 'krypton' , 0.083798) +K = Element(19, 'K' , 'potassium' , 0.03909831004117) +Ca = Element(20, 'Ca', 'calcium' , 0.04007840004221) +Sc = Element(21, 'Sc', 'scandium' , 0.04495590744734) +Ti = Element(22, 'Ti', 'titanium' , 0.04786710005041) +V = Element(23, 'V' , 'vanadium' , 0.05094151005365) +Cr = Element(24, 'Cr', 'chromium' , 0.05199616005476) +Mn = Element(25, 'Mn', 'manganese' , 0.05493804325786) +Fe = Element(26, 'Fe', 'iron' , 0.05584520005881) +Co = Element(27, 'Co', 'cobalt' , 0.05893319436206) +Ni = Element(28, 'Ni', 'nickel' , 0.05869344006181) +Cu = Element(29, 'Cu', 'copper' , 0.06354630006692) +Zn = Element(30, 'Zn', 'zinc' , 0.06538200006885) +Ga = Element(31, 'Ga', 'gallium' , 0.06972310007343) +Ge = Element(32, 'Ge', 'germanium' , 0.07263080007649) +As = Element(33, 'As', 'arsenic' , 0.0749215956789) +Se = Element(34, 'Se', 'selenium' , 0.07897180008317) +Br = Element(35, 'Br', 'bromine' , 0.07990430008415) +Kr = Element(36, 'Kr', 'krypton' , 0.08379820008825) # Period 5 -Rb = Element(37, 'Rb', 'rubidium' , 0.0854678) -Sr = Element(38, 'Sr', 'strontium' , 0.08762) -Y = Element(39, 'Y' , 'yttrium' , 0.08890585) -Zr = Element(40, 'Zr', 'zirconium' , 0.091224) -Nb = Element(41, 'Nb', 'niobium' , 0.09290638) -Mo = Element(42, 'Mo', 'molybdenum' , 0.09594) -Tc = Element(43, 'Tc', 'technetium' , 0.098) -Ru = Element(44, 'Ru', 'ruthenium' , 0.10107) -Rh = Element(45, 'Rh', 'rhodium' , 0.10290550) -Pd = Element(46, 'Pd', 'palladium' , 0.10642) -Ag = Element(47, 'Ag', 'silver' , 0.1078682) -Cd = Element(48, 'Cd', 'cadmium' , 0.112411) -In = Element(49, 'In', 'indium' , 0.114818) -Sn = Element(50, 'Sn', 'tin' , 0.118710) -Sb = Element(51, 'Sb', 'antimony' , 0.121760) -Te = Element(52, 'Te', 'tellurium' , 0.12760) -I = Element(53, 'I' , 'iodine' , 0.12690447) -Xe = Element(54, 'Xe', 'xenon' , 0.131293) +Rb = Element(37, 'Rb', 'rubidium' , 0.08546783009001) +Sr = Element(38, 'Sr', 'strontium' , 0.08762100009227) +Y = Element(39, 'Y' , 'yttrium' , 0.08890583829363) +Zr = Element(40, 'Zr', 'zirconium' , 0.09122230009607) +Nb = Element(41, 'Nb', 'niobium' , 0.09290637109784) +Mo = Element(42, 'Mo', 'molybdenum' , 0.09595100010105) +Ru = Element(44, 'Ru', 'ruthenium' , 0.10107200010644) +Rh = Element(45, 'Rh', 'rhodium' , 0.10290549210837) +Pd = Element(46, 'Pd', 'palladium' , 0.10642100011207) +Ag = Element(47, 'Ag', 'silver' , 0.1078682201136) +Cd = Element(48, 'Cd', 'cadmium' , 0.11241440011838) +In = Element(49, 'In', 'indium' , 0.11481810012091) +Sn = Element(50, 'Sn', 'tin' , 0.11871070012501) +Sb = Element(51, 'Sb', 'antimony' , 0.12176010012823) +Te = Element(52, 'Te', 'tellurium' , 0.12760300013438) +I = Element(53, 'I' , 'iodine' , 0.12690447313364) +Xe = Element(54, 'Xe', 'xenon' , 0.13129360013827) # Period 6 -Cs = Element(55, 'Cs', 'caesium' , 0.13290545) -Ba = Element(56, 'Ba', 'barium' , 0.137327) -La = Element(57, 'La', 'lanthanum' , 0.1389055) -Ce = Element(58, 'Ce', 'cerium' , 0.140116) -Pr = Element(59, 'Pr', 'praesodymium' , 0.14090765) -Nd = Element(60, 'Nd', 'neodymium' , 0.14424) -Pm = Element(61, 'Pm', 'promethium' , 0.145) -Sm = Element(62, 'Sm', 'samarium' , 0.15036) -Eu = Element(63, 'Eu', 'europium' , 0.151964) -Gd = Element(64, 'Gd', 'gadolinium' , 0.15725) -Tb = Element(65, 'Tb', 'terbium' , 0.15892534) -Dy = Element(66, 'Dy', 'dysprosium' , 0.162500) -Ho = Element(67, 'Ho', 'holmium' , 0.16493032) -Er = Element(68, 'Er', 'erbium' , 0.167259) -Tm = Element(69, 'Tm', 'thulium' , 0.16893421) -Yb = Element(70, 'Yb', 'ytterbium' , 0.17304) -Lu = Element(71, 'Lu', 'lutetium' , 0.174967) -Hf = Element(72, 'Hf', 'hafnium' , 0.17849) -Ta = Element(73, 'Ta', 'tantalum' , 0.1809479) -W = Element(74, 'W' , 'tungsten' , 0.18384) -Re = Element(75, 'Re', 'rhenium' , 0.186207) -Os = Element(76, 'Os', 'osmium' , 0.19023) -Ir = Element(77, 'Ir', 'iridium' , 0.192217) -Pt = Element(78, 'Pt', 'platinum' , 0.195078) -Au = Element(79, 'Au', 'gold' , 0.19696655) -Hg = Element(80, 'Hg', 'mercury' , 0.20059) -Tl = Element(81, 'Tl', 'thallium' , 0.2043833) -Pb = Element(82, 'Pb', 'lead' , 0.2072) -Bi = Element(83, 'Bi', 'bismuth' , 0.20898038) -Po = Element(84, 'Po', 'polonium' , 0.209) -At = Element(85, 'At', 'astatine' , 0.210) -Rn = Element(86, 'Rn', 'radon' , 0.222) +Cs = Element(55, 'Cs', 'caesium' , 0.13290545210596) +Ba = Element(56, 'Ba', 'barium' , 0.13732770014462) +La = Element(57, 'La', 'lanthanum' , 0.13890547714628) +Ce = Element(58, 'Ce', 'cerium' , 0.14011610014756) +Pr = Element(59, 'Pr', 'praseodymium' , 0.14090766114839) +Nd = Element(60, 'Nd', 'neodymium' , 0.1442423001519) +Sm = Element(62, 'Sm', 'samarium' , 0.15036200015835) +Eu = Element(63, 'Eu', 'europium' , 0.15196410016003) +Gd = Element(64, 'Gd', 'gadolinium' , 0.1572492001656) +Tb = Element(65, 'Tb', 'terbium' , 0.15892535486736) +Dy = Element(66, 'Dy', 'dysprosium' , 0.16250010017113) +Ho = Element(67, 'Ho', 'holmium' , 0.16493032967369) +Er = Element(68, 'Er', 'erbium' , 0.16725930017614) +Tm = Element(69, 'Tm', 'thulium' , 0.1689342196779) +Yb = Element(70, 'Yb', 'ytterbium' , 0.17304510018223) +Lu = Element(71, 'Lu', 'lutetium' , 0.17496669518426) +Hf = Element(72, 'Hf', 'hafnium' , 0.17848660018796) +Ta = Element(73, 'Ta', 'tantalum' , 0.18094788219056) +W = Element(74, 'W' , 'tungsten' , 0.1838410001936) +Re = Element(75, 'Re', 'rhenium' , 0.18620710019609) +Os = Element(76, 'Os', 'osmium' , 0.19023300020033) +Ir = Element(77, 'Ir', 'iridium' , 0.19221720020242) +Pt = Element(78, 'Pt', 'platinum' , 0.19508490020544) +Au = Element(79, 'Au', 'gold' , 0.19696657060743) +Hg = Element(80, 'Hg', 'mercury' , 0.20059230021124) +Tl = Element(81, 'Tl', 'thallium' , 0.20438100021523) +Pb = Element(82, 'Pb', 'lead' , 0.2072000002182) +Bi = Element(83, 'Bi', 'bismuth' , 0.20898040122008) # Period 7 -Fr = Element(87, 'Fr', 'francium' , 0.223) -Ra = Element(88, 'Ra', 'radium' , 0.226) -Ac = Element(89, 'Ac', 'actinum' , 0.227) -Th = Element(90, 'Th', 'thorium' , 0.2320381) -Pa = Element(91, 'Pa', 'protactinum' , 0.23103588) -U = Element(92, 'U' , 'uranium' , 0.23802891) -Np = Element(93, 'Np', 'neptunium' , 0.237) -Pu = Element(94, 'Pu', 'plutonium' , 0.244) -Am = Element(95, 'Am', 'americium' , 0.243) -Cm = Element(96, 'Cm', 'curium' , 0.247) -Bk = Element(97, 'Bk', 'berkelium' , 0.247) -Cf = Element(98, 'Cf', 'californium' , 0.251) -Es = Element(99, 'Es', 'einsteinium' , 0.252) -Fm = Element(100, 'Fm', 'fermium' , 0.257) -Md = Element(101, 'Md', 'mendelevium' , 0.258) -No = Element(102, 'No', 'nobelium' , 0.259) -Lr = Element(103, 'Lr', 'lawrencium' , 0.262) -Rf = Element(104, 'Rf', 'rutherfordium' , 0.261) -Db = Element(105, 'Db', 'dubnium' , 0.262) -Sg = Element(106, 'Sg', 'seaborgium' , 0.266) -Bh = Element(107, 'Bh', 'bohrium' , 0.264) -Hs = Element(108, 'Hs', 'hassium' , 0.277) -Mt = Element(109, 'Mt', 'meitnerium' , 0.268) -Ds = Element(110, 'Ds', 'darmstadtium' , 0.281) -Rg = Element(111, 'Rg', 'roentgenium' , 0.272) -Cn = Element(112, 'Cn', 'copernicum' , 0.285) +Th = Element(90, 'Th', 'thorium' , 0.23203774024436) +Pa = Element(91, 'Pa', 'protactinium' , 0.2310358812433) +U = Element(92, 'U' , 'uranium' , 0.23802891325067) # A list of the elements, sorted by increasing atomic number element_list = [ e, X, H, D, T, He, - Li, Be, B, C, C13, N, O, O18, F, Ne, + Li, Be, B, C, C13, N, N15, O, O17, O18, F, Ne, Na, Mg, Al, Si, P, S, Cl, Ar, K, Ca, Sc, Ti, V, Cr, Mn, Fe, Co, Ni, Cu, Zn, Ga, Ge, As, Se, Br, Kr, - Rb, Sr, Y, Zr, Nb, Mo, Tc, Ru, Rh, Pd, Ag, Cd, In, Sn, Sb, Te, I, Xe, - Cs, Ba, La, Ce, Pr, Nd, Pm, Sm, Eu, Gd, Tb, Dy, Ho, Er, Tm, Yb, Lu, Hf, Ta, W, Re, Os, Ir, Pt, Au, Hg, Tl, Pb, Bi, - Po, At, Rn, - Fr, Ra, Ac, Th, Pa, U, Np, Pu, Am, Cm, Bk, Cf, Es, Fm, Md, No, Lr, Rf, Db, Sg, Bh, Hs, Mt, Ds, Rg, Cn + Rb, Sr, Y, Zr, Nb, Mo, Ru, Rh, Pd, Ag, Cd, In, Sn, Sb, Te, I, Xe, + Cs, Ba, La, Ce, Pr, Nd, Sm, Eu, Gd, Tb, Dy, Ho, Er, Tm, Yb, Lu, Hf, Ta, W, Re, Os, Ir, Pt, Au, Hg, Tl, Pb, Bi, + Th, Pa, U ] # Bond Dissociation Energies diff --git a/test/arkane/arkaneOutputTest.py b/test/arkane/arkaneOutputTest.py index adde2c6873a..3db62c236b8 100644 --- a/test/arkane/arkaneOutputTest.py +++ b/test/arkane/arkaneOutputTest.py @@ -70,7 +70,7 @@ def test_prettify(self): with open(os.path.join(benzyl_path, "output.py"), "r") as f: lines = f.readlines() assert "conformer(\n" in lines - assert " E0 = (193.749, 'kJ/mol'),\n" in lines + assert " E0 = (193.688, 'kJ/mol'),\n" in lines assert "thermo(\n" in lines assert " Cp0 = (33.2579, 'J/(mol*K)'),\n" in lines diff --git a/test/arkane/commonTest.py b/test/arkane/commonTest.py index 9afec8f5917..5d185d74bde 100644 --- a/test/arkane/commonTest.py +++ b/test/arkane/commonTest.py @@ -234,8 +234,8 @@ def test_calculate_tst_rate_coefficient(self): """ Test the calculation of the high-pressure limit rate coef for one of the kinetics jobs at Tmin and Tmax. """ - assert "%0.7f" % self.kineticsjob.reaction.calculate_tst_rate_coefficient(self.TminValue) == str(46608.5904933) - assert "%0.5f" % self.kineticsjob.reaction.calculate_tst_rate_coefficient(self.Tmaxvalue) == str(498796.64535) + assert "%0.6f" % self.kineticsjob.reaction.calculate_tst_rate_coefficient(self.TminValue) == str(46608.257064) + assert "%0.5f" % self.kineticsjob.reaction.calculate_tst_rate_coefficient(self.Tmaxvalue) == str(498794.08094) def test_tunneling(self): """ diff --git a/test/arkane/ess/arkaneGaussianTest.py b/test/arkane/ess/arkaneGaussianTest.py index 8109b708a96..c506be582d6 100644 --- a/test/arkane/ess/arkaneGaussianTest.py +++ b/test/arkane/ess/arkaneGaussianTest.py @@ -153,8 +153,8 @@ def test_load_oxygen_from_gaussian_log(self): rot = [mode for mode in conformer.modes if isinstance(mode, LinearRotor)][0] vib = [mode for mode in conformer.modes if isinstance(mode, HarmonicOscillator)][0] t_list = np.array([298.15], float) - assert abs(trans.get_partition_function(t_list) - 7.11169e6) < 1e1 - assert abs(rot.get_partition_function(t_list) - 7.13316e1) < 1e-4 + assert abs(trans.get_partition_function(t_list) - 7111672.939157387) < 1.0e-3 + assert abs(rot.get_partition_function(t_list) - 71.33147184209874) < 1e-4 assert abs(vib.get_partition_function(t_list) - 1.00037e0) < 1e-4 assert round(abs(e0 / constants.Na / constants.E_h - -150.3784877), 4) == 0 diff --git a/test/arkane/ess/molproTest.py b/test/arkane/ess/molproTest.py index 36a121f6238..79896409506 100644 --- a/test/arkane/ess/molproTest.py +++ b/test/arkane/ess/molproTest.py @@ -131,8 +131,8 @@ def test_load_hosi_from_molpro_log(self): vib = [mode for mode in conformer.modes if isinstance(mode, HarmonicOscillator)][0] t_list = np.array([298.15], float) - assert abs(trans.get_partition_function(t_list) - 9.175364e7) < 1e1 - assert abs(rot.get_partition_function(t_list) - 1.00005557e5) < 1e-2 + assert abs(trans.get_partition_function(t_list) - 9.175364e7) < (9.175364e7 * 2.0e-5) + assert abs(rot.get_partition_function(t_list) - 100005.3890535083) < 1e-2 assert abs(vib.get_partition_function(t_list) - 1.9734989e0) < 1e-4 assert round(abs(e0 / constants.Na / constants.E_h - -768.275662), 4) == 0 @@ -145,7 +145,7 @@ def test_load_non_f12_e0(self): """ molpro_log = MolproLog(os.path.join(self.data_path, "TS_CCSD(T)_no_F12_sp_molpro.out")) e0 = molpro_log.load_energy() - assert round(abs(e0 - -301585968.58196217), 7) == 0 + assert round(abs(e0 - -301585943.43887734), 7) == 0 def test_load_rs2c_e0(self): """ @@ -153,7 +153,7 @@ def test_load_rs2c_e0(self): """ molpro_log = MolproLog(os.path.join(self.data_path, "HO2_RS2C.out")) e0 = molpro_log.load_energy() - assert round(abs(e0 - -395663227.2323160), 6) == 0 + assert round(abs(e0 - -395663194.2460534), 6) == 0 def test_load_mrci_e0(self): """ @@ -163,8 +163,8 @@ def test_load_mrci_e0(self): mrciq_log = MolproLog(os.path.join(self.data_path, "molpro_mrci+q.out")) mrci_e0 = mrci_log.load_energy() mrciq_e0 = mrciq_log.load_energy() - assert round(abs(mrci_e0 - -293217091.0381712), 7) == 0 - assert round(abs(mrciq_e0 - -293284017.3925107), 7) == 0 + assert round(abs(mrci_e0 - -293217066.59279585), 7) == 0 + assert round(abs(mrciq_e0 - -293283992.9415558), 7) == 0 def test_load_negative_frequency(self): """ diff --git a/test/arkane/ess/orcaTest.py b/test/arkane/ess/orcaTest.py index 2d24a6814ab..60d0945b164 100644 --- a/test/arkane/ess/orcaTest.py +++ b/test/arkane/ess/orcaTest.py @@ -90,11 +90,11 @@ def test_energy_from_orca_log(self): molecular energies can be properly read. """ log = OrcaLog(os.path.join(self.data_path, "Orca_opt_freq_test.log")) - assert abs(log.load_energy() - -200656222.56292167) < 1e-3 + assert abs(log.load_energy() - -200656205.83430383) < 1e-3 log = OrcaLog(os.path.join(self.data_path, "Orca_TS_test.log")) - assert abs(log.load_energy() - -88913623.10592663) < 1e-3 + assert abs(log.load_energy() - -88913615.69323839) < 1e-3 log = OrcaLog(os.path.join(self.data_path, "Orca_dlpno_test.log")) - assert abs(log.load_energy() - -1816470909.1153) < 1e-3 + assert abs(log.load_energy() - -1816470757.6769478) < 1e-3 def test_load_zero_point_energy_from_orca_log(self): """ @@ -102,9 +102,9 @@ def test_load_zero_point_energy_from_orca_log(self): molecular zero point_energy can be properly read. """ log = OrcaLog(os.path.join(self.data_path, "Orca_opt_freq_test.log")) - assert abs(log.load_zero_point_energy() - 55502.673180815) < 1e-3 + assert abs(log.load_zero_point_energy() - 55502.66855358243) < 1e-3 log = OrcaLog(os.path.join(self.data_path, "Orca_TS_test.log")) - assert abs(log.load_zero_point_energy() - 93500.08860598055) < 1e-3 + assert abs(log.load_zero_point_energy() - 93500.08081092076) < 1e-3 def test_load_negative_frequency_from_orca_log(self): """ diff --git a/test/arkane/ess/psi4Test.py b/test/arkane/ess/psi4Test.py index ac387a5910e..bed6c57b613 100644 --- a/test/arkane/ess/psi4Test.py +++ b/test/arkane/ess/psi4Test.py @@ -87,13 +87,13 @@ def test_energy_from_psi4_log(self): molecular energies can be properly read. """ log = Psi4Log(os.path.join(self.data_path, "opt_freq.out")) - assert abs(log.load_energy() - -199599899.9822719) < 1e-2 + assert abs(log.load_energy() - -199599883.34171918) < 1e-2 log = Psi4Log(os.path.join(self.data_path, "opt_freq_ts.out")) - assert abs(log.load_energy() - -395828407.5987777) < 1e-2 + assert abs(log.load_energy() - -395828374.5987437) < 1e-2 log = Psi4Log(os.path.join(self.data_path, "opt_freq_dft.out")) - assert abs(log.load_energy() - -200640009.37231186) < 1e-2 + assert abs(log.load_energy() - -200639992.64504567) < 1e-2 log = Psi4Log(os.path.join(self.data_path, "opt_freq_dft_ts.out")) - assert abs(log.load_energy() - -397841662.56434655) < 1e-2 + assert abs(log.load_energy() - -397841629.3964684) < 1e-2 def test_zero_point_energy_from_psi4_log(self): """ diff --git a/test/arkane/ess/qchemTest.py b/test/arkane/ess/qchemTest.py index 664b71d9cc2..e492806dc5a 100644 --- a/test/arkane/ess/qchemTest.py +++ b/test/arkane/ess/qchemTest.py @@ -83,11 +83,11 @@ def test_energy_from_qchem_log(self): molecular energies can be properly read. """ log = QChemLog(os.path.join(self.data_path, "npropyl.out")) - assert abs(log.load_energy() - -310896203.5432524) < 1e-7 + assert abs(log.load_energy() - -310896177.62397754) < 1e-7 log = QChemLog(os.path.join(self.data_path, "co.out")) - assert abs(log.load_energy() - -297402545.0217114) < 1e-7 + assert abs(log.load_energy() - -297402520.2273967) < 1e-7 log = QChemLog(os.path.join(self.data_path, "CH4_sp.out")) - assert abs(log.load_energy() - -106356735.53661588) < 1e-7 + assert abs(log.load_energy() - -106356726.66970329) < 1e-7 def test_zero_point_energy_from_qchem_log(self): """ diff --git a/test/arkane/ess/terachemTest.py b/test/arkane/ess/terachemTest.py index 3f70059bf4b..9bf03f2dfd1 100644 --- a/test/arkane/ess/terachemTest.py +++ b/test/arkane/ess/terachemTest.py @@ -1215,8 +1215,8 @@ def test_load_energy(self): e_elect_4 = opt_file.load_energy() assert e_elect_1 == e_elect_2 assert e_elect_1 == e_elect_3 - assert round(abs(e_elect_1 - -300621953.7863082), 7) == 0 - assert round(abs(e_elect_4 - -206346606.4271929), 7) == 0 + assert round(abs(e_elect_1 - -300621928.7235929), 7) == 0 + assert round(abs(e_elect_4 - -206346589.2241703), 7) == 0 def test_load_zero_point_energy(self): """Test loading the ZPE from a TeraChem freq output file""" @@ -1234,52 +1234,52 @@ def test_load_scan_energies(self): v_list, angles = log_file.load_scan_energies() print(angles) expected_v_list = [ - 3.31469351e00, - 5.61670297e02, - 2.28894412e03, - 5.02988537e03, - 8.06230147e03, - 1.09146826e04, - 1.31616066e04, - 1.44091777e04, - 1.42173813e04, - 1.28403610e04, - 1.07514495e04, - 7.96656078e03, - 4.81040645e03, - 2.42069223e03, - 7.90256554e02, - 4.20132486e00, - 4.54592173e02, - 2.06279144e03, - 4.67391931e03, - 7.62857835e03, - 1.04970774e04, - 1.27455046e04, - 1.42866289e04, - 1.43930501e04, - 1.31587081e04, - 1.10047441e04, - 8.24254519e03, - 5.10264086e03, - 2.56880350e03, - 7.56736797e02, - 1.30067263e00, - 5.19872864e02, - 2.30963595e03, - 5.02046166e03, - 7.97285489e03, - 1.06923710e04, - 1.29244615e04, - 1.43422341e04, - 1.43905580e04, - 1.32047110e04, - 1.12088126e04, - 8.31162367e03, - 5.06568695e03, - 2.54966151e03, - 8.50076205e02, - 0.00000000e00, + 3.31469324E+00, + 5.61670250E+02, + 2.28894393E+03, + 5.02988495E+03, + 8.06230080E+03, + 1.09146817E+04, + 1.31616055E+04, + 1.44091765E+04, + 1.42173801E+04, + 1.28403599E+04, + 1.07514486E+04, + 7.96656012E+03, + 4.81040605E+03, + 2.42069203E+03, + 7.90256488E+02, + 4.20132451E+00, + 4.54592135E+02, + 2.06279127E+03, + 4.67391892E+03, + 7.62857771E+03, + 1.04970765E+04, + 1.27455035E+04, + 1.42866277E+04, + 1.43930489E+04, + 1.31587070E+04, + 1.10047431E+04, + 8.24254450E+03, + 5.10264043E+03, + 2.56880329E+03, + 7.56736734E+02, + 1.30067253E+00, + 5.19872821E+02, + 2.30963575E+03, + 5.02046124E+03, + 7.97285423E+03, + 1.06923701E+04, + 1.29244604E+04, + 1.43422329E+04, + 1.43905568E+04, + 1.32047099E+04, + 1.12088117E+04, + 8.31162297E+03, + 5.06568653E+03, + 2.54966129E+03, + 8.50076134E+02, + 0.00000000E+00, ] expected_angles = [ 0.0, diff --git a/test/arkane/statmechTest.py b/test/arkane/statmechTest.py index a828763fa6d..3f2d49437c8 100644 --- a/test/arkane/statmechTest.py +++ b/test/arkane/statmechTest.py @@ -224,7 +224,7 @@ def test_specifying_absolute_file_paths(self): statmech_job = StatMechJob(species=h2o2, path=h2o2_path) statmech_job.level_of_theory = LevelOfTheory("b3lyp", "6-311+g(3df,2p)") statmech_job.load(pdep=False, plot=False) - assert round(abs(h2o2.conformer.E0.value_si - -146031.49933673252), 7) == 0 + assert round(abs(h2o2.conformer.E0.value_si - -146066.21039109805), 7) == 0 os.remove(h2o2_path) def test_hinder_rotor_from_1d_array(self): @@ -367,7 +367,7 @@ def test_hinder_rotor_from_1d_array(self): assert statmech_job.raw_hindered_rotor_data[0][2] == 1 assert np.allclose(statmech_job.raw_hindered_rotor_data[0][3], angles, atol=1e-6) assert np.allclose(statmech_job.raw_hindered_rotor_data[0][4], energies, atol=1e-6) - assert round(abs(h2o2.conformer.E0.value_si - -146031.49933673252), 7) == 0 + assert round(abs(h2o2.conformer.E0.value_si - -146066.21039109805), 7) == 0 os.remove(h2o2_path) def test_scanlog_class(self): diff --git a/test/rmgpy/constantsTest.py b/test/rmgpy/constantsTest.py index 14515aba429..32c231a3759 100644 --- a/test/rmgpy/constantsTest.py +++ b/test/rmgpy/constantsTest.py @@ -48,42 +48,42 @@ def test_avogadro_constant(self): """ Test the value of the Avogadro constant. """ - Na = 6.02214179e23 + Na = 6.02214076e23 assert round(abs(constants.Na / Na - 1.0), 6) == 0, "{0} != {1}".format(constants.Na, Na) def test_boltzmann_constant(self): """ Test the value of the Boltzmann constant. """ - kB = 1.3806504e-23 + kB = 1.380649e-23 assert round(abs(constants.kB / kB - 1.0), 6) == 0, "{0} != {1}".format(constants.kB, kB) def test_elementary_charge(self): """ Test the value of the elementary charge constant. """ - e = 1.602176565e-19 + e = 1.602176634e-19 assert round(abs(constants.e / e - 1.0), 6) == 0, "{0} != {1}".format(constants.e, e) def test_gas_law_constant(self): """ Test the value of the gas law constant. """ - R = 8.314472 + R = 8.314462618 assert round(abs(constants.R / R - 1.0), 6) == 0, "{0} != {1}".format(constants.R, R) def test_planck_constant(self): """ Test the value of the Planck constant. """ - h = 6.62606896e-34 + h = 6.62607015e-34 assert round(abs(constants.h / h - 1.0), 6) == 0, "{0} != {1}".format(constants.h, h) def test_reduced_planck_constant(self): """ Test the value of the reduced Planck constant. """ - hbar = 1.054571726e-34 + hbar = 1.054571817e-34 assert round(abs(constants.hbar / hbar - 1.0), 6) == 0, "{0} != {1}".format(constants.hbar, hbar) def test_pi(self): @@ -103,21 +103,21 @@ def test_electron_mass(self): """ Test the value of the electron rest mass. """ - m_e = 9.10938291e-31 + m_e = 9.1093837139e-31 assert round(abs(constants.m_e / m_e - 1.0), 6) == 0, "{0} != {1}".format(constants.m_e, m_e) def test_proton_mass(self): """ Test the value of the proton rest mass. """ - m_p = 1.672621777e-27 + m_p = 1.67262192595e-27 assert round(abs(constants.m_p / m_p - 1.0), 6) == 0, "{0} != {1}".format(constants.m_p, m_p) def test_neutron_mass(self): """ Test the value of the neutron rest mass. """ - m_n = 1.674927351e-27 + m_n = 1.67492750056e-27 assert round(abs(constants.m_n / m_n - 1.0), 6) == 0, "{0} != {1}".format(constants.m_n, m_n) def test_atomic_mass_unit(self): @@ -131,12 +131,12 @@ def test_bohr_radius(self): """ Test the value of the Bohr radius. """ - a0 = 5.2917721092e-11 + a0 = 5.29177210544e-11 assert round(abs(constants.a0 / a0 - 1.0), 6) == 0, "{0} != {1}".format(constants.a0, a0) def test_hartree_energy(self): """ Test the value of the Hartree energy. """ - E_h = 4.35974434e-18 + E_h = 4.3597447222060e-18 assert round(abs(constants.E_h / E_h - 1.0), 6) == 0, "{0} != {1}".format(constants.E_h, E_h) diff --git a/test/rmgpy/data/solvationTest.py b/test/rmgpy/data/solvationTest.py index 5aceb1b1ebd..4beba8144fe 100644 --- a/test/rmgpy/data/solvationTest.py +++ b/test/rmgpy/data/solvationTest.py @@ -383,7 +383,7 @@ def test_Kfactor_parameters(self): delS298 = correction.entropy # in J/mol/K solvent_name = solvent_data.name_in_coolprop kfactor_parameters = self.database.get_Kfactor_parameters(delG298, delH298, delS298, solvent_name) - assert round(abs(kfactor_parameters.lower_T[0] - -9.780), 3) == 0 # check up to 3 decimal places + assert round(abs(kfactor_parameters.lower_T[0] - -9.780514412256302), 3) == 0 # check up to 3 decimal places assert round(abs(kfactor_parameters.lower_T[1] - 0.492), 3) == 0 assert round(abs(kfactor_parameters.lower_T[2] - 10.485), 3) == 0 assert round(abs(kfactor_parameters.higher_T - 1.147), 3) == 0 diff --git a/test/rmgpy/molecule/elementTest.py b/test/rmgpy/molecule/elementTest.py index 51c5bd3675e..bab06e9054b 100644 --- a/test/rmgpy/molecule/elementTest.py +++ b/test/rmgpy/molecule/elementTest.py @@ -96,7 +96,7 @@ def test_chemkin_name(self): assert d.chemkin_name == "D" c13 = rmgpy.molecule.element.get_element("C", isotope=13) - assert c13.chemkin_name == "CI" + assert c13.chemkin_name == "C13" o18 = rmgpy.molecule.element.get_element("O", isotope=18) - assert o18.chemkin_name == "OI" + assert o18.chemkin_name == "O18" diff --git a/test/rmgpy/quantityTest.py b/test/rmgpy/quantityTest.py index 3ea0c2b4f28..adfd9b52a33 100644 --- a/test/rmgpy/quantityTest.py +++ b/test/rmgpy/quantityTest.py @@ -207,7 +207,7 @@ def test_kelvin(self): Test the creation of an energy quantity with units of K (not really an energy!). """ q = quantity.Energy(10.0, "K") - assert abs(q.value - 10 * 8.314472) < 1e-6 + assert abs(q.value - 10 * 8.314462618) < 1e-6 assert q.units == "J/mol" diff --git a/test/rmgpy/reactionTest.py b/test/rmgpy/reactionTest.py index 4e1cc0cc507..db459312fde 100644 --- a/test/rmgpy/reactionTest.py +++ b/test/rmgpy/reactionTest.py @@ -36,6 +36,7 @@ import cantera as ct import numpy import yaml + from copy import deepcopy import pytest @@ -68,6 +69,29 @@ def order_of_magnitude(number): return math.floor(math.log(number, 10)) + +def approx_compare_nested_dicts(dict1, dict2, rtol=1e-05, atol=1e-08): + """ + Approximately compares two nested dictionaries, allowing for small differences + in floating-point values. + """ + if dict1.keys() != dict2.keys(): + return False + + for key in dict1: + value1 = dict1[key] + value2 = dict2[key] + + if isinstance(value1, dict) and isinstance(value2, dict): + if not approx_compare_nested_dicts(value1, value2, rtol, atol): + return False + elif isinstance(value1, float) and isinstance(value2, float): + if not math.isclose(value1, value2, rel_tol=rtol, abs_tol=atol): + return False + else: + if value1 != value2: + return False + return True class PseudoSpecies(object): """ @@ -936,16 +960,16 @@ def test_equilibrium_constant_ka(self): Kalist0 = [ float(v) for v in [ - "8.75951e+29", - "7.1843e+10", - "34272.7", - "26.1877", - "0.378696", - "0.0235579", - "0.00334673", - "0.000792389", - "0.000262777", - "0.000110053", + "8.75880597190277e+29", + "7.1837225762561e+10", + "3.42699454002829e+4", + "26.1855952159879", + "0.37866556306639", + "0.0235560065809", + "0.00334646101327", + "7.92325313318903e-4", + "2.62755879824179e-4", + "1.10044154710231e-4", ] ] Kalist = self.reaction2.get_equilibrium_constants(Tlist, type="Ka") @@ -960,16 +984,16 @@ def test_equilibrium_constant_kc(self): Kclist0 = [ float(v) for v in [ - "1.45661e+28", - "2.38935e+09", - "1709.76", - "1.74189", - "0.0314866", - "0.00235045", - "0.000389568", - "0.000105413", - "3.93273e-05", - "1.83006e-05", + "1.45649529633233e+28", + "2.38916184585555e+9", + "1709.6253615292801", + "1.74175283138817", + "0.03148412052471", + "0.00235026490911", + "3.89537322688704e-4", + "1.05404699042489e-4", + "3.93242030931069e-5", + "1.82991588826518e-5", ] ] Kclist = self.reaction2.get_equilibrium_constants(Tlist, type="Kc") @@ -990,16 +1014,16 @@ def test_equilibrium_constant_kp(self): Kplist0 = [ float(v) for v in [ - "8.75951e+24", - "718430", - "0.342727", - "0.000261877", - "3.78696e-06", - "2.35579e-07", - "3.34673e-08", - "7.92389e-09", - "2.62777e-09", - "1.10053e-09", + "8.75880597190277e+24", + "7.1837225762561e+5", + "3.42699454002829e-1", + "2.61855952159879e-4", + "3.7866556306639e-6", + "2.35560065809e-7", + "3.34646101327e-8", + "7.92325313318903e-9", + "2.62755879824179e-9", + "1.10044154710231e-9", ] ] Kplist = self.reaction2.get_equilibrium_constants(Tlist, type="Kp") @@ -2916,7 +2940,9 @@ def test_arrhenius(self): # Check that the reaction string is the same assert repr(converted_obj) == repr(ct_obj) # Check that the rate is the same. arrhenius string is not going to be identical - assert converted_obj.rate.input_data == ct_obj.rate.input_data + + #assert converted_obj.rate.input_data == ct_obj.rate.input_data + assert approx_compare_nested_dicts(converted_obj.rate.input_data, ct_obj.rate.input_data) == True def test_multi_arrhenius(self): """ @@ -2936,9 +2962,9 @@ def test_multi_arrhenius(self): # Check that the reaction string is the same assert repr(converted_rxn) == repr(ct_rxn) # Check that the Arrhenius rates are identical - assert round(abs(converted_rxn.rate.pre_exponential_factor - ct_rxn.rate.pre_exponential_factor), 3) == 0 - assert round(abs(converted_rxn.rate.temperature_exponent - ct_rxn.rate.temperature_exponent), 7) == 0 - assert round(abs(converted_rxn.rate.activation_energy - ct_rxn.rate.activation_energy), 7) == 0 + assert abs((converted_rxn.rate.pre_exponential_factor - ct_rxn.rate.pre_exponential_factor) / converted_rxn.rate.pre_exponential_factor) < 1.0e-3 + assert abs(converted_rxn.rate.temperature_exponent - ct_rxn.rate.temperature_exponent) < 1.0e-4 + assert abs(converted_rxn.rate.activation_energy - ct_rxn.rate.activation_energy) < 1.0e-4 def test_pdep_arrhenius(self): """ @@ -3145,7 +3171,7 @@ def test_get_rate_coeff(self): kf_1 = self.rxn_reduction.get_rate_coefficient(298,potential=0) kf_2 = self.rxn_reduction.kinetics.get_rate_coefficient(298,0) - assert abs(kf_1 - 43870506959779.0) < 0.000001 + assert abs((kf_1 - 43870307169260.055) / kf_1) < 1.0e-5 assert abs(kf_1 - kf_2) < 0.000001 #kf_2 should be greater than kf_1 @@ -3158,11 +3184,13 @@ def test_equilibrium_constant_surface_charge_transfer_kc(self): Test the equilibrium constants of type Kc of a surface charge transfer reaction. """ Tlist = numpy.arange(400.0, 1600.0, 200.0, numpy.float64) - Kclist0 = [1.39365463e+03, 1.78420988e+01, 2.10543835e+00, 6.07529099e-01, - 2.74458007e-01, 1.59985450e-01] #reduction + Kclist0 = [1.39366980e+03, 1.78421971e+01, 2.10544419e+00, 6.07529777e-01, + 2.74458011e-01, 1.59985326e-01] #reduction Kclist_reduction = self.rxn_reduction.get_equilibrium_constants(Tlist, type='Kc') Kclist_oxidation = self.rxn_oxidation.get_equilibrium_constants(Tlist, type='Kc') # Test a range of temperatures + print(Kclist_reduction) + print(Kclist_oxidation) for i in range(len(Tlist)): assert abs(Kclist_reduction[i] / Kclist0[i] - 1.0) < 0.000001 assert abs(1 / Kclist_oxidation[i] / Kclist0[i] - 1.0) < 0.000001 diff --git a/test/rmgpy/statmech/conformerTest.py b/test/rmgpy/statmech/conformerTest.py index bf6e6070efb..57c182ebe83 100644 --- a/test/rmgpy/statmech/conformerTest.py +++ b/test/rmgpy/statmech/conformerTest.py @@ -109,7 +109,7 @@ def setup_class(self): self.conformer = Conformer( E0=(self.E0, "kJ/mol"), modes=[ - IdealGasTranslation(mass=(30.0469, "amu")), + IdealGasTranslation(mass=(30.04695, "amu")), NonlinearRotor(inertia=([6.27071, 25.3832, 25.3833], "amu*angstrom^2"), symmetry=6), HarmonicOscillator( frequencies=( @@ -276,7 +276,7 @@ def test_get_total_mass(self): """ Test the Conformer.get_total_mass() method. """ - assert round(abs(self.conformer.get_total_mass() * constants.Na * 1000.0 - np.sum(self.mass)), 6) == 0 + assert abs(self.conformer.get_total_mass() * constants.Na * 1000.0 - np.sum(self.mass)) < 1.0e-5 def test_get_center_of_mass(self): """ diff --git a/test/rmgpy/thermo/wilhoitTest.py b/test/rmgpy/thermo/wilhoitTest.py index 4b74fd72a76..c92617625f9 100644 --- a/test/rmgpy/thermo/wilhoitTest.py +++ b/test/rmgpy/thermo/wilhoitTest.py @@ -54,8 +54,8 @@ def setup_class(self): self.a2 = 26.2524 self.a3 = -12.6785 self.B = 1068.68 - self.H0 = -94088.0 # -782.292 kJ/mol / constants.R - self.S0 = -118.46 # -984.932 J/mol*K / constants.R + self.H0 = -94088.1011728 # -782.292 kJ/mol / constants.R + self.S0 = -118.460091199 # -984.932 J/mol*K / constants.R self.Tmin = 300.0 self.Tmax = 3000.0 self.comment = "C2H6" @@ -425,13 +425,13 @@ def test_wilhoit_as_dict(self): "H0": { "units": "kJ/mol", "class": "ScalarQuantity", - "value": -782.292041536, + "value": -782.2920000142657, }, "Tmax": {"units": "K", "class": "ScalarQuantity", "value": 3000.0}, "S0": { "units": "J/(mol*K)", "class": "ScalarQuantity", - "value": -984.93235312, + "value": -984.9320000171091, }, "a1": -16.3067, "a0": 0.0977518, @@ -440,12 +440,12 @@ def test_wilhoit_as_dict(self): "Cp0": { "units": "J/(mol*K)", "class": "ScalarQuantity", - "value": 33.257888, + "value": 33.25785047261296, }, "CpInf": { "units": "J/(mol*K)", "class": "ScalarQuantity", - "value": 178.76114800000002, + "value": 178.76094629029464, }, "class": "Wilhoit", }