Commit ff27e704 authored by Daniel Wortmann's avatar Daniel Wortmann

More flexible include feature

parent 09cb2516
...@@ -43,7 +43,7 @@ PROGRAM inpgen ...@@ -43,7 +43,7 @@ PROGRAM inpgen
REAL, ALLOCATABLE :: atompos(:, :),atomid(:) REAL, ALLOCATABLE :: atompos(:, :),atomid(:)
CHARACTER(len=20), ALLOCATABLE :: atomLabel(:) CHARACTER(len=20), ALLOCATABLE :: atomLabel(:)
LOGICAL :: l_fullinput,l_explicit,l_inpxml,l_include LOGICAL :: l_fullinput,l_explicit,l_inpxml,l_include(4)
TYPE(t_input) :: input TYPE(t_input) :: input
TYPE(t_atoms) :: atoms TYPE(t_atoms) :: atoms
...@@ -67,8 +67,7 @@ PROGRAM inpgen ...@@ -67,8 +67,7 @@ PROGRAM inpgen
!Start program and greet user !Start program and greet user
CALL inpgen_help() CALL inpgen_help()
l_explicit=judft_was_argument("-explicit") l_explicit=judft_was_argument("-explicit")
l_include=judft_was_argument("-singlefile")
OPEN(6,file='out') OPEN(6,file='out')
INQUIRE(file='inp.xml',exist=l_inpxml) INQUIRE(file='inp.xml',exist=l_inpxml)
...@@ -113,6 +112,7 @@ PROGRAM inpgen ...@@ -113,6 +112,7 @@ PROGRAM inpgen
!Now the IO-section !Now the IO-section
! !
IF (.NOT.l_inpxml.or.judft_was_argument("-overwrite")) THEN IF (.NOT.l_inpxml.or.judft_was_argument("-overwrite")) THEN
call determine_includes(l_include)
!the inp.xml file !the inp.xml file
!CALL dump_FleurInputSchema() !CALL dump_FleurInputSchema()
CALL w_inpxml(& CALL w_inpxml(&
...@@ -131,4 +131,45 @@ PROGRAM inpgen ...@@ -131,4 +131,45 @@ PROGRAM inpgen
CALL juDFT_end("All done") CALL juDFT_end("All done")
contains
subroutine determine_includes(l_include)
logical,intent(out)::l_include(4) !kpts,operations,species,position
l_include=[.false.,.false.,.true.,.true.]
IF (judft_was_argument("-inc")) THEN
str=judft_string_for_argument("-inc")
do while(len_trim(str)>0) then
if (str(1:1)=='-') then
incl=.false.
str=str(2:)
else
incl=.true.
if (str(1:1)=='+') str=str(2:)
endif
select case(str(1:1))
case ('k','K')
l_include(1)=incl
case ('o','O')
l_include(2)=incl
case ('s','S')
l_include(3)=incl
case ('p','P')
l_include(4)=incl
case ('a','A')
l_include(:)=incl
end select
if (index(str,"'")>0) then
str=str(index(str,"'")+1:)
else
str=""
end if
end do
endif
IF (LEN_TRIM(str)>1) CALL judft_error("Do not specify k-points in file and on command line")
str=judft_string_for_argument("-k")
END IF
END PROGRAM inpgen END PROGRAM inpgen
...@@ -27,7 +27,7 @@ CONTAINS ...@@ -27,7 +27,7 @@ CONTAINS
CALL new_argument(0,"-inp","convert old inp file to inp.xml file","") CALL new_argument(0,"-inp","convert old inp file to inp.xml file","")
CALL new_argument(1,"-f","filename to process","") CALL new_argument(1,"-f","filename to process","")
CALL new_argument(0,"-warn_only","do not stop for warnings","") CALL new_argument(0,"-warn_only","do not stop for warnings","")
CALL new_argument(0,"-singlefile","include all data in inp.xml, do not create files for kpoints and symmetry","") CALL new_argument(1,"-inc","which data to include in inp.xml, e.g. +all,-species,+operations,-kpts","")
CALL new_argument(1,"-k","String to define k-point set","") CALL new_argument(1,"-k","String to define k-point set","")
call new_argument(0,"-no_send","Do not send usage data","") call new_argument(0,"-no_send","Do not send usage data","")
......
...@@ -19,7 +19,7 @@ CONTAINS ...@@ -19,7 +19,7 @@ CONTAINS
SUBROUTINE w_inpXML(& SUBROUTINE w_inpXML(&
atoms,vacuum,input,stars,sliceplot,forcetheo,banddos,& atoms,vacuum,input,stars,sliceplot,forcetheo,banddos,&
cell,sym,xcpot,noco,oneD,hybrid,kpts,enpara,& cell,sym,xcpot,noco,oneD,hybrid,kpts,enpara,&
filenum,l_explicitIn,l_includeIn,filename) l_explicitIn,l_includeIn,filename)
use m_types_input use m_types_input
...@@ -62,12 +62,11 @@ SUBROUTINE w_inpXML(& ...@@ -62,12 +62,11 @@ SUBROUTINE w_inpXML(&
TYPE(t_noco),INTENT(IN) :: noco TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_enpara),INTENT(IN) :: enpara TYPE(t_enpara),INTENT(IN) :: enpara
CLASS(t_forcetheo),INTENT(IN):: forcetheo !nothing is done here so far.... CLASS(t_forcetheo),INTENT(IN):: forcetheo !nothing is done here so far....
LOGICAL, INTENT (IN) :: l_explicitIn,l_includeIn LOGICAL, INTENT (IN) :: l_explicitIn,l_includeIn(4)
INTEGER,INTENT(IN) :: fileNum
CHARACTER(LEN=*),INTENT(IN),OPTIONAL :: filename CHARACTER(LEN=*),INTENT(IN),OPTIONAL :: filename
INTEGER :: iSpecies INTEGER :: iSpecies,fileNum
CHARACTER(len=8) :: name(10) CHARACTER(len=8) :: name(10)
INTEGER :: numSpecies INTEGER :: numSpecies
INTEGER :: speciesRepAtomType(atoms%ntype) INTEGER :: speciesRepAtomType(atoms%ntype)
...@@ -116,7 +115,7 @@ SUBROUTINE w_inpXML(& ...@@ -116,7 +115,7 @@ SUBROUTINE w_inpXML(&
CHARACTER(len=20) :: mixingScheme CHARACTER(len=20) :: mixingScheme
CHARACTER(len=10) :: loType CHARACTER(len=10) :: loType
CHARACTER(len=10) :: bzIntMode CHARACTER(len=10) :: bzIntMode
LOGICAL :: l_explicit, l_nocoOpt,l_include LOGICAL :: l_explicit, l_nocoOpt,l_include(4)
INTEGER :: iAtomType, startCoreStates, endCoreStates INTEGER :: iAtomType, startCoreStates, endCoreStates
CHARACTER(len=100) :: posString(3) CHARACTER(len=100) :: posString(3)
CHARACTER(len=7) :: str CHARACTER(len=7) :: str
...@@ -133,10 +132,12 @@ SUBROUTINE w_inpXML(& ...@@ -133,10 +132,12 @@ SUBROUTINE w_inpXML(&
IF(PRESENT(filename)) THEN IF(PRESENT(filename)) THEN
filenum=98
OPEN (fileNum,file=TRIM(ADJUSTL(filename)),form='formatted',status='replace') OPEN (fileNum,file=TRIM(ADJUSTL(filename)),form='formatted',status='replace')
WRITE (fileNum,'(a)') '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' WRITE (fileNum,'(a)') '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
WRITE (fileNum,'(a)') '<fleurInput fleurInputVersion="0.29">' WRITE (fileNum,'(a)') '<fleurInput fleurInputVersion="0.29">'
ELSE ELSE
fileNum = getXMLOutputUnitNumber()
CALL openXMLElementNoAttributes('inputData') CALL openXMLElementNoAttributes('inputData')
END IF END IF
...@@ -224,7 +225,7 @@ SUBROUTINE w_inpXML(& ...@@ -224,7 +225,7 @@ SUBROUTINE w_inpXML(&
200 FORMAT(' <bzIntegration valenceElectrons="',f0.8,'" mode="',a,'" fermiSmearingEnergy="',f0.8,'">') 200 FORMAT(' <bzIntegration valenceElectrons="',f0.8,'" mode="',a,'" fermiSmearingEnergy="',f0.8,'">')
WRITE (fileNum,200) input%zelec,TRIM(ADJUSTL(bzIntMode)),input%tkb WRITE (fileNum,200) input%zelec,TRIM(ADJUSTL(bzIntMode)),input%tkb
if (l_include) THEN if (l_include(1)) THEN
call kpts%print_xml(fileNum) call kpts%print_xml(fileNum)
else else
WRITE (fileNum,'(a)')' <!-- k-points included here -->' WRITE (fileNum,'(a)')' <!-- k-points included here -->'
...@@ -238,7 +239,7 @@ SUBROUTINE w_inpXML(& ...@@ -238,7 +239,7 @@ SUBROUTINE w_inpXML(&
WRITE (fileNum,'(a)') ' </calculationSetup>' WRITE (fileNum,'(a)') ' </calculationSetup>'
WRITE (fileNum,'(a)') ' <cell>' WRITE (fileNum,'(a)') ' <cell>'
if (l_include) THEN if (l_include(2)) THEN
call sym%print_xml(fileNum) call sym%print_xml(fileNum)
else else
WRITE (fileNum,'(a)')' <!-- symmetry operations included here -->' WRITE (fileNum,'(a)')' <!-- symmetry operations included here -->'
...@@ -306,7 +307,14 @@ SUBROUTINE w_inpXML(& ...@@ -306,7 +307,14 @@ SUBROUTINE w_inpXML(&
speciesRepAtomType(numSpecies)=n speciesRepAtomType(numSpecies)=n
end if end if
enddo enddo
if (.not.include(3)) then
open(99,file='species.xml')
WRITE (fileNum,'(a)')' <!-- species included here -->'
WRITE (fileNum,'(a)')' <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="species.xml"> </xi:include>'
fileNum=99
endif
WRITE (fileNum,'(a)') ' <atomSpecies>' WRITE (fileNum,'(a)') ' <atomSpecies>'
DO iSpecies=1, numSpecies DO iSpecies=1, numSpecies
iAtomType = speciesRepAtomType(iSpecies) iAtomType = speciesRepAtomType(iSpecies)
...@@ -383,6 +391,19 @@ SUBROUTINE w_inpXML(& ...@@ -383,6 +391,19 @@ SUBROUTINE w_inpXML(&
WRITE (fileNum,'(a)') ' </species>' WRITE (fileNum,'(a)') ' </species>'
END DO END DO
WRITE (fileNum,'(a)') ' </atomSpecies>' WRITE (fileNum,'(a)') ' </atomSpecies>'
if (.not.include(3)) then
close(99)
fileNum=98
endif
if (.not.include(4)) then
open(99,file='atoms.xml')
WRITE (fileNum,'(a)')' <!-- atoms group included here -->'
WRITE (fileNum,'(a)')' <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="atoms.xml"> </xi:include>'
fileNum=98
endif
WRITE (fileNum,'(a)') ' <atomGroups>' WRITE (fileNum,'(a)') ' <atomGroups>'
na = 0 na = 0
DO iAtomType=1, atoms%ntype DO iAtomType=1, atoms%ntype
...@@ -466,6 +487,10 @@ SUBROUTINE w_inpXML(& ...@@ -466,6 +487,10 @@ SUBROUTINE w_inpXML(&
WRITE (fileNum,'(a)') ' </atomGroup>' WRITE (fileNum,'(a)') ' </atomGroup>'
END DO END DO
WRITE (fileNum,'(a)') ' </atomGroups>' WRITE (fileNum,'(a)') ' </atomGroups>'
if (.not.include(3)) then
close(99)
fileNum=98
endif
368 FORMAT(' <output dos="',l1,'" band="',l1,'" vacdos="',l1,'" slice="',l1,'" mcd="',l1,'">') 368 FORMAT(' <output dos="',l1,'" band="',l1,'" vacdos="',l1,'" slice="',l1,'" mcd="',l1,'">')
WRITE (fileNum,368) banddos%dos,band,banddos%vacdos,sliceplot%slice,banddos%l_mcd WRITE (fileNum,368) banddos%dos,band,banddos%vacdos,sliceplot%slice,banddos%l_mcd
......
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