**UFRJ**

# Quantum espresso

(Parte **2** de 7)

The QUANTUM ESPRESSO distribution is written, mostly, in Fortran-95, with some parts in C or in Fortran-7. Fortran-95 offers the possibility to introduce advanced programming techniques without sacrificing the performances. Moreover Fortran is still the language of choice for high-performance computing and it allows for easy integration of legacy codes written in this language. A single source tree is used for all architectures, with C preprocessor options selecting a small subset of architecture-dependent code. Parallelization is achieved using the Message-Passing paradigm and calls to standard MPI (Message Passing Interface) [30] libraries. Most calls are hidden in a few routines that act as an intermediate layer, accomplishing e.g. the tasks of summing a distributed quantity over processors, of collecting distributed arrays or distributing them across processors, and to perform parallel three-dimensional Fast Fourier Transforms (FFT). This allows to develop straightforwardly and transparently new modules and functionalities that preserve the efficient parallelization backbone of the codes.

2.1. QE-forge

The ambition of the QUANTUM ESPRESSO project is not limited to providing highly efficient and user-friendly software for large-scale electronic-structure calculations and materials modeling. QUANTUM ESPRESSO aims at promoting active cooperation between a vast and diverse community of scientists developing new methods and algorithms in electronic-structure theory and of end users interested in their application to the numerical simulation of materials and devices.

As mentioned, the main source of inspiration for the model we want to promote is the successful cooperative experience of the GNU/Linux developers’ and users’ community. One

QUANTUM ESPRESSO 7 of the main outcomes of this community has been the incorporation within the GNU/Linux operating system distributions of third-party software components, which, while being developed and maintained by autonomous, and often very small, groups of users, are put at the disposal of the entire community under the terms of the GPL. The community, in turn, provides positive feedback and extensive validation by benchmarking new developments, reporting bugs, and requesting new features. These developments have largely benefited from the SourceForge code repository and software development service [31], or by other similar services, such as RubyForge, Tigris.org, BountySource, BerliOS, JavaForge, and GNU Savannah.

Inspired by this model, the QUANTUM ESPRESSO developers’ and users’ community has set up its own web portal, named qe-forge [27]. The goal of qe-forge is to complement the traditional web sites of individual scientific software projects, which are passive instruments of information retrieval, with a dynamical space for active content creation and sharing. Its aim is to foster and simplify the coordination and integration of the programming efforts of heterogeneous groups and to ease the dissemination of the software tools thus obtained. qe-forge provides, through a user-friendly web interface, an integrated development environment, whereby researchers can freely upload, manage and maintain their own software, while retaining full control over it, including the right of not releasing it. The services so far available include source-code management software (CVS or SVN repository), mailing lists, public forums, bug tracking facilities, up/down-load space, and wiki pages for projects’ documentation. qe-forge is expected to be the main tool by which QUANTUM ESPRESSO end users and external contributors can maintain QUANTUM ESPRESSO- related projects and make them available to the community.

2.2. Educational usage of QUANTUM ESPRESSO

Training on advanced simulation techniques using the QUANTUM ESPRESSO distribution is regularly offered at SISSA to first-year graduate students within the electronic structure course. The scope of this course is not limited to the opportunities that modern simulation techniques based on electronic-structure theory offer to molecular and materials modeling. Emphasis is put onto the skills that are necessary to turn new ideas into new algorithms and onto the methods that are needed to validate the implementation and application of computer simulation methods. Based on this experience, the QUANTUM ESPRESSO developers’ group offers on a regular basis training courses to graduate students and young researchers worldwide, also in collaboration with the Abdus Salam International Centre for Theoretical Physics, which operates under the aegis of the UNESCO and IAEA agencies of the UNO.

The QUANTUM ESPRESSO distribution is used not only for graduate, but also for undergraduate training. At MIT, for example, it is one of the teaching tools in the class Introduction to Modeling and Simulations—an institute-wide course offered to undergraduates from the School of Science and the School of Engineering. The challenge here is to provide students of different backgrounds with an overview of numerical simulations

