Fig. 1: Calculations of many material properties require accuracte descriptions on multiple scales.

Modern material research requires a fundamental understanding of material properties on all scales ranging from the microscopic, via mesoscopic to the macroscopic scale. The microscopic scale describes atomic bond distances, electronic and vibrational properties in the order of Angstroms or fsec. Thermodynamical properties, such as pressure or temperature distributions, can be simulated by applying statistical mechanics to reach orders of μm or nsec. Structural properties due to the material's microstructure happen in the mesoscopic scale (<mm,<ms). Engineering calls for an accurate description in the macroscopic scale to fashion constructions (>mm,>sec). An important contribution of computational physics to material research and -design is the development of highly optimized methods to model accurately the material properties across these scales. Conventionally, different disciplines of computational physics are dedicated to a single scale, respectively. For each single scale several highly specialized program packages have been developed from different research teams. As the computer power steadily increases, a new trend of combining the single-scale methods emerges (multiscale methods). Their various single-scale approaches make it not straightforward to couple them to perform truly multiscaling calculations. Additionally, each of those single-scale packages is long and thus, hard to maintain. Reusing code fragments across different packages is hardly possible. To address this issue a new object-oriented approach is developed in the Algorithm Design and Modeling group. It allows a seamless coupling of the various single-scale approaches and an easy development of various multiscale strategies. Although the work of the current project bridges only the first two scales its general approach allows future developments in all scales. The new library is called S/PHI/nX [1]. (S)phinx represents (p)hysical algorithms in an (h)ierarchy of (i)ndependent object (n)odes using template e(x)pression techniques. The name "S/Φ/nX" is also a wordplay combining the egyptian goddess of wisdom and knowledge (Sphinx) with the greek letter Φ representing the one-particle wave function Φ in quantum mechanics (HΦ=εΦ) as basis of ab initio calculations. S/PHI/nX relies on a class hierarchy based upon our highly optimized algebraic layer. On top of this layer we have developed modules and interfaces to address the various scales.


In the field of method and code development there is a constant need to improve the package with respect to efficiency and accuracy. S/PHI/nX, written in C++, offers therefore

  • a matrix based formulation of Density Functional Theory[2] (DFT) and
  • a completely modular and object-oriented approach.

The matrix-based notation provides an efficient tool to describe new algorithms and gives direct access to fast BLAS3 (matrix-matrix) routines which are significantly faster than single-element or vector operations on modern computer architectures. The high level of modularity makes it easy for beginners to understand, modify and test parts of the code without affecting the rest of the program. Using this program it was possible to implement even complex algorithms such as the exact-exchange formalism[3] and new electronic minimization algorithms in a few weeks rather than months

The module concept behind S/PHI/nX

Fig. 2: The S/PHI/nX class hierarchy. Abstract physics modules can be kept very short and transparent as they are separated from numerics and service routines.

S/PHI/nX consists of a set of hierarchical layers. Each layer represents a certain aspect of the simulations, i.e.,

  1. Algebra library
    All C++ classes in S/PHI/nX's algebra library present a cross platform interface between the actual implementations of algorithms and high performance numeric libraries.
  1. Microscopic layer
    The classes which are organized in this layer represent the actual implementation of DFT. In the current implementation a pseudo potential plane-wave Hamiltonian[2], a self-consistent density functional tight binding Hamiltonian[4,5] as well as various empirical potentials can be found here.
  1. Structure layer
    All atomic geometry based algorithms, such as structure optimization, molecular dynamics, or phonon calculations are located in this layer.
  1. Add-on layer
    S/PHI/nX is a library. In order to perform and control calculations and to analyse the results, programs can be easily developed by combining several modules from the underlying class hierarchy. Besides the actual simulation program currently about 50 analysis tools are available. Thanks to the high abstraction level of the S/PHI/nX library each add-on requires only 50-150 code lines. This shows how the usage of our S/PHI/nX library simplifies development drastically.
Fig. 3: The application of our high level algebra library yields peak performance thanks to new programming techniques[8]

The layered structure provides an efficient programming interface with increasing abstraction level: (1) Algorithms in quantum mechanics are often expressed in terms of algebraic equations. On modern computer architectures highly optimized numeric libraries specialized in solving algebraic equations efficiently on the respective platform are available (BLAS/LAPACK/FFT). The S/PHI/nX algebra library provides an efficient cross-platform interface to various high performance numeric libraries. Fig. 3 shows performance results of the evaluation of an algebraic expression using (i) conventional Fortran90 (matmul based), (ii) a test code combining Fortran90 and BLAS/LAPACK calls as well as (iii) a test program based on the S/PHI/nX library. In S/PHI/nX there is no performance penalty due to higher abstraction or the intuitive interface. (2) In order to describe the microscopic scale a density functional theory (DFT) module has been developed on top of our algebra library. Depending on the system to be modeled different basis-sets are suited to express the Hamiltonian. Chemical bonding of molecules or biological systems is accomplished best by applying atomic or numerical orbitals while periodicity of semiconductors and metallic systems calls for applying pseudo potential plane-waves[4] (PS-PP) or projector augmented waves[5] (PAW). Ab-initio calculations are computationally very expensive which limits the number of atoms that can be treated. However, by applying the SC-DFTB Hamiltonian module or the module for empirical potentials the system size can be increased in trade for accuracy. State-of-the-art program packages are usually focusing on only a single basis-set or approach. In S/PHI/nX a new ansatz has been chosen to allow a basis-set free definition of the Hamiltonian, which allows the choice of the best fitting basis-set for the system under consideration. (3) The DFT layer of S/PHI/nX is connected to an atomic structure library, which is capable of performing structure optimization, molecular dynamics as well as transition state searches. This library provides access to dynamic matrices which are used, e.g., to determine thermodynamic potentials via the evaluation of phonons. Since the S/PHI/nX structure library is based on our algebra library high performance is guaranteed. In the top layers (2)-(4), the developer can focus on the actual quantum mechanical expressions and algorithms rather then computational issues. This approach speeds up the time for development dramatically.


The S/PHI/nX approach developed by us provides an excellent basis for a rapid development of computationally highly efficient multiscale algorithms.


[1] S. Boeck et al.,
[2] W. Kohn, L. Sham, Phys. Rev. 140 (1965) A1133
[3] M. Städele, M. Moukara, J.A. Majewski, P. Vogl, and A. Görling, Phys. Rev. B 59, (1999) 10031
[4] L. Kleinman, D. M. Bylander, Phys. Rev. Lett. 48 (1982) 1425
[5] P. E. Blöchl, Phys. Rev. B 50 (1994) 17953
[6] T. Frauenheim, Phys. stat. sol. B 217 (2000) 41
[7] M. Elstner, Phys. Rev. B 58 (1998) 7260