mirror of
https://github.com/TREX-CoE/fparser.git
synced 2024-08-24 22:21:45 +02:00
cleanup
This commit is contained in:
parent
a147bbeff9
commit
31dd42e876
BIN
parser/a.out
BIN
parser/a.out
Binary file not shown.
@ -12,24 +12,16 @@ PROGRAM iochamp
|
|||||||
!
|
!
|
||||||
implicit none
|
implicit none
|
||||||
!--------------------------------------------------------------- Local Variables
|
!--------------------------------------------------------------- Local Variables
|
||||||
integer, parameter :: maxa = 100
|
type(block_fdf) :: bfdf
|
||||||
logical :: doit, debug
|
type(parsed_line), pointer :: pline
|
||||||
|
|
||||||
character(len=72) :: fname, filename, fmt
|
logical :: debug
|
||||||
character(len=72) :: molecule_name, key, comment
|
|
||||||
character(2) :: symbol(maxa)
|
integer(sp) :: i, j, ia
|
||||||
character(len=20) :: chunks(10), subblock(10)
|
|
||||||
character(len=30) :: keyword(5)
|
character(len=72) :: fmt, key
|
||||||
integer(sp) :: i, j, ia, na, number_of_atoms
|
character(2), allocatable :: symbol(:)
|
||||||
integer(sp) :: isa(maxa)
|
|
||||||
real(dp) :: coeff(maxa)
|
|
||||||
real(sp) :: wmix
|
|
||||||
real(dp) :: phonon_energy
|
|
||||||
real(dp) :: xa(3, maxa)
|
|
||||||
real(dp) :: listr(maxa)
|
|
||||||
type(block_fdf) :: bfdf, bfdf2
|
|
||||||
type(parsed_line), pointer :: pline, pline2
|
|
||||||
real(dp) :: float_value
|
|
||||||
character(len=20) :: real_format = '(A, T28, F14.8)'
|
character(len=20) :: real_format = '(A, T28, F14.8)'
|
||||||
character(len=20) :: int_format = '(A, T34, I8)'
|
character(len=20) :: int_format = '(A, T34, I8)'
|
||||||
character(len=80) :: string_format = '(A, T40, A)'
|
character(len=80) :: string_format = '(A, T40, A)'
|
||||||
@ -37,9 +29,8 @@ PROGRAM iochamp
|
|||||||
|
|
||||||
! for determinants sections
|
! for determinants sections
|
||||||
integer :: nelectrons, nexcitation, iostat
|
integer :: nelectrons, nexcitation, iostat
|
||||||
integer, allocatable :: det_alpha(:), det_beta(:)
|
|
||||||
real(kind=8), allocatable :: det_coeff(:)
|
real(kind=8), allocatable :: det_coeff(:)
|
||||||
character(len=20) :: temp1, temp2, temp3, temp4, temp5
|
character(len=20) :: temp1, temp2, temp3
|
||||||
!------------------------------------------------------------------------- BEGIN
|
!------------------------------------------------------------------------- BEGIN
|
||||||
|
|
||||||
! Initialize
|
! Initialize
|
||||||
@ -58,6 +49,8 @@ PROGRAM iochamp
|
|||||||
write(6,*) '------------------------------------------------------'
|
write(6,*) '------------------------------------------------------'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
! Get all the filenames from which the data is to be read
|
! Get all the filenames from which the data is to be read
|
||||||
file_basis = fdf_load_filename('basis', 'default.gbs')
|
file_basis = fdf_load_filename('basis', 'default.gbs')
|
||||||
write(6,fmt=string_format) ' filename basis :: ', trim(file_basis)
|
write(6,fmt=string_format) ' filename basis :: ', trim(file_basis)
|
||||||
@ -75,22 +68,22 @@ PROGRAM iochamp
|
|||||||
optimize_wave = fdf_boolean("optimize_wave", .false.)
|
optimize_wave = fdf_boolean("optimize_wave", .false.)
|
||||||
! write(6,fmt=logical_format) 'optimize_wavefunction = ', optimize_wave
|
! write(6,fmt=logical_format) 'optimize_wavefunction = ', optimize_wave
|
||||||
|
|
||||||
! Integer numbers (keyword, default_value). The variable is assigned default_value when keyword is not present
|
|
||||||
|
|
||||||
|
! Integer numbers (keyword, default_value). The variable is assigned default_value when keyword is not present
|
||||||
nextorb = fdf_integer('nextorb', 0)
|
nextorb = fdf_integer('nextorb', 0)
|
||||||
! write(6,fmt=int_format) ' NExtOrb =', nextorb
|
! write(6,fmt=int_format) ' NExtOrb =', nextorb
|
||||||
|
|
||||||
! floats (keyword, default_value) variable is assigned default_value when keyword is not present
|
! floats (keyword, default_value) variable is assigned default_value when keyword is not present
|
||||||
|
|
||||||
sr_eps = fdf_double('sr_eps', 0.025d0)
|
sr_eps = fdf_double('sr_eps', 0.025d0)
|
||||||
! write(6,fmt=real_format) ' sr_eps:', sr_eps
|
! write(6,fmt=real_format) ' sr_eps:', sr_eps
|
||||||
|
|
||||||
! logical :: true, .true., yes, T, 1, and TRUE are equivalent
|
! logical :: true, .true., yes, T, 1, and TRUE are equivalent
|
||||||
debug = fdf_boolean('Debug', .TRUE.)
|
debug = fdf_boolean('Debug', .TRUE.)
|
||||||
! write(6,'(A, L2)') ' Debug:', debug
|
! write(6,'(A, L2)') ' Debug:', debug
|
||||||
|
|
||||||
! floats/integers/strings/boolean can be parsed generically using fdf_get
|
|
||||||
|
|
||||||
|
|
||||||
|
! floats/integers/strings/boolean can be parsed generically using fdf_get
|
||||||
sr_tau = fdf_get('sr_tau', 0.025d0)
|
sr_tau = fdf_get('sr_tau', 0.025d0)
|
||||||
! write(6,fmt=real_format) ' sr_tau:', sr_tau
|
! write(6,fmt=real_format) ' sr_tau:', sr_tau
|
||||||
|
|
||||||
@ -107,7 +100,7 @@ PROGRAM iochamp
|
|||||||
! write(6,fmt=logical_format) ' multiple_adiag:', multiple_adiag
|
! write(6,fmt=logical_format) ' multiple_adiag:', multiple_adiag
|
||||||
|
|
||||||
|
|
||||||
! mixed types in one line (for example, reading a number with units)
|
! mixed types in one line (for example, reading a number with units)
|
||||||
tau = fdf_get('tau', 0.05)
|
tau = fdf_get('tau', 0.05)
|
||||||
! write(6,fmt=real_format) ' DMC tau = ', tau
|
! write(6,fmt=real_format) ' DMC tau = ', tau
|
||||||
|
|
||||||
@ -115,7 +108,7 @@ PROGRAM iochamp
|
|||||||
! write(6,fmt=real_format) ' Energy CutOff in eV :: ', energy_trial
|
! write(6,fmt=real_format) ' Energy CutOff in eV :: ', energy_trial
|
||||||
|
|
||||||
|
|
||||||
! Pretty printing of above-mentioned keywords
|
! Pretty printing of above-mentioned keywords
|
||||||
write(6,'(A)')
|
write(6,'(A)')
|
||||||
write(6,*) '------------------------------------------------------'
|
write(6,*) '------------------------------------------------------'
|
||||||
|
|
||||||
@ -142,25 +135,6 @@ PROGRAM iochamp
|
|||||||
write(6,'(A)')
|
write(6,'(A)')
|
||||||
write(6,*) '------------------------------------------------------'
|
write(6,*) '------------------------------------------------------'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
! To Search a keyword inside a %block
|
|
||||||
|
|
||||||
if (fdf_block('general', bfdf)) then
|
|
||||||
write(*,*) "Inside general block"
|
|
||||||
i = 1
|
|
||||||
do while(fdf_bline(bfdf, pline))
|
|
||||||
doit = fdf_bsearch(pline, "pool")
|
|
||||||
write(*,*) "pool found", doit
|
|
||||||
i = i + 1
|
|
||||||
enddo
|
|
||||||
|
|
||||||
write(6,'(A)')
|
|
||||||
write(6,*) '------------------------------------------------------'
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (.not. fdf_block('molecule', bfdf)) then
|
if (.not. fdf_block('molecule', bfdf)) then
|
||||||
@ -173,6 +147,7 @@ PROGRAM iochamp
|
|||||||
read(12,*) natoms
|
read(12,*) natoms
|
||||||
print*, "natoms ", natoms
|
print*, "natoms ", natoms
|
||||||
if (.not. allocated(cent)) allocate(cent(3,natoms))
|
if (.not. allocated(cent)) allocate(cent(3,natoms))
|
||||||
|
if (.not. allocated(symbol)) allocate(symbol(natoms))
|
||||||
|
|
||||||
read(12,'(A)') key
|
read(12,'(A)') key
|
||||||
print*, "Comment :: ", trim(key)
|
print*, "Comment :: ", trim(key)
|
||||||
@ -206,6 +181,7 @@ PROGRAM iochamp
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if (.not. allocated(cent)) allocate(cent(3,natoms))
|
if (.not. allocated(cent)) allocate(cent(3,natoms))
|
||||||
|
if (.not. allocated(symbol)) allocate(symbol(natoms))
|
||||||
|
|
||||||
if (pline%ntokens == 4) then
|
if (pline%ntokens == 4) then
|
||||||
symbol(ia) = fdf_bnames(pline, 1)
|
symbol(ia) = fdf_bnames(pline, 1)
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
%module general
|
%module general
|
||||||
title "This is a sample input file."
|
title "This is a sample input file."
|
||||||
pool ./pool
|
pool ./pool
|
||||||
@ -49,4 +47,4 @@ Methane
|
|||||||
tau = 0.04
|
tau = 0.04
|
||||||
# Units can be specified after a number
|
# Units can be specified after a number
|
||||||
etrial = -15 Ha
|
etrial = -15 Ha
|
||||||
%endmodule
|
%endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user