1
0
mirror of https://github.com/TREX-CoE/fparser.git synced 2025-01-10 21:18:38 +01:00

lists int and floats working within limits

This commit is contained in:
Ravindra Shinde 2021-02-19 02:05:50 +01:00
parent 44f8276ff6
commit 3c64728501
2 changed files with 43 additions and 77 deletions

View File

@ -16,6 +16,7 @@ PROGRAM iochamp
character(len=30) :: keyword(5), argument(5) character(len=30) :: keyword(5), argument(5)
integer(sp) :: i, j, ia, na, external_entry, number_of_atoms integer(sp) :: i, j, ia, na, external_entry, number_of_atoms
integer(sp) :: isa(maxa) integer(sp) :: isa(maxa)
real(dp) :: coeff(maxa)
real(sp) :: wmix real(sp) :: wmix
real(dp) :: cutoff, phonon_energy, factor real(dp) :: cutoff, phonon_energy, factor
real(dp) :: xa(3, maxa) real(dp) :: xa(3, maxa)
@ -276,93 +277,47 @@ PROGRAM iochamp
enddo enddo
endif endif
write(6,'(A)')
write(6,*) '------------------------------------------------------'
! if ( fdf_block('ListBlock',bfdf) ) then
! i = 0
! do while ( fdf_bline(bfdf,pline) )
! i = i + 1
! na = fdf_bnlists(pline)
! write(*,'(2(a,i0),a)') 'Listblock line: ',i,' has ',na,' lists'
! do ia = 1 , na
! j = -1
! call fdf_bilists(pline,ia,j,isa)
! write(*,'(tr5,2(a,i0),a)') 'list ',ia,' has ',j,' entries'
! call fdf_bilists(pline,ia,j,isa)
! write(*,'(tr5,a,1000(tr1,i0))') 'list: ',isa(1:j)
! end do
! end do
! end if
! Check lists if ( fdf_block('ListBlock',bfdf) ) then
if ( fdf_islinteger('MyList') .and. fdf_islist('MyList') & i = 0
.and. (.not. fdf_islreal('MyList')) ) then do while ( fdf_bline(bfdf,pline) )
na = -1 i = i + 1
call fdf_list('MyList',na,isa) na = fdf_bnlists(pline)
if ( na < 2 ) stop 1 write(*,'(2(a,i0),a)') 'Listblock line: ',i,' has ',na,' lists'
write(*,'(tr1,a,i0,a)') 'MyList has ',na,' entries' do ia = 1 , na
call fdf_list('MyList',na,isa) j = -1
write(*,'(tr5,a,1000(tr1,i0))') 'MyList: ',isa(1:na)
else
write(*,*)'MyList was not recognized'
stop 1
end if
if ( fdf_islinteger('MyListOne') .and. fdf_islist('MyListOne') & call fdf_bilists(pline,ia,j,isa)
.and. (.not. fdf_islreal('MyListOne')) ) then write(*,'(tr5,2(a,i0),a)') 'list ',ia,' has ',j,' entries'
na = -1 call fdf_bilists(pline,ia,j,isa)
call fdf_list('MyListOne',na,isa) write(*,'(tr5,a,1000(tr1,i0))') 'list: ',isa(1:j)
if ( na /= 1 ) stop 1
write(*,'(tr1,a,i0,a)') 'MyListOne has ',na,' entries' end do
call fdf_list('MyListOne',na,isa) end do
write(*,'(tr5,a,1000(tr1,i0))') 'MyListOne: ',isa(1:na)
else
write(*,*)'MyListOne was not recognized'
stop 1
end if end if
if ( fdf_islreal('MyListR') .and. fdf_islist('MyListR') &
.and. (.not. fdf_islinteger('MyListR')) ) then if ( fdf_islreal('list_floats') .and. fdf_islist('list_floats') &
.and. (.not. fdf_islinteger('list_floats')) ) then
na = -1 na = -1
call fdf_list('MyListR',na,listr) call fdf_list('list_floats',na,listr)
write(*,'(tr1,a,i0,a)') 'MyListR has ',na,' entries' write(*,'(tr1,a,i0,a)') 'list_floats has ',na,' entries'
if ( na < 2 ) stop 1 if ( na < 2 ) stop 1
call fdf_list('MyListR',na,listr) call fdf_list('list_floats',na,listr)
write(*,'(tr5,a,1000(tr1,f4.1))') 'MyListR: ',listr(1:na) write(*,'(tr5,a,1000(tr1,f12.8))') 'list_floats: ',listr(1:na)
else else
write(*,*)'MyListR was not recognized' write(*,*)'list_floats was not recognized'
stop 1 stop 1
end if end if
if ( fdf_islreal('MyListROne') .and. fdf_islist('MyListROne') &
.and. (.not. fdf_islinteger('MyListROne')) ) then
na = -1
call fdf_list('MyListROne',na,listr)
if ( na /= 1 ) stop 1
write(*,'(tr1,a,i0,a)') 'MyListROne has ',na,' entries'
call fdf_list('MyListROne',na,listr)
write(*,'(tr5,a,1000(tr1,f4.1))') 'MyListROne: ',listr(1:na)
else
write(*,*)'MyListROne was not recognized'
stop 1
end if
if ( fdf_islist('externalentry') ) then
write(*,*) 'externalentry is a list'
else
write(*,*) 'externalentry is not a list'
end if
external_entry = fdf_integer('externalentry', 60)
write(6,*) 'ExternalEntry:', external_entry
axis = fdf_string('AxisXY', 'Cartesian')
status = fdf_string('StatusXY', 'Enabled')
write(6,*) 'Axis: ', TRIM(axis), ' | ', TRIM(status)
! Shutdown and deallocates fdf structure
call fdf_shutdown() call fdf_shutdown()
!----------------------------------------------------------------------------END !----------------------------------------------------------------------------END

View File

@ -58,10 +58,10 @@ energy_tol 0.004
%block inline_xyz %block inline_xyz
3 3
hypothetical molecule
Nh 1.50 1.108000 -3 O 4.013 0.831 -9.083
Ox 0.333000 0 45 H 4.941 0.844 -8.837
Pd -1.431000 -1.108000 20 H 3.750 -0.068 -9.293
%endblock inline_xyz %endblock inline_xyz
@ -81,3 +81,14 @@ hypothetical molecule
## To include another file having fdf syntax ## To include another file having fdf syntax
%include temp.fdf %include temp.fdf
## Lists
%block ListBlock
list_integers [1 to 6 7 9 10 ] [ 1 to 7 8 9 11 12 ]
%endblock ListBlock
list_floats [ 0.94725807 -0.09274559 -0.05238276 -0.05238264 -0.04867531 -0.04162750 -0.04054186 -0.04017050 -0.04017045 -0.02963522 -0.02749165 -0.02351945 0.02056895 0.02056894 -0.01996166 0.01987062 0.01987060]