  Despite initiatives to improve the quality of scientific codes, there still
is a large presence of legacy code. Such code often needs to implement a lot of
functionality under time constrains, sacrificing quality. Additionally, quality
is rarely improved by optimizations for new architectures. This development
model leads to code that is increasingly difficult to work with. Our suggested
solution includes complexity-reducing refactoring and hardware abstraction. We
focus on the AIREBO potential from LAMMPS, where the challenge is that any
potential kernel is rather large and complex, hindering systematic
optimization. This issue is common to codes that model multiple physical
phenomena. We present our journey from the C++ port of a previous Fortran code
to performance-portable, KNC-hybrid, vectorized, scalable, optimized code
supporting full and reduced precision. The journey includes extensive testing
that fixed bugs in the original code. Large-scale, full-precision runs sustain
speedups of more than 4x (KNL) and 3x (Skylake).
