|
1 | 1 | use cxx::{let_cxx_string, CxxVector}; |
| 2 | +use rdkit_sys::PeriodicTableOps; |
2 | 3 |
|
3 | 4 | pub struct PeriodicTable {} |
4 | 5 |
|
5 | 6 | impl PeriodicTable { |
| 7 | + /// Returns a vector of all stable valences. For atoms where we really don't |
| 8 | + /// have any idea what a reasonable maximum valence is (like transition |
| 9 | + /// metals), the vector ends with -1 |
| 10 | + /// # Arguments |
| 11 | + /// * `atomic_number` - The atomic number of the element |
6 | 12 | pub fn get_valence_list(atomic_number: u32) -> &'static CxxVector<i32> { |
7 | | - rdkit_sys::periodic_table_ffi::get_valence_list(atomic_number) |
| 13 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getValenceList(atomic_number) |
8 | 14 | } |
9 | 15 |
|
| 16 | + /// Returns the mass of the most common isotope |
| 17 | + /// # Arguments |
| 18 | + /// * `atom` - The symbol of the element |
10 | 19 | pub fn get_most_common_isotope_mass(atom: &str) -> f64 { |
11 | 20 | let_cxx_string!(atom_cxx_string = atom); |
12 | | - rdkit_sys::periodic_table_ffi::get_most_common_isotope_mass(&atom_cxx_string) |
| 21 | + rdkit_sys::periodic_table_ffi::get_periodic_table() |
| 22 | + .getMostCommonIsotopeMass(&atom_cxx_string) |
| 23 | + } |
| 24 | + |
| 25 | + /// Returns the atomic weight of the atom |
| 26 | + pub fn get_atomic_weight(atomic_number: u32) -> f64 { |
| 27 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getAtomicWeight(atomic_number) |
| 28 | + } |
| 29 | + |
| 30 | + /// Returns the atomic number of the atom |
| 31 | + /// # Arguments |
| 32 | + /// * `atom` - The symbol of the element |
| 33 | + pub fn get_atomic_number(atom: &str) -> i32 { |
| 34 | + let_cxx_string!(atom_cxx_string = atom); |
| 35 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getAtomicNumber(&atom_cxx_string) |
| 36 | + } |
| 37 | + |
| 38 | + /// Returns the symbol of the element |
| 39 | + /// # Arguments |
| 40 | + /// * `atomic_number` - The atomic number of the element |
| 41 | + pub fn get_element_symbol(atomic_number: u32) -> String { |
| 42 | + rdkit_sys::periodic_table_ffi::getElementSymbol(atomic_number) |
| 43 | + } |
| 44 | + |
| 45 | + /// Returns the full element name |
| 46 | + /// # Arguments |
| 47 | + /// * `atomic_number` - The atomic number of the element |
| 48 | + pub fn get_element_name(atomic_number: u32) -> String { |
| 49 | + rdkit_sys::periodic_table_ffi::getElementName(atomic_number) |
| 50 | + } |
| 51 | + |
| 52 | + /// Returns the atom's Van der Waals radius |
| 53 | + /// # Arguments |
| 54 | + /// * `atomic_number` - The atomic number of the element |
| 55 | + pub fn get_radius_van_der_waals(atomic_number: u32) -> f64 { |
| 56 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getRvdw(atomic_number) |
| 57 | + } |
| 58 | + |
| 59 | + /// Returns the atom's covalent radius |
| 60 | + /// # Arguments |
| 61 | + /// * `atomic_number` - The atomic number of the element |
| 62 | + pub fn get_radius_covalent(atomic_number: u32) -> f64 { |
| 63 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getRcovalent(atomic_number) |
| 64 | + } |
| 65 | + |
| 66 | + /// Returns the atom's bond radius |
| 67 | + /// # Arguments |
| 68 | + /// * `atomic_number` - The atomic number of the element |
| 69 | + pub fn get_radius_b0(atomic_number: u32) -> f64 { |
| 70 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getRb0(atomic_number) |
| 71 | + } |
| 72 | + |
| 73 | + /// Returns the atom's default valence |
| 74 | + /// # Arguments |
| 75 | + /// * `atomic_number` - The atomic number of the element |
| 76 | + pub fn get_default_valence(atomic_number: u32) -> i32 { |
| 77 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getDefaultValence(atomic_number) |
| 78 | + } |
| 79 | + |
| 80 | + /// Returns the number of outer shell electrons |
| 81 | + /// # Arguments |
| 82 | + /// * `atomic_number` - The atomic number of the element |
| 83 | + pub fn get_n_outer_elecs(atomic_number: u32) -> i32 { |
| 84 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getNouterElecs(atomic_number) |
| 85 | + } |
| 86 | + |
| 87 | + /// Returns the atom's most common isotope |
| 88 | + /// # Arguments |
| 89 | + /// * `atomic_number` - The atomic number of the element |
| 90 | + pub fn get_most_common_isotope(atomic_number: u32) -> i32 { |
| 91 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getMostCommonIsotope(atomic_number) |
| 92 | + } |
| 93 | + |
| 94 | + /// Returns the mass of the isotope |
| 95 | + /// # Arguments |
| 96 | + /// * `atomic_number` - The atomic number of the element |
| 97 | + /// * `isotope` - The isotope number |
| 98 | + pub fn get_mass_for_isotope(atomic_number: u32, isotope: u32) -> f64 { |
| 99 | + rdkit_sys::periodic_table_ffi::get_periodic_table() |
| 100 | + .getMassForIsotope(atomic_number, isotope) |
| 101 | + } |
| 102 | + |
| 103 | + /// Returns the maximum recognized atomic number |
| 104 | + pub fn get_max_atomic_number() -> u32 { |
| 105 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getMaxAtomicNumber() |
| 106 | + } |
| 107 | + |
| 108 | + /// Returns the abundance of the isotope |
| 109 | + /// # Arguments |
| 110 | + /// * `atomic_number` - The atomic number of the element |
| 111 | + /// * `isotope` - The isotope number |
| 112 | + pub fn get_abundance_for_isotope(atomic_number: u32, isotope: u32) -> f64 { |
| 113 | + rdkit_sys::periodic_table_ffi::get_periodic_table() |
| 114 | + .getAbundanceForIsotope(atomic_number, isotope) |
| 115 | + } |
| 116 | + |
| 117 | + /// Returns true if the first atom is more electronegative than the second |
| 118 | + /// # Arguments |
| 119 | + /// * `atomic_number1` - The atomic number of the first element |
| 120 | + /// * `atomic_number2` - The atomic number of the second element |
| 121 | + pub fn more_electro_negative(atomic_number1: u32, atomic_number2: u32) -> bool { |
| 122 | + rdkit_sys::periodic_table_ffi::get_periodic_table() |
| 123 | + .moreElectroNegative(atomic_number1, atomic_number2) |
| 124 | + } |
| 125 | + |
| 126 | + /// Returns the row of the periodic table |
| 127 | + /// # Arguments |
| 128 | + /// * `atomic_number` - The atomic number of the element |
| 129 | + pub fn get_row(atomic_number: u32) -> u32 { |
| 130 | + rdkit_sys::periodic_table_ffi::get_periodic_table().getRow(atomic_number) |
13 | 131 | } |
14 | 132 | } |
0 commit comments