Skip to main content

AtomData

Struct AtomData 

Source
pub struct AtomData {
    pub atomic_num: u8,
    pub formal_charge: i8,
    pub isotope: u16,
    pub num_explicit_hs: u8,
    pub num_implicit_hs: u8,
    pub num_radical_electrons: u8,
    pub atom_map: u16,
    pub chiral_tag: ChiralTag,
    pub stereo_perm: u8,
    pub hybridization: Hybridization,
    pub flags: AtomFlags,
}
Expand description

单个原子的可变数据。

字段与 MolBatch 的列一一对应 —— 增加字段时两处必须同步。

Fields§

§atomic_num: u8

原子序数。0 表示 SMILES 通配原子 *

§formal_charge: i8

形式电荷

§isotope: u16

同位素质量数。0 表示未指定(即天然丰度)。

§num_explicit_hs: u8

方括号中显式书写的氢数。仅当 AtomFlags::NO_IMPLICIT 置位时有意义。

§num_implicit_hs: u8

隐式氢数。由 L2 的价键计算填充,解析阶段恒为 0。

§num_radical_electrons: u8

自由基电子数。由 L2 第 6 步 FINDRADICALS 填充,在那之前恒为 0。

隐式氢推断会读它,所以两者的先后顺序有实际后果 —— 净化管线里第 6 步排在第 3 步之后,故第 3 步看到的必然是 0。

§atom_map: u16

反应原子映射号(SMILES 中的 :n)。0 表示无映射。

§chiral_tag: ChiralTag

立体标记的几何类别

§stereo_perm: u8

立体标记的类内排列序号,与 chiral_tag 配套。

0 表示未指定。四面体的两种排列由 chiral_tag 自身表达,此处恒为 0 —— 两处都记就有了两个可以互相矛盾的真相来源。

§相对邻居的存储顺序

序号的含义依赖“配体按什么顺序排列“,而解析会重排邻居(环闭合键统一 追加到末尾)—— 不说清楚“相对什么顺序“,这个字段就没有意义。

类别多面体有几个顶点本字段相对什么顺序
ChiralTag::SquarePlanar4邻居的存储顺序(解析时已归一)
ChiralTag::TrigonalBipyramidal5同上
ChiralTag::Octahedral6同上
以上三类但顶点比邻居多两个及以上书写时的字面值;写出时整个丢掉
ChiralTag::Allene (@AL)4(来自累积双键两端)四个配体的存储顺序(解析时已归一)

丙二烯那一行的“配体“不是这个原子自己的邻居 —— 中心只有两个邻居, 四个配体是两端端原子上的取代基。取不到四个(标记没落在丙二烯中心上、 某一端两个配体相同)时序号归 0,写出侧整个丢掉。

顶点比邻居多一个时照样归一:方括号里的氢、或者一个空的配位位置, 也占一个顶点而不在邻居序列里,补一个占位的进去即可 —— 它排在存储序的 最前,书写序里则落在“自身位置“。补法在 omgkit-io 那一侧 (smiles::coordination_ligands),解析与写出共用同一份。

多两个及以上就不归一了:那几个顶点在 SMILES 里全落在同一处、彼此 分不开,换算出来的序号不唯一。那时写出侧整个丢掉这个标记:丢掉是 老实的,瞎写一个序号是撒谎。

换算见 crate::polyhedron::renumber;那三张表是从 RDKit 2025.09.2 穷举量出来的(72 / 2400 / 21600 种写法,零反例),不是照着规范条文写的。

§hybridization: Hybridization

杂化状态。由净化第 9 步填充,在那之前为 Unspecified

§flags: AtomFlags

标志位

Implementations§

Source§

impl AtomData

Source

pub fn new(atomic_num: u8) -> Self

构造一个只指定了元素的原子,其余字段取默认值。

Trait Implementations§

Source§

impl Clone for AtomData

Source§

fn clone(&self) -> AtomData

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AtomData

Source§

impl Debug for AtomData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AtomData

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for AtomData

Source§

impl PartialEq for AtomData

Source§

fn eq(&self, other: &AtomData) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AtomData

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.