#define MX_ELEM 105 #include "bbltyp.h" void get_atomic_weights(ums_type *mol) { int i; for (i = 1; i <= Atoms; i++) { Double(i) = atnum2mass(Atomic_number(i)); } } double calc_molecular_weight(ums_type *mol) { int i; double amw = 0.0; for (i = 1; i <= Atoms; i++) { amw += atnum2mass(Atomic_number(i)); } return(amw); } double atnum2mass(int atnum) { static double aaw[MX_ELEM + 1] = { 0.000, 1.008, 4.0026, 6.94, 9.01218, 10.81, 12.011, 14.0067, 15.9994, 18.99846, 20.17, 22.98977, 24.305, 26.9815, 28.086, 30.9738, 32.06, 35.453, 39.948, 39.1, 40.08, 44.9559, 47.9, 50.941, 51.996, 54.938, 55.847, 58.9332, 58.71, 63.543, 65.38, 69.72, 72.59, 74.9216, 78.96, 79.904, 83.8, 85.467, 87.62, 88.9059, 91.22, 92.9064, 95.94, 98.9062, 101.07, 102.9055, 106.4, 107.868, 112.4, 114.82, 118.69, 121.75, 127.6, 126.9045, 131.3, 132.9055, 137.34, 138.9055, 140.12, 140.9077, 144.24, 145., 150.4, 151.96, 157.25, 158.9254, 162.5, 164.9303, 167.26, 168.9342, 173.04, 174.97, 178.49, 180.947, 183.85, 186.2, 190.2, 192.22, 195.09, 196.9665, 200.59, 204.37, 207.2, 208.9806, 209., 210., 222., 223., 226., 227., 232.0381, 231.0359, 238.029, 237.0408, 244., 243., 247., 247., 251., 254.09, 257.08, 258.098, 259.10, 260.1, 261.1, 262.11 }; if ((atnum < 1) || (atnum > MX_ELEM)) { fprintf(stderr, "ERROR: Unknown atom number --> %d\n", atnum); return (0); } else return(aaw[atnum]); }