1
0
mirror of https://github.com/TREX-CoE/fparser.git synced 2024-12-23 04:44:04 +01:00

commiting output files also

This commit is contained in:
Ravindra Shinde 2021-02-23 10:43:38 +01:00
parent 21d0f0459c
commit 86c224105b
3 changed files with 133 additions and 51 deletions

View File

@ -4,6 +4,7 @@
PROGRAM iochamp PROGRAM iochamp
USE fdf USE fdf
USE prec USE prec
USE parse
implicit none implicit none
!--------------------------------------------------------------- Local Variables !--------------------------------------------------------------- Local Variables
integer, parameter :: maxa = 100 integer, parameter :: maxa = 100
@ -13,8 +14,8 @@ PROGRAM iochamp
character(len=72) :: molecule_name, key, comment character(len=72) :: molecule_name, key, comment
character(2) :: symbol(maxa) character(2) :: symbol(maxa)
character(len=20) :: chunks(10), subblock(10) character(len=20) :: chunks(10), subblock(10)
character(len=30) :: keyword(5), argument(5) character(len=30) :: keyword(5)
integer(sp) :: i, j, ia, na, external_entry, number_of_atoms integer(sp) :: i, j, ia, na, external_entry, number_of_atoms, ind
integer(sp) :: isa(maxa) integer(sp) :: isa(maxa)
real(dp) :: coeff(maxa) real(dp) :: coeff(maxa)
real(sp) :: wmix real(sp) :: wmix
@ -24,7 +25,7 @@ PROGRAM iochamp
type(block_fdf) :: bfdf, bfdf2 type(block_fdf) :: bfdf, bfdf2
type(parsed_line), pointer :: pline, pline2 type(parsed_line), pointer :: pline, pline2
!type(fdf_file) :: fdffile !type(fdf_file) :: fdffile
integer :: nextorb, nblk_max, nopt_iter, max_iteration, max_iter, linecount integer :: nextorb, nblk_max, nopt_iter, max_iteration, max_iter, linecount, argument(5)
real(dp) :: energy_tol, float_value real(dp) :: energy_tol, float_value
real(dp) :: sr_tau, sr_eps, sr_adiag real(dp) :: sr_tau, sr_eps, sr_adiag
character(len=20) :: real_format = '(A, T20, F14.5)' character(len=20) :: real_format = '(A, T20, F14.5)'
@ -42,7 +43,7 @@ PROGRAM iochamp
fname = fdf_string('title', 'Default title') fname = fdf_string('title', 'Default title')
write(6,'(A)') 'title of the calculation :: ', fname write(6,'(A)') 'title of the calculation :: ', fname
! 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) 'Next Orb =', nextorb write(6,fmt=int_format) 'Next Orb =', nextorb
@ -66,7 +67,15 @@ PROGRAM iochamp
energy_tol = fdf_get('energy_tol', 0.00001d0) energy_tol = fdf_get('energy_tol', 0.00001d0)
write(6,fmt=real_format) 'energy_tol:', energy_tol write(6,fmt=real_format) 'energy_tol:', energy_tol
! logical :: true, .true., yes, T, and TRUE are equivalent nopt_iter = fdf_integer('a', 0)
write(6,fmt=int_format) 'a =', nopt_iter
nopt_iter = fdf_integer('b', 0)
write(6,fmt=int_format) 'b =', nopt_iter
! logical :: true, .true., yes, T, 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
@ -92,22 +101,19 @@ PROGRAM iochamp
write(6,*) '------------------------------------------------------' write(6,*) '------------------------------------------------------'
! block containing other key-value pairs :: A temporary workaround ! block containing logical key-value pairs
if (fdf_block('optimization_flags', bfdf)) then doit = fdf_boolean("optimize_wavefunction", .True.)
write(*,*) "inside optimization_flags block" write(6,*) ' optimize_wavefunction = ', doit
linecount = fdf_block_linecount("optimization_flags")
i = 1 doit = fdf_boolean('optimize_ci', .True.)
do while(fdf_bline(bfdf, pline)) write(6,*) ' optimize_ci = ', doit
! write(*,*) "some debug info pline" , pline%ntokens, pline%line
keyword(i) = fdf_bnames(pline, 1) doit = fdf_boolean('optimize_jastrow', .True.)
argument(i) = fdf_bnames(pline, 2) write(6,*) ' optimize_jastrow = ', doit
i = i + 1
enddo doit = fdf_boolean('optimize_orbitals', .True.)
endif write(6,*) ' optimize_orbitals = ', doit
do i = 1, linecount
write(6,'(*(A,4X,A))') keyword(i), argument(i)
enddo
write(6,'(A)') write(6,'(A)')
@ -131,26 +137,6 @@ PROGRAM iochamp
write(6,*) '------------------------------------------------------' write(6,*) '------------------------------------------------------'
! This block currently fails as it is not possible to parse within the scope of a block
doit = fdf_get("optimize_wavefunction", .false.)
write(6,*) 'outside optimize_wavefunction', doit
doit = fdf_get('opt.optimize_ci', .false.)
write(6,*) 'outside optimize_ci', doit
doit = fdf_get('opt.optimize_jastrow', .false.)
write(6,*) 'outside optimize_jastrow:', doit
doit = fdf_get('opt.optimize_orbitals', .false.)
write(6,*) 'outside optimize_orbitals:', doit
write(6,'(A)')
write(6,*) '------------------------------------------------------'
if (fdf_block('molecule', bfdf)) then if (fdf_block('molecule', bfdf)) then

