1pub mod data;
2
3use crate::atom::UffAtomType;
4use data::UFF_DATA;
5
6#[derive(Debug, Clone, Copy)]
8pub struct UffParams {
9 pub r1: f64, pub theta0: f64, pub x1: f64, pub d1: f64, pub zeta: f64, pub z_star: f64, pub chi: f64, pub u_i: f64, }
18
19pub fn get_uff_params(atom_type: &UffAtomType) -> Option<UffParams> {
21 let label = atom_type.as_str();
22
23 UFF_DATA.iter()
24 .find(|&&(id, ..)| id == label || (id.ends_with('_') && label.starts_with(id)))
25 .map(|&(_, r1, theta0, x1, d1, zeta, z_star, chi, u_i)| UffParams {
26 r1, theta0, x1, d1, zeta, z_star, chi, u_i,
27 })
28}
29
30pub fn element_symbol(z: usize) -> &'static str {
32 let symbols = [
33 "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne",
34 "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca",
35 "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn",
36 "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr",
37 "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn",
38 "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd",
39 "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb",
40 "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg",
41 "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th",
42 "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm",
43 "Md", "No", "Lr",
44 ];
45 if z > 0 && z <= symbols.len() {
46 symbols[z - 1]
47 } else {
48 "X"
49 }
50}