Commit ff27e704 authored by Daniel Wortmann's avatar Daniel Wortmann

More flexible include feature

parent 09cb2516
......@@ -43,7 +43,7 @@ PROGRAM inpgen
REAL, ALLOCATABLE :: atompos(:, :),atomid(:)
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_atoms) :: atoms
......@@ -67,8 +67,7 @@ PROGRAM inpgen
!Start program and greet user
CALL inpgen_help()
l_explicit=judft_was_argument("-explicit")
l_include=judft_was_argument("-singlefile")
OPEN(6,file='out')
INQUIRE(file='inp.xml',exist=l_inpxml)
......@@ -113,6 +112,7 @@ PROGRAM inpgen
!Now the IO-section
!
IF (.NOT.l_inpxml.or.judft_was_argument("-overwrite")) THEN
call determine_includes(l_include)
!the inp.xml file
!CALL dump_FleurInputSchema()
CALL w_inpxml(&
......@@ -131,4 +131,45 @@ PROGRAM inpgen
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
......@@ -27,7 +27,7 @@ CONTAINS
CALL new_argument(0,"-inp","convert old inp file to inp.xml file","")
CALL new_argument(1,"-f","filename to process","")
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(0,"-no_send","Do not send usage data","")
......
......@@ -19,7 +19,7 @@ CONTAINS
SUBROUTINE w_inpXML(&
atoms,vacuum,input,stars,sliceplot,forcetheo,banddos,&
cell,sym,xcpot,noco,oneD,hybrid,kpts,enpara,&
filenum,l_explicitIn,l_includeIn,filename)
l_explicitIn,l_includeIn,filename)
use m_types_input
......@@ -62,12 +62,11 @@ SUBROUTINE w_inpXML(&
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_enpara),INTENT(IN) :: enpara
CLASS(t_forcetheo),INTENT(IN):: forcetheo !nothing is done here so far....
LOGICAL, INTENT (IN) :: l_explicitIn,l_includeIn
INTEGER,INTENT(IN) :: fileNum
LOGICAL, INTENT (IN) :: l_explicitIn,l_includeIn(4)
CHARACTER(LEN=*),INTENT(IN),OPTIONAL :: filename
INTEGER :: iSpecies
INTEGER :: iSpecies,fileNum
CHARACTER(len=8) :: name(10)
INTEGER :: numSpecies
INTEGER :: speciesRepAtomType(atoms%ntype)
......@@ -116,7 +115,7 @@ SUBROUTINE w_inpXML(&
CHARACTER(len=20) :: mixingScheme
CHARACTER(len=10) :: loType
CHARACTER(len=10) :: bzIntMode
LOGICAL :: l_explicit, l_nocoOpt,l_include
LOGICAL :: l_explicit, l_nocoOpt,l_include(4)
INTEGER :: iAtomType, startCoreStates, endCoreStates
CHARACTER(len=100) :: posString(3)
CHARACTER(len=7) :: str
......@@ -133,10 +132,12 @@ SUBROUTINE w_inpXML(&
IF(PRESENT(filename)) THEN
filenum=98
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)') '<fleurInput fleurInputVersion="0.29">'
ELSE
fileNum = getXMLOutputUnitNumber()
CALL openXMLElementNoAttributes('inputData')
END IF
......@@ -224,7 +225,7 @@ SUBROUTINE w_inpXML(&
200 FORMAT(' <bzIntegration valenceElectrons="',f0.8,'" mode="',a,'" fermiSmearingEnergy="',f0.8,'">')
WRITE (fileNum,200) input%zelec,TRIM(ADJUSTL(bzIntMode)),input%tkb
if (l_include) THEN
if (l_include(1)) THEN
call kpts%print_xml(fileNum)
else
WRITE (fileNum,'(a)')' <!-- k-points included here -->'
......@@ -238,7 +239,7 @@ SUBROUTINE w_inpXML(&
WRITE (fileNum,'(a)') ' </calculationSetup>'
WRITE (fileNum,'(a)') ' <cell>'
if (l_include) THEN
if (l_include(2)) THEN
call sym%print_xml(fileNum)
else
WRITE (fileNum,'(a)')' <!-- symmetry operations included here -->'
......@@ -306,7 +307,14 @@ SUBROUTINE w_inpXML(&
speciesRepAtomType(numSpecies)=n
end if
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>'
DO iSpecies=1, numSpecies
iAtomType = speciesRepAtomType(iSpecies)
......@@ -383,6 +391,19 @@ SUBROUTINE w_inpXML(&
WRITE (fileNum,'(a)') ' </species>'
END DO
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>'
na = 0
DO iAtomType=1, atoms%ntype
......@@ -466,6 +487,10 @@ SUBROUTINE w_inpXML(&
WRITE (fileNum,'(a)') ' </atomGroup>'
END DO
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,'">')
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