View File

@ -1,22 +1,24 @@
title "A Sample QMC input file parsed by libfdf interfaced to CHAMP" title "A Sample QMC input file parsed by libfdf interfaced to CHAMP"
nextorb 280
nblk_max 200
nopt_iter 2
sr_tau 1.023 sr_tau 1.023
sr_eps 0.001 sr_eps 0.001
sr_adiag 0.05 sr_adiag 0.05
energy_tol 0.004 energy_tol 0.004
a = 20
b = 30
%block optimization_flags optimize_wavefunction no
optimize_wavefunction no optimize_ci no
optimize_ci No optimize_jastrow yes
optimize_jastrow yes optimize_orbitals false
optimize_orbitals False
%endblock
nextorb 280
nblk_max 200
nopt_iter 20
@ -58,7 +60,7 @@ energy_tol 0.004
%block inline_xyz %block inline_xyz
3 3
sample comment
O 4.013 0.831 -9.083 O 4.013 0.831 -9.083
H 4.941 0.844 -8.837 H 4.941 0.844 -8.837
H 3.750 -0.068 -9.293 H 3.750 -0.068 -9.293

94
src/test-champ.out Normal file
View File

@ -0,0 +1,94 @@
#:block? new-style F
#:defined? new-style F
title A Sample QMC input file parsed by libfdf interfaced to CHAMP
nextorb 280
nblk_max 200
nopt_iter 20
sr_tau 1.023000000
sr_eps 0.1000000000E-02
sr_adiag 0.5000000000E-01
energy_tol 0.4000000000E-02
a 20
b 30
Debug T # default value
max_iteration 2147483647
float_value 0.3140000000E+11
Energy_Cutoff 36.74899422 Ry
# above item originally: Energy_Cutoff 500.0000000 eV
phonon-energy 0.4264063563E-01 eV
# above item originally: phonon-energy 344.0000000 cm**-1
optimize_wavefunction F
optimize_ci F
optimize_jastrow T
optimize_orbitals F
%block general
pool_directory pool
pseudopotential BFD
basis BFD-T-normf0
%endblock general
%block molecule
24
molecule 1,3,7-Trimethylpurine-2,6-dione
N 1.5808 0.7027 -0.2279
C 1.7062 -0.7374 -0.2126
N 0.5340 -1.5671 -0.3503
C 0.3231 1.3600 0.0274
C -0.8123 0.4553 0.0817
C -0.6967 -0.9322 -0.0662
N -2.1886 0.6990 0.2783
C -2.8512 -0.5205 0.2532
N -1.9537 -1.5188 0.0426
C 0.6568 -3.0274 -0.1675
O 2.8136 -1.2558 -0.1693
O 0.2849 2.5744 0.1591
C -2.8096 2.0031 0.5032
C 2.8301 1.5004 -0.1968
H -3.9271 -0.6787 0.3762
H 1.4823 -3.4046 -0.7865
H -0.2708 -3.5204 -0.4868
H 0.8567 -3.2990 0.8788
H -2.4123 2.7478 -0.2017
H -2.6042 2.3621 1.5221
H -3.8973 1.9344 0.3695
H 3.5959 1.0333 -0.8314
H 3.2249 1.5791 0.8255
H 2.6431 2.5130 -0.5793
%endblock molecule
%block Coordinates
C 0.00000 1.40272 0 # can have comments in between or after the data
H 0.00000 2.49029 0
C -1.21479 0.70136 0
H -2.15666 1.24515 0
C -1.21479 -0.70136 0
H -2.15666 -1.24515 0
C 0.00000 -1.40272 0
H 0.00000 -2.49029 0
C 1.21479 -0.70136 0
H 2.15666 -1.24515 0
C 1.21479 0.70136 0
H 2.15666 1.24515 0
%endblock Coordinates
%block inline_xyz
3
sample comment
O 4.013 0.831 -9.083
H 4.941 0.844 -8.837
H 3.750 -0.068 -9.293
%endblock inline_xyz
%block inline_xyz2
6
C 3.402 0.773 -9.252
C 4.697 0.791 -8.909
H 2.933 -0.150 -9.521
H 2.837 1.682 -9.258
H 5.262 -0.118 -8.904
H 5.167 1.714 -8.641
%endblock inline_xyz2
%block ListBlock
list_integers [1 to 6 7 9 10 ] [ 1 to 7 8 9 11 12 ]
%endblock ListBlock
#:lreal? list_floats T
#:list? list_floats T
#:linteger? list_floats F
list_floats 17
list_floats 17