/* DFT++ is a density functional package developed by the research group of Professor Tomas Arias Copyright 1996-2003 Sohrab Ismail-Beigi This file is part of DFT++. DFT++ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. DFT++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with DFT++; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Please see the file CREDITS for a list of authors. For academic users, we request that publications using results obtained with this software reference "New algebraic formulation of density functional calculation," by Sohrab Ismail-Beigi and T.A. Arias, Computer Physics Communications 128:1-2, 1-45 (June 2000). and, if using the wavelet basis, further reference "Multiresolution analysis of electronic structure: semicardinal and wavelet bases," T.A. Arias, Reviews of Modern Physics 71:1, 267-311 (January 1999). and "Robust ab initio calculation of condensed matter: transparent convergence through semicardinal multiresolution analysis,'' I.P. Daykov, T.A. Arias, and Torkel D. Engeness, Physical Review Letters, 90:21, 216402 (May 2003). For your convenience, preprints of the above articles may be obtained from http://arXiv.org/abs/cond-mat/9909130, 9805262, and 0204411, respectively. */ /* * header.h * */ /* $Id: header.h,v 1.28.2.41 2003/05/29 18:54:27 ivan Exp $ */ #ifndef DFT_HEADER_H #define DFT_HEADER_H #include #include #include #include #include #ifdef _WIN32 // the function itself is defined in symm.cpp double rint(double x); #endif // HACK ALERT!!! // This variable stores the square magnitude of Ygrad globally, so that the // wavelet invL routing can access it. extern double global_abs2Yg; /*=======================================================================* * * * Forward declarations of classes in this file * * * *=======================================================================*/ class Output; // Generic class to allow text output to a file class System; // take cares of system init./finalize, and // parallelization information class vector; // vector of scalars, also used for FFT-box class diag_matrix; // mainly for filling matrix. class ComplexMatrix; // general purpose matrix. class scalar_column; // single column of scalars used to create column_bundle. class ColumnBundle; // stores wavefunctions class QuantumNumber; // a set of quantum numbers, eg kvec, spin etc class Control; // contains control information for the run. class Lattice; // Lattice information (vectors, reciprocal, etc.) class RealArray; class ComplexArray; class PW_BasisSpec; class PW_Basis; // G vector and realspace grid indices. // Wavelet stuff; class WL_BasisSpec; class WL_Basis; class Speciesinfo; // information for an ion species class Ioninfo; // collections of all Speciesinfos class Symmetries; // symmetry info class IonDyninfo; // Ionic dynamics information. class Elecinfo; // parameters for electronic states class Elecvars; // collection of electronic variables. class Energies; // collection of all energies. class Lattice_forces; // contains forces on the lattice vectors. class Everything; // A big collection of most of the above structures // used to make passing arguments easier /*=========================================================================* * * * Constant definition section * * * *=========================================================================*/ #ifndef M_PI #define M_PI 3.141592653589793238462643 #endif // Representation of the obejcts #define COEFFSPACE 0 #define REALSPACE 1 // Type of algorithms for electronic minimization #define DFT_EOM 1 #define DFT_PEOM 2 #define DFT_SD 3 #define DFT_PSD 4 #define DFT_CG 5 #define DFT_PCG 6 // linmin methods #define QUAD 1 #define LIN 2 // string constants #define DFT_LINE_LEN 2024 #define DFT_MSG_LEN 256 #define DFT_FILENAME_LEN 256 // logical constants #define TRUE 1 #define FALSE 0 // types of exchange correlation functionals #define DFT_EXCORR_LDA 0 #define DFT_EXCORR_GGA_PW91 1 #define DFT_EXCORR_LSD_TETER 2 #define DFT_EXCORR_GGA_PBE 3 #define DFT_EXCORR_SGA_PBE 4 /* Report levels for logging */ #define DFT_SILENCE 0 // don't log anything #define DFT_BASIC_LOG 1 // print the basics #define DFT_ANAL_LOG 2 // print lots and lots! #define DFT_NERD_LOG 3 // only if you're seriously interested... /* Short-hand for logging: we don't want to type that ugly * long string every time we want to log! */ #define dft_log System::global_log->printf #define dft_log_flush System::global_log->flush #define dft_global_log System::global_log /* program parameters. maybe put them into parameter.h ? */ #define MIN_ION_DISTANCE 1e-10 #define MIN_KPT_DISTANCE 1e-8 #define MIN_SYMM_TOL 1e-4 /* spin types */ enum SpinType {NOSPIN, ZSPIN, FREESPIN}; /* coord types */ enum CoordsType {LATTICE_COORDS, CARTESIAN_COORDS}; /* * There are several compiler flags that can be chosen: * * DFT_MPI * : Turn on MPI * * DFT_PROFILING * : Turn on some profiling timing and allocation counters. * * DFT_MEMALIGN * : Forces memory allocation to align on 32-byte-boundaries. * : This option is known to cause some memory-leak problems on Origin 2000 * * DFT_TRACE_MEM * : Turn on memory allocation traces. For memory debugging purpose. */ /*=======================================================================* * * * Definition of the scalar: either real of complex * * * *=======================================================================*/ typedef double real; /* Depending on whether our scalars are complex or real, include * one XOR the other of the lines below */ /* #define SCALAR_IS_REAL typedef real scalar; #include "complex.h" #define REAL(x) (x) #define IMAG(z) ((z).y) */ #define SCALAR_IS_COMPLEX #include "complex.h" typedef complex scalar; /* #define REAL(z) ((z).x) #define IMAG(z) ((z).y) */ // the size of scalar variables in multiples of sizeof(double) #ifdef SCALAR_IS_COMPLEX #define SCALAR_SIZE 2 #elif defined SCALAR_IS_REAL #define SCALAR_SIZE 1 #else #error Scalar is neither real nor complex! #endif // define two shorthand string compare macros: #define MATCH(a,b) (strcmp(a,b)==0) #define MATCHn(a,b,c) (strncmp(a,b,c)==0) #include "RealArray.h" #include "ComplexArray.h" /*-----------------------------------------------------------------------* * Output class: takes care of text output to a file * * (mainly used for logging). * *-----------------------------------------------------------------------*/ #include "Output.h" /*=======================================================================* * * * Include 3D vector and matrix classes and routines * * * *=======================================================================*/ #include "lin3.h" /*-----------------------------------------------------------------------* * Professor Arias file suite for IO class and operations * * it also defines the dft_text_FILE class * *-----------------------------------------------------------------------*/ #include "dft_text_FILE.h" /*-----------------------------------------------------------------------* * System class: takes care of parallelization information * *-----------------------------------------------------------------------*/ #include "System.h" /*-----------------------------------------------------------------------* * Control class: tells us what this run should do, and various * * parameters for the minimization, tolerances, etc. * *-----------------------------------------------------------------------*/ #include "Control.h" /*-----------------------------------------------------------------------* * mem.c: memory allocation routines and a general die() function * * that exits with a message. All memory allocations/deallocs * * should be done with these routines. * *-----------------------------------------------------------------------*/ #include "mem.h" /*-----------------------------------------------------------------------* * timer.c: provides timer functions for timing various operations * *-----------------------------------------------------------------------*/ #include "timer.h" /*-----------------------------------------------------------------------* * Lattice class: holds information about the lattice vectors * *-----------------------------------------------------------------------*/ #include "Lattice.h" /*-----------------------------------------------------------------------* * diag_matrix class: a diagonal matrix of scalar elements * *-----------------------------------------------------------------------*/ #include "diag_matrix.h" /*-----------------------------------------------------------------------* * matrix class: general purpose matrix whose elements are scalars * *-----------------------------------------------------------------------*/ #include "ComplexMatrix.h" ///////////////// BASIS DEPENDENT PART ///////////////////////// #ifdef PLANEWAVES #include "PW_Basis.h" #include "PW_Column.h" #include "PW_IonicPotential.h" #include "chooser.h" #include "PW_IJ.h" #include "PW_LO.h" #include "PW_Vlocpot.h" #include "PW_nlpot.h" #include "PW_precond.h" #include "PW_ener.h" #include "PW_symm.h" /*-----------------------------------------------------------------------* * ft.c: FFT3D routine (which calls FFTW package) * *-----------------------------------------------------------------------*/ #include "ft.h" /*-----------------------------------------------------------------------* * calcionicforces.c: self explanatory! * *-----------------------------------------------------------------------*/ #include "PW_ionicforces.h" #elif defined WAVELETS #include "WL_header.h" #include "WL_Basis.h" #include "WL_Column.h" #include "WL_IonicPotential.h" #include "chooser.h" #include "WL_IJ.h" #include "WL_LO.h" #include "WL_Vlocpot.h" #include "WL_nlpot.h" #include "WL_precond.h" #include "WL_ener.h" #include "WL_symm.h" /*-----------------------------------------------------------------------* * calcionicforces.c: self explanatory! * *-----------------------------------------------------------------------*/ #include "WL_ionicforces.h" #else #error "header: Must specify a basis!" #endif #include "IJLO.h" /*-----------------------------------------------------------------------* * column_bundle class: a collection of vectors composed of scalars * * each vector is a scalar_column class. * * used to store wave-functions * *-----------------------------------------------------------------------*/ #include "ColumnBundle.h" /*-----------------------------------------------------------------------* * dist_multiply.c: does various matrix multiplies for column_bundle * * classes * *-----------------------------------------------------------------------*/ #include "dist_multiply.h" /*-----------------------------------------------------------------------* * Speciesinfo class: contains information describing an ionic species * * and its pseudopoentials. Togther with Ioninfo * * defines the ions and pseudopotentials * *-----------------------------------------------------------------------*/ #include "Speciesinfo.h" /*-----------------------------------------------------------------------* * Ioninfo class: Master structure containing info on all ions * *-----------------------------------------------------------------------*/ #include "Ioninfo.h" /*-----------------------------------------------------------------------* * IonDyninfo class: extended Ioninfo class to include dynamics info * *-----------------------------------------------------------------------*/ // #include "IonDyninfo.h" /*-----------------------------------------------------------------------* * Elecinfo class: contains info for describing electronic states * *-----------------------------------------------------------------------*/ #include "Elecinfo.h" /*-----------------------------------------------------------------------* * Elecvars class: contains the electronic variables * *-----------------------------------------------------------------------*/ #include "Elecvars.h" /*-----------------------------------------------------------------------* * Energies class: contains all the energy terms for our system * *-----------------------------------------------------------------------*/ #include "Energies.h" /*-----------------------------------------------------------------------* * Symmetries class: symmetry information about the system * *-----------------------------------------------------------------------*/ #include "Symmetries.h" /*-----------------------------------------------------------------------* * Lattice_forces class: holds forces on lattice vectors * *-----------------------------------------------------------------------*/ #include "Lattice_forces.h" /*-----------------------------------------------------------------------* * PHLO.c: Implement operators: P, Hsp, L, O, Obar, etc. * *-----------------------------------------------------------------------*/ //#include "PHLO.h" /*-----------------------------------------------------------------------* * IJ.c: I, J, Idag, L, and O operators * *-----------------------------------------------------------------------*/ #include "IJLO.h" /*-----------------------------------------------------------------------* * PH.c: Hsc, Vsc, P, and Pbar operators * *-----------------------------------------------------------------------*/ #include "PH.h" /*-----------------------------------------------------------------------* * diaginnerouter.c: find charge density * *-----------------------------------------------------------------------*/ #include "diaginnerouter.h" /*-----------------------------------------------------------------------* * exc.c: exchange-correlation energy densities and deriv. versus n * *-----------------------------------------------------------------------*/ #include "exc.h" /*-----------------------------------------------------------------------* * ewald.c: Ewald energies and forces * *-----------------------------------------------------------------------*/ #include "ewald.h" /*-----------------------------------------------------------------------* * signals.c: signal handling (dead for MPI versions...???) * *-----------------------------------------------------------------------*/ // #include "signals.h" /*-----------------------------------------------------------------------* * dump.c: Dump the electronic variables with date/time stamps * *-----------------------------------------------------------------------*/ #include "dump.h" /*-----------------------------------------------------------------------* * calcUVCn.c: calc. U, C, and density n (and rot. matrix V) * *-----------------------------------------------------------------------*/ #include "calcUVCn.h" /*-----------------------------------------------------------------------* * poisson.c: solve Poisson equation * *-----------------------------------------------------------------------*/ #include "poisson.h" /*-----------------------------------------------------------------------* * calcener.c: calculates all the various energy terms in various * * combinations. * *-----------------------------------------------------------------------*/ #include "calcener.h" /*-----------------------------------------------------------------------* * calcelecgrad.c: calc. energy gradient versus elec. variables * *-----------------------------------------------------------------------*/ #include "calcelecgrad.h" /*-----------------------------------------------------------------------* * minimize.c: minimizes energy versus elec. vars (CG, PCG, PSD, etc.) * *-----------------------------------------------------------------------*/ #include "minimize.h" /*-----------------------------------------------------------------------* * rnd.c: defines a random number generator using the system rand() * * function. Also uses this rnd() to create gauss() * *-----------------------------------------------------------------------*/ #include "rnd.h" /*-----------------------------------------------------------------------* * calcionicforces.c: self explanatory! * *-----------------------------------------------------------------------*/ //#include "calcionicforces.h" /*-----------------------------------------------------------------------* * calclatforces.c: calculate forces on lattice vectors * *-----------------------------------------------------------------------*/ /* #include "calclatforces.h" */ /*-----------------------------------------------------------------------* * calcempties.c: calculates eigenenergies (and states) for empty bands * * via CG minimization * *-----------------------------------------------------------------------*/ // #include "calcempties.h" /*-----------------------------------------------------------------------* * fermifill.c: calc. Fermi-Dirac fillings (via FD distribution) * *-----------------------------------------------------------------------*/ #include "fermifill.h" /*-----------------------------------------------------------------------* * symm.c: calculates symmetries, fold and reduce k-points, and * * symmetrize charge density * *-----------------------------------------------------------------------*/ #include "symm.h" /*-----------------------------------------------------------------------* * dft_io.c: centralized i/o routines for our matrix, vector, and * * column_bundle classes that does serial and/or parallel * * i/o depending on the case. * *-----------------------------------------------------------------------*/ #include "dft_io.h" /*-----------------------------------------------------------------------* * matrix_mult.c: does all the actual matrix multiplications and the * * blockings to get good performance. This is the place * * to go for optimizing matrix multiplies. * *-----------------------------------------------------------------------*/ #include "matrix_mult.h" /*-----------------------------------------------------------------------* * dft_thread.h: routines that performing thread parallelization. * * Requires DFT_THREAD to be defined. * *-----------------------------------------------------------------------*/ #include "dft_thread.h" /*-----------------------------------------------------------------------* * Everything.h: define the Everything class, which is a collection * * of other classes, and is used to make passing * * arguments to functions easier * *-----------------------------------------------------------------------*/ #include "Everything.h" /*-----------------------------------------------------------------------* * parser.h: The parser reads the input file, checking for * * consistency, errors, and gets the information into * * the internal variables. * *-----------------------------------------------------------------------*/ #include "parser.h" /*-------------------------- dump_bands.c -----------------------------* * * * Dump the density band by band * * * *-----------------------------------------------------------------------*/ // #include "dump_bands.h" // #include "calcspinorbit.h" #include "finitediff.h" #endif // DFT_HEADER_H