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 let label_stem = label.trim_end_matches('_');
23
24 UFF_DATA.iter()
25 .find(|&&(id, ..)| {
26 let id_stem = id.trim_end_matches('_');
27 id == label ||
28 id.starts_with(label) ||
29 label.starts_with(id) ||
30 id.starts_with(label_stem) ||
31 label_stem.starts_with(id_stem)
32 })
33 .map(|&(_, r1, theta0, x1, d1, zeta, z_star, chi, u_i)| UffParams {
34 r1, theta0, x1, d1, zeta, z_star, chi, u_i,
35 })
36}
37
38pub fn element_symbol(z: usize) -> &'static str {
40 let symbols = [
41 "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne",
42 "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca",
43 "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn",
44 "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr",
45 "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn",
46 "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd",
47 "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb",
48 "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg",
49 "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th",
50 "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm",
51 "Md", "No", "Lr",
52 ];
53 if z > 0 && z <= symbols.len() {
54 symbols[z - 1]
55 } else {
56 "X"
57 }
58}