refactor: unify and modernize periodic table utilities and typing
- Replace atomsymb and atommass tuples with AtomInfo dataclass and PTable enum for atomic data - Refactor all usages to access atomic symbol and mass via PTable methods - Remove nptyping dependency, switch to numpy.typing for type annotations - Update molecule and atom classes to use new typing and atomic data access - Bump numpy version to 2.x and remove nptyping from dependencies
This commit is contained in:
@@ -1,52 +1,23 @@
|
||||
from diceplayer.utils.ptable import atommass
|
||||
from diceplayer.utils.ptable import PTable
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Atom:
|
||||
"""
|
||||
Atom class declaration. This class is used throughout the DicePlayer program to represent atoms.
|
||||
|
||||
Atributes:
|
||||
lbl (int): Dice derived variable used to represent atoms with identical energies and simetric positions.
|
||||
na (int): Atomic number of the represented atom.
|
||||
rx (float): x cartesian coordinates of the represented atom.
|
||||
ry (float): y cartesian coordinates of the represented atom.
|
||||
rz (float): z cartesian coordinates of the represented atom.
|
||||
chg (float): charge of the represented atom.
|
||||
eps (float): quantum number epsilon of the represented atom.
|
||||
sig (float): quantum number sigma of the represented atom.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
lbl: int,
|
||||
na: int,
|
||||
rx: float,
|
||||
ry: float,
|
||||
rz: float,
|
||||
chg: float,
|
||||
eps: float,
|
||||
sig: float,
|
||||
) -> None:
|
||||
"""
|
||||
The constructor function __init__ is used to create new instances of the Atom class.
|
||||
lbl: int
|
||||
na: int
|
||||
rx: float
|
||||
ry: float
|
||||
rz: float
|
||||
chg: float
|
||||
eps: float
|
||||
sig: float
|
||||
|
||||
Args:
|
||||
lbl (int): Dice derived variable used to represent atoms with identical energies and simetric positions.
|
||||
na (int): Atomic number of the represented atom.
|
||||
rx (float): x cartesian coordinates of the represented atom.
|
||||
ry (float): y cartesian coordinates of the represented atom.
|
||||
rz (float): z cartesian coordinates of the represented atom.
|
||||
chg (float): charge of the represented atom.
|
||||
eps (float): quantum number epsilon of the represented atom.
|
||||
sig (float): quantum number sigma of the represented atom.
|
||||
"""
|
||||
|
||||
self.lbl = lbl
|
||||
self.na = na
|
||||
self.rx = rx
|
||||
self.ry = ry
|
||||
self.rz = rz
|
||||
self.chg = chg
|
||||
self.eps = eps
|
||||
self.sig = sig
|
||||
self.mass = atommass[self.na]
|
||||
@property
|
||||
def mass(self) -> float:
|
||||
return PTable.get_atomic_mass(self.na)
|
||||
|
||||
@@ -7,11 +7,12 @@ if TYPE_CHECKING:
|
||||
from nptyping import Float, NDArray, Shape
|
||||
|
||||
from diceplayer import logger
|
||||
from diceplayer.environment.atom import Atom
|
||||
from diceplayer.environment import Atom
|
||||
from diceplayer.utils.misc import BOHR2ANG
|
||||
from diceplayer.utils.ptable import ghost_number
|
||||
from diceplayer.utils.ptable import GHOST_NUMBER
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
from numpy.linalg import linalg
|
||||
from typing_extensions import Any, List, Tuple, Union
|
||||
|
||||
@@ -26,12 +27,12 @@ class Molecule:
|
||||
Atributes:
|
||||
molname (str): The name of the represented molecule
|
||||
atom (List[Atom]): List of atoms of the represented molecule
|
||||
position (NDArray[Any, Any]): The position relative to the internal atoms of the represented molecule
|
||||
energy (NDArray[Any, Any]): The energy of the represented molecule
|
||||
gradient (NDArray[Any, Any]): The first derivative of the energy relative to the position
|
||||
hessian (NDArray[Any, Any]): The second derivative of the energy relative to the position
|
||||
position (npt.NDArray[np.float64]): The position relative to the internal atoms of the represented molecule
|
||||
energy (npt.NDArray[np.float64]): The energy of the represented molecule
|
||||
gradient (npt.NDArray[np.float64]): The first derivative of the energy relative to the position
|
||||
hessian (npt.NDArray[np.float64]): The second derivative of the energy relative to the position
|
||||
total_mass (int): The total mass of the molecule
|
||||
com (NDArray[Any, Any]): The center of mass of the molecule
|
||||
com (npt.NDArray[np.float64]): The center of mass of the molecule
|
||||
"""
|
||||
|
||||
def __init__(self, molname: str) -> None:
|
||||
@@ -44,16 +45,16 @@ class Molecule:
|
||||
self.molname: str = molname
|
||||
|
||||
self.atom: List[Atom] = []
|
||||
self.position: NDArray[Any, Any]
|
||||
self.energy: NDArray[Any, Any]
|
||||
self.gradient: NDArray[Any, Any]
|
||||
self.hessian: NDArray[Any, Any]
|
||||
self.position: npt.NDArray[np.float64]
|
||||
self.energy: npt.NDArray[np.float64]
|
||||
self.gradient: npt.NDArray[np.float64]
|
||||
self.hessian: npt.NDArray[np.float64]
|
||||
|
||||
self.ghost_atoms: List[Atom] = []
|
||||
self.lp_atoms: List[Atom] = []
|
||||
|
||||
self.total_mass: int = 0
|
||||
self.com: Union[None, NDArray[Any, Any]] = None
|
||||
self.com: Union[None, npt.NDArray[np.float64]] = None
|
||||
|
||||
def add_atom(self, a: Atom) -> None:
|
||||
"""
|
||||
@@ -68,7 +69,7 @@ class Molecule:
|
||||
|
||||
self.center_of_mass()
|
||||
|
||||
def center_of_mass(self) -> NDArray[Any, Any]:
|
||||
def center_of_mass(self) -> npt.NDArray[np.float64]:
|
||||
"""
|
||||
Calculates the center of mass of the molecule
|
||||
"""
|
||||
@@ -115,7 +116,7 @@ class Molecule:
|
||||
|
||||
return [charge, dipole[0], dipole[1], dipole[2], total_dipole]
|
||||
|
||||
def distances_between_atoms(self) -> NDArray[Shape["Any,Any"], Float]:
|
||||
def distances_between_atoms(self) -> npt.NDArray[np.float64]:
|
||||
"""
|
||||
Calculates distances between the atoms of the molecule
|
||||
|
||||
@@ -135,16 +136,22 @@ class Molecule:
|
||||
|
||||
return np.array(distances).reshape(dim, dim - 1)
|
||||
|
||||
def inertia_tensor(self) -> NDArray[Shape["3, 3"], Float]:
|
||||
def inertia_tensor(self) -> npt.NDArray[np.float64]:
|
||||
"""
|
||||
Calculates the inertia tensor of the molecule.
|
||||
|
||||
Returns:
|
||||
NDArray[Shape["3, 3"], Float]: inertia tensor of the molecule.
|
||||
npt.NDArray[np.float64]: inertia tensor of the molecule.
|
||||
"""
|
||||
|
||||
self.center_of_mass()
|
||||
Ixx = Ixy = Ixz = Iyy = Iyz = Izz = 0.0
|
||||
|
||||
Ixx = 0.0
|
||||
Ixy = 0.0
|
||||
Ixz = 0.0
|
||||
Iyy = 0.0
|
||||
Iyz = 0.0
|
||||
Izz = 0.0
|
||||
|
||||
for atom in self.atom:
|
||||
dx = atom.rx - self.com[0]
|
||||
@@ -374,9 +381,9 @@ class Molecule:
|
||||
|
||||
distances = []
|
||||
for atom1 in self.atom:
|
||||
if atom1.na != ghost_number:
|
||||
if atom1.na != GHOST_NUMBER:
|
||||
for atom2 in molec.atom:
|
||||
if atom2.na != ghost_number:
|
||||
if atom2.na != GHOST_NUMBER:
|
||||
dx = atom1.rx - atom2.rx
|
||||
dy = atom1.ry - atom2.ry
|
||||
dz = atom1.rz - atom2.rz
|
||||
|
||||
@@ -2,12 +2,12 @@ from __future__ import annotations
|
||||
|
||||
from diceplayer import logger
|
||||
from diceplayer.config.player_config import PlayerConfig
|
||||
from diceplayer.environment.atom import Atom
|
||||
from diceplayer.environment import Atom
|
||||
from diceplayer.environment.molecule import Molecule
|
||||
from diceplayer.environment.system import System
|
||||
from diceplayer.interface import Interface
|
||||
from diceplayer.utils.misc import date_time
|
||||
from diceplayer.utils.ptable import atomsymb
|
||||
from diceplayer.utils.ptable import PTable
|
||||
|
||||
import numpy as np
|
||||
from nptyping import NDArray
|
||||
@@ -161,9 +161,9 @@ class GaussianInterface(Interface):
|
||||
|
||||
if (
|
||||
line[0].title()
|
||||
!= atomsymb[
|
||||
!= PTable.get_atomic_symbol(
|
||||
self.system.molecule[type].atom[site].na
|
||||
].strip()
|
||||
).strip()
|
||||
):
|
||||
raise SyntaxError(
|
||||
"Error: Invalid Dice Output. Atom type does not match."
|
||||
@@ -188,7 +188,7 @@ class GaussianInterface(Interface):
|
||||
for atom in new_molecule.atom:
|
||||
asec_charges.append(
|
||||
{
|
||||
"lbl": atomsymb[atom.na],
|
||||
"lbl": PTable.get_atomic_symbol(atom.na),
|
||||
"rx": atom.rx,
|
||||
"ry": atom.ry,
|
||||
"rz": atom.rz,
|
||||
@@ -258,7 +258,7 @@ class GaussianInterface(Interface):
|
||||
)
|
||||
|
||||
for atom in self.system.molecule[0].atom:
|
||||
symbol = atomsymb[atom.na]
|
||||
symbol = PTable.get_atomic_symbol(atom.na)
|
||||
gaussian_input.append(
|
||||
"{:<2s} {:>10.5f} {:>10.5f} {:>10.5f}\n".format(
|
||||
symbol, atom.rx, atom.ry, atom.rz
|
||||
|
||||
@@ -2,7 +2,7 @@ from diceplayer import VERSION, logger
|
||||
from diceplayer.config.player_config import PlayerConfig
|
||||
from diceplayer.environment import Atom, Molecule, System
|
||||
from diceplayer.interface import DiceInterface, GaussianInterface
|
||||
from diceplayer.utils import atomsymb, weekday_date_time
|
||||
from diceplayer.utils import PTable, weekday_date_time
|
||||
|
||||
import yaml
|
||||
from pydantic import BaseModel
|
||||
@@ -289,7 +289,7 @@ class Player:
|
||||
file.write(f"Cycle # {cycle}\n")
|
||||
|
||||
for atom in self.system.molecule[0].atom:
|
||||
symbol = atomsymb[atom.na]
|
||||
symbol = PTable.get_atomic_symbol(atom.na)
|
||||
file.write(
|
||||
f"{symbol:<2s} {atom.rx:>10.6f} {atom.ry:>10.6f} {atom.rz:>10.6f}\n"
|
||||
)
|
||||
|
||||
@@ -6,14 +6,14 @@ from .misc import (
|
||||
make_step_dir,
|
||||
weekday_date_time,
|
||||
)
|
||||
from .ptable import atommass, atomsymb
|
||||
from .ptable import AtomInfo, PTable
|
||||
|
||||
|
||||
__all__ = [
|
||||
"Logger",
|
||||
"valid_logger",
|
||||
"atomsymb",
|
||||
"atommass",
|
||||
"PTable",
|
||||
"AtomInfo",
|
||||
"weekday_date_time",
|
||||
"date_time",
|
||||
"compress_files_1mb",
|
||||
|
||||
@@ -1,223 +1,143 @@
|
||||
#### Label used in Dice for a ghost atom
|
||||
dice_ghost_label = "Xx"
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
||||
#### Tuple of atom symbols
|
||||
atomsymb = (
|
||||
"00",
|
||||
"H ",
|
||||
"He",
|
||||
"Li",
|
||||
"Be",
|
||||
"B ",
|
||||
"C ",
|
||||
"N ",
|
||||
"O ",
|
||||
"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",
|
||||
"Ti",
|
||||
"Pb",
|
||||
"Bi",
|
||||
"Po",
|
||||
"At",
|
||||
"Rn",
|
||||
"Fr",
|
||||
"Ra",
|
||||
"Ac",
|
||||
"Th",
|
||||
"Pa",
|
||||
"U ",
|
||||
"Np",
|
||||
"Pu",
|
||||
"Am",
|
||||
"Cm",
|
||||
"Bk",
|
||||
"Cf",
|
||||
"Es",
|
||||
"Fm",
|
||||
"Md",
|
||||
"No",
|
||||
"Lr",
|
||||
dice_ghost_label,
|
||||
)
|
||||
|
||||
#### Tuple of atom masses
|
||||
atommass = (
|
||||
0.0,
|
||||
1.0079,
|
||||
4.0026,
|
||||
6.9410,
|
||||
9.0122,
|
||||
10.811,
|
||||
12.011,
|
||||
14.007,
|
||||
15.999,
|
||||
18.998,
|
||||
20.180,
|
||||
22.990,
|
||||
24.305,
|
||||
26.982,
|
||||
28.086,
|
||||
30.974,
|
||||
32.065,
|
||||
35.453,
|
||||
39.948,
|
||||
39.098,
|
||||
40.078,
|
||||
44.956,
|
||||
47.867,
|
||||
50.942,
|
||||
51.996,
|
||||
54.938,
|
||||
55.845,
|
||||
58.933,
|
||||
58.693,
|
||||
63.546,
|
||||
65.409,
|
||||
69.723,
|
||||
72.640,
|
||||
74.922,
|
||||
78.960,
|
||||
79.904,
|
||||
83.798,
|
||||
85.468,
|
||||
87.620,
|
||||
88.906,
|
||||
91.224,
|
||||
92.906,
|
||||
95.940,
|
||||
98.000,
|
||||
101.07,
|
||||
102.91,
|
||||
106.42,
|
||||
107.87,
|
||||
112.41,
|
||||
114.82,
|
||||
118.71,
|
||||
121.76,
|
||||
127.60,
|
||||
126.90,
|
||||
131.29,
|
||||
132.91,
|
||||
137.33,
|
||||
138.91,
|
||||
140.12,
|
||||
140.91,
|
||||
144.24,
|
||||
145.00,
|
||||
150.36,
|
||||
151.96,
|
||||
157.25,
|
||||
158.93,
|
||||
162.50,
|
||||
164.93,
|
||||
167.26,
|
||||
168.93,
|
||||
173.04,
|
||||
174.97,
|
||||
178.49,
|
||||
180.95,
|
||||
183.84,
|
||||
186.21,
|
||||
190.23,
|
||||
192.22,
|
||||
195.08,
|
||||
196.97,
|
||||
200.59,
|
||||
204.38,
|
||||
207.20,
|
||||
208.98,
|
||||
209.00,
|
||||
210.00,
|
||||
222.00,
|
||||
223.00,
|
||||
226.00,
|
||||
227.00,
|
||||
232.04,
|
||||
231.04,
|
||||
238.03,
|
||||
237.00,
|
||||
244.00,
|
||||
243.00,
|
||||
247.00,
|
||||
247.00,
|
||||
251.00,
|
||||
252.00,
|
||||
257.00,
|
||||
258.00,
|
||||
259.00,
|
||||
262.00,
|
||||
0.000,
|
||||
)
|
||||
DICE_GHOST_LABEL = "Xx"
|
||||
|
||||
#### Number of the ghost atom
|
||||
ghost_number = len(atomsymb) - 1
|
||||
GHOST_NUMBER = 0
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class AtomInfo:
|
||||
atomic_number: int
|
||||
symbol: str
|
||||
mass: float
|
||||
|
||||
|
||||
class PTable(Enum):
|
||||
Xx = AtomInfo(GHOST_NUMBER, DICE_GHOST_LABEL, 0.0)
|
||||
H = AtomInfo(1, "H", 1.0079)
|
||||
He = AtomInfo(2, "He", 4.0026)
|
||||
Li = AtomInfo(3, "Li", 6.9410)
|
||||
Be = AtomInfo(4, "Be", 9.0122)
|
||||
B = AtomInfo(5, "B", 10.811)
|
||||
C = AtomInfo(6, "C", 12.011)
|
||||
N = AtomInfo(7, "N", 14.007)
|
||||
O = AtomInfo(8, "O", 15.999)
|
||||
F = AtomInfo(9, "F", 18.998)
|
||||
Ne = AtomInfo(10, "Ne", 20.180)
|
||||
Na = AtomInfo(11, "Na", 22.990)
|
||||
Mg = AtomInfo(12, "Mg", 24.305)
|
||||
Al = AtomInfo(13, "Al", 26.982)
|
||||
Si = AtomInfo(14, "Si", 28.086)
|
||||
P = AtomInfo(15, "P", 30.974)
|
||||
S = AtomInfo(16, "S", 32.065)
|
||||
Cl = AtomInfo(17, "Cl", 35.453)
|
||||
Ar = AtomInfo(18, "Ar", 39.948)
|
||||
K = AtomInfo(19, "K", 39.098)
|
||||
Ca = AtomInfo(20, "Ca", 40.078)
|
||||
Sc = AtomInfo(21, "Sc", 44.956)
|
||||
Ti = AtomInfo(22, "Ti", 47.867)
|
||||
V = AtomInfo(23, "V", 50.942)
|
||||
Cr = AtomInfo(24, "Cr", 51.996)
|
||||
Mn = AtomInfo(25, "Mn", 54.938)
|
||||
Fe = AtomInfo(26, "Fe", 55.845)
|
||||
Co = AtomInfo(27, "Co", 58.933)
|
||||
Ni = AtomInfo(28, "Ni", 58.693)
|
||||
Cu = AtomInfo(29, "Cu", 63.546)
|
||||
Zn = AtomInfo(30, "Zn", 65.409)
|
||||
Ga = AtomInfo(31, "Ga", 69.723)
|
||||
Ge = AtomInfo(32, "Ge", 72.640)
|
||||
As = AtomInfo(33, "As", 74.922)
|
||||
Se = AtomInfo(34, "Se", 78.960)
|
||||
Br = AtomInfo(35, "Br", 79.904)
|
||||
Kr = AtomInfo(36, "Kr", 83.798)
|
||||
Rb = AtomInfo(37, "Rb", 85.468)
|
||||
Sr = AtomInfo(38, "Sr", 87.620)
|
||||
Y = AtomInfo(39, "Y", 88.906)
|
||||
Zr = AtomInfo(40, "Zr", 91.224)
|
||||
Nb = AtomInfo(41, "Nb", 92.906)
|
||||
Mo = AtomInfo(42, "Mo", 95.940)
|
||||
Tc = AtomInfo(43, "Tc", 98.000)
|
||||
Ru = AtomInfo(44, "Ru", 101.07)
|
||||
Rh = AtomInfo(45, "Rh", 102.91)
|
||||
Pd = AtomInfo(46, "Pd", 106.42)
|
||||
Ag = AtomInfo(47, "Ag", 107.87)
|
||||
Cd = AtomInfo(48, "Cd", 112.41)
|
||||
In = AtomInfo(49, "In", 114.82)
|
||||
Sn = AtomInfo(50, "Sn", 118.71)
|
||||
Sb = AtomInfo(51, "Sb", 121.76)
|
||||
Te = AtomInfo(52, "Te", 127.60)
|
||||
I = AtomInfo(53, "I", 126.90)
|
||||
Xe = AtomInfo(54, "Xe", 131.29)
|
||||
Cs = AtomInfo(55, "Cs", 132.91)
|
||||
Ba = AtomInfo(56, "Ba", 137.33)
|
||||
La = AtomInfo(57, "La", 138.91)
|
||||
Ce = AtomInfo(58, "Ce", 140.12)
|
||||
Pr = AtomInfo(59, "Pr", 140.91)
|
||||
Nd = AtomInfo(60, "Nd", 144.24)
|
||||
Pm = AtomInfo(61, "Pm", 145.00)
|
||||
Sm = AtomInfo(62, "Sm", 150.36)
|
||||
Eu = AtomInfo(63, "Eu", 151.96)
|
||||
Gd = AtomInfo(64, "Gd", 157.25)
|
||||
Tb = AtomInfo(65, "Tb", 158.93)
|
||||
Dy = AtomInfo(66, "Dy", 162.50)
|
||||
Ho = AtomInfo(67, "Ho", 164.93)
|
||||
Er = AtomInfo(68, "Er", 167.26)
|
||||
Tm = AtomInfo(69, "Tm", 168.93)
|
||||
Yb = AtomInfo(70, "Yb", 173.04)
|
||||
Lu = AtomInfo(71, "Lu", 174.97)
|
||||
Hf = AtomInfo(72, "Hf", 178.49)
|
||||
Ta = AtomInfo(73, "Ta", 180.95)
|
||||
W = AtomInfo(74, "W", 183.84)
|
||||
Re = AtomInfo(75, "Re", 186.21)
|
||||
Os = AtomInfo(76, "Os", 190.23)
|
||||
Ir = AtomInfo(77, "Ir", 192.22)
|
||||
Pt = AtomInfo(78, "Pt", 195.08)
|
||||
Au = AtomInfo(79, "Au", 196.97)
|
||||
Hg = AtomInfo(80, "Hg", 200.59)
|
||||
Tl = AtomInfo(81, "Tl", 204.38)
|
||||
Pb = AtomInfo(82, "Pb", 207.20)
|
||||
Bi = AtomInfo(83, "Bi", 208.98)
|
||||
Po = AtomInfo(84, "Po", 209.00)
|
||||
At = AtomInfo(85, "At", 210.00)
|
||||
Rn = AtomInfo(86, "Rn", 222.00)
|
||||
Fr = AtomInfo(87, "Fr", 223.00)
|
||||
Ra = AtomInfo(88, "Ra", 226.00)
|
||||
Ac = AtomInfo(89, "Ac", 227.00)
|
||||
Th = AtomInfo(90, "Th", 232.04)
|
||||
Pa = AtomInfo(91, "Pa", 231.04)
|
||||
U = AtomInfo(92, "U", 238.03)
|
||||
Np = AtomInfo(93, "Np", 237.00)
|
||||
Pu = AtomInfo(94, "Pu", 244.00)
|
||||
Am = AtomInfo(95, "Am", 243.00)
|
||||
Cm = AtomInfo(96, "Cm", 247.00)
|
||||
Bk = AtomInfo(97, "Bk", 247.00)
|
||||
Cf = AtomInfo(98, "Cf", 251.00)
|
||||
Es = AtomInfo(99, "Es", 252.00)
|
||||
Fm = AtomInfo(100, "Fm", 257.00)
|
||||
Md = AtomInfo(101, "Md", 258.00)
|
||||
No = AtomInfo(102, "No", 259.00)
|
||||
Lr = AtomInfo(103, "Lr", 262.00)
|
||||
|
||||
@classmethod
|
||||
def get_atomic_symbol(cls, atomic_number: int) -> str:
|
||||
for element in cls:
|
||||
if element.value.atomic_number == atomic_number:
|
||||
return element.value.symbol
|
||||
raise ValueError(f"Atomic number {atomic_number} not found in PTable.")
|
||||
|
||||
@classmethod
|
||||
def get_atomic_mass(cls, atomic_number: int) -> float:
|
||||
for element in cls:
|
||||
if element.value.atomic_number == atomic_number:
|
||||
return element.value.mass
|
||||
raise ValueError(f"Atomic number {atomic_number} not found in PTable.")
|
||||
|
||||
@classmethod
|
||||
def get_from_atomic_number(cls, atomic_number: int) -> AtomInfo:
|
||||
for element in cls:
|
||||
if element.value.atomic_number == atomic_number:
|
||||
return element.value
|
||||
raise ValueError(f"Atomic number {atomic_number} not found in PTable.")
|
||||
|
||||
108
poetry.lock
generated
108
poetry.lock
generated
@@ -259,73 +259,59 @@ files = [
|
||||
{file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nptyping"
|
||||
version = "2.5.0"
|
||||
description = "Type hints for NumPy."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "nptyping-2.5.0-py3-none-any.whl", hash = "sha256:764e51836faae33a7ae2e928af574cfb701355647accadcc89f2ad793630b7c8"},
|
||||
{file = "nptyping-2.5.0.tar.gz", hash = "sha256:e3d35b53af967e6fb407c3016ff9abae954d3a0568f7cc13a461084224e8e20a"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
numpy = {version = ">=1.20.0,<2.0.0", markers = "python_version >= \"3.8\""}
|
||||
typing-extensions = {version = ">=4.0.0,<5.0.0", markers = "python_version < \"3.10\""}
|
||||
|
||||
[package.extras]
|
||||
build = ["invoke (>=1.6.0)", "pip-tools (>=6.5.0)"]
|
||||
complete = ["pandas", "pandas-stubs-fork ; python_version >= \"3.8\""]
|
||||
dev = ["autoflake", "beartype (<0.10.0) ; python_version < \"3.10\"", "beartype (>=0.10.0) ; python_version >= \"3.10\"", "black", "codecov (>=2.1.0)", "coverage", "feedparser", "invoke (>=1.6.0)", "isort", "mypy", "pandas", "pandas-stubs-fork ; python_version >= \"3.8\"", "pip-tools (>=6.5.0)", "pylint", "pyright", "setuptools", "typeguard", "wheel"]
|
||||
pandas = ["pandas", "pandas-stubs-fork ; python_version >= \"3.8\""]
|
||||
qa = ["autoflake", "beartype (<0.10.0) ; python_version < \"3.10\"", "beartype (>=0.10.0) ; python_version >= \"3.10\"", "black", "codecov (>=2.1.0)", "coverage", "feedparser", "isort", "mypy", "pylint", "pyright", "setuptools", "typeguard", "wheel"]
|
||||
|
||||
[[package]]
|
||||
name = "numpy"
|
||||
version = "1.26.4"
|
||||
version = "2.0.2"
|
||||
description = "Fundamental package for array computing in Python"
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0"},
|
||||
{file = "numpy-1.26.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a"},
|
||||
{file = "numpy-1.26.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4"},
|
||||
{file = "numpy-1.26.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f"},
|
||||
{file = "numpy-1.26.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a"},
|
||||
{file = "numpy-1.26.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2"},
|
||||
{file = "numpy-1.26.4-cp310-cp310-win32.whl", hash = "sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07"},
|
||||
{file = "numpy-1.26.4-cp310-cp310-win_amd64.whl", hash = "sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5"},
|
||||
{file = "numpy-1.26.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71"},
|
||||
{file = "numpy-1.26.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef"},
|
||||
{file = "numpy-1.26.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e"},
|
||||
{file = "numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5"},
|
||||
{file = "numpy-1.26.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a"},
|
||||
{file = "numpy-1.26.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a"},
|
||||
{file = "numpy-1.26.4-cp311-cp311-win32.whl", hash = "sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20"},
|
||||
{file = "numpy-1.26.4-cp311-cp311-win_amd64.whl", hash = "sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2"},
|
||||
{file = "numpy-1.26.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218"},
|
||||
{file = "numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b"},
|
||||
{file = "numpy-1.26.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b"},
|
||||
{file = "numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed"},
|
||||
{file = "numpy-1.26.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a"},
|
||||
{file = "numpy-1.26.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0"},
|
||||
{file = "numpy-1.26.4-cp312-cp312-win32.whl", hash = "sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110"},
|
||||
{file = "numpy-1.26.4-cp312-cp312-win_amd64.whl", hash = "sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818"},
|
||||
{file = "numpy-1.26.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c"},
|
||||
{file = "numpy-1.26.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be"},
|
||||
{file = "numpy-1.26.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764"},
|
||||
{file = "numpy-1.26.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3"},
|
||||
{file = "numpy-1.26.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd"},
|
||||
{file = "numpy-1.26.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c"},
|
||||
{file = "numpy-1.26.4-cp39-cp39-win32.whl", hash = "sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6"},
|
||||
{file = "numpy-1.26.4-cp39-cp39-win_amd64.whl", hash = "sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea"},
|
||||
{file = "numpy-1.26.4-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30"},
|
||||
{file = "numpy-1.26.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c"},
|
||||
{file = "numpy-1.26.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0"},
|
||||
{file = "numpy-1.26.4.tar.gz", hash = "sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:51129a29dbe56f9ca83438b706e2e69a39892b5eda6cedcb6b0c9fdc9b0d3ece"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f15975dfec0cf2239224d80e32c3170b1d168335eaedee69da84fbe9f1f9cd04"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:8c5713284ce4e282544c68d1c3b2c7161d38c256d2eefc93c1d683cf47683e66"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:becfae3ddd30736fe1889a37f1f580e245ba79a5855bff5f2a29cb3ccc22dd7b"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2da5960c3cf0df7eafefd806d4e612c5e19358de82cb3c343631188991566ccd"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:496f71341824ed9f3d2fd36cf3ac57ae2e0165c143b55c3a035ee219413f3318"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a61ec659f68ae254e4d237816e33171497e978140353c0c2038d46e63282d0c8"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d731a1c6116ba289c1e9ee714b08a8ff882944d4ad631fd411106a30f083c326"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-win32.whl", hash = "sha256:984d96121c9f9616cd33fbd0618b7f08e0cfc9600a7ee1d6fd9b239186d19d97"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:c7b0be4ef08607dd04da4092faee0b86607f111d5ae68036f16cc787e250a131"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:49ca4decb342d66018b01932139c0961a8f9ddc7589611158cb3c27cbcf76448"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:11a76c372d1d37437857280aa142086476136a8c0f373b2e648ab2c8f18fb195"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:807ec44583fd708a21d4a11d94aedf2f4f3c3719035c76a2bbe1fe8e217bdc57"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:8cafab480740e22f8d833acefed5cc87ce276f4ece12fdaa2e8903db2f82897a"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a15f476a45e6e5a3a79d8a14e62161d27ad897381fecfa4a09ed5322f2085669"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13e689d772146140a252c3a28501da66dfecd77490b498b168b501835041f951"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9ea91dfb7c3d1c56a0e55657c0afb38cf1eeae4544c208dc465c3c9f3a7c09f9"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c1c9307701fec8f3f7a1e6711f9089c06e6284b3afbbcd259f7791282d660a15"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-win32.whl", hash = "sha256:a392a68bd329eafac5817e5aefeb39038c48b671afd242710b451e76090e81f4"},
|
||||
{file = "numpy-2.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:286cd40ce2b7d652a6f22efdfc6d1edf879440e53e76a75955bc0c826c7e64dc"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:df55d490dea7934f330006d0f81e8551ba6010a5bf035a249ef61a94f21c500b"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8df823f570d9adf0978347d1f926b2a867d5608f434a7cff7f7908c6570dcf5e"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:9a92ae5c14811e390f3767053ff54eaee3bf84576d99a2456391401323f4ec2c"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:a842d573724391493a97a62ebbb8e731f8a5dcc5d285dfc99141ca15a3302d0c"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c05e238064fc0610c840d1cf6a13bf63d7e391717d247f1bf0318172e759e692"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0123ffdaa88fa4ab64835dcbde75dcdf89c453c922f18dced6e27c90d1d0ec5a"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:96a55f64139912d61de9137f11bf39a55ec8faec288c75a54f93dfd39f7eb40c"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ec9852fb39354b5a45a80bdab5ac02dd02b15f44b3804e9f00c556bf24b4bded"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-win32.whl", hash = "sha256:671bec6496f83202ed2d3c8fdc486a8fc86942f2e69ff0e986140339a63bcbe5"},
|
||||
{file = "numpy-2.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:cfd41e13fdc257aa5778496b8caa5e856dc4896d4ccf01841daee1d96465467a"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9059e10581ce4093f735ed23f3b9d283b9d517ff46009ddd485f1747eb22653c"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:423e89b23490805d2a5a96fe40ec507407b8ee786d66f7328be214f9679df6dd"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-macosx_14_0_arm64.whl", hash = "sha256:2b2955fa6f11907cf7a70dab0d0755159bca87755e831e47932367fc8f2f2d0b"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-macosx_14_0_x86_64.whl", hash = "sha256:97032a27bd9d8988b9a97a8c4d2c9f2c15a81f61e2f21404d7e8ef00cb5be729"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e795a8be3ddbac43274f18588329c72939870a16cae810c2b73461c40718ab1"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f26b258c385842546006213344c50655ff1555a9338e2e5e02a0756dc3e803dd"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fec9451a7789926bcf7c2b8d187292c9f93ea30284802a0ab3f5be8ab36865d"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:9189427407d88ff25ecf8f12469d4d39d35bee1db5d39fc5c168c6f088a6956d"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-win32.whl", hash = "sha256:905d16e0c60200656500c95b6b8dca5d109e23cb24abc701d41c02d74c6b3afa"},
|
||||
{file = "numpy-2.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:a3f4ab0caa7f053f6797fcd4e1e25caee367db3112ef2b6ef82d749530768c73"},
|
||||
{file = "numpy-2.0.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:7f0a0c6f12e07fa94133c8a67404322845220c06a9e80e85999afe727f7438b8"},
|
||||
{file = "numpy-2.0.2-pp39-pypy39_pp73-macosx_14_0_x86_64.whl", hash = "sha256:312950fdd060354350ed123c0e25a71327d3711584beaef30cdaa93320c392d4"},
|
||||
{file = "numpy-2.0.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26df23238872200f63518dd2aa984cfca675d82469535dc7162dc2ee52d9dd5c"},
|
||||
{file = "numpy-2.0.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:a46288ec55ebbd58947d31d72be2c63cbf839f0a63b49cb755022310792a3385"},
|
||||
{file = "numpy-2.0.2.tar.gz", hash = "sha256:883c987dee1880e2a864ab0dc9892292582510604156762362d9326444636e78"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -829,4 +815,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess
|
||||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = ">=3.9"
|
||||
content-hash = "0e661d700053564022ef8eff6a86d1d55bc23196df8383a7241cad4ced174b1b"
|
||||
content-hash = "5536e92d5b39407e1809eaee99d24007803bbae5b3238e879d12b7dae559a0fa"
|
||||
|
||||
@@ -18,11 +18,10 @@ version = "0.0.0"
|
||||
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
numpy = "^1.26.4"
|
||||
numpy = "^2.0.2"
|
||||
argparse = "^1.4.0"
|
||||
setproctitle = "^1.3.2"
|
||||
pyyaml = "^6.0"
|
||||
nptyping = "^2.5.0"
|
||||
pydantic = "^2.12.5"
|
||||
typing-extensions = "^4.15.0"
|
||||
|
||||
@@ -65,6 +64,9 @@ omit = [
|
||||
# Linters
|
||||
[tool.ruff.lint]
|
||||
extend-select = ["I"]
|
||||
ignore = [
|
||||
"E741" # ambiguous variable name 'l', 'O', or 'I'
|
||||
]
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
known-first-party = ["jambo"]
|
||||
|
||||
Reference in New Issue
Block a user