Commit 597e7658 authored by Daniel Wortmann's avatar Daniel Wortmann

Finished merge

parent a8cdfbb1
build-gfortran:
image: ubuntu:16.10
stage: build
cache:
paths:
- build
script:
- apt-get update -qq && apt-get install -y -qq build-essential gfortran gfortran-6 g++-6 gcc-6 binutils-gold git cmake libxml2-dev liblapack-dev libblas-dev doxygen
- cd /builds/fleur/fleur; ./configure.sh AUTO; cd build; make
test-gfortran:
image: ubuntu:16.10
stage: test
cache:
paths:
- build
script:
- apt-get update -qq && apt-get install -y -qq build-essential gfortran gfortran-6 g++-6 gcc-6 binutils-gold git cmake libxml2-dev liblapack-dev libblas-dev doxygen
- ulimit -s unlimited ;cd /builds/fleur/fleur/build;ctest
#build-pgi:
# image: hopobcn/pgi-ce
# stage: build
# cache:
# paths:
# - build.debug
# script:
# - apt-get update -qq && apt-get install -y -qq cmake libxml2-dev
# - cd /builds/fleur/fleur; ./configure.sh AUTO debug; cd build.debug; make
#test-pgi:
# image: hopobcn/pgi-ce
# stage: test
# cache:
# paths:
# - build.debug
# script:
# - apt-get update -qq && apt-get install -y -qq cmake libxml2-dev
# - cd /builds/fleur/fleur/build.debug;ctest
......@@ -3,7 +3,7 @@ MODULE m_cdnval
CONTAINS
SUBROUTINE cdnval(eig_id, mpi,kpts,jspin,sliceplot,noco, input,banddos,cell,atoms,enpara,stars,&
vacuum,dimension, sphhar, sym,obsolete, igq_fft,vr, vz, oneD, n_mmp,results, qpw,rhtxy,&
rho,rht,cdom,cdomvz,cdomvxy,qa21, chmom,clmom)
rho,rht,cdom,cdomvz,cdomvxy,qvac,qvlay,qa21, chmom,clmom)
!
! ***********************************************************
! this subroutin is a modified version of cdnval.F.
......@@ -123,6 +123,8 @@ CONTAINS
REAL, INTENT (OUT) :: chmom(atoms%ntype,dimension%jspd),clmom(3,atoms%ntype,dimension%jspd)
REAL, INTENT (INOUT) :: rho(atoms%jmtd,0:sphhar%nlhd,atoms%ntype,dimension%jspd)
REAL, INTENT (INOUT) :: rht(vacuum%nmzd,2,dimension%jspd)
REAL, INTENT (INOUT) :: qvac(dimension%neigd,2,kpts%nkpt,dimension%jspd)
REAL, INTENT (INOUT) :: qvlay(dimension%neigd,vacuum%layerd,2,kpts%nkpt,dimension%jspd)
COMPLEX, INTENT(INOUT) :: n_mmp(-3:3,-3:3,atoms%n_u)
#ifdef CPP_MPI
......@@ -158,7 +160,7 @@ CONTAINS
REAL, ALLOCATABLE :: volintsl(:)
REAL, ALLOCATABLE :: qintsl(:,:),qmtsl(:,:)
REAL, ALLOCATABLE :: orbcomp(:,:,:),qmtp(:,:)
REAL, ALLOCATABLE :: qis(:,:,:),qvac(:,:,:,:),qvlay(:,:,:,:,:)
REAL, ALLOCATABLE :: qis(:,:,:)
!-new_sl
!-dw
INTEGER, ALLOCATABLE :: gvac1d(:),gvac2d(:) ,kveclo(:)
......@@ -349,10 +351,7 @@ CONTAINS
aclo(:,:,:) = 0.0 ; bclo(:,:,:) = 0.0 ; ccnmt(:,:,:,:,:) = 0.0
acnmt(:,:,:,:,:)=0.0 ; bcnmt(:,:,:,:,:)=0.0 ; cclo(:,:,:,:)=0.0
ALLOCATE ( qis(dimension%neigd,kpts%nkpt,dimension%jspd), &
qvac(dimension%neigd,2,kpts%nkpt,dimension%jspd), &
qvlay(dimension%neigd,vacuum%layerd,2,kpts%nkpt,dimension%jspd) )
qvac(:,:,:,:)=0.0 ; qvlay(:,:,:,:,:)=0.0
ALLOCATE ( qis(dimension%neigd,kpts%nkpt,dimension%jspd))
skip_tt = dot_product(enpara%skiplo(:atoms%ntype,jspin),atoms%neq(:atoms%ntype))
IF (noco%l_soc.OR.noco%l_noco) skip_tt = 2 * skip_tt
......@@ -919,6 +918,7 @@ CONTAINS
ener(0,1,ispin),sqal(0,1,ispin),&
enerlo(1,1,ispin),&
sqlo(1,1,ispin))
CALL w_enpara(&
atoms,jspin,input%film,&
enpara,16)
......
......@@ -78,6 +78,7 @@ CONTAINS
USE m_rfft
USE m_cfft
USE m_types
USE m_fft_interface
IMPLICIT NONE
TYPE(t_lapw),INTENT(IN) :: lapw
TYPE(t_mpi),INTENT(IN) :: mpi
......@@ -135,6 +136,10 @@ CONTAINS
COMPLEX CPP_BLAS_cdotc
EXTERNAL CPP_BLAS_cdotc
LOGICAL forw
INTEGER length_zfft(3)
COMPLEX, ALLOCATABLE :: zfft(:)
!-------> ABBREVIATIONS
!
......@@ -196,6 +201,7 @@ CONTAINS
ELSE
ALLOCATE ( psir(0:stars%kq1_fft*stars%kq2_fft*stars%kq3_fft-1),&
psii(0:stars%kq1_fft*stars%kq2_fft*stars%kq3_fft-1),&
zfft(0:stars%kq1_fft*stars%kq2_fft*stars%kq3_fft-1),&
rhon(0:stars%kq1_fft*stars%kq2_fft*stars%kq3_fft-1) )
IF (input%l_f) ALLOCATE ( kpsir(0:stars%kq1_fft*stars%kq2_fft*stars%kq3_fft-1),&
kpsii(0:stars%kq1_fft*stars%kq2_fft*stars%kq3_fft-1),&
......@@ -396,9 +402,21 @@ CONTAINS
ENDDO
ENDIF
ELSE
CALL cfft(psir,psii,ifftq3,stars%kq1_fft,ifftq1,isn)
CALL cfft(psir,psii,ifftq3,stars%kq2_fft,ifftq2,isn)
CALL cfft(psir,psii,ifftq3,stars%kq3_fft,ifftq3,isn)
!--------------------------------
! FFT transform
zfft = cmplx(psir,psii)
if (isn == -1) then
forw = .true.
else
forw = .false.
end if
length_zfft(1) = stars%kq1_fft
length_zfft(2) = stars%kq2_fft
length_zfft(3) = stars%kq3_fft
call fft_interface(3,length_zfft,zfft,forw)
psir = real(zfft)
psii = aimag(zfft)
!--------------------------------
! GM forces part
IF (input%l_f) THEN
DO ir = 0,ifftq3d-1
......@@ -420,9 +438,21 @@ CONTAINS
kpsii( iv1d(iv,jspin) ) = s * AIMAG(zMat%z_c(iv,nu))
ENDDO
CALL cfft(kpsir,kpsii,ifftq3,stars%kq1_fft,ifftq1,isn)
CALL cfft(kpsir,kpsii,ifftq3,stars%kq2_fft,ifftq2,isn)
CALL cfft(kpsir,kpsii,ifftq3,stars%kq3_fft,ifftq3,isn)
!--------------------------------
! FFT transform
zfft = cmplx(kpsir,kpsii)
if (isn == -1) then
forw = .true.
else
forw = .false.
end if
length_zfft(1) = stars%kq1_fft
length_zfft(2) = stars%kq2_fft
length_zfft(3) = stars%kq3_fft
call fft_interface(3,length_zfft,zfft,forw)
kpsir = real(zfft)
kpsii = aimag(zfft)
!--------------------------------
DO ir = 0,ifftq3d-1
ekin(ir) = ekin(ir) + wtf(nu) * 0.5 * (kpsir(ir)**2+kpsii(ir)**2)
......@@ -543,14 +573,38 @@ CONTAINS
IF (input%l_f) CALL rfft(isn,stars%kq1_fft,stars%kq2_fft,stars%kq3_fft+1,stars%kq1_fft,stars%kq2_fft,stars%kq3_fft,&
stars%kq1_fft,stars%kq2_fft,stars%kq3_fft,wsave,kpsir(ifftq3d), ekin(-ifftq2))
ELSE
CALL cfft(rhon,psir,ifftq3,stars%kq1_fft,ifftq1,isn)
CALL cfft(rhon,psir,ifftq3,stars%kq2_fft,ifftq2,isn)
CALL cfft(rhon,psir,ifftq3,stars%kq3_fft,ifftq3,isn)
!--------------------------------
! FFT transform
zfft = cmplx(rhon,psir)
if (isn == -1) then
forw = .true.
else
forw = .false.
end if
length_zfft(1) = stars%kq1_fft
length_zfft(2) = stars%kq2_fft
length_zfft(3) = stars%kq3_fft
call fft_interface(3,length_zfft,zfft,forw)
rhon = real(zfft)
psir = aimag(zfft)
!--------------------------------
!+apw
IF (input%l_f) THEN
CALL cfft(ekin,psii,ifftq3,stars%kq1_fft,ifftq1,isn)
CALL cfft(ekin,psii,ifftq3,stars%kq2_fft,ifftq2,isn)
CALL cfft(ekin,psii,ifftq3,stars%kq3_fft,ifftq3,isn)
!--------------------------------
! FFT transform
zfft = cmplx(ekin,psii)
if (isn == -1) then
forw = .true.
else
forw = .false.
end if
length_zfft(1) = stars%kq1_fft
length_zfft(2) = stars%kq2_fft
length_zfft(3) = stars%kq3_fft
call fft_interface(3,length_zfft,zfft,forw)
ekin = real(zfft)
psii = aimag(zfft)
!--------------------------------
ENDIF
ENDIF
ENDIF
......
......@@ -47,16 +47,16 @@ CONTAINS
nz = 1
na = 0
DO i=1,atoms%ntype
DO j=1,atoms%neq(i)
equivAtomsLoop: DO j=1,atoms%neq(i)
na = na + 1
zs = atoms%pos(3,na)
DO iz=1,nz
IF(ABS(zs-znz(iz)).LT.epsz) CYCLE
ENDDO
IF(ABS(zs-znz(iz)).LT.epsz) CYCLE equivAtomsLoop
END DO
nz = nz+1
znz(nz) = zs
ENDDO
ENDDO
END DO equivAtomsLoop
END DO
nsld = nz
IF(nsld>atoms%nat) CALL juDFT_error("nsld.GT.atoms%nat ",calledby="slab_dim")
!
......
......@@ -7,6 +7,7 @@ include("cmake/compilerflags.cmake")
include("cmake/tests/test_XML.cmake")
include("cmake/tests/test_LAPACK.cmake")
include("cmake/tests/test_MPI.cmake")
include("cmake/tests/test_FFTMKL.cmake")
include("cmake/tests/test_HDF5.cmake")
include("cmake/tests/test_MAGMA.cmake")
include("cmake/tests/test_GPU.cmake")
......
......@@ -18,6 +18,7 @@ message("\n${Red}These Libraries are required:${CReset}")
message("${Green} XML Library found :${CReset} ${FLEUR_USE_XML}")
message("${Green} LAPACK Library found:${CReset} ${FLEUR_USE_LAPACK}")
message("${Red}These Libraries are optional:${CReset}")
message("${Green} FFT from MKL found :${CReset} ${FLEUR_USE_FFTMKL}")
message("${Green} HDF5 Library found :${CReset} ${FLEUR_USE_HDF5}")
message("${Green} MAGMA Library found:${CReset} ${FLEUR_USE_MAGMA}")
message("${Green} MPI Library found :${CReset} ${FLEUR_USE_MPI}")
......
......@@ -10,6 +10,7 @@ if (${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -C -traceback -O0 -g -ftrapuv -check uninit -check pointers -CB ")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI")
message("PGI Fortran detected")
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") #fix problem in cmake
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mp -Mr8 -Mr8intrinsics -Mcuda:kepler+ -ta:tesla:cuda7.5 -DUSE_STREAMS -DNUM_STREAMS=${N_STREAMS} -Minfo=accel -acc")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fast -O3")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -C -traceback -O0 -g -Mchkstk -Mchkptr")
......@@ -27,6 +28,6 @@ elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
message(FATAL_ERROR "Only modern versions of gfortran >6.3 will be able to compile FLEUR\nYou need to specify a different compiler.\nSee the docs at www.flapw.de.\n")
endif()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none -fopenmp -fdefault-real-8 ")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -O4")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -O1")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -fdump-core -Wall -Wextra -Warray-temporaries -fbacktrace -fcheck=all -finit-real=nan -O0 -g")
endif()
......@@ -4,4 +4,4 @@ set(CMAKE_Fortran_COMPILER mpiifort)
#Add include pathes
#set(FLEUR_Fortran_FLAGS "")
#Add linker stuff
set(FLEUR_LIBRARIES ${FLEUR_LIBRARIES} "-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64")
set(FLEUR_LIBRARIES ${FLEUR_LIBRARIES} "-lxml2;-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64;-mt_mpi")
#First check if we can compile with FFT from MKL
try_compile(FLEUR_USE_FFTMKL ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_FFTMKL.f90
LINK_LIBRARIES ${FLEUR_LIBRARIES}
)
message("FFT from MKL found:${FLEUR_USE_FFTMKL}")
if (FLEUR_USE_FFTMKL)
set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_FFT_MKL")
set(FLEUR_DEFINITIONS ${FLEUR_DEFINITIONS} "CPP_FFT_MKL")
endif()
MODULE MKL_DFT_TYPE
TYPE, PUBLIC :: DFTI_DESCRIPTOR
PRIVATE
INTEGER :: dontuse
! Structure of this type is not used in Fortran code
! the pointer to this type is used only
END TYPE DFTI_DESCRIPTOR
END MODULE MKL_DFT_TYPE
MODULE MKL_TEST
INTERFACE DftiCommitDescriptor
FUNCTION dfti_commit_descriptor_external(desc)
USE MKL_DFT_TYPE
!DEC$ ATTRIBUTES C :: dfti_commit_descriptor_external
!DEC$ ATTRIBUTES REFERENCE :: dfti_commit_descriptor_external
INTEGER dfti_commit_descriptor_external
TYPE(DFTI_DESCRIPTOR), POINTER :: desc
END FUNCTION dfti_commit_descriptor_external
END INTERFACE
END MODULE
program test
use MKL_DFT_TYPE
use MKL_test
type(dfti_descriptor),pointer :: dfti_handle
integer :: dfti_status
dfti_status = DftiCommitDescriptor(dfti_handle)
end program test
......@@ -21,12 +21,12 @@ message("XML Library found for linking:${FLEUR_USE_XML}")
if (FLEUR_USE_XML)
try_compile(FLEUR_USE_XML ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_XML.c
LINK_LIBRARIES ${FLEUR_LIBRARIES})
LINK_LIBRARIES "-lxml2")
if (NOT FLEUR_USE_XML)
find_package(LibXml2)
set(CMAKE_C_FLAGS "-I${LIBXML2_INCLUDE_DIR}")
try_compile(FLEUR_USE_XML ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_XML.c
LINK_LIBRARIES ${FLEUR_LIBRARIES})
LINK_LIBRARIES ${LIBXML2_LIBRARIES})
endif()
endif()
......
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#process arguments
help=0
all_tests=0
machine=""
label=""
backup=0
gitupdate=0
debug=0
error=""
while [ $# -gt 0 ]
do
case "$1" in
-h) help=1;;
-help) help=1;;
-b) backup=1;;
-backup) backup=1;;
-g) gitupdate=1;;
-gitupdate) gitupdate=1;;
-t) all_tests=1;;
-all_tests) all_tests=1;;
-l) shift;label=$1;;
-m) shift;machine=$1;;
-d) debug=1;;
-*) error="Unkown argument";;
*) break;; # terminate while loop
esac
shift
done
if [ $# -gt 0 ]
then
if [ "$machine" = "" ]
then
machine=$1;shift
else
error="You specified the -m switch and gave an additional MACHINE argument"
fi
fi
if [ $# -gt 0 ]
then
if [ "$label" = "" ]
then
label=$1;shift
else
error="You specified the -l switch and gave an additional LABEL argument"
fi
fi
if [ $# -gt 0 ]
then
error="Extra unkown arguments"
fi
echo "------------ Welcome to the FLEUR configuration script -------------"
if [ "$error" != "" ]
then
echo $error
echo "ERROR in calling configure. Please use -h for help on usage"
exit 1
fi
. $DIR/cmake/machines.sh
#check if -h or --help was given as argument
if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]
#check if -h or -help was given as argument
if [ $help -gt 0 ]
then
echo "USAGE: configure.sh [MACHINE] [label]"
echo "USAGE: configure.sh [options] [MACHINE] [label]"
echo "
The following command line options are supported:
-h : print this help-page
-m # : specify the machine to build on (see below for possible options)
This can also be specified without -m as a first argument
-l # : label for the build. It will be attached to the name of the build directory.
This option can also be specified as second argument without -l
-d : build a debugging version of FLEUR (adds .debug to label)
-g : do a git pull first if this is a git version
-t : generate all tests including those that run longer
-b : backup an old build directory if present
To help the script finding a proper configuration you should
provide the name of a specific machine to compile on.
Currently known machine configurations are:
"
echo " $known_machines"
echo "
If you do not find a proper choice you might try
'configure.sh AUTO'
If you do not specify the machine the AUTO option will be used in which some
defaults are tested. It might work if your machine is not one of those known.
You might also want to add your configuration to the file
cmake/machines.sh in this case :-)
......@@ -25,9 +98,9 @@ then
FLEUR_LIBRARIES -- list of linker arguments i.e. '-L/lib;-lbla'
CMAKE_Fortran_FLAGS -- list of compiler options i.e. '-r8'"
echo "
By specifying a label which contains 'debug' in addition to your
machine configuration you will build a debugging version. Otherwise
the label will be added to the build directory name."
By specifying a label you can have different build directories.
The label will be added to the 'build' directory name."
exit 1
fi
#Check if we are using the git version and update if pull was used as an argument
......@@ -41,12 +114,11 @@ if test -d $DIR/.git
echo "Git version found, hook installed"
fi
then
if [[ $1 =~ .*pull.* ]] || [[ $2 =~ .*pull.* ]] || [[ $3 =~ .*pull.* ]]
if [ $gitupdate -gt 0 ]
then
cd $DIR
git pull
cd -
exit
fi
fi
......@@ -58,7 +130,6 @@ then
fi
#Name of the build directory
label=$2
if [ -n "$label" ]
then
buildname="build.$label"
......@@ -66,35 +137,53 @@ else
buildname="build"
fi
if [ $debug -gt 0 ]
then
echo "Debug version will be build"
BUILD=Debug
buildname="$buildname.debug"
else
BUILD=Release
fi
#check if there is a build directory
if test -d $buildname
then
echo "OLD build directory found, saved in build.$$"
mv $buildname $buildname.$$
if [ $backup -gt 0 ]
then
echo "OLD build directory found, saved in build.$$"
mv $buildname $buildname.$$
else
echo "Overwriting old build"
rm -r $buildname
fi
fi
mkdir $buildname
cd $buildname
#Now check the machine and set some defaults
machine=$1
if [[ $machine =~ FLEUR_CONFIG_MACHINE ]]
then
machine=$FLEUR_CONFIG_MACHINE
fi
if [ "$machine" = "" ]
then
machine=AUTO
fi
echo "Machine config:$machine"
configure_machine
#run cmake
if [[ $buildname =~ .*debug.* ]]
cmake -Dall_tests=$all_tests -DCMAKE_BUILD_TYPE=$BUILD $DIR 2>&1 |tee configure.out
if [ -r $buildname/Makefile ]
then
echo "Debug version will be build"
BUILD=Debug
echo "Your configuration failed"
echo "Perhaps you have to specify compiler options or give a machine dependent configuration."
echo "You might want to call the configure.sh script with -h"
else
BUILD=Release
echo "Configuration finished"
echo "You should change into directory $buildname "
echo "run 'make' or 'make -j'"
fi
cmake -DCMAKE_BUILD_TYPE=$BUILD $DIR
echo "Configuration finished"
echo "If no errors occured you should change into directory $buildname "
echo "run 'make' or 'make -j4'"
......@@ -73,20 +73,16 @@
DATA spin12/'.1' , '.2'/
DATA ch_mcd/'.+' , '.-' , '.0'/
!
l_orbcomp = .false.
IF (banddos%ndir.NE.-3) THEN
qdim = lmax*atoms%ntype+3
ELSE
qdim = lmax*atoms%ntype+3
l_orbcomp = banddos%l_orb
IF (banddos%ndir.EQ.-3) THEN
qdim = 2*nsld
n_orb = 0
INQUIRE(file='orbcomp',exist=l_orbcomp)
IF (l_orbcomp) THEN
OPEN (1,file='orbcomp',form='formatted')
READ (1,*) n_orb
WRITE (*,*) 'DOS: orbcomp',n_orb
CLOSE (1)
qdim = 23
ENDIF
IF (banddos%l_orb) THEN
n_orb = banddos%orbCompAtom
WRITE (*,*) 'DOS: orbcomp',n_orb
qdim = 23
END IF
ENDIF
ALLOCATE( qal(qdim,dimension%neigd,kpts%nkpt),&
& qval(vacuum%nstars*vacuum%layers*vacuum%nvac,dimension%neigd,kpts%nkpt),&
......@@ -170,12 +166,12 @@
ALLOCATE( qis(dimension%neigd),qvlay(dimension%neigd,vacuum%layerd,2))
CALL read_eig(eig_id,k,jspin,bk=vk(:,k),wk=wt(k),neig=nevk(k),eig=ev(:,k))
CALL read_dos(eig_id,k,jspin,qal_tmp,qvac,qis,qvlay,qstars,ksym,jsym,mcd,qintsl,qmtsl,qmtp,orbcomp)
qal(1:lmax*atoms%ntype,:,k)=reshape(qal_tmp,(/lmax*atoms%ntype,size(qal_tmp,3)/))
qal(lmax*atoms%ntype+2,:,k)=qvac(:,1) ! vacuum 1
qal(lmax*atoms%ntype+3,:,k)=qvac(:,2) ! vacuum 2
qal(lmax*atoms%ntype+1,:,k)=qis ! interstitial
DEALLOCATE( ksym,jsym )
IF (l_orbcomp)THEN
IF (.NOT.l_orbcomp) THEN
qal(1:lmax*atoms%ntype,:,k)=reshape(qal_tmp,(/lmax*atoms%ntype,size(qal_tmp,3)/))
qal(lmax*atoms%ntype+2,:,k)=qvac(:,1) ! vacuum 1
qal(lmax*atoms%ntype+3,:,k)=qvac(:,2) ! vacuum 2
qal(lmax*atoms%ntype+1,:,k)=qis ! interstitial
ELSE
IF (n_orb == 0) THEN
qal(1:nsld,:,k) = qintsl(:,:)
qal(nsld+1:2*nsld,:,k) = qmtsl(:,:)
......@@ -183,13 +179,14 @@
DO i = 1, 23
DO l = 1, nevk(k)
qal(i,l,k) = orbcomp(l,i,n_orb)*qmtp(l,n_orb)/10000.
ENDDO
END DO
DO l = nevk(k)+1, dimension%neigd
qal(i,l,k) = 0.0
ENDDO
ENDDO
ENDIF
ENDIF
END DO
END DO
END IF
END IF
DEALLOCATE( ksym,jsym )
DEALLOCATE( orbcomp,qintsl,qmtsl,qmtp,qvac,qis,qal_tmp,qvlay)
ntb = max(ntb,nevk(k))
!
......
......@@ -55,20 +55,38 @@ CONTAINS
! .. Local Scalars ..
COMPLEX th,ts,phase
REAL b1(3),b2(3),r2
INTEGER i,i1,i2,i3,ii,in,j,ig3,ispin,l
INTEGER i,i1,i2,i3,ii,in,j,ig3,ispin,l,iloc
INTEGER istart,nc
COMPLEX ust1,vp1
COMPLEX, ALLOCATABLE :: vpw1(:) ! for J constants
! ..
! ..
!$OMP PARALLEL
if (l_real) THEN
hamOvlp%a_r=0.0
hamOvlp%b_r=0.0
!$OMP DO
do i = 1, size(hamOvlp%a_r)
hamOvlp%a_r(i)=0.0
end do
!OMP END DO
!$OMP DO
do i = 1, size(hamOvlp%b_r)
hamOvlp%b_r(i)=0.0
end do
!OMP END DO
ELSE
hamOvlp%a_c=0.0
hamOvlp%b_c=0.0
!$OMP DO
do i = 1, size(hamOvlp%a_c)
hamOvlp%a_c(i)=0.0
end do
!$OMP END DO
!$OMP DO
do i = 1, size(hamOvlp%b_c)
hamOvlp%b_c(i)=0.0
end do
!$OMP END DO
ENDIF
!$OMP END PARALLEL
ust1 = stars%ustep(1)
ispin = jspin
lapw%nmat = lapw%nv(ispin)
......@@ -104,10 +122,19 @@ CONTAINS
vp1 = vpw(1)
!---> loop over (k+g')
ii = 0
!$OMP PARALLEL DO SCHEDULE(dynamic) DEFAULT(none) &
!$OMP SHARED(n_rank,n_size,lapw,ispin,stars,input,bkpt,cell,vpw,ust1,vp1) &
!$OMP SHARED(l_real,hamOvlp)&
!$OMP PRIVATE(i,j,iloc,i1,i2,i3,in,phase,b1,b2,r2,th,ts)&
!$OMP FIRSTPRIVATE(ii)
DO i = n_rank+1, lapw%nv(ispin), n_size
!---> loop over (k+g)
DO j = 1,i - 1
ii = ii + 1
ii = 0
DO iloc = n_rank+1,i-n_size,n_size
ii = ii + iloc
ENDDO
ii = ii + j
!--> determine index and phase factor
i1 = lapw%k1(i,ispin) - lapw%k1(j,ispin)
i2 = lapw%k2(i,ispin) - lapw%k2(j,ispin)
......@@ -132,21 +159,22 @@ CONTAINS
if (l_real) THEN
hamOvlp%a_r(ii) = REAL(th)
hamOvlp%b_r(ii) = REAL(ts)
else
else
hamOvlp%a_c(ii) = th
hamOvlp%b_c(ii) = ts
endif
endif
ENDDO
!---> diagonal term (g-g'=0 always first star)
ii = ii + 1
if (l_real) THEN
hamOvlp%a_r(ii) = 0.5*lapw%rk(i,ispin)*lapw%rk(i,ispin)*REAL(ust1) + REAL(vp1)
hamOvlp%b_r(ii) = REAL(ust1)
else
else
hamOvlp%a_c(ii) = 0.5*lapw%rk(i,ispin)*lapw%rk(i,ispin)*ust1 + vp1
hamOvlp%b_c(ii) = ust1
endif
endif
ENDDO
!$OMP END PARALLEL DO
!---> pk non-collinear
IF (noco%l_noco) THEN
......
......@@ -76,21 +76,22 @@ MODULE m_tlmplm
!---> generate the wavefunctions for each l
!
l_write=mpi%irank==0
!!$ l_write=.false.
!!$ call gaunt2(atoms%lmaxd)
!!$OMP PARALLEL DO DEFAULT(NONE)&
!!$OMP PRIVATE(indt,dvd,dvu,uvd,uvu,f,g,x,flo,uuilon,duilon,ulouilopn)&
!!$OMP PRIVATE(cil,temp,wronk,i,l,l2,lamda,lh,lm,lmin,lmin0,lmp,lmpl)&
!!$OMP PRIVATE(lmplm,lmx,lmxx,lp,lp1,lpl,m,mem,mems,mp,mu,n,nh,noded)&
!!$OMP PRIVATE(nodeu,nsym,na)&
!!$OMP SHARED(dimension,atoms,lh0,jspin,jsp,sphhar,enpara,td,ud,l_write,ci,vr,mpi,input)
!$ l_write=.false.
!$ call gaunt2(atoms%lmaxd)
!$OMP PARALLEL DO DEFAULT(NONE)&
!$OMP PRIVATE(indt,dvd,dvu,uvd,uvu,f,g,x,flo,uuilon,duilon,ulouilopn)&
!$OMP PRIVATE(cil,temp,wronk,i,l,l2,lamda,lh,lm,lmin,lmin0,lmp,lmpl)&
!$OMP PRIVATE(lmplm,lmx,lmxx,lp,lp1,lpl,m,mem,mems,mp,mu,n,nh,noded)&
!$OMP PRIVATE(nodeu,nsym,na)&
!$OMP SHARED(dimension,atoms,lh0,jspin,jsp,sphhar,enpara,td,ud,l_write,ci,vr,mpi,input)