  Legacy codes in computational science and engineering have been very
successful in providing essential functionality to researchers. However, they
are not capable of exploiting the massive parallelism provided by emerging
heterogeneous architectures. The lack of portable performance and scalability
puts them at high risk: either they evolve or they are doomed to disappear. One
example of legacy code which would heavily benefit from a modern design is
FLEUR, a software for electronic structure calculations. In previous work, the
computational bottleneck of FLEUR was partially re-engineered to have a modular
design that relies on standard building blocks, namely BLAS and LAPACK. In this
paper, we demonstrate how the initial redesign enables the portability to
heterogeneous architectures. More specifically, we study different approaches
to port the code to architectures consisting of multi-core CPUs equipped with
one or more coprocessors such as Nvidia GPUs and Intel Xeon Phis. Our final
code attains over 70\% of the architectures' peak performance, and outperforms
Nvidia's and Intel's libraries. Finally, on JURECA, the supercomputer where
FLEUR is often executed, the code takes advantage of the full power of the
computing nodes, attaining $5\times$ speedup over the sole use of the CPUs.
