Commit e15587dc authored by Markus Betzinger's avatar Markus Betzinger Committed by Ingo Meyer
Browse files

Initial release of FLEUR v0.27

Based on v0.26 hybrid branch
parent af9fa5b2
cmake_minimum_required(VERSION 2.8)
project(FLEUR LANGUAGES NONE)
include("cmake/Architectures.txt")
include("cmake/ReportConfig.txt")
#Here the targets and the files are defined
include("cmake/Files_and_Targets.txt")
#install(TARGETS fleur inpgen DESTINATION bin)
install(PROGRAMS ${CMAKE_BINARY_DIR}/fleur
CONFIGURATIONS Debug
DESTINATION bin
RENAME fleur_dbg)
Currently, there are no releases or stable commits. Please checkout the development branch by running:
Welcome to the source code of FLEUR
git checkout -t origin/develop
Outline:
1. Short Overview of the code
2. Installation
----------------------------------------------
1. Overview of the code
----------------------------------------------
The source of FLEUR is organized in several
subdirectories. Some of them collect code
specific for particular features, others code
relevant for crutial steps in the code or simply
code that is usually executed together.
Here a short description of the directories:
main: contains the main-program and several core subroutines
init: stuff for the initialization (called from fleur_init in main)
vgen: potential generation (called from vgen in main)
eigen: setup of the eigenproblem
diagonalization: various methods to diagonalize the Hamiltonian
cdn: general code for the generation of charge
cdn_mt: charge generation in MT-spheres
force: code related to the evaluation of forces
mix: charge/potential mixing routines
ldau: routines needed in case of LDA+U calculations
inpgen: code for the input generator (seperate executable inpgen)
fermi: determination of the fermi-level
eigen_secvar: second variational solution of the Hamiltonian
eigen_soc: Spin-orbit related code
core: Core states
dos: Code for Density of states, bandstructures
orbdep: Code for quantities depending on orbitals
optional: code that is used in special cases like inital charge generation
wannier: wannier related code
xc-pot: various exchange-correlation potential routines
mpi: code for parallel execution
io: subroutines doing IO
juDFT: timing, error handling, etc
math: code providing math functionality
include: c-type include files
global: code used everywhere (here you find types.F90 with the data-types)
cmake: definitions used by cmake (see Installation)
----------------------------------------------
2. Installation
----------------------------------------------
For the compilation of FLEUR you will need:
- Fortran compiler (should support Fortran2003)
- Compatible C compiler for the XML-IO
- cmake for controlling the make-process
- Libraries:
* LAPACK/BLAS
* MPI for parallelization
* SCALAPACK or ELPA or ELEMENTAL if you want to use parallel diagonalization
(without you can only exploit k-point parallelism)
* HDF5 for parallel IO (if you have lots of memory, you might not need to do IO :-)
You should probably create a directory structure like this:
somewhere/src -this is where the source code lives, i.e. the location of this README
somewhere/build -here you can build the code
change to the build directory and type:
cmake ../src
make
This might generate the FLEUR executables. If you get errors, you have to adjust cmake
so that your build system is correctly set-up. To do so, please adjust cmake.config. You might
find inspiration in the cmake.???.config files provided for several systems.
If your build environment is recognized correctly you can obtain the following executables:
inpgen - the input generator of FLEUR
fleur - general version of FLEUR
fleur_INVS - version of FLEUR suitable for systems with inversion symmetry leading to real matrices
fleur_SOC - version of FLEUR with spin-orbit coupling
All codes might also have a _MPI attached to indicate parallel versions.
\ No newline at end of file
List of BUGS/ things not tested or implemented:
-omp bug in vmtxc oder xcall
-MPI version not compiling
-DOS IO missing
-Wannier part
-Hybrid functionals
-vdW
-one-dimensional code
set(fleur_F77 ${fleur_F77}
cdn/diflgr.f
cdn/od_chirot.f
cdn/rcerf.f
cdn/rot_den_mat.f
)
set(fleur_F90 ${fleur_F90}
cdn/cdnovlp.F90
cdn/cdntot.f90
cdn/cdnval.F90
cdn/eparas.f90
cdn/int_21.f90
cdn/int_21lo.f90
cdn/m_perp.f90
cdn/n_mat.f90
cdn/od_abvac.f90
cdn/prp_qfft_map.f90
cdn/pwden.F90
cdn/pwint.f90
cdn/pwint_sl.f90
cdn/q_int_sl.F90
cdn/q_mt_sl.f90
cdn/qal_21.f90
cdn/qpw_to_nmt.f90
cdn/slab_dim.f90
cdn/slabgeom.f90
cdn/vacden.F90
)
MODULE m_cdnovlp
USE m_juDFT
CONTAINS
SUBROUTINE cdnovlp(mpi,&
& sphhar,stars,atoms,sym,&
& DIMENSION,vacuum,cell,&
& input,oneD,&
& jspin,rh,&
& qpw,rhtxy,rho,rht)
!*****************************************************************
! calculates the overlapping core tail density and adds
! its contribution to the corresponging components of
! valence density.
!
! OLD VERSION:
! The previous version to calculate the overlap of the
! core tails was done in real space:
! A three dimensional real space grid was set up. On each
! of these grid points the charge density of all atoms inside
! the unit cell and neigboring unit cells was calculated.
! This calculation required a lagrange fit since the core
! charge is on a radial mesh. The same was done in the vacuum
! region, except on each z-plane we worked on a two dimension
! grid. After the charge density was generated on a equidistant
! grid the charge density was FFTed into G-space. The set up
! of the charge density on the real space grid is rather time
! consuming. 3-loops are required for the 3D grid
! 1-loop over all atoms in the unit cells
! Larange interpolation
! 3D and 2D FFTs
! In order to save time the non-spherical contributions inside
! the sphere had been ignored. It turns out that the later
! approximation is pure in the context of force calculations.
!
! PRESENT VERSION:
! The present version is written from scratch. It is based on the
! idea that the FFT of an overlap of spherically symmetric
! charges can be expressed by the product of
!
! sum_natype{ F(G,ntype) * sum_atom(atype) {S(\vec{G},atom)}}
!
! of form factor F and structure factor S. The Form factor
! depends only G while the structure factor depends on \vec{G}
! and can build up in G-space. F of a gaussian chargedensity can
! be calculated analytically.
! The core-tails to the vacuum region are described by an
! exponentially decaying function into the vacuum:
! rho(r_||,z,ivac)= sum_n{ rho(n,ivac) * exp(-kappa*(z-z_v))
! * exp(iG(n)r_||) }
! And the plane waves are expanded into lattice harmonics
! up to a l_cutoff. Tests of the accuracy inside the sphere
! have shown that a reduction of the l_cutoff inside the
! in order to save time leads to sizable errors and should
! be omitted.
! rho_L(r) = 4 \pi i^l \sum_{g =|= 0} \rho_int(g) r_i^{2} \times
! j_{l} (gr_i) \exp{ig\xi_i} Y^*_{lm} (g)
! Tests have shown that the present version is about 10 times
! faster than the previous one also all nonspherical terms are
! included up to l=8 and the previous one included only l=0.
! For l=16 it is still faster by factor 2.
! coded Stefan Bl"ugel, IFF Nov. 1997
! tested RObert Abt , IFF Dez. 1997
!*****************************************************************
!
USE m_intgr, ONLY : intgr3,intgz0
USE m_constants
USE m_spgrot
USE m_qpwtonmt
USE m_cylbes
USE m_dcylbs
USE m_rcerf
USE m_od_cylbes
USE m_od_chirot
USE m_diflgr
USE m_types
#ifdef CPP_MPI
USE m_mpi_bc_st
#endif
IMPLICIT NONE
!
! .. Parameters ..
TYPE(t_mpi),INTENT(IN) :: mpi
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_dimension),INTENT(IN)::DIMENSION
TYPE(t_vacuum),INTENT(in):: vacuum
TYPE(t_input),INTENT(in)::input
INTEGER method1, method2
PARAMETER (method1 = 2, method2 = 1)
! ..
! .. Scalar Arguments ..
INTEGER,INTENT (IN) :: jspin
! ..
! .. Array Arguments ..
COMPLEX,INTENT (INOUT) :: qpw(stars%n3d,DIMENSION%jspd)
COMPLEX,INTENT (INOUT) :: rhtxy(vacuum%nmzxyd,oneD%odi%n2d-1,2,DIMENSION%jspd)
REAL, INTENT (INOUT) :: rho(atoms%jmtd,0:sphhar%nlhd,atoms%ntypd,DIMENSION%jspd)
REAL, INTENT (INOUT) :: rht(vacuum%nmzd,2,DIMENSION%jspd)
REAL, INTENT (INOUT) :: rh(DIMENSION%msh,atoms%ntypd)
! ..
! .. Local Scalars ..
COMPLEX czero,sf,carg,VALUE,slope,ci
REAL ai,ar,a4,dif,dxx,f11,f12,g,gr,gz,qfin,qfout,dtildh,&
& rkappa,sign,signz,tol_14,x,z,zero,zvac,alpha3,&
& g2,phi,gamma,qq
INTEGER ig3,imz,ir,ivac,j,j1,k,kz,k1,k2,l_cutoff,m0,&
& n,nz,nrz,nat1,nat2,nzvac,n_out_p,nat,&
& irec2,irec3,irec1,m,gzi
LOGICAL tail
! ..
! .. Local Arrays ..
COMPLEX, ALLOCATABLE :: qpwc(:)
REAL, ALLOCATABLE :: qf(:)
REAL acoff(atoms%ntypd),alpha(atoms%ntypd),rho_out(2)
COMPLEX phas(sym%nop)
REAL rhohelp(DIMENSION%msh),rat(DIMENSION%msh,atoms%ntypd)
INTEGER kr(3,sym%nop),mshc(atoms%ntypd)
REAL kro(3,oneD%ods%nop),fJ(-oneD%odi%M:oneD%odi%M),dfJ(-oneD%odi%M:oneD%odi%M)
COMPLEX phaso(oneD%ods%nop)
! ..
DATA czero /(0.0,0.0)/, zero /0.0/, tol_14 /1.0e-10/!-14
!
!----> Abbreviation
!
! l_cutoff : cuts off the l-expansion of the nonspherical charge
! density due to the core-tails of neigboring atoms
! mshc : maximal radial meshpoint for which the radial coretail
! density is larger than tol_14
! method1 : two different ways to calculate the derivative of the
! charge density at the sphere boundary.
! (1) use subroutine diflgr based on lagrange interpol.
! (2) use two point formular in real space,
! see notes of SB.
! Tests have shown that (2) is more accurate.
! method2 : two different integration routines to calculate form
! factor of coretails outside the sphere.
! (1) use subroutine intgrz to integrate the tails from
! outside to inside.
! (2) use subroutine intgr3 to integrate the tails from
! muffin-tin radius to outside and include correction
! for start up.
! Tests have shown that (1) is more accurate.
!
!
ci = CMPLX(0.0,1.0)
ALLOCATE (qpwc(stars%n3d),qf(stars%n3d))
IF (mpi%irank ==0) THEN
!
!----> prepare local array to store pw-expansion of pseudo core charge
!
DO k = 1 , stars%ng3
qpwc(k) = czero
ENDDO
!
!----> (1) set up radial mesh beyond muffin-tin radius
! (2) cut_off core tails from noise
!
nloop: DO n = 1 , atoms%ntype
IF (atoms%ncst(n).GT.0) THEN
DO j = 1 , atoms%jri(n)
rat(j,n) = atoms%rmsh(j,n)
ENDDO
dxx = EXP(atoms%dx(n))
DO j = atoms%jri(n) + 1 , DIMENSION%msh
rat(j,n) = rat(j-1,n)*dxx
ENDDO
DO j = atoms%jri(n) - 1 , DIMENSION%msh
rh(j,n) = rh(j,n)/ (fpi_const*rat(j,n)*rat(j,n))
ENDDO
DO j = DIMENSION%msh , atoms%jri(n) , -1
IF ( rh(j,n) .GT. tol_14 ) THEN
mshc(n) = j
CYCLE nloop
END IF
ENDDO
mshc(n) = atoms%jri(n)
ENDIF
ENDDO nloop
!
!-----> the core density inside the spheres is replaced by a
! gaussian-like pseudo density : n(r) = acoff*exp(-alpha*r*r)
! acoff and alpha determined to obtain a continous and
! differentiable density at the sphere boundary.
! IF mshc = jri either core tail too small or no core (i.e. H)
!
DO n = 1,atoms%ntype
IF ((mshc(n).GT.atoms%jri(n)).AND.(atoms%ncst(n).GT.0)) THEN
j1 = atoms%jri(n) - 1
IF ( method1 .EQ. 1) THEN
dif = diflgr(rat(j1,n),rh(j1,n))
WRITE (6,FMT=8000) n,rh(atoms%jri(n),n),dif
alpha(n) = -0.5 * dif / ( rh(atoms%jri(n),n)*atoms%rmt(n) )
ELSEIF ( method1 .EQ. 2) THEN
alpha(n) = LOG( rh(j1,n) / rh(atoms%jri(n),n) )
alpha(n) = alpha(n)&
& / ( atoms%rmt(n)*atoms%rmt(n)*( 1.0-EXP( -2.0*atoms%dx(n) ) ) )
ELSE
WRITE (6,'('' error in choice of method1 in cdnovlp '')')
CALL juDFT_error("error in choice of method1 in cdnovlp"&
& ,calledby ="cdnovlp")
ENDIF
acoff(n) = rh(atoms%jri(n),n) * EXP( alpha(n)*atoms%rmt(n)*atoms%rmt(n) )
WRITE (6,FMT=8010) alpha(n),acoff(n)
DO j = 1,atoms%jri(n) - 1
rh(j,n) = acoff(n) * EXP( -alpha(n)*rat(j,n)**2 )
ENDDO
ELSE
alpha(n) = 0.0
ENDIF
ENDDO
!
8000 FORMAT (/,10x,'core density and its first derivative ',&
& 'at sph. bound. for atom type',&
& i2,' is',3x,2e15.7)
8010 FORMAT (/,10x,'alpha=',f10.5,5x,'acoff=',f10.5)
!
!=====> calculate the fourier transform of the core-pseudocharge
!
! qpw(\vec{G}) = Sum_{n} [ F(G,n) * Sum_{atm{n}} S(\vec{G},atm) ]
! n = atom_type
! F = Formfactor = F_in_sphere + F_outsphere
! S = Structure factor
!
tail = .FALSE.
!
!*****> start loop over the atom type
!
nat1 = 1
DO n = 1,atoms%ntype
IF ( ( mshc(n) .GT. atoms%jri(n) ).AND.&
& ( alpha(n) .GT. tol_14 ) ) THEN
!
n_out_p = mshc(n)-atoms%jri(n)+1
!
! (1) Form factor for each atom type
!
f11 = tpi_const * atoms%rmt(n) * rh(atoms%jri(n),n) / alpha(n)
f12 = acoff(n) * ( pi_const/alpha(n) ) *SQRT(pi_const/alpha(n))
ar = SQRT( alpha(n) ) * atoms%rmt(n)
!
DO k = 1,stars%ng3
g = stars%sk3(k)
! first G=0
IF ( k.EQ.1 ) THEN
ai = zero
!
! ----> calculate form factor inside the mt-sphere
! (use analytic integration of gaussian)
!
qfin = - f11 + f12 * rcerf(ar,ai)
!
! ----> calculate form factor outside the mt-sphere
! (do numerical integration of tails)
!
IF ( method2 .EQ. 1) THEN
DO ir = 1 , n_out_p
j = atoms%jri(n)+ir-1
rhohelp(mshc(n)+1-j) = rat(j,n) * rat(j,n) &
& * rat(j,n) * rh(j,n)
END DO
CALL intgz0(rhohelp,atoms%dx(n),n_out_p,qfout,tail)
ELSE
DO ir = 1 , n_out_p
j = atoms%jri(n)+ir-1
rhohelp(ir) = rat(j,n) * rat(j,n) * rh(j,n)
END DO
CALL intgr3(rhohelp,rat(atoms%jri(n),n),atoms%dx(n),&
& n_out_p,qfout)
!---> have to remove the small r-correction from intgr3
qfout=qfout-atoms%rmt(n)*rhohelp(1)
END IF
qfout = fpi_const * qfout
!
ELSE
! then G>0
ai = 0.5*g/SQRT(alpha(n))
gr = g*atoms%rmt(n)
a4 = 0.25/alpha(n)
!
! ----> calculate form factor inside the mt-sphere
! (use analytic integration of gaussian)
!
qfin = - f11 * SIN(gr)/gr &
& + f12 * rcerf(ar,ai) * EXP(-a4*g*g)
!
! ----> calculate form factor outside the mt-sphere
! (do numerical integration of tails)
IF ( method2 .EQ. 1) THEN
DO ir = 1 , n_out_p
j = atoms%jri(n)+ir-1
rhohelp(mshc(n)-atoms%jri(n)+2-ir) = rat(j,n)*rat(j,n) &
& * rh(j,n) * SIN( g*rat(j,n) )
END DO
!
!---> note we use here the integration routine for vacuum. Because
! the vacuum integration is made for an inwards integration
! from outside to inside. Outside the starting value will be
! nearly zero since the core density is small. if the tail
! correction (tail=.true.) is included for the integrals, the
! integrand is from infinity inward. This might not be
! necessary. Further the integration routine is made for
! equidistant meshpoints, therefore the term r(i) of
! dr/di = dx*r(i) is included in rhohelp
CALL intgz0(rhohelp,atoms%dx(n),n_out_p,qfout,tail)
ELSE
DO ir = 1 , n_out_p
j = atoms%jri(n)+ir-1
rhohelp(ir) = rat(j,n) * rh(j,n) * SIN(g*rat(j,n))
END DO
CALL intgr3(rhohelp,rat(atoms%jri(n),n),atoms%dx(n),&
& n_out_p,qfout)
!---> have to remove the small r-correction from intgr3
!roa...correction.from.intgr3.......................
IF (rhohelp(1)*rhohelp(2).GT.zero) THEN
alpha3 = 1.0 + LOG(rhohelp(2)/rhohelp(1))/atoms%dx(n)
IF (alpha3.GT.zero)&
& qfout = qfout - rat(atoms%jri(n),n)*rhohelp(1)/alpha3
ENDIF
!roa...end.correction...............................
END IF
qfout = fpi_const * qfout / g
!
END IF
!
qf(k) = (qfin + qfout)/cell%omtil
ENDDO
!
! (2) structure constant for each atom of atom type
!
!
! first G=0
!
k=1
qpw(k,jspin) = qpw(k,jspin) + atoms%neq(n) * qf(k)
qpwc(k) = qpwc(k) + atoms%neq(n) * qf(k)
!
! then G>0
!
DO k = 2,stars%ng3
IF (.NOT.oneD%odi%d1) THEN
CALL spgrot(&
& sym%nop,sym%symor,sym%mrot,sym%tau,sym%invtab,&
& stars%kv3(:,k),&
& kr,phas)
!
! ----> start loop over equivalent atoms
!
nat2 = nat1 + atoms%neq(n) - 1
DO nat = nat1,nat2
sf = czero
DO j = 1,sym%nop
x = -tpi_const* ( kr(1,j) * atoms%taual(1,nat)&
& + kr(2,j) * atoms%taual(2,nat)&
& + kr(3,j) * atoms%taual(3,nat))
sf = sf + CMPLX(COS(x),SIN(x))*phas(j)
ENDDO
sf = sf / REAL( sym%nop )
qpw(k,jspin) = qpw(k,jspin) + sf * qf(k)
qpwc(k) = qpwc(k) + sf * qf(k)
ENDDO
ELSE
!-odim
CALL od_chirot(oneD%odi,oneD%ods,cell%bmat,stars%kv3(:,k),kro,phaso)
nat2 = nat1 + atoms%neq(n) - 1
DO nat = nat1,nat2
! sf = cmplx(1.,0.)
sf = czero
DO j = 1,oneD%ods%nop
x = -tpi_const* ( kro(1,j)*atoms%taual(1,nat)&
& + kro(2,j)*atoms%taual(2,nat)&
& + kro(3,j)*atoms%taual(3,nat))
sf = sf + CMPLX(COS(x),SIN(x))*phaso(j)
ENDDO
sf = sf / REAL( oneD%ods%nop )
qpw(k,jspin) = qpw(k,jspin) + sf * qf(k)
qpwc(k) = qpwc(k) + sf * qf(k)
ENDDO
!+odim
END IF
ENDDO
END IF
nat1 = nat1 + atoms%neq(n)
ENDDO
!
!=====> calculate core-tails to the vacuum region
! Coretails expanded in exponentially decaying functions.
! Describe vacuum by:
! rho(r_||,z,ivac)= sum_n{ rho(n,ivac) * exp(-kappa*(z-z_v))
! * exp(iG(n)r_||) }
IF (input%film .AND. .NOT.oneD%odi%d1) THEN
!+gu
dtildh = 0.5 * tpi_const / cell%bmat(3,3)
IF (vacuum%nvac.EQ.1) THEN
rho_out(1) = qpwc(1)*cell%z1
DO k = 2,stars%ng3
IF ((stars%kv3(1,k).EQ.0).AND.(stars%kv3(2,k).EQ.0)) THEN
nz = 1
IF (sym%invs.OR.sym%zrfs) nz = 2
g = stars%kv3(3,k) * cell%bmat(3,3)
rho_out(1) = rho_out(1) + nz*qpwc(k)*SIN(g*cell%z1)/g
ENDIF
ENDDO
rho_out(1) = qpwc(1) * dtildh - rho_out(1)
ELSE
DO ivac = 1, vacuum%nvac
carg = CMPLX(0.0,0.0)
DO k = 2,stars%ng3
IF ((stars%kv3(1,k).EQ.0).AND.(stars%kv3(2,k).EQ.0)) THEN
g = stars%kv3(3,k) * cell%bmat(3,3) * (3. - 2.*ivac)
carg = carg -qpwc(k)*(EXP(ci*g*dtildh)-EXP(ci*g*cell%z1))/g
ENDIF
ENDDO
rho_out(ivac) = qpwc(1) * ( dtildh-cell%z1 ) - AIMAG(carg)
ENDDO
ENDIF
!-gu
! nzvac = min(50,nmz)
m0 = -stars%mx3
IF (sym%zrfs) m0 = 0
!
!---> loop over 2D stars
!
DO 280 k = 1,stars%ng2