- Replace manual property updates with @cached_property for total_mass, com, and inertia_tensor - Introduce invalidate_computed_properties decorator to auto-invalidate cached properties on atom changes - Vectorize distances_between_atoms, sizes_of_molecule, and minimum_distance calculations using numpy - Unify and clarify center of mass and standard orientation methods (move_center_of_mass_to_origin, rotate_to_standard_orientation) - Remove redundant or outdated code, improve typing and error handling - Update dependent files and tests to use new method names and behaviors
28 lines
540 B
Python
28 lines
540 B
Python
from diceplayer.utils.ptable import PTable, AtomInfo
|
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass
|
|
class Atom:
|
|
"""
|
|
Atom class declaration. This class is used throughout the DicePlayer program to represent atoms.
|
|
"""
|
|
|
|
lbl: int
|
|
na: int
|
|
rx: float
|
|
ry: float
|
|
rz: float
|
|
chg: float
|
|
eps: float
|
|
sig: float
|
|
|
|
@property
|
|
def mass(self) -> float:
|
|
return PTable.get_atomic_mass(self.na)
|
|
|
|
@property
|
|
def atom_info(self) -> AtomInfo:
|
|
return PTable.get_from_atomic_number(self.na)
|