CJam, 175 174 bytes
0000000: 7232316222faaf6c3e227b693138302b257d2f296322 r21b"..l>"{i180+%}/)c"
0000016: 0221dce3cc4eb9561f953aaf640771c048ca3b9926c1 .!...N.V..:.d.q.H.;.&.
000002c: 4d033768588e2545069a202e128f0e238546134bdb31 M.7hX.%E.. ....#.F.K.1
0000042: c2e9e6924a7a8642dab33d6b789009112b5a8a652dd3 ....Jz.B..=kx...+Z.e-.
0000058: 7dbf0f0b27eb18e52808e857967bd7be4ce2545181b8 }...'...(..W.{..L.TQ..
000006e: 01101447504f4443c6392449222322f43a606ce335e0 ...GPODC.9$I"#".:`l.5.
0000084: 4356e76914357218e3942869eb8ab3f97e2e161ef061 CV.i.5r...(i....~....a
000009a: 59c310c6cbe922323538623762364365723e3a2b Y....."258b7b6Cer>:+
The above is a reversible xxd dump. You can try the code online in the [CJam interpreter][1].
If the permalink doesn't work in your browser, you can copy the code from [this paste][2].
In supported browsers, you can [verify all test cases][3] at once.
Idea
The actual weights are encoded in the same fashion as in Martin Büttner's answer, with three minor modifications:
- 12's are replaced with 6's instead of 7's.
- The encoding is done in base 7 instead of base 8.
- The order of the elements is reversed.
The difference between our answers lies in how the element abbreviations are stored.
In this approach, we hash all 100 element abbreviations into 8-bit characters, by doing the following:
- Take the element name (treated as the array of its code points) and apply base 21 conversion.
Examples: "H"21b
yields 72, "He"21b
yields 1613 = 21 × 72 + 101.
- Successively compute the residue of the division by 430, 355, 288 and 242.
Example: 1613 430% 355% 288% 242%
yields 35.
- Increment and cast to character.
Example: 35)c
yields $.
Code
r e# Read a whitespace-separated token from STDIN.
21b e# Convert to intger, using base 21 conversion.
"ú¯l>" e# Push that string.
{i180+%}/ e# Cast each char to integer, add 180 and apply modular division.
)c e# Add 1 and cast to character.
"!ÜãÌN¹V:¯dqÀHÊ;&ÁM7hX%E .#FKÛ1ÂéæJzBÚ³=kx +Ze-Ó}¿'ëå(èW{×¾LâTQ¸GPODCÆ9$I"
e# Push that string.
e# "He", e.g., is hashed to '$', which is the second char from the right.
# e# Compute the index of the character hash in the string.
"ô:`lã5àCVçi5rã(ië³ù~.ðaYÃÆËé"
e# Push that string.
258b7b e# Convert from base 258 to base 7.
6Cer e# Replace 6's with 12's.
> e# Keep only weight differences before the hashes occurrence.
:+ e# Push the sum of the weight differences.
[1]: http://cjam.aditsu.net/#code=r21b%22%C3%BA%C2%AFl%3E%22%7Bi180%2B%25%7D%2F)c%22%02!%C3%9C%C3%A3%C3%8CN%C2%B9V%1F%C2%95%3A%C2%AFd%07q%C3%80H%C3%8A%3B%C2%99%26%C3%81M%037hX%C2%8E%25E%06%C2%9A%20.%12%C2%8F%0E%23%C2%85F%13K%C3%9B1%C3%82%C3%A9%C3%A6%C2%92Jz%C2%86B%C3%9A%C2%B3%3Dkx%C2%90%09%11%2BZ%C2%8Ae-%C3%93%7D%C2%BF%0F%0B'%C3%AB%18%C3%A5(%08%C3%A8W%C2%96%7B%C3%97%C2%BEL%C3%A2TQ%C2%81%C2%B8%01%10%14GPODC%C3%869%24I%22%23%22%C3%B4%3A%60l%C3%A35%C3%A0CV%C3%A7i%145r%18%C3%A3%C2%94(i%C3%AB%C2%8A%C2%B3%C3%B9~.%16%1E%C3%B0aY%C3%83%10%C3%86%C3%8B%C3%A9%22258b7b6Cer%3E%3A%2B&input=Pt [2]: http://pastebin.com/Y1pscnmg [3]: http://cjam.aditsu.net/#code=qN%2F%7BS%25~21b%22%C3%BA%C2%AFl%3E%22%7Bi180%2B%25%7D%2F)c%22%02!%C3%9C%C3%A3%C3%8CN%C2%B9V%1F%C2%95%3A%C2%AFd%07q%C3%80H%C3%8A%3B%C2%99%26%C3%81M%037hX%C2%8E%25E%06%C2%9A%20.%12%C2%8F%0E%23%C2%85F%13K%C3%9B1%C3%82%C3%A9%C3%A6%C2%92Jz%C2%86B%C3%9A%C2%B3%3Dkx%C2%90%09%11%2BZ%C2%8Ae-%C3%93%7D%C2%BF%0F%0B'%C3%AB%18%C3%A5(%08%C3%A8W%C2%96%7B%C3%97%C2%BEL%C3%A2TQ%C2%81%C2%B8%01%10%14GPODC%C3%869%24I%22%23%22%C3%B4%3A%60l%C3%A35%C3%A0CV%C3%A7i%145r%18%C3%A3%C2%94(i%C3%AB%C2%8A%C2%B3%C3%B9~.%16%1E%C3%B0aY%C3%83%10%C3%86%C3%8B%C3%A9%22258b7b6Cer%3E%3A%2B%60%3D%7D%25&input=1%20H%0A4%20He%0A7%20Li%0A9%20Be%0A11%20B%0A12%20C%0A14%20N%0A16%20O%0A19%20F%0A20%20Ne%0A23%20Na%0A24%20Mg%0A27%20Al%0A28%20Si%0A31%20P%0A32%20S%0A35%20Cl%0A39%20K%0A40%20Ar%0A40%20Ca%0A45%20Sc%0A48%20Ti%0A51%20V%0A52%20Cr%0A55%20Mn%0A56%20Fe%0A59%20Co%0A59%20Ni%0A64%20Cu%0A65%20Zn%0A70%20Ga%0A73%20Ge%0A75%20As%0A79%20Se%0A80%20Br%0A84%20Kr%0A85%20Rb%0A88%20Sr%0A89%20Y%0A91%20Zr%0A93%20Nb%0A96%20Mo%0A98%20Tc%0A101%20Ru%0A103%20Rh%0A106%20Pd%0A108%20Ag%0A112%20Cd%0A115%20In%0A119%20Sn%0A122%20Sb%0A127%20I%0A128%20Te%0A131%20Xe%0A133%20Cs%0A137%20Ba%0A139%20La%0A140%20Ce%0A141%20Pr%0A144%20Nd%0A145%20Pm%0A150%20Sm%0A152%20Eu%0A157%20Gd%0A159%20Tb%0A163%20Dy%0A165%20Ho%0A167%20Er%0A169%20Tm%0A173%20Yb%0A175%20Lu%0A178%20Hf%0A181%20Ta%0A184%20W%0A186%20Re%0A190%20Os%0A192%20Ir%0A195%20Pt%0A197%20Au%0A201%20Hg%0A204%20Tl%0A207%20Pb%0A209%20Bi%0A209%20Po%0A210%20At%0A222%20Rn%0A223%20Fr%0A226%20Ra%0A227%20Ac%0A231%20Pa%0A232%20Th%0A237%20Np%0A238%20U%0A243%20Am%0A244%20Pu%0A247%20Bk%0A247%20Cm%0A251%20Cf%0A252%20Es%0A257%20Fm