rdkit_sys/bridge/
ro_mol.rs1#[cxx::bridge(namespace = "RDKit")]
2pub mod ffi {
3 #[repr(i32)]
4 #[derive(Debug, PartialEq)]
5 pub enum HybridizationType {
6 UNSPECIFIED,
7 S,
8 SP,
9 SP2,
10 SP3,
11 SP2D,
12 SP3D,
13 SP3D2,
14 OTHER,
15 }
16
17 unsafe extern "C++" {
18 include!("wrapper/include/ro_mol.h");
19
20 pub type ROMol;
21 pub type ExplicitBitVect = crate::fingerprint_ffi::ExplicitBitVect;
22 pub type SmilesParserParams;
23 pub type Atom;
24 pub type HybridizationType;
25
26 pub type MolSanitizeException;
27 pub type MolSanitizeExceptionUniquePtr; pub fn copy_mol(mol: &SharedPtr<ROMol>) -> SharedPtr<ROMol>;
30
31 pub fn smiles_to_mol(smi: &CxxString) -> Result<SharedPtr<ROMol>>;
32
33 pub fn smiles_to_mol_with_params(
34 smi: &CxxString,
35 params: &SharedPtr<SmilesParserParams>,
36 ) -> Result<SharedPtr<ROMol>>;
37 pub fn new_smiles_parser_params() -> SharedPtr<SmilesParserParams>;
38 pub fn smiles_parser_params_set_sanitize(
39 ptr: &SharedPtr<SmilesParserParams>,
40 sanitize: bool,
41 );
42 pub fn smiles_parser_params_get_sanitize(ptr: &SharedPtr<SmilesParserParams>) -> bool;
43
44 pub fn mol_to_smiles(mol: &SharedPtr<ROMol>) -> String;
45
46 pub fn mol_to_molblock(mol: &SharedPtr<ROMol>) -> String;
47
48 pub fn detect_chemistry_problems(
49 mol: &SharedPtr<ROMol>,
50 ) -> UniquePtr<CxxVector<MolSanitizeExceptionUniquePtr>>;
51
52 pub fn mol_sanitize_exception_type(
53 mol_sanitize_exception: &MolSanitizeExceptionUniquePtr,
54 ) -> String;
55
56 pub fn atom_sanitize_exception_get_atom_idx(
57 mol_sanitize_exception: &MolSanitizeExceptionUniquePtr,
58 ) -> u32;
59
60 pub fn get_num_atoms(mol: &SharedPtr<ROMol>, onlyExplicit: bool) -> u32;
61 pub fn get_atom_with_idx(mol: &mut SharedPtr<ROMol>, idx: u32) -> Pin<&mut Atom>;
62 pub fn get_symbol(atom: Pin<&Atom>) -> String;
63 pub fn get_is_aromatic(atom: Pin<&Atom>) -> bool;
64 pub fn get_atomic_num(atom: Pin<&Atom>) -> i32;
65 pub fn get_formal_charge(atom: Pin<&Atom>) -> i32;
66 pub fn get_total_num_hs(atom: Pin<&Atom>) -> u32;
67 pub fn get_total_valence(atom: Pin<&Atom>) -> u32;
68 pub fn set_formal_charge(atom: Pin<&mut Atom>, what: i32);
69 pub fn set_num_explicit_hs(atom: Pin<&mut Atom>, what: i32);
70 pub fn atom_update_property_cache(atom: Pin<&mut Atom>, strict: bool) -> Result<()>;
71 pub fn atom_set_hybridization(atom: Pin<&mut Atom>, what: HybridizationType);
72 pub fn atom_get_hybridization(atom: Pin<&Atom>) -> HybridizationType;
73
74 pub fn ro_mol_update_property_cache(atom: &mut SharedPtr<ROMol>, strict: bool);
75
76 pub fn set_int_prop(atom: Pin<&mut Atom>, key: &CxxString, value: i32);
77 pub fn get_int_prop(atom: Pin<&Atom>, key: &CxxString) -> Result<i32>;
78 pub fn set_float_prop(atom: Pin<&mut Atom>, key: &CxxString, value: f64);
79 pub fn get_float_prop(atom: Pin<&Atom>, key: &CxxString) -> Result<f64>;
80 pub fn set_bool_prop(atom: Pin<&mut Atom>, key: &CxxString, value: bool);
81 pub fn get_bool_prop(atom: Pin<&Atom>, key: &CxxString) -> Result<bool>;
82 pub fn set_prop(atom: Pin<&mut Atom>, key: &CxxString, value: &CxxString);
83 pub fn get_prop(atom: Pin<&Atom>, key: &CxxString) -> Result<String>;
84 pub fn get_num_radical_electrons(atom: Pin<&Atom>) -> u32;
85
86 pub fn get_degree(atom: Pin<&Atom>) -> u32;
88 }
89}