QUANTUM ESPRESSO 8 methods to study properties of real materials. For many undergraduates, this represents the first experience of computers used as scientific tools. To facilitate the access and use of QUANTUM ESPRESSO a user-friendly web interface has been developed at MIT, based on the GenePattern portal, that allows direct access to the code, thus removing the need to use a Unix/Linux environment or the details of the job queueing and submission procedure. The user utilizes a web browser (see Fig. 1) to build input files and view the outputs of simulations, and to perform calculations from wherever Internet access is available. The calculations run on dedicated computer clusters where the code has been previously installed and tested.

Using a web interface to easily access computational resources and share them among different users naturally points to the concept of cloud computing, and the previous model was tested at MIT in the Spring 2009, wholly based on a cluster of virtual machines on Amazon’s Elastic Compute Cloud (EC2) web service. Our experience shows that when compared to the cost of purchasing, maintaining and administering computer clusters, the use of web-based computational resources becomes a very appealing and affordable option. It is particularly suited for classroom instruction, where advanced computational performance is not required, and it allows for easy transferability of this resource across universities.

Figure 1. Snapshot of the web interface used for undergraduate teaching at MIT. The software has been developed at the MIT’s Office of Educational Innovation and Technology.

3. Short description of QUANTUM ESPRESSO

QUANTUM ESPRESSO implements a variety of methods and algorithms aimed at a chemically realistic modeling of materials from the nanoscale upwards, based on the solution

QUANTUM ESPRESSO 9 of the density-functional theory (DFT) [2, 3] problem, using a plane waves (PW) basis set and pseudopotentials (P) [32] to represent electron-ion interactions.

The codes are constructed around the use of periodic boundary conditions, which allows for a straightforward treatment of infinite crystalline systems, and an efficient convergence to the thermodynamic limit for aperiodic but extended systems, such as liquids or amorphous materials. Finite systems are also treated using supercells; if required, open-boundary conditions can be used through the use of the density-countercharge method [3]. QUANTUM ESPRESSO can thus be used for any crystal structure or supercell, and for metals as well as for insulators. The atomic cores can be described by separable [34] norm-conserving (NC) PPs [35], ultra-soft (US) PPs [36], or by projector-augmented wave (PAW) sets [37]. Many different exchange-correlation functionals are available in the framework of the local-density (LDA) or generalized-gradient approximation (GGA) [38], plus advanced functionals like Hubbard U corrections and few meta-GGA [39] and hybrid functionals [40, 41, 42]. The latter is an area of very active development, and more details on the implementation of hybrid functionals and related Fock-exchange techniques are given in Appendix A.5. The basic computations/simulations that can be performed include:

• calculation of the Kohn-Sham (KS) orbitals and energies [43] for isolated or extended/periodic systems, and of their ground-state energies;

• complete structural optimizations of the microscopic (atomic coordinates) and macroscopic (unit cell) degrees of freedom, using Hellmann-Feynman forces [4, 45] and stresses [46];

• ground states for magnetic or spin-polarized system, including spin-orbit coupling [47] and non-collinear magnetism [48, 49];

• ab initio molecular dynamics (MD), using either the Car-Parrinello Lagrangian [50] or the Hellmann-Feynman forces calculated on the Born-Oppenheimer (BO) surface [51], in a variety of thermodynamical ensembles, including NPT variable-cell [52, 53] MD;

• density-functional perturbation theory (DFPT) [54, 5, 56], to calculate second and third derivatives of the total energy at any arbitrary wavelength, providing phonon dispersions, electron-phonon and phonon-phonon interactions, and static response functions (dielectric tensors, Born effective charges, IR spectra, Raman tensors);

• location of saddle points and transition states via transition-path optimization using the nudged elastic band (NEB) method [57, 58, 59];

• ballistic conductance within the Landauer-Büttiker theory using the scattering approach [60];

• generation of maximally localized Wannier functions [61, 62] and related quantities;

• calculation of nuclear magnetic resonance (NMR) and electronic paramagnetic resonance (EPR) parameters [63, 64];

• calculation of K-edge X-ray absorption spectra [65].

Other more advanced or specialized capabilities are described in the next sections, while ongoing projects (e.g. time-dependent DFT and many-body perturbation theory) are

