Commit 47afe243 authored by Daniel Wortmann's avatar Daniel Wortmann

more updates to juDFT library

parent 0730def7
......@@ -60,7 +60,7 @@ math/outint.f math/grule.f )
set(inpgen_F90 ${inpgen_F90} global/constants.f90 io/xsf_io.f90
eigen/orthoglo.F90 math/ylm4.F90 mpi/mpi_bc_tool.F90
global/sort.f90 global/chkmt.f90 inpgen/inpgen.f90 inpgen/set_inp.f90 inpgen/inpgen_help.f90 io/rw_inp.f90 global/find_enpara.f90
inpgen/closure.f90 inpgen/inpgen_arguments.F90 math/intgr.F90
inpgen/closure.f90 math/intgr.F90
io/w_inpXML.f90 kpoints/julia.f90 global/utility.F90
init/compile_descr.F90 kpoints/kpoints.f90 io/xmlOutput.F90 kpoints/brzone2.f90 cdn/slab_dim.f90 cdn/slabgeom.f90 dos/nstm3.f90 cdn/int_21.f90
cdn/int_21lo.f90 cdn_mt/rhomt21.f90 cdn_mt/rhonmt21.f90 force/force_a21.F90 force/force_a21_lo.f90 force/force_a21_U.f90 force/force_a12.f90
......
......@@ -24,8 +24,9 @@ PROGRAM diag_test
IF (isize>1) THEN
ALLOCATE(t_mpimat::hmat)
ALLOCATE(t_mpimat::smat)
ALLOCATE(hmat%blacsdata)
smat%blacsdata=>hmat%blacsdata
hmat%blacsdata%mpi_comm=MPI_COMM_WORLD
smat%blacsdata%mpi_comm=MPI_COMM_WORLD
END IF
#endif
IF (.NOT.ALLOCATED(hmat)) THEN
......@@ -33,23 +34,24 @@ PROGRAM diag_test
ALLOCATE(t_mat::smat)
ENDIF
! get mode
filename=judft_string_for_argument("-mode")
READ(filename,*) mode
! get filename
filename=judft_string_for_argument("-file")
INQUIRE(file=filename,exist=l_exist)
INQUIRE(file=trim(filename)//".hdf",exist=l_exist)
IF (.NOT.l_exist) CALL judft_error("File specified does not exist")
!matsize is actually only needed if file is created
fid=open_matrix(l_real,matsize,2,2,filename)
!l_real,matsize is actually only needed if file is created
fid=open_matrix(l_real,matsize,2,2,trim(filename))
CALL read_matrix(hmat,1,fid)
CALL read_matrix(smat,2,fid)
SELECT TYPE(hmat)
TYPE is (t_mpimat)
SELECT TYPE(smat)
TYPE is (t_mpimat)
smat%blacsdata=>hmat%blacsdata!make sure we use same blacs-grids
END SELECT
ne=0.15*hmat%global_size1
ALLOCATE(eig(hmat%global_size1))
CLASS default
......@@ -58,6 +60,7 @@ PROGRAM diag_test
END SELECT
CALL cpu_TIME(t1)
mode=0
CALL eigen_diag(mode,hmat,smat,ne,eig,ev)
CALL cpu_TIME(t2)
PRINT *,"No of eigenvalues:",ne
......
......@@ -10,13 +10,22 @@ CONTAINS
USE m_compile_descr
USE m_constants
USE m_juDFT
USE m_fleur_arguments
USE m_check_arguments
IMPLICIT NONE
CHARACTER(:), ALLOCATABLE:: infostring
PRINT *," Welcome to FLEUR - inpgen (www.flapw.de) "
PRINT *," MaX-Release 3.0 (www.max-centre.eu)"
CALL new_argument(0,"-genEnpara","Generate an 'enpara' file for the energy parameters","")
CALL new_argument(0,"-explicit","Write out k-point list, symmetry operations, and optional input to inp.xml","")
CALL new_argument(0,"-kpts_gw","add alternative k point set for GW in all outputs for the XML input file","")
CALL new_argument(0,"-noco","write out noco parameters into inp.xml","")
CALL new_argument(0,"-electronConfig","explicitely write the electron configuration into inp.xml","")
CALL new_argument(0,"-fast_defaults","generate more aggressive (and less stable) input parameters for faster calculations","")
CALL new_argument(0,"-h","Print this help message","")
IF (.NOT.check_arguments()) CALL judft_warn("Invalid command line arguments",hint="Use -h option to see valid choices")
IF (.NOT. juDFT_was_argument("-h")) RETURN
!now print version info and help on command line arguments:
......@@ -27,7 +36,6 @@ CONTAINS
WRITE(*,'(a)')"inpgen usage info:"
WRITE(*,'(a)')"The following command line options are known:"
WRITE(*,'(a)')""
CALL print_argument("-old")
CALL print_argument("-genEnpara")
CALL print_argument("-explicit")
CALL print_argument("-noco")
......
......@@ -314,9 +314,6 @@
input%elup = input%elup + 10.0
input%gw_neigd = bands
l_gamma = .true.
IF(juDFT_was_argument("-old")) THEN
CALL juDFT_error('No hybrid functionals input for old input file implemented', calledby='set_inp')
END IF
input%minDistance = 1.0e-5
ELSE
input%gw_neigd = 0
......@@ -434,7 +431,6 @@
kpts%specificationType = 2
END IF
IF(.NOT.juDFT_was_argument("-old")) THEN
nkptOld = kpts%nkpt
latnamTemp = cell%latnam
......@@ -494,8 +490,7 @@
kpts%nkpt = nkptOld
cell%latnam = latnamTemp
END IF !xml output
DEALLOCATE (noco%l_relax,noco%b_con,noco%alphInit,noco%alph,noco%beta)
DEALLOCATE (atoms%ulo_der)
......@@ -512,31 +507,6 @@
CLOSE (6)
IF (juDFT_was_argument("-old")) THEN
IF (atoms%ntype.GT.999) THEN
CALL juDFT_error('More than 999 atom types only work with the inp.xml input file',calledby='set_inp')
END IF
IF (kpts%specificationType.EQ.4) THEN
CALL juDFT_error('No k point set specification by density supported for old inp file',&
calledby = 'set_inp')
END IF
CALL rw_inp(ch_rw,atoms,obsolete,vacuum,input,stars,sliceplot,banddos,&
cell,sym,xcpot,noco,oneD,hybrid,kpts,&
noel,namex,relcor,a1,a2,a3,dtild,input%comment)
iofile = 6
OPEN (iofile,file='inp',form='formatted',status='old',position='append')
IF((div(1) == 0).OR.(div(2) == 0)) THEN
WRITE (iofile,'(a5,i5)') 'nkpt=',kpts%nkpt
ELSE
WRITE (iofile,'(a5,i5,3(a4,i2))') 'nkpt=',kpts%nkpt,',nx=',div(1),',ny=',div(2),',nz=',div(3)
ENDIF
CLOSE (iofile)
END IF
END SUBROUTINE set_inp
END MODULE m_setinp
......@@ -50,7 +50,7 @@ CONTAINS
CLASS(t_Mat),INTENT(INOUT) :: mat
INTEGER,INTENT(IN) :: rec,id
CALL mat%alloc()
!CALL mat%alloc()
SELECT CASE (fh(id)%mode)
CASE (1)
SELECT TYPE(mat)
......
......@@ -23,7 +23,7 @@ juDFT/string.f90
juDFT/time.F90
juDFT/args.F90
juDFT/sysinfo.F90
juDFT/fleur_arguments.F90
juDFT/check_arguments.F90
juDFT/xmlOutput.F90
)
target_compile_definitions(juDFT PUBLIC ${FLEUR_DEFINITIONS})
......
......@@ -10,7 +10,7 @@ MODULE m_juDFT_args
PUBLIC judft_was_argument,juDFT_string_for_argument
CONTAINS
FUNCTION juDFT_was_argument(arg) RESULT(OK)
USE m_fleur_arguments
USE m_check_arguments
IMPLICIT NONE
CHARACTER(len=*),INTENT(IN)::arg
LOGICAL ok
......
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_check_arguments
IMPLICIT NONE
PRIVATE
TYPE t_param
INTEGER :: TYPE !can be 0,1,2 for a simple argument, an argument with a string or with a number
CHARACTER(len=20) :: name
CHARACTER(len=200) :: desc
CHARACTER(len=200) :: values
END TYPE t_param
TYPE(t_param),ALLOCATABLE:: params(:)
PUBLIC argument_type,print_argument,check_arguments,new_argument
CONTAINS
SUBROUTINE new_argument(argtype,arg,desc,values)
INTEGER,INTENT(in) :: argtype
CHARACTER(len=*),INTENT(in) :: arg,desc,values
TYPE(t_param),ALLOCATABLE::tmp(:)
!extend the params array
IF (ALLOCATED(params)) THEN
CALL MOVE_ALLOC(params,tmp)
ALLOCATE(params(SIZE(tmp)+1))
params(:SIZE(tmp))=tmp
ELSE
ALLOCATE(params(1))
ENDIF
params(SIZE(params))=t_param(argtype,arg,desc,values)
END SUBROUTINE new_argument
FUNCTION argument_type(name)
IMPLICIT NONE
CHARACTER(len=*),INTENT(in):: name
INTEGER :: n,argument_type
argument_type=-1
IF (.NOT.ALLOCATED(params)) THEN
!nothing to check
argument_type=0
RETURN
END IF
DO n=1,SIZE(params)
IF (TRIM(name)==params(n)%name) argument_type=params(n)%TYPE
END DO
END FUNCTION argument_type
LOGICAL FUNCTION check_arguments()
IMPLICIT NONE
INTEGER :: i,n
CHARACTER(len=200):: str
check_arguments=.TRUE.
IF (.NOT.ALLOCATED(params)) RETURN
i=1
DO WHILE(i<=COMMAND_ARGUMENT_COUNT())
CALL GET_COMMAND_ARGUMENT(i,str)
param_loop:DO n=1,SIZE(params)
IF (TRIM(str)==params(n)%name) THEN
SELECT CASE (params(n)%TYPE)
CASE(1)
i=i+1
CALL GET_COMMAND_ARGUMENT(i,str)
IF (TRIM(params(n)%values)/="") THEN
IF (INDEX(TRIM(params(n)%values),TRIM(str))==0) THEN
PRINT *,"Invalid value :",TRIM(str)
PRINT *,"Possible values:",TRIM(params(n)%values)
check_arguments=.false.
END IF
END IF
CASE(2)
i=i+1
END SELECT
EXIT param_loop
END IF
ENDDO param_loop
IF (n>SIZE(params)) THEN
PRINT *,"Unkown command line argument:"//str
check_arguments=.FALSE.
END IF
i=i+1
ENDDO
END FUNCTION check_arguments
SUBROUTINE print_argument(name)
IMPLICIT NONE
CHARACTER(len=*),INTENT(in):: name
INTEGER :: n
IF (.NOT.ALLOCATED(params)) RETURN
DO n=1,size(params)
IF (TRIM(name)==TRIM(params(n)%name)) THEN
IF (params(n)%TYPE==0) THEN !parameter without option
WRITE(*,1001) TRIM(params(n)%name),TRIM(params(n)%desc)
ELSEIF (params(n)%TYPE==1) THEN
IF (params(n)%values=="") THEN !parameter with string
WRITE(*,1002) TRIM(params(n)%name),TRIM(params(n)%desc)
ELSE !parameter with string and choice
WRITE(*,1003) TRIM(params(n)%name),TRIM(params(n)%values),TRIM(params(n)%desc)
END IF
ELSE !parameter with number
WRITE(*,1004) TRIM(params(n)%name),TRIM(params(n)%desc)
ENDIF
RETURN
ENDIF
END DO
1001 FORMAT(t5,a,t20,": ",a)
1002 FORMAT(t5,a," $$$",t20,": ",a)
1003 FORMAT(t5,a," [",a,"]",/,t20,": ",a)
1004 FORMAT(t5,a," #",t20,": ",a)
PRINT *,"BUG, check handling of parameters in check_arguments.f90"
PRINT *,name
END SUBROUTINE print_argument
END MODULE m_check_arguments
......@@ -6,153 +6,13 @@
MODULE m_fleur_arguments
IMPLICIT NONE
PRIVATE
TYPE t_fleur_param
TYPE t_param
INTEGER :: TYPE !can be 0,1,2 for a simple argument, an argument with a string or with a number
CHARACTER(len=20) :: name
CHARACTER(len=200) :: desc
CHARACTER(len=200) :: values
END TYPE t_fleur_param
INTEGER,PARAMETER:: no_params=25
TYPE(t_fleur_param) :: fleur_param(no_params)=(/&
!Input options
t_fleur_param(0,"-toXML","Convert an old 'inp' file into the new XML format",""),&
t_fleur_param(1,"-xmlXPath","modify the xml-xpath of the inp.xml file",""),&
!Control the job
t_fleur_param(0,"-check","run in check mode, i.e. stop after init",""),&
t_fleur_param(0,"-info","Print out information on recommended parallelization and available charge densities",""),&
t_fleur_param(2,"-wtime","run for # minutes (used to estimate if another iteration is started)",""),&
t_fleur_param(1,"-j","Distribute MPI ranks to run subjobs (Format PE:DIR meaning run with PE in directory DIR)",""),&
t_fleur_param(1,"-f","Obtain info on subjobs from file",""),&
t_fleur_param(2,"-n_min_size","Try to use at least specified number of PE in eigenvalue parallelization",""),&
t_fleur_param(1,"-diag","Choose method for diagonalization","lapack,debugout"&
#ifdef CPP_SCALAPACK
//",scalapack"&
#endif
#ifdef CPP_ELPA_ONENODE
//",elpa_1node"&
#endif
#ifdef CPP_ELPA
//",elpa"&
#endif
#ifdef CPP_CHASE
//",chase"&
#endif
#ifdef CPP_MAGMA
//",magma"&
#endif
#ifdef CPP_GPU
//",cusolver"&
#endif
),&
t_fleur_param(1,"-eig","Method for storing the eigenvectors","mem,da"&
#ifdef CPP_MPI
//",mpi"&
#endif
#ifdef CPP_HDF
//",hdf"&
#endif
),&
!Debugging
t_fleur_param(0,"-warn_only","Continue execution after a warning message",""),&
t_fleur_param(0,"-trace","Try to generate a stacktrace in case of an error",""),&
t_fleur_param(0,"-debugtime","Write the start/stop of all timers to the console",""),&
!Output
t_fleur_param(0,"-mix_io","Do not store mixing history in memory but do IO in each iteration",""),&
t_fleur_param(0,"-no_out","Do not open the 'out' file but write to stdout",""),&
t_fleur_param(0,"-genEnpara","Generate an 'enpara' file for the energy parameters",""),&
t_fleur_param(0,"-kpts_gw","add alternative k point set for GW in all outputs for the XML input file",""),&
t_fleur_param(0,"-noco","write out noco parameters in all outputs for inp.xml",""),&
t_fleur_param(0,"-h","Print this message",""),&
t_fleur_param(0,"-no_send","Do not send usage data","")&
!HDF density
,t_fleur_param(0,"-no_cdn_hdf","Disable HDF charge density mode (activated by default if HDF5 is available)","")&
,t_fleur_param(0,"-last_extra","Generate an additional file cdn_last.hdf that contains only the last density","")&
,t_fleur_param(2,"-sd","use starting density N, where N is the index of the density according to -info","")&
,t_fleur_param(1,"-delden","delete densities (either an index N, a range N-M or the keyword 'allbutlast' should be given)","")&
!GPU parameter
,t_fleur_param(0,"-gpu","Use GPU for computing","")&
/)
END TYPE t_param
PUBLIC argument_type,print_argument,check_arguments
CONTAINS
FUNCTION argument_type(name)
IMPLICIT NONE
CHARACTER(len=*),INTENT(in):: name
INTEGER :: n,argument_type
argument_type=-1
DO n=1,SIZE(fleur_param)
IF (TRIM(name)==fleur_param(n)%name) argument_type=fleur_param(n)%TYPE
END DO
END FUNCTION argument_type
LOGICAL FUNCTION check_arguments()
IMPLICIT NONE
INTEGER :: i,n
CHARACTER(len=200):: str
check_arguments=.TRUE.
i=1
DO WHILE(i<=COMMAND_ARGUMENT_COUNT())
CALL GET_COMMAND_ARGUMENT(i,str)
param_loop:DO n=1,SIZE(fleur_param)
IF (TRIM(str)==fleur_param(n)%name) THEN
SELECT CASE (fleur_param(n)%TYPE)
CASE(1)
i=i+1
CALL GET_COMMAND_ARGUMENT(i,str)
IF (TRIM(fleur_param(n)%values)/="") THEN
IF (INDEX(TRIM(fleur_param(n)%values),TRIM(str))==0) THEN
PRINT *,"Invalid value :",TRIM(str)
PRINT *,"Possible values:",TRIM(fleur_param(n)%values)
check_arguments=.false.
END IF
END IF
CASE(2)
i=i+1
END SELECT
EXIT param_loop
END IF
ENDDO param_loop
IF (n>SIZE(fleur_param)) THEN
PRINT *,"Unkown command line argument:"//str
check_arguments=.FALSE.
END IF
i=i+1
ENDDO
END FUNCTION check_arguments
SUBROUTINE print_argument(name)
IMPLICIT NONE
CHARACTER(len=*),INTENT(in):: name
INTEGER :: n
DO n=1,no_params
IF (TRIM(name)==TRIM(fleur_param(n)%name)) THEN
IF (fleur_param(n)%TYPE==0) THEN !parameter without option
WRITE(*,1001) TRIM(fleur_param(n)%name),TRIM(fleur_param(n)%desc)
ELSEIF (fleur_param(n)%TYPE==1) THEN
IF (fleur_param(n)%values=="") THEN !parameter with string
WRITE(*,1002) TRIM(fleur_param(n)%name),TRIM(fleur_param(n)%desc)
ELSE !parameter with string and choice
WRITE(*,1003) TRIM(fleur_param(n)%name),TRIM(fleur_param(n)%values),TRIM(fleur_param(n)%desc)
END IF
ELSE !parameter with number
WRITE(*,1004) TRIM(fleur_param(n)%name),TRIM(fleur_param(n)%desc)
ENDIF
RETURN
ENDIF
END DO
1001 FORMAT(t5,a,t20,": ",a)
1002 FORMAT(t5,a," $$$",t20,": ",a)
1003 FORMAT(t5,a," [",a,"]",/,t20,": ",a)
1004 FORMAT(t5,a," #",t20,": ",a)
PRINT *,"BUG IN FLEUR, check handling of parameters in fleur_help.f90"
PRINT *,name
END SUBROUTINE print_argument
END MODULE m_fleur_arguments
......@@ -5,20 +5,21 @@
!--------------------------------------------------------------------------------
MODULE m_fleur_help
IMPLICIT NONE
PRIVATE
PUBLIC fleur_help
CONTAINS
SUBROUTINE fleur_help()
USE m_compile_descr
USE m_constants
USE m_juDFT
USE m_fleur_arguments
USE m_check_arguments
IMPLICIT NONE
CHARACTER(:), ALLOCATABLE:: infostring
PRINT *," Welcome to FLEUR (www.flapw.de) "
PRINT *," MaX-Release 2.1 (www.max-centre.eu)"
CALL add_fleur_arguments()
IF (.NOT.check_arguments()) CALL judft_warn("Invalid command line arguments",hint="Use -h option to see valid choices")
......@@ -75,4 +76,65 @@ CONTAINS
CALL juDFT_end("",l_endXML=.FALSE.) !No message so do a not print more on exit
END SUBROUTINE fleur_help
SUBROUTINE add_fleur_arguments()
USE m_check_arguments
CALL new_argument(0,"-toXML","Convert an old 'inp' file into the new XML format","")
CALL new_argument(1,"-xmlXPath","modify the xml-xpath of the inp.xml file","")
!Control the job
CALL new_argument(0,"-check","run in check mode, i.e. stop after init","")
CALL new_argument(0,"-info","Print out information on recommended parallelization and available charge densities","")
CALL new_argument(2,"-wtime","run for # minutes (used to estimate if another iteration is started)","")
CALL new_argument(1,"-j","Distribute MPI ranks to run subjobs (Format PE:DIR meaning run with PE in directory DIR)","")
CALL new_argument(1,"-f","Obtain info on subjobs from file","")
CALL new_argument(2,"-n_min_size","Try to use at least specified number of PE in eigenvalue parallelization","")
CALL new_argument(1,"-diag","Choose method for diagonalization","lapack,debugout"&
#ifdef CPP_SCALAPACK
//",scalapack"&
#endif
#ifdef CPP_ELPA_ONENODE
//",elpa_1node"&
#endif
#ifdef CPP_ELPA
//",elpa"&
#endif
#ifdef CPP_CHASE
//",chase"&
#endif
#ifdef CPP_MAGMA
//",magma"&
#endif
#ifdef CPP_GPU
//",cusolver"&
#endif
)
CALL new_argument(1,"-eig","Method for storing the eigenvectors","mem,da"&
#ifdef CPP_MPI
//",mpi"&
#endif
#ifdef CPP_HDF
//",hdf"&
#endif
)
!Debugging
CALL new_argument(0,"-warn_only","Continue execution after a warning message","")
CALL new_argument(0,"-trace","Try to generate a stacktrace in case of an error","")
CALL new_argument(0,"-debugtime","Write the start/stop of all timers to the console","")
!Output
CALL new_argument(0,"-mix_io","Do not store mixing history in memory but do IO in each iteration","")
CALL new_argument(0,"-no_out","Do not open the 'out' file but write to stdout","")
CALL new_argument(0,"-genEnpara","Generate an 'enpara' file for the energy parameters","")
CALL new_argument(0,"-kpts_gw","add alternative k point set for GW in all outputs for the XML input file","")
CALL new_argument(0,"-noco","write out noco parameters in all outputs for inp.xml","")
CALL new_argument(0,"-h","Print this message","")
CALL new_argument(0,"-no_send","Do not send usage data","")
!HDF density
CALL new_argument(0,"-no_cdn_hdf","Disable HDF charge density mode (activated by default if HDF5 is available)","")
CALL new_argument(0,"-last_extra","Generate an additional file cdn_last.hdf that contains only the last density","")
CALL new_argument(2,"-sd","use starting density N, where N is the index of the density according to -info","")
CALL new_argument(1,"-delden","delete densities (either an index N, a range N-M or the keyword 'allbutlast' should be given)","")
!GPU parameter
CALL new_argument(0,"-gpu","Use GPU for computing","")
END SUBROUTINE add_fleur_arguments
END MODULE m_fleur_help
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