Commit 63ded4ad authored by Daniel Wortmann's avatar Daniel Wortmann

More cleanup in IO

parent 9edf71e7
......@@ -58,26 +58,42 @@ PROGRAM inpgen
TYPE(t_sym) :: sym
TYPE(t_noco) :: noco
TYPE(t_vacuum) :: vacuum
CALL inpgen_help()
CALL read_input()
!Start program and greet user
CALL inpgen_help()
CALL make_crystal(film, symor,atomid,atompos,atomlabel,amat,dvac,noco,&
cell,sym,atoms)
!read the input
CALL read_input(film,symor,atomid,atompos,atomlabel,amat,dvac,noco)
!First we determine the spacegoup and map the atoms to groups
CALL make_crystal(film,symor,atomid,atompos,atomlabel,amat,dvac,noco,&
cell,sym,atoms)
!All atom related parameters are set here. Note that some parameters might
!have been set in the read_input call before by adding defaults to the atompar module
CALL make_atomic_defaults(cell,atoms)
!Set all defaults that have not been specified before or can not be specified in inpgen
call make_defaults(atoms,vacuum,input,stars,sliceplot,forcetheo,banddos,&
& cell,sym,xcpot,noco,oneD,hybrid,kpts)
!
!Now the IO-section
CALL w_inpxml()
!
!the inp.xml file
CALL w_inpxml(&
& atoms,vacuum,input,stars,sliceplot,forcetheo,banddos,&
& cell,sym,xcpot,noco,oneD,hybrid,kpts,&
& div,l_gamma,& !should be in kpts!?
& namex,relcor,dtild_opt,name_opt,&!?should be somewhere...
& l_outFile,"inp.xml",&
& l_explicit,enpara)
!the sym.xml file
CALL write_sym()
!
! --> Structure in xsf-format
!
! Structure in xsf-format
OPEN (55,file="struct.xsf")
CALL xsf_WRITE_atoms(55,atoms,input%film,.FALSE.,cell%amat)
CLOSE (55)
......
This diff is collapsed.
......@@ -17,7 +17,6 @@ CONTAINS
atoms,obsolete,vacuum,input,stars,sliceplot,banddos,DIMENSION,forcetheo,field,&
cell,sym,xcpot,noco,oneD,hybrid,kpts,enpara,coreSpecInput,wann,&
noel,namex,relcor,a1,a2,a3,dtild,&
atomTypeSpecies,speciesRepAtomType,&
l_kpts)
USE iso_c_binding
......@@ -63,8 +62,6 @@ CONTAINS
TYPE(t_coreSpecInput),INTENT(OUT) :: coreSpecInput
TYPE(t_wann) ,INTENT(INOUT) :: wann
LOGICAL, INTENT(OUT) :: l_kpts
INTEGER, ALLOCATABLE, INTENT(INOUT) :: atomTypeSpecies(:)
INTEGER, ALLOCATABLE, INTENT(INOUT) :: speciesRepAtomType(:)
CHARACTER(len=3), ALLOCATABLE, INTENT(INOUT) :: noel(:)
CHARACTER(len=4), INTENT(OUT) :: namex
CHARACTER(len=12), INTENT(OUT) :: relcor
......@@ -238,12 +235,7 @@ CONTAINS
ALLOCATE(noco%alphInit(atoms%ntype),noco%alph(atoms%ntype),noco%beta(atoms%ntype))
ALLOCATE(noco%socscale(atoms%ntype))
DEALLOCATE(atomTypeSpecies,speciesRepAtomType)
ALLOCATE(atomTypeSpecies(atoms%ntype))
ALLOCATE(speciesRepAtomType(numSpecies))
atomTypeSpecies = -1
speciesRepAtomType = -1
ALLOCATE (kpts%ntetra(4,kpts%ntet),kpts%voltet(kpts%ntet))
......@@ -1288,7 +1280,9 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ALLOCATE (speciesNLO(numSpecies))
ALLOCATE(atoms%speciesName(numSpecies))
ALLOCATE(speciesName(numSpecies))
ALLOCATE(atoms%speciesName(atoms%ntype))
atoms%lapw_l(:) = -1
atoms%n_u = 0
......@@ -1299,7 +1293,7 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu
DO iSpecies = 1, numSpecies
! Attributes of species
WRITE(xPathA,*) '/fleurInput/atomSpecies/species[',iSpecies,']'
atoms%speciesName(iSpecies) = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA))//'/@name')))
speciesName(iSpecies) = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA))//'/@name')))
atomicNumber = evaluateFirstIntOnly(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA))//'/@atomicNumber'))
magMom = evaluateFirstOnly(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA))//'/@magMom'))
flipSpin = evaluateFirstBoolOnly(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA))//'/@flipSpin'))
......@@ -1360,8 +1354,8 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu
DO iType = 1, atoms%ntype
WRITE(xPathA,*) '/fleurInput/atomGroups/atomGroup[',iType,']/@species'
valueString = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA)))))
IF(TRIM(ADJUSTL(atoms%speciesName(iSpecies))).EQ.TRIM(ADJUSTL(valueString))) THEN
atom%speciesName(iType) = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA)))))
IF(TRIM(ADJUSTL(speciesName(iSpecies))).EQ.TRIM(ADJUSTL(atom%speciesName(iType)))) THEN
atoms%nz(iType) = atomicNumber
atoms%zatom(iType) = atoms%nz(iType)
IF (atoms%nz(iType).EQ.0) THEN
......@@ -1393,8 +1387,6 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu
atoms%lda_u(atoms%n_u)%l_amf = l_amf(i)
atoms%lda_u(atoms%n_u)%atomType = iType
END DO
atomTypeSpecies(iType) = iSpecies
IF(speciesRepAtomType(iSpecies).EQ.-1) speciesRepAtomType(iSpecies) = iType
END IF
END DO
END DO
......
......@@ -17,11 +17,11 @@ MODULE m_winpXML
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
CONTAINS
SUBROUTINE w_inpXML(&
& atoms,obsolete,vacuum,input,stars,sliceplot,forcetheo,banddos,&
& atoms,vacuum,input,stars,sliceplot,forcetheo,banddos,&
& cell,sym,xcpot,noco,oneD,hybrid,kpts,div,l_gamma,&
& noel,namex,relcor,a1,a2,a3,dtild_opt,name_opt,&
& atomTypeSpecies,speciesRepAtomType,l_outFile,filename,&
& l_explicitIn,numSpecies,enpara)
& namex,relcor,a1,a2,a3,dtild_opt,name_opt,&
& l_outFile,filename,&
& l_explicitIn,enpara)
USE m_types
USE m_juDFT
......@@ -37,7 +37,6 @@ SUBROUTINE w_inpXML(&
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_vacuum),INTENT(IN) :: vacuum
TYPE(t_obsolete),INTENT(IN) :: obsolete
TYPE(t_kpts),INTENT(IN) :: kpts
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_hybrid),INTENT(IN) :: hybrid
......@@ -48,13 +47,9 @@ 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....
INTEGER, INTENT (IN) :: numSpecies
INTEGER, INTENT (IN) :: div(3)
INTEGER, INTENT (IN) :: atomTypeSpecies(atoms%ntype)
INTEGER, INTENT (IN) :: speciesRepAtomType(numSpecies)
LOGICAL, INTENT (IN) :: l_gamma, l_outFile, l_explicitIn
REAL, INTENT (IN) :: a1(3),a2(3),a3(3)
CHARACTER(len=3),INTENT(IN) :: noel(atoms%ntype)
CHARACTER(len=4),INTENT(IN) :: namex
CHARACTER(len=12),INTENT(IN):: relcor
CHARACTER(LEN=*),INTENT(IN) :: filename
......@@ -62,9 +57,15 @@ SUBROUTINE w_inpXML(&
CHARACTER(len=8),INTENT(IN),OPTIONAL:: name_opt(10)
INTEGER :: iSpecies, fileNum
INTEGER :: iSpecies, fileNum
CHARACTER(len=8) :: name(10)
INTEGER :: numSpecies
INTEGER :: speciesRepAtomType(numSpecies)
CHARACTER(len=20):: speciesNames(atoms%ntype)
LOGICAL :: known_species
!+lda+u
REAL u,j
INTEGER l, i_u
......@@ -433,6 +434,18 @@ SUBROUTINE w_inpXML(&
uIndices(2,atoms%lda_u(i_u)%atomType) = i_u
END DO
!Build list of species
speciesNames=''
numSpecies=0
DO n=1,atoms%ntype
known_species=any(trim(adjustl(atoms%speciesname(n)))==trim(adjustl(speciesNames(:numSpecies))))
if (.not.known_species) THEN
numSpecies=numSpecies+1
speciesNames(numSpecies)=atoms%speciesname(n)
speciesRepAtomType(numSpecies)=n
end if
enddo
WRITE (fileNum,'(a)') ' <atomSpecies>'
DO iSpecies=1, numSpecies
iAtomType = speciesRepAtomType(iSpecies)
......@@ -442,7 +455,7 @@ SUBROUTINE w_inpXML(&
! <species name="Si-1" element="Si" atomicNumber="14" coreStates="4" magMom="0.0" flipSpin="F">
300 FORMAT(' <species name="',a,'" element="',a,'" atomicNumber="',i0,'" magMom="',f0.8,'" flipSpin="',l1,'">')
speciesName = TRIM(ADJUSTL(atoms%speciesName(iSpecies)))
WRITE (fileNum,300) TRIM(ADJUSTL(speciesName)),TRIM(ADJUSTL(noel(iAtomType))),atoms%nz(iAtomType),atoms%bmu(iAtomType),atoms%nflip(iAtomType)
WRITE (fileNum,300) TRIM(ADJUSTL(speciesName)),TRIM(ADJUSTL(namat_const(nint(atoms%nz(iAtomType)+1)))),atoms%nz(iAtomType),atoms%bmu(iAtomType),atoms%nflip(iAtomType)
! <mtSphere radius="2.160000" gridPoints="521" logIncrement="0.022000"/>
310 FORMAT(' <mtSphere radius="',f0.8,'" gridPoints="',i0,'" logIncrement="',f0.8,'"/>')
......
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