Commit ac77ff17 authored by Gregor Michalicek's avatar Gregor Michalicek

Implemented naming of species in input for inpgen

It can now be specified according to the following example:

&atom element="Na" id=11.1 name="mySodium" /
parent b11d972d
......@@ -251,6 +251,7 @@
!pos of atom (relat)(3,nat)
REAL,ALLOCATABLE::taual(:,:)
!lda_u information(ntype)
CHARACTER(len=20), ALLOCATABLE :: speciesName(:)
TYPE(t_utype),ALLOCATABLE::lda_u(:)
INTEGER,ALLOCATABLE :: relax(:,:) !<(3,ntype)
INTEGER, ALLOCATABLE :: nflip(:) !<flip magnetisation of this atom
......
......@@ -20,6 +20,7 @@
> input,idlist,xmlCoreRefOccs,
X nline,xmlElectronStates,
X xmlPrintCoreStates,xmlCoreOccs,
> atomTypeSpecies,numSpecies,
< nel,atoms,enpara )
USE m_types
......@@ -38,10 +39,12 @@
! ... Arguments ...
INTEGER, INTENT (IN) :: infh ! file number of input-file
INTEGER, INTENT (IN) :: bfh
INTEGER, INTENT (IN) :: numSpecies
INTEGER, INTENT (INOUT) :: nline ! current line in this file
INTEGER, INTENT (INOUT) :: nel ! number of valence electrons
INTEGER, INTENT (IN) :: xl_buffer
INTEGER, INTENT (IN) :: atomTypeSpecies(atoms%ntype)
REAL , INTENT (IN) :: idlist(atoms%ntype)
REAL , INTENT (IN) :: xmlCoreRefOccs(29)
REAL, INTENT (INOUT) :: xmlCoreOccs(2,29,atoms%ntype)
......@@ -74,6 +77,7 @@
CHARACTER(len= l_buffer) :: econfig(atoms%ntype) ! verbose electronic config
CHARACTER(len=80) :: lo(atoms%ntype), lo0
CHARACTER(len=13) :: fname
CHARACTER(LEN=20) :: speciesName0
CHARACTER(len=1) :: lotype(0:3)
......@@ -209,12 +213,14 @@
econfig0 = 'NONE'
bmu0 = -9999.9
lo0 = ' '
speciesName0 = ''
!---> read namelist
CALL read_atom(
> bfh,l_buffer,lotype,
< id,zat0,rmt0,jri0,dx0,lmax0,lnonsph0,
< ncst0,econfig0,bmu0,lo0,nlod0,llod,ios)
< ncst0,econfig0,speciesName0,bmu0,lo0,nlod0,llod,
< ios)
IF (ios.ne.0) THEN
CALL err(3)
ELSE
......@@ -226,6 +232,24 @@
fatalerror=.true.
EXIT
ELSE
IF (speciesName0.NE.'') THEN
atoms%speciesName(atomTypeSpecies(n)) =
& TRIM(ADJUSTL(speciesName0))
DO i = 1, numSpecies
IF (i.NE.atomTypeSpecies(n)) THEN
IF((TRIM(ADJUSTL(speciesName0))).EQ.
& (TRIM(ADJUSTL(atoms%speciesName(i))))) THEN
WRITE(*,*) ''
WRITE(*,*) 'Error for species name'
WRITE(*,*) TRIM(ADJUSTL(speciesName0))
WRITE(*,*) ''
CALL juDFT_error
+ ("Same name for different species",
+ calledby ="atom_input")
END IF
END IF
END DO
END IF
IF (rmt0 > -9999.8) THEN
atoms%rmt(n) = rmt0
WRITE (6,'(a9,i4,2a2,a16,f12.6)') 'for atom ',n,
......@@ -768,7 +792,7 @@ c in s and p states equal occupation of up and down states
SUBROUTINE read_atom(
> bfh,l_buffer,lotype,
X id,z,rmt,jri,dx,lmax,lnonsph,ncst,econfig,
< bmu,lo,nlod,llod,ios )
< speciesName,bmu,lo,nlod,llod,ios )
!***********************************************************************
! reads in muffin-tin radius, mesh, etc.
!***********************************************************************
......@@ -777,32 +801,38 @@ c in s and p states equal occupation of up and down states
IMPLICIT NONE
! ... arguments ...
INTEGER, INTENT (IN) :: bfh,l_buffer
REAL, INTENT (OUT) :: id,z,rmt,dx,bmu
INTEGER :: lmax,lnonsph,ncst,jri,nlod,llod
CHARACTER(len=l_buffer) :: econfig
CHARACTER(len=80) :: lo
INTEGER, INTENT (OUT) :: ios
CHARACTER(len=1), INTENT (IN) :: lotype(0:3)
INTEGER, INTENT (IN) :: bfh,l_buffer
REAL, INTENT (OUT) :: id,z,rmt,dx,bmu
INTEGER :: lmax,lnonsph,ncst,jri,nlod,llod
CHARACTER(len=l_buffer) :: econfig
CHARACTER(len=80) :: lo
CHARACTER(len=20), INTENT(OUT) :: speciesName
INTEGER, INTENT (OUT) :: ios
CHARACTER(len=1), INTENT (IN) :: lotype(0:3)
! ... internal variables ...
INTEGER :: i,j,k,l,n
REAL :: zz
CHARACTER(len=2) :: element
CHARACTER(len=20) :: name
CHARACTER(len=80) :: lo1
CHARACTER(len=2) :: lotype2(0:3)
DATA lotype2 /'sS','pP','dD','fF'/
NAMELIST /atom/ id,z,rmt,dx,jri,lmax,lnonsph,ncst,
& econfig,bmu,lo,element
& econfig,bmu,lo,element,name
id = -9999.9
z = -9999.9
element = ' '
speciesName = ''
name = ''
READ (bfh,atom,err=911,end=911,iostat=ios)
speciesName = TRIM(ADJUSTL(name))
! -> determine which atom we are concerned with ...
IF ((z < -9999.8).AND.(element.EQ.' ')) THEN
......
......@@ -24,16 +24,18 @@ PROGRAM inpgen
USE m_xsf_io, ONLY : xsf_write_atoms
USE m_types
USE m_inpgen_help
USE m_constants
IMPLICIT NONE
INTEGER natmax,nop48,nline,natin,ngen,i,j,bfh
INTEGER nops,no3,no2,na,numSpecies,i_c
INTEGER nops,no3,no2,na,numSpecies,i_c,element
INTEGER infh,errfh,warnfh,symfh,dbgfh,outfh,dispfh
LOGICAL cal_symm,checkinp,newSpecies
LOGICAL cartesian,oldfleur,l_hyb ,inistop
REAL aa
REAL a1(3),a2(3),a3(3),scale(3),factor(3)
INTEGER :: elementNumSpecies(0:104)
INTEGER, ALLOCATABLE :: mmrot(:,:,:)
REAL, ALLOCATABLE :: ttr(:, :),atompos(:, :),atomid(:)
REAL, ALLOCATABLE :: idlist(:)
......@@ -47,6 +49,7 @@ PROGRAM inpgen
CHARACTER(len=80):: title
CHARACTER(len=7) :: symfn
CHARACTER(len=4) :: dispfn
CHARACTER(LEN=8) :: tempNumberString
TYPE(t_input) :: input
TYPE(t_atoms) :: atoms
......@@ -175,9 +178,12 @@ PROGRAM inpgen
ALLOCATE (atomTypeSpecies(atoms%ntype))
ALLOCATE (speciesRepAtomType(atoms%nat))
ALLOCATE (atoms%speciesName(atoms%nat))
elementNumSpecies = 0
numSpecies = 0
speciesRepAtomType = -1
atomTypeSpecies = -1
atoms%speciesName = ''
DO i = 1, atoms%nat
newSpecies = .TRUE.
DO j = 1, i-1
......@@ -191,6 +197,12 @@ PROGRAM inpgen
numSpecies = numSpecies + 1
speciesRepAtomType(numSpecies) = natype(i)
atomTypeSpecies(natype(i)) = numSpecies
element = nint(atoms%zatom(natype(i)))
elementNumSpecies(element) = elementNumSpecies(element) + 1
tempNumberString = ''
WRITE(tempNumberString,'(i0)') elementNumSpecies(element)
atoms%speciesName(numSpecies) = &
TRIM(ADJUSTL(namat_const(element))) // '-' // TRIM(ADJUSTL(tempNumberString))
END IF
END DO
......@@ -203,10 +215,10 @@ PROGRAM inpgen
& infh,nline,xl_buffer,bfh,buffer,l_hyb,&
& atoms,sym,cell,title,idlist,&
& input,vacuum,noco,&
& atomTypeSpecies,speciesRepAtomType,&
& atomTypeSpecies,speciesRepAtomType,numSpecies,&
& a1,a2,a3)
DEALLOCATE (atomTypeSpecies,speciesRepAtomType)
DEALLOCATE (atoms%speciesName,atomTypeSpecies,speciesRepAtomType)
DEALLOCATE ( ntyrep, natype, natrep, atomid )
CLOSE(bfh,STATUS='delete')
......
......@@ -16,7 +16,7 @@
& infh,nline,xl_buffer,bfh,buffer,l_hyb,&
& atoms,sym,cell,title,idlist,&
& input,vacuum,noco,&
& atomTypeSpecies,speciesRepAtomType,&
& atomTypeSpecies,speciesRepAtomType,numSpecies,&
& a1,a2,a3)
USE iso_c_binding
......@@ -41,7 +41,7 @@
TYPE(t_cell),INTENT(INOUT) :: cell
TYPE(t_atoms),INTENT(INOUT) :: atoms
INTEGER, INTENT (IN) :: infh,xl_buffer,bfh
INTEGER, INTENT (IN) :: infh,xl_buffer,bfh,numSpecies
INTEGER, INTENT (INOUT) :: nline
INTEGER, INTENT (IN) :: atomTypeSpecies(atoms%ntype)
INTEGER, INTENT (IN) :: speciesRepAtomType(atoms%nat)
......@@ -66,7 +66,7 @@
CHARACTER(LEN=20) :: filename
INTEGER nu,iofile
INTEGER iggachk
INTEGER n ,iostat, errorStatus, numSpecies
INTEGER n ,iostat, errorStatus
REAL scale,scpos ,zc
TYPE(t_banddos)::banddos
......@@ -215,6 +215,7 @@
& input,idlist,xmlCoreRefOccs,&
& nline,&
& xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
& atomTypeSpecies,numSpecies,&
& nel,atoms,enpara)
DO n = 1, atoms%ntype
......@@ -469,7 +470,6 @@
STOP 'Error: Cannot print out FleurInputSchema.xsd'
END IF
filename = 'inp.xml'
numSpecies = atoms%nat
CALL w_inpXML(&
& atoms,obsolete,vacuum,input,stars,sliceplot,banddos,&
......
......@@ -1221,6 +1221,7 @@ SUBROUTINE r_inpXML(&
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ALLOCATE (speciesNames(numSpecies), speciesNLO(numSpecies))
ALLOCATE(atoms%speciesName(numSpecies))
atoms%numStatesProvided = 0
atoms%lapw_l(:) = -1
......@@ -1233,6 +1234,7 @@ SUBROUTINE r_inpXML(&
! Attributes of species
WRITE(xPathA,*) '/fleurInput/atomSpecies/species[',iSpecies,']'
speciesNames(iSpecies) = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA))//'/@name')))
atoms%speciesName(iSpecies) = TRIM(ADJUSTL(speciesNames(iSpecies)))
atomicNumber = evaluateFirstIntOnly(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA))//'/@atomicNumber'))
coreStates = evaluateFirstIntOnly(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA))//'/@coreStates'))
magMom = evaluateFirstOnly(xmlGetAttributeValue(TRIM(ADJUSTL(xPathA))//'/@magMom'))
......
......@@ -423,7 +423,8 @@ SUBROUTINE w_inpXML(&
300 FORMAT(' <species name="',a,'" element="',a,'" atomicNumber="',i0,'" coreStates="',i0,'" magMom="',f0.8,'" flipSpin="',l1,'">')
tempNumberString = ''
WRITE(tempNumberString,'(i0)') iSpecies
speciesName = TRIM(ADJUSTL(noel(iAtomType))) // '-' // TRIM(ADJUSTL(tempNumberString))
! speciesName = TRIM(ADJUSTL(noel(iAtomType))) // '-' // TRIM(ADJUSTL(tempNumberString))
speciesName = TRIM(ADJUSTL(atoms%speciesName(iSpecies)))
WRITE (fileNum,300) TRIM(ADJUSTL(speciesName)),TRIM(ADJUSTL(noel(iAtomType))),atoms%nz(iAtomType),atoms%ncst(iAtomType),atoms%bmu(iAtomType),atoms%nflip(iAtomType)
! <mtSphere radius="2.160000" gridPoints="521" logIncrement="0.022000"/>
......@@ -538,7 +539,8 @@ SUBROUTINE w_inpXML(&
330 FORMAT(' <atomGroup species="',a,'">')
tempNumberString = ''
WRITE(tempNumberString,'(i0)') iSpecies
speciesName = TRIM(ADJUSTL(noel(iAtomType))) // '-' // TRIM(ADJUSTL(tempNumberString))
! speciesName = TRIM(ADJUSTL(noel(iAtomType))) // '-' // TRIM(ADJUSTL(tempNumberString))
speciesName = TRIM(ADJUSTL(atoms%speciesName(iSpecies)))
WRITE (fileNum,330) TRIM(ADJUSTL(speciesName))
DO ieq=1,atoms%neq(iAtomType)
......
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