Commit a7f8e4f5 authored by Matthias Redies's avatar Matthias Redies

tests work; so will do a commit

parent ec89d5af
......@@ -38,7 +38,7 @@ elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS "6.1.0")
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 "${CMAKE_Fortran_FLAGS} -ffree-line-length-none -fopenmp -fdefault-real-8 -Wno-missing-include-dirs")
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()
......@@ -87,7 +87,7 @@ CONTAINS
ENDIF
CALL vgen_xcpot(hybrid,input,xcpot,dimension,atoms,sphhar,stars,vacuum,sym,&
obsolete,cell,oneD,sliceplot,mpi,noco,den,denRot,vTot,vx,results)
obsolete,cell,oneD,sliceplot,mpi,noco,den,denRot,EnergyDen,vTot,vx,results)
!ToDo, check if this is needed for more potentials as well...
CALL vgen_finalize(atoms,stars,vacuum,sym,noco,input,vTot,denRot)
......
......@@ -122,6 +122,7 @@ CONTAINS
SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad,kinEnergyDen)
USE m_types_misc
USE m_judft
USE, INTRINSIC :: IEEE_ARITHMETIC
IMPLICIT NONE
......
......@@ -10,7 +10,7 @@ MODULE m_vgen_xcpot
CONTAINS
SUBROUTINE vgen_xcpot(hybrid,input,xcpot,dimension,atoms,sphhar,stars,vacuum,sym,&
obsolete,cell,oneD,sliceplot,mpi,noco,den,denRot,vTot,vx,results)
obsolete,cell,oneD,sliceplot,mpi,noco,den,denRot,EnergyDen,vTot,vx,results)
! ***********************************************************
! FLAPW potential generator *
......@@ -51,7 +51,7 @@ CONTAINS
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_sphhar), INTENT(IN) :: sphhar
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_potden), INTENT(IN) :: den,denRot
TYPE(t_potden), INTENT(IN) :: den,denRot,EnergyDen
TYPE(t_potden), INTENT(INOUT) :: vTot,vx
TYPE(t_results), INTENT(INOUT), OPTIONAL :: results
......@@ -116,7 +116,7 @@ CONTAINS
IF ( (.NOT. obsolete%lwb) .OR. ( .not.xcpot%needs_grad() ) ) THEN
! no White-Bird-trick
CALL vis_xc(stars,sym,cell,den,xcpot,input,noco,vTot,vx,exc)
CALL vis_xc(stars,sym,cell,den,xcpot,input,noco,EnergyDen,vTot,vx,exc)
ELSE
! White-Bird-trick
......@@ -138,7 +138,7 @@ CONTAINS
END IF
CALL vmt_xc(DIMENSION,mpi,sphhar,atoms, den,xcpot,input,sym,&
obsolete, vTot,vx,exc)
obsolete,EnergyDen, vTot,vx,exc)
!
......
......@@ -16,7 +16,7 @@ MODULE m_vis_xc
! including gradient corrections. t.a. 1996.
! ******************************************************
CONTAINS
SUBROUTINE vis_xc(stars,sym,cell,den,xcpot,input,noco,EnergyDen,vtot, vxc,vx,exc)
SUBROUTINE vis_xc(stars,sym,cell,den,xcpot,input,noco,EnergyDen,vTot,vx,exc)
! ******************************************************
! instead of visxcor.f: the different exchange-correlation
......@@ -33,6 +33,7 @@ CONTAINS
USE m_types
USE m_types_xcpot_libxc
USE m_libxc_postprocess_gga
USE m_metagga
IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN) :: xcpot
......@@ -41,11 +42,11 @@ CONTAINS
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_potden),INTENT(IN) :: den, EnergyDen, vtot
TYPE(t_potden),INTENT(INOUT) :: vxc,vx,exc
TYPE(t_potden),INTENT(IN) :: den, EnergyDen
TYPE(t_potden),INTENT(INOUT) :: vTot,vx,exc
TYPE(t_gradients) :: grad, tmp_grad
REAL, ALLOCATABLE :: rho(:,:), ED_rs(:,:), vtot_rs(:,:), kinED_rs(:,:)
REAL, ALLOCATABLE :: rho(:,:), ED_rs(:,:), vTot_rs(:,:), kinED_rs(:,:)
REAL, ALLOCATABLE :: v_x(:,:),v_xc(:,:),e_xc(:,:)
CALL init_pw_grid(xcpot,stars,sym,cell)
......@@ -64,20 +65,21 @@ CONTAINS
END SELECT
ENDIF
!Put the potentials in rez. space.
CALL pw_from_grid(xcpot,stars,input%total,v_xc,vxc%pw,vxc%pw_w)
CALL pw_from_grid(xcpot,stars,input%total,v_xc,vTot%pw,vTot%pw_w)
CALL pw_from_grid(xcpot,stars,input%total,v_x,vx%pw,vx%pw_w)
! use updated vTot for exc calculation
IF(ALLOCATED(EnergyDen%pw) .AND. xcpot%exc_is_MetaGGA()) THEN
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, cell, EnergyDen%pw, tmp_grad, ED_rs)
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, cell, vtot%pw, tmp_grad, vtot_rs)
CALL calc_kinEnergyDen(ED_rs, vtot_rs, kinED_rs)
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, cell, vTot%pw, tmp_grad, vTot_rs)
CALL calc_kinEnergyDen(ED_rs, vTot_rs, rho, kinED_rs)
ENDIF
!calculate the ex.-cor energy density
IF (ALLOCATED(exc%pw_w)) THEN
ALLOCATE ( e_xc(SIZE(rho,1),1) ); e_xc=0.0
IF(ALLOCATED(kinED_rs)) THEN
IF(ALLOCATED(EnergyDen%pw) .AND. xcpot%exc_is_MetaGGA()) THEN
CALL xcpot%get_exc(input%jspins,rho,e_xc(:,1),grad,kinED_rs)
ELSE
CALL xcpot%get_exc(input%jspins,rho,e_xc(:,1),grad)
......
......@@ -23,13 +23,14 @@ MODULE m_vmt_xc
CONTAINS
SUBROUTINE vmt_xc(DIMENSION,mpi,sphhar,atoms,&
den,xcpot,input,sym, obsolete,vxc,vx,exc)
den,xcpot,input,sym, obsolete,EnergyDen,vTot,vx,exc)
#include"cpp_double.h"
use m_libxc_postprocess_gga
USE m_mt_tofrom_grid
USE m_types_xcpot_inbuild
USE m_types
USE m_metagga
IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN) :: xcpot
......@@ -40,16 +41,16 @@ CONTAINS
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_potden),INTENT(IN) :: den
TYPE(t_potden),INTENT(INOUT) :: vxc,vx,exc
TYPE(t_potden),INTENT(IN) :: den,EnergyDen
TYPE(t_potden),INTENT(INOUT) :: vTot,vx,exc
#ifdef CPP_MPI
include "mpif.h"
#endif
! ..
! .. Local Scalars ..
TYPE(t_gradients) :: grad
TYPE(t_gradients) :: grad, tmp_grad
TYPE(t_xcpot_inbuild) :: xcpot_tmp
REAL, ALLOCATABLE :: ch(:,:)
REAL, ALLOCATABLE :: ch(:,:), ED_rs(:,:), vTot_rs(:,:), kinED_rs(:,:)
INTEGER :: n,nsp,nt,jr
REAL :: divi
......@@ -88,7 +89,7 @@ CONTAINS
n_start=mpi%irank+1
n_stride=mpi%isize
IF (mpi%irank>0) THEN
vxc%mt=0.0
vTot%mt=0.0
vx%mt=0.0
exc%mt=0.0
ENDIF
......@@ -118,14 +119,27 @@ CONTAINS
!Add postprocessing for libxc
IF (l_libxc.AND.xcpot%needs_grad()) CALL libxc_postprocess_gga_mt(xcpot,atoms,sphhar,n,v_xc,grad)
CALL mt_from_grid(atoms,sphhar,nsp,n,input%jspins,v_xc,vxc%mt(:,0:,n,:))
CALL mt_from_grid(atoms,sphhar,nsp,n,input%jspins,v_xc,vTot%mt(:,0:,n,:))
CALL mt_from_grid(atoms,sphhar,nsp,n,input%jspins,v_x,vx%mt(:,0:,n,:))
! use updated vTot for exc calculation
IF(ALLOCATED(EnergyDen%mt) .AND. xcpot%exc_is_MetaGGA()) THEN
CALL mt_to_grid(xcpot, input%jspins, atoms,sphhar,EnergyDen%mt(:,0:,n,:),nsp,n,tmp_grad,ED_rs)
CALL mt_to_grid(xcpot, input%jspins, atoms,sphhar,vTot%mt(:,0:,n,:),nsp,n,tmp_grad,vTot_rs)
CALL calc_kinEnergyDen(ED_rs, vTot_rs, ch, kinED_rs)
ENDIF
IF (ALLOCATED(exc%mt)) THEN
!
! calculate the ex.-cor energy density
!
CALL xcpot%get_exc(input%jspins,ch(:nsp*atoms%jri(n),:),e_xc(:nsp*atoms%jri(n),1),grad)
IF(ALLOCATED(EnergyDen%mt) .AND. xcpot%exc_is_MetaGGA()) THEN
CALL xcpot%get_exc(input%jspins,ch(:nsp*atoms%jri(n),:),e_xc(:nsp*atoms%jri(n),1),grad, kinED_rs)
ELSE
CALL xcpot%get_exc(input%jspins,ch(:nsp*atoms%jri(n),:),e_xc(:nsp*atoms%jri(n),1),grad)
ENDIF
IF (lda_atom(n)) THEN
! Use local part of pw91 for this atom
CALL xcpot_tmp%get_exc(input%jspins,ch(:nsp*atoms%jri(n),:),xcl(:nsp*atoms%jri(n),1),grad)
......@@ -144,7 +158,7 @@ CONTAINS
CALL finish_mt_grid()
#ifdef CPP_MPI
CALL MPI_ALLREDUCE(MPI_IN_PLACE,vx%mt,SIZE(vx%mt),CPP_MPI_REAL,MPI_SUM,mpi%mpi_comm,ierr)
CALL MPI_ALLREDUCE(MPI_IN_PLACE,vxc%mt,SIZE(vxc%mt),CPP_MPI_REAL,MPI_SUM,mpi%mpi_comm,ierr)
CALL MPI_ALLREDUCE(MPI_IN_PLACE,vTot%mt,SIZE(vTot%mt),CPP_MPI_REAL,MPI_SUM,mpi%mpi_comm,ierr)
CALL MPI_ALLREDUCE(MPI_IN_PLACE,exc%mt,SIZE(exc%mt),CPP_MPI_REAL,MPI_SUM,mpi%mpi_comm,ierr)
#endif
!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment