Commit c1b62fb2 authored by Gregor Michalicek's avatar Gregor Michalicek

Formalized bfh buffer and delet the file at the end of inpgen

parent a14a5ef7
......@@ -7,7 +7,7 @@
MODULE m_atominput
use m_juDFT
INTEGER, PARAMETER :: dbgfh=6, errfh=6, bfh=93, warnfh=6
INTEGER, PARAMETER :: dbgfh=6, errfh=6, warnfh=6
REAL, PARAMETER :: eps=0.00000001
CONTAINS
......@@ -16,7 +16,7 @@
! file. Part of inp-generator
!***********************************************************************
SUBROUTINE atom_input(
> infh,xl_buffer,buffer,
> infh,xl_buffer,bfh,buffer,
> jspins,film,idlist,xmlCoreRefOccs,
X nline,xmlElectronStates,
X xmlPrintCoreStates,xmlCoreOccs,
......@@ -36,6 +36,7 @@
! ... Arguments ...
INTEGER, INTENT (IN) :: infh ! file number of input-file
INTEGER, INTENT (IN) :: bfh
INTEGER, INTENT (INOUT) :: nline ! current line in this file
INTEGER, INTENT (INOUT) :: nel ! number of valence electrons
......@@ -125,7 +126,7 @@
IF (nbuffer == 0) THEN
DO
CALL read_record(infh,xl_buffer,nline,nbuffer,buffer,ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
IF (ios==1) GOTO 999
IF (ios == 2) CALL juDFT_error
+ ("end of file while reading a record",
......@@ -150,7 +151,7 @@
ELSE
!---> read defaults for atom defaults
CALL read_allatoms(
> l_buffer,
> bfh,l_buffer,
< rmt0_def,dx0_def,jri0_def,lmax0_def,
< lnonsph0_def,ncst0_def,econfig0_def,
< bmu0_def,ios)
......@@ -211,7 +212,7 @@
!---> read namelist
CALL read_atom(
> l_buffer,lotype,
> bfh,l_buffer,lotype,
< id,zat0,rmt0,jri0,dx0,lmax0,lnonsph0,
< ncst0,econfig0,bmu0,lo0,nlod0,llod,ios)
IF (ios.ne.0) THEN
......@@ -699,7 +700,7 @@ c in s and p states equal occupation of up and down states
!----------------------------------------------------------------
!================================================================
SUBROUTINE read_allatoms(
> l_buffer,
> bfh,l_buffer,
X rmt,dx,jri,lmax,lnonsph,ncst,econfig,
< bmu,ios)
!****************************************************************
......@@ -708,7 +709,7 @@ c in s and p states equal occupation of up and down states
IMPLICIT NONE
INTEGER, INTENT (IN) :: l_buffer
INTEGER, INTENT (IN) :: bfh,l_buffer
INTEGER, INTENT (INOUT) :: jri ! mt radial mesh points
INTEGER, INTENT (INOUT) :: lmax ! max. l to include for density, overlap etc.
INTEGER, INTENT (INOUT) :: lnonsph ! max. l for nonspherical MT-contributions
......@@ -727,7 +728,7 @@ c in s and p states equal occupation of up and down states
END SUBROUTINE read_allatoms
!================================================================
SUBROUTINE read_atom(
> l_buffer,lotype,
> bfh,l_buffer,lotype,
X id,z,rmt,jri,dx,lmax,lnonsph,ncst,econfig,
< bmu,lo,nlod,llod,ios )
!***********************************************************************
......@@ -738,7 +739,7 @@ c in s and p states equal occupation of up and down states
IMPLICIT NONE
! ... arguments ...
INTEGER, INTENT (IN) :: l_buffer
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
......
......@@ -25,9 +25,9 @@ PROGRAM inpgen
USE m_types
IMPLICIT NONE
INTEGER natmax,nop48,nline,natin,ngen,i,j
INTEGER natmax,nop48,nline,natin,ngen,i,j,bfh
INTEGER nops,no3,no2,na,numSpecies,i_c
INTEGER infh,errfh,bfh,warnfh,symfh,dbgfh,outfh,dispfh
INTEGER infh,errfh,warnfh,symfh,dbgfh,outfh,dispfh
LOGICAL cal_symm,checkinp,newSpecies
LOGICAL cartesian,oldfleur,l_hyb ,inistop
REAL aa
......@@ -59,13 +59,14 @@ PROGRAM inpgen
ngen = 0
infh = 5
errfh = 6 ; warnfh = 6 ; dbgfh = 6 ; outfh = 6
bfh = 93
symfh = 94
symfn = 'sym '
dispfh = 97
dispfn='disp'
nline = 0
bfh = 93
input%l_inpXML = .FALSE.
ALLOCATE ( mmrot(3,3,nop48), ttr(3,nop48) )
......@@ -73,9 +74,10 @@ PROGRAM inpgen
! OPEN (5,file='inp2',form='formatted',status='old')
OPEN (6,file='out',form='formatted',status='unknown')
OPEN (bfh,file='bfh.txt',form='formatted',status='unknown')
CALL struct_input(&
& infh,errfh,bfh,warnfh,symfh,symfn,&
& infh,errfh,warnfh,symfh,symfn,bfh,&
& natmax,nop48,&
& nline,xl_buffer,buffer,&
& title,input%film,cal_symm,checkinp,sym%symor,&
......@@ -193,7 +195,7 @@ PROGRAM inpgen
ALLOCATE ( atoms%rmt(atoms%ntype) )
atoms%nlod=9 ! This fixed dimensioning might have to be made more dynamical!
CALL set_inp(&
& infh,nline,xl_buffer,buffer,l_hyb,&
& infh,nline,xl_buffer,bfh,buffer,l_hyb,&
& atoms,sym,cell,title,idlist,&
& input,vacuum,noco,&
& atomTypeSpecies,speciesRepAtomType,&
......@@ -202,6 +204,8 @@ PROGRAM inpgen
DEALLOCATE (atomTypeSpecies,speciesRepAtomType)
DEALLOCATE ( ntyrep, natype, natrep, atomid )
CLOSE(bfh,STATUS='delete')
!
! --> Structure in povray or xsf-format
!
......
......@@ -3,11 +3,11 @@
!-----------------------------------------------------------------------
! read in some lapw-specific input or set appropriate defauts
!-----------------------------------------------------------------------
INTEGER, PARAMETER :: dbgfh=6, errfh=6, bfh=93, warnfh=6
INTEGER, PARAMETER :: dbgfh=6, errfh=6, warnfh=6
CONTAINS
SUBROUTINE lapw_input(
> infh,nline,xl_buffer,buffer,
> infh,nline,xl_buffer,bfh,buffer,
< jspins,kcrel,ndvgrd,nkpt,div,
< frcor,ctail,chng,tria,kmax,gmax,gmaxxc,
< igrd,dvac,dtild,tkb,namex,relcor)
......@@ -15,7 +15,7 @@
USE m_readrecord
IMPLICIT NONE
INTEGER, INTENT (IN) :: xl_buffer,infh
INTEGER, INTENT (IN) :: xl_buffer,infh,bfh
INTEGER, INTENT (OUT) :: jspins,kcrel,ndvgrd,nkpt,div(3)
INTEGER, INTENT (OUT) :: igrd
LOGICAL, INTENT (OUT) :: frcor,ctail,tria
......@@ -60,7 +60,7 @@
IF (nbuffer == 0) then
DO
CALL read_record(infh,xl_buffer,nline,nbuffer,buffer,ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
IF (ios==1) GOTO 999
IF (ios == 2) CALL juDFT_error
+ ("end of file while reading a record",calledby
......
......@@ -19,7 +19,7 @@
!***********************************************************************
CONTAINS
SUBROUTINE read_record(
> infh,xl_buffer,
> infh,xl_buffer,bfh,
X nline,
< nbuffer,buffer,ios )
......@@ -27,6 +27,7 @@
INTEGER, INTENT (IN) :: infh ! input filehandle (5)
INTEGER, INTENT (IN) :: xl_buffer ! maximum length of read record
INTEGER, INTENT (IN) :: bfh
INTEGER, INTENT (INOUT) :: nline ! in: last line read ; on output new read lines added
INTEGER, INTENT (OUT) :: nbuffer, ios ! read buffer & I/O status
CHARACTER(len=xl_buffer), INTENT (OUT) :: buffer
......@@ -37,7 +38,7 @@
LOGICAL, SAVE :: reached_EOF = .false.
INTEGER, PARAMETER :: dbgfh=6, errfh=6, bfh=93
INTEGER, PARAMETER :: dbgfh=6, errfh=6
!---> initialize some variables
building = .false.
......
......@@ -13,7 +13,7 @@
!---------------------------------------------------------------------
CONTAINS
SUBROUTINE set_inp(&
& infh,nline,xl_buffer,buffer,l_hyb,&
& infh,nline,xl_buffer,bfh,buffer,l_hyb,&
& atoms,sym,cell,title,idlist,&
& input,vacuum,noco,&
& atomTypeSpecies,speciesRepAtomType,&
......@@ -41,7 +41,7 @@
TYPE(t_cell),INTENT(INOUT) :: cell
TYPE(t_atoms),INTENT(INOUT) :: atoms
INTEGER, INTENT (IN) :: infh,xl_buffer
INTEGER, INTENT (IN) :: infh,xl_buffer,bfh
INTEGER, INTENT (INOUT) :: nline
INTEGER, INTENT (IN) :: atomTypeSpecies(atoms%ntype)
INTEGER, INTENT (IN) :: speciesRepAtomType(atoms%nat)
......@@ -221,7 +221,7 @@
ALLOCATE (enpara%enmix(input%jspins))
CALL atom_input(&
& infh,xl_buffer,buffer,&
& infh,xl_buffer,bfh,buffer,&
& input%jspins,input%film,idlist,xmlCoreRefOccs,&
& nline,&
& xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
......@@ -350,7 +350,7 @@
! read some lapw input
!
CALL lapw_input(&
& infh,nline,xl_buffer,buffer,&
& infh,nline,xl_buffer,bfh,buffer,&
& input%jspins,input%kcrel,obsolete%ndvgrd,kpts%nkpt,div,&
& input%frcor,input%ctail,obsolete%chng,input%tria,input%rkmax,stars%gmax,xcpot%gmaxxc,&
& xcpot%igrd,vacuum%dvac,dtild,input%tkb,namex,relcor)
......
......@@ -5,7 +5,7 @@
!********************************************************************
CONTAINS
SUBROUTINE struct_input(
> infh,errfh,bfh,warnfh,symfh,symfn,
> infh,errfh,warnfh,symfh,symfn,bfh,
> natmax,nop48,
X nline,xl_buffer,buffer,
< title,film,cal_symm,checkinp,symor,
......@@ -20,7 +20,7 @@
IMPLICIT NONE
!===> Arguments
INTEGER, INTENT (IN) :: infh, errfh, bfh, warnfh, symfh
INTEGER, INTENT (IN) :: infh, errfh, warnfh, symfh,bfh
INTEGER, INTENT (IN) :: natmax, nop48, xl_buffer
INTEGER, INTENT (INOUT) :: nline
CHARACTER(len=xl_buffer) :: buffer
......@@ -104,7 +104,7 @@
!===> start reading input
CALL read_record(
> infh,xl_buffer,
> infh,xl_buffer,bfh,
X nline,
< nbuffer,buffer,ios )
......@@ -113,7 +113,7 @@
IF ( buffer(1:1) == '&' ) THEN ! already read some input
title = 'unnamed project'
ELSE
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios )
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
ENDIF
IF ( buffer(1:6)=='&input' ) THEN ! get namelist 'input'
......@@ -133,7 +133,7 @@
!dbg-
ENDIF
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios )
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
ENDIF
IF ( buffer(1:1) == '&' ) THEN
......@@ -195,12 +195,12 @@
a1(1)=evaluatefirst(buffer)
a1(2)=evaluatefirst(buffer)
a1(3)=evaluatefirst(buffer)
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
!READ (buffer,*) a2
a2(1)=evaluatefirst(buffer)
a2(2)=evaluatefirst(buffer)
a2(3)=evaluatefirst(buffer)
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
!READ (buffer,*, err=811,end=811, iostat=ios) a3, dvac
a3(1)=evaluatefirst(buffer)
a3(2)=evaluatefirst(buffer)
......@@ -216,13 +216,13 @@
!---> read in overall lattice constant
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
!READ (buffer,*) aa
aa=evaluatefirst(buffer)
!---> read in scale
scale = 0.00
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
!READ (buffer,*) scale
scale(1)=evaluatefirst(buffer)
scale(2)=evaluatefirst(buffer)
......@@ -252,7 +252,7 @@
!---> read in number of atoms or types
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios )
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
!READ (buffer,*) natin
natin=evaluatefirst(buffer)
!---> read in atomic positions
......@@ -261,7 +261,7 @@
!---> (atomid is used later as default for atom Z value (zatom)
DO n = 1, abs(natin)
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
!READ (buffer,*) atomid(n), atompos(:,n)
atomid(n)=evaluatefirst(buffer)
atompos(1,n)=evaluatefirst(buffer)
......@@ -269,7 +269,7 @@
atompos(3,n)=evaluatefirst(buffer)
ENDDO
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios )
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
IF ( buffer(1:6)=='&shift') then
buffer = buffer(7:len_trim(buffer)-1)
......@@ -283,7 +283,7 @@
atompos(n,1:abs(natin)) = atompos(n,1:abs(natin))+shift(n)
ENDDO
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
ENDIF
IF ( buffer(1:7)=='&factor') THEN
......@@ -298,7 +298,7 @@
atompos(n,1:abs(natin)) = atompos(n,1:abs(natin))/factor(n)
ENDDO
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
ENDIF
IF ( buffer(1:1).NE.'&') THEN
......@@ -374,7 +374,7 @@
cal_symm = .false.
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
ENDIF ! &gen or &sym
......@@ -384,7 +384,7 @@
buffer = ADJUSTL(buffer(5:nbuffer))
nbuffer = LEN_TRIM(buffer)
READ (buffer,*,err=913, end=913, iostat=ios) theta,phi
CALL read_record( infh, xl_buffer, nline, nbuffer, buffer, ios)
CALL read_record(infh,xl_buffer,bfh,nline,nbuffer,buffer,ios)
ENDIF
IF ( buffer(1:4)=='&qss' ) THEN
l_ss=.true.
......
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