From bad6a5a51fb5588f4560f7d0d1dcc3dc410e632e Mon Sep 17 00:00:00 2001 From: Pierre-Francois Loos Date: Wed, 14 Oct 2020 09:44:03 +0200 Subject: [PATCH] merge eDFT in QuAcK --- input/dft | 2 -- src/QuAcK/QuAcK.f90 | 3 ++- src/eDFT/eDFT.f90 | 33 ++++++++++++++++----------------- src/eDFT/read_options_dft.f90 | 24 +----------------------- src/make_ninja.py | 4 ++-- 5 files changed, 21 insertions(+), 45 deletions(-) diff --git a/input/dft b/input/dft index 636957a..709e75b 100644 --- a/input/dft +++ b/input/dft @@ -36,5 +36,3 @@ 0.191734 -0.0364788 -0.017035 # choice of UCC exchange coefficient : 1 for Cx1, 2 for Cx2, 3 for Cx1*Cx2 2 -# GOK-DFT: maxSCF thresh DIIS n_diis guess_type ortho_type - 1000 0.00001 T 5 1 1 diff --git a/src/QuAcK/QuAcK.f90 b/src/QuAcK/QuAcK.f90 index 113a340..7bab00d 100644 --- a/src/QuAcK/QuAcK.f90 +++ b/src/QuAcK/QuAcK.f90 @@ -314,7 +314,8 @@ program QuAcK if(doKS) then call cpu_time(start_KS) - call eDFT(nNuc,ZNuc,rNuc,nBas,nEl,nC,nO,nV,nR,nShell,TotAngMomShell,CenterShell,KShell,DShell,ExpShell, & + call eDFT(maxSCF_HF,thresh_HF,n_diis_HF,guess_type,nNuc,ZNuc,rNuc,ENuc,nBas,nEl,nC, & + nO,nV,nR,nShell,TotAngMomShell,CenterShell,KShell,DShell,ExpShell, & max_ang_mom,min_exponent,max_exponent,S,T,V,Hc,X,ERI_AO,dipole_int) call cpu_time(end_KS) diff --git a/src/eDFT/eDFT.f90 b/src/eDFT/eDFT.f90 index ab6ea93..2fa4513 100644 --- a/src/eDFT/eDFT.f90 +++ b/src/eDFT/eDFT.f90 @@ -1,15 +1,21 @@ -subroutine eDFT(nNuc,ZNuc,rNuc,nBas,nEl,nC,nO,nV,nR,nShell,TotAngMomShell,CenterShell,KShell,DShell,ExpShell, & - max_ang_mom,min_exponent,max_exponent,S,T,V,Hc,X,ERI_AO,dipole_int) +subroutine eDFT(maxSCF,thresh,max_diis,guess_type,nNuc,ZNuc,rNuc,ENuc,nBas,nEl,nC,nO,nV,nR, & + nShell,TotAngMomShell,CenterShell,KShell,DShell,ExpShell, & + max_ang_mom,min_exponent,max_exponent,S,T,V,Hc,X,ERI,dipole_int) ! exchange-correlation density-functional theory calculations -! use xc_f90_lib_m + use xc_f90_lib_m implicit none include 'parameters.h' ! Input variables + integer,intent(in) :: maxSCF + integer,intent(in) :: max_diis + integer,intent(in) :: guess_type + double precision,intent(in) :: thresh + integer,intent(in) :: nNuc integer,intent(in) :: nBas integer,intent(in) :: nEl(nspin) @@ -17,12 +23,12 @@ subroutine eDFT(nNuc,ZNuc,rNuc,nBas,nEl,nC,nO,nV,nR,nShell,TotAngMomShell,Center integer,intent(in) :: nO(nspin) integer,intent(in) :: nV(nspin) integer,intent(in) :: nR(nspin) - double precision,intent(in) :: ENuc,Ew + double precision,intent(in) :: ENuc double precision,intent(in) :: ZNuc(nNuc) double precision,intent(in) :: rNuc(nNuc,ncart) - integer,intent(in) :: nBas,nShell + integer,intent(in) :: nShell double precision,intent(in) :: CenterShell(maxShell,ncart) integer,intent(in) :: TotAngMomShell(maxShell) integer,intent(in) :: KShell(maxShell) @@ -43,8 +49,7 @@ subroutine eDFT(nNuc,ZNuc,rNuc,nBas,nEl,nC,nO,nV,nR,nShell,TotAngMomShell,Center ! Local variables - double precision,allocatable :: min_exponent(:,:) - double precision,allocatable :: max_exponent(:) + double precision :: Ew double precision,allocatable :: c(:,:) character(len=8) :: method @@ -72,12 +77,6 @@ subroutine eDFT(nNuc,ZNuc,rNuc,nBas,nEl,nC,nO,nV,nR,nShell,TotAngMomShell,Center logical :: doNcentered double precision,allocatable :: wEns(:) - integer :: maxSCF,max_diis - double precision :: thresh - logical :: DIIS - integer :: guess_type - integer :: ortho_type - double precision,allocatable :: occnum(:,:,:) integer :: Cx_choice @@ -102,11 +101,11 @@ subroutine eDFT(nNuc,ZNuc,rNuc,nBas,nEl,nC,nO,nV,nR,nShell,TotAngMomShell,Center ! DFT options !------------------------------------------------------------------------ -! Allocate ensemble weights +! Allocate ensemble weights and MO coefficients - allocate(wEns(maxEns),occnum(nBas,nspin,maxEns)) + allocate(c(nBas,nspin),wEns(maxEns),occnum(nBas,nspin,maxEns)) call read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns,aCC_w1,aCC_w2, & - maxSCF,thresh,DIIS,max_diis,guess_type,ortho_type,doNcentered,occnum,Cx_choice) + doNcentered,occnum,Cx_choice) !------------------------------------------------------------------------ ! Construct quadrature grid @@ -221,4 +220,4 @@ subroutine eDFT(nNuc,ZNuc,rNuc,nBas,nEl,nC,nO,nV,nR,nShell,TotAngMomShell,Center !------------------------------------------------------------------------ ! End of eDFT !------------------------------------------------------------------------ -end program eDFT +end subroutine eDFT diff --git a/src/eDFT/read_options_dft.f90 b/src/eDFT/read_options_dft.f90 index 1448aff..a9e14a1 100644 --- a/src/eDFT/read_options_dft.f90 +++ b/src/eDFT/read_options_dft.f90 @@ -1,5 +1,5 @@ subroutine read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns,aCC_w1,aCC_w2, & - maxSCF,thresh,DIIS,max_diis,guess_type,ortho_type,doNcentered,occnum,Cx_choice) + doNcentered,occnum,Cx_choice) ! Read DFT options @@ -31,12 +31,6 @@ subroutine read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns, double precision,intent(out) :: aCC_w2(3) double precision,intent(out) :: occnum(nBas,nspin,maxEns) - integer,intent(out) :: maxSCF - double precision,intent(out) :: thresh - logical,intent(out) :: DIIS - integer,intent(out) :: max_diis - integer,intent(out) :: guess_type - integer,intent(out) :: ortho_type integer,intent(out) :: Cx_choice ! Open file with method specification @@ -181,22 +175,6 @@ subroutine read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns, call matout(3,1,aCC_w2) write(*,*) -! Read KS options - - maxSCF = 64 - thresh = 1d-6 - DIIS = .false. - max_diis = 5 - guess_type = 1 - ortho_type = 1 - - read(1,*) - read(1,*) maxSCF,thresh,answer,max_diis,guess_type,ortho_type - - if(answer == 'T') DIIS = .true. - - if(.not.DIIS) max_diis = 1 - ! Close file with options close(unit=1) diff --git a/src/make_ninja.py b/src/make_ninja.py index 3c0305d..6f0d913 100755 --- a/src/make_ninja.py +++ b/src/make_ninja.py @@ -166,7 +166,7 @@ build_main = "\n".join([ build_GoDuck, ]) -exe_dirs = [ "QuAcK", "eDFT" ] +exe_dirs = [ "QuAcK"] lib_dirs = list(filter(lambda x: os.path.isdir(x) and \ x not in exe_dirs, os.listdir("."))) @@ -239,7 +239,7 @@ rule build_lib sources = filter(lambda x: x.endswith(".f") or x.endswith(".f90"), sources) sources = " ".join(sources) f.write("build $LDIR/{0}.a: build_lib {1}\n dir = $SDIR/{0}\n".format(libname, sources)) - f.write("build all: phony $QUACK_ROOT/GoDuck $BDIR/QuAcK $BDIR/eDFT\n") + f.write("build all: phony $QUACK_ROOT/GoDuck $BDIR/QuAcK\n") f.write("default all\n") def create_makefile(directory):