QUANTUM ESPRESSO 10 mentioned in the last section. Selected applications were described in Ref [6]. Several utilities for data post-processing and interfacing to advanced graphic applications are available, allowing e.g. to calculate scanning tunneling microscopy (STM) images [67], the electron localization function (ELF) [68], Löwdin charges [69], the density of states (DOS), and planar [70] or spherical averages of the charge and spin densities and potentials.

3.1. Data file format

The interoperability of different software components within a complex project such as QUANTUM ESPRESSO relies on the careful design of file formats for data exchange. A rational and open approach to data file formats is also essential for interfacing applications within QUANTUM ESPRESSO with third-party applications, and more generally to make the results of lengthy and expensive computer simulations accessible to, and reproducible by, the scientific community at large. The need for data file formats that make data exchange easier than it is now is starting to be widely appreciated in the electronic-structure community. This problem has many aspects and likely no simple, "one-size-fits-all", solution. Data files should ideally be

• extensible: one should be able to add some more information to a file without breaking all codes that read that file;

• self-documenting: it should be possible to understand the contents of a file without too much effort;

• efficient: with data size in the order of GBytes for large-scale calculations, slow or wasteful I/O should be avoided.

The current trend in the electronic-structure community seems to be the adoption of one of the following approaches:

• Structured file formats, notably Hierarchical Data Format (HDF) [71] and network

Common Data Form (netCDF) [72], that have been widely used for years in other communities;

• file formats based on the Extensible Markup Language (XML) [73].

It is unlikely that a common, standardized data format will ever prevail in our community. We feel that we should focus, rather than on standardization, on an approach that allows an easy design and usage of simple and reliable converters among different data formats. Prompted by these considerations, QUANTUM ESPRESSO developers have opted for a simple solution that tries to combine the advantages of both the above-mentioned approaches. A single file containing all the data of a simulation is replaced by a data directory, containing several files and subdirectories, much in the same way as it is done in the Mac OS X operating system. The “head” file contains data written with ordinary Fortran formatted I/O, identified by XML tags. Only data of small size, such as atomic positions, parameters used in the calculation, oneelectron and total energies, are written in the head file. Data of potentially large size, such as PW coefficients of KS orbitals, charge density, and potentials, are present as links to separate

QUANTUM ESPRESSO 1 files, written using unformatted Fortran I/O. Data for each k-point are written to a separate subdirectory. A lightweight library called iotk, standing for Input/Output ToolKit [74], is used to read and write the data directory.

Another problem affecting interoperability of PW-P codes is the availability of data files containing atomic P’s—one of the basic ingredients of the calculation. There are many different types of P’s, many different codes generating P’s (see e.g. Ref [75, 76, 7]), each one with its own format. Again, the choice has fallen on a simple solution that makes it easy to write converters from and to the format used by QUANTUM ESPRESSO. Each atomic P is contained in a formatted file (efficiency is not an issue here), described by a XML-like syntax. The resulting format has been named Unified Pseudopotential File (UPF). Several converters from other formats to the UPF format are available in QUANTUM ESPRESSO.

4. QUANTUM ESPRESSO packages

The complete QUANTUM ESPRESSO distribution is rather large. The current 4.1 version includes about 310,0 lines of Fortran-90 code, 1,0 lines of Fortran-7 code, 1,0 lines of C code, 2000 lines of Tcl code, plus parts of external libraries such as FFTW, BLAS, LAPACK and the external toolkit iotk. In addition, there are approx. 10,0 lines of specific documentation (not counting different formats), more than 100 different examples and more than 100 tests of the different functionalities. Overall the complete distribution includes more than 3000 files, organized into 200 directories, and takes 22Mb in compressed format.

With such a sizable code basis, modularization becomes necessary. QUANTUM

ESPRESSO is presently divided into several executables, performing different types of calculations, although some of them have overlapping functionalities. Typically there is a single set of functions/subroutines or a single Fortran 90 module that performs each specific task (e.g. matrix diagonalizations, or potential updates), but there are still important exceptions to this rule, reflecting the different origin and different styles of the original components. QUANTUM ESPRESSO has in fact been built out of the merge and reengineering of different packages, that were independently developed for several years. In the following, the main components are briefly described.

(Parte **2** de 7)