1
0
mirror of https://github.com/TREX-CoE/fparser.git synced 2024-12-22 20:36:12 +01:00

cofig fortran edited to incorporate changes

This commit is contained in:
Ravindra Shinde 2021-02-11 21:59:19 +01:00
parent 8e4a092b2e
commit 562bacb8a5
5 changed files with 113 additions and 60 deletions

8
.gitignore vendored
View File

@ -8,3 +8,11 @@
*.out *.out
*.toc *.toc
auto/ auto/
.DS_Store
*.mod
*.o
test_m_config
*.a
example_1
example_2

1
config_fortran Submodule

@ -0,0 +1 @@
Subproject commit 9c32706691e9a2747d99e26a8b916a8c5c90a649

View File

@ -1,5 +1,5 @@
24 24
1,3,7-Trimethylpurine-2,6-dione caffeine
N 1.5808 0.7027 -0.2279 N 1.5808 0.7027 -0.2279
C 1.7062 -0.7374 -0.2126 C 1.7062 -0.7374 -0.2126
N 0.5340 -1.5671 -0.3503 N 0.5340 -1.5671 -0.3503

View File

@ -7,23 +7,27 @@ PROGRAM iochamp
implicit none implicit none
!--------------------------------------------------------------- Local Variables !--------------------------------------------------------------- Local Variables
integer, parameter :: maxa = 100 integer, parameter :: maxa = 100
logical :: doit, debug, check, val logical :: doit, debug, check, val, logic(10)
character(len=72) :: fname, axis, status, filename, title, molecule_name, key logical :: beginning, ending
character(len=72) :: fname, axis, status, filename, title
character(len=72) :: molecule_name, key, comment
character(2) :: symbol(maxa) character(2) :: symbol(maxa)
integer(sp) :: i, j, ia, na, external_entry character(len=20) :: chunks(10), subblock(10)
character(len=30) :: keyword(5), argument(5)
integer(sp) :: i, j, ia, na, external_entry, number_of_atoms
integer(sp) :: isa(maxa) integer(sp) :: isa(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)
real(dp) :: listr(maxa) real(dp) :: listr(maxa)
type(block_fdf) :: bfdf type(block_fdf) :: bfdf, bfdf2
type(parsed_line), pointer :: pline type(parsed_line), pointer :: pline, pline2
!type(fdf_file) :: fdffile !type(fdf_file) :: fdffile
integer :: nextorb, nblk_max, nopt_iter, max_iteration, max_iter integer :: nextorb, nblk_max, nopt_iter, max_iteration, max_iter
real(dp) :: energy_tol real(dp) :: energy_tol
real(dp) :: sr_tau, sr_eps, sr_adiag real(dp) :: sr_tau, sr_eps, sr_adiag
character(len=15) :: real_format = '(A, T20, F8.5)' character(len=20) :: real_format = '(A, T20, F8.5)'
character(len=15) :: int_format = '(A, T20, I8)' character(len=20) :: int_format = '(A, T20, I8)'
!------------------------------------------------------------------------- BEGIN !------------------------------------------------------------------------- BEGIN
@ -53,16 +57,16 @@ PROGRAM iochamp
! 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_tau = fdf_double('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
sr_eps = fdf_double('sr_eps', 0.001d0) sr_eps = fdf_get('sr_eps', 0.001d0)
write(6,fmt=real_format) 'sr_eps:', sr_eps write(6,fmt=real_format) 'sr_eps:', sr_eps
sr_adiag = fdf_double('sr_adiag', 0.01d0) sr_adiag = fdf_get('sr_adiag', 0.01d0)
write(6,fmt=real_format) 'sr_adiag:', sr_adiag write(6,fmt=real_format) 'sr_adiag:', sr_adiag
energy_tol = fdf_double('sr_tau', 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 ! logical :: true, .true., yes, T, and TRUE are equivalent
@ -80,35 +84,51 @@ PROGRAM iochamp
! block containing other key-value pairs (currently not working) ! block containing other key-value pairs (currently not working)
! if (fdf_block('optimization_flags', bfdf)) then if (fdf_block('optimization_flags', bfdf)) then
! ia = 1 write(*,*) "inside opt block"
! do while((fdf_bline(bfdf, pline)) .and. (ia .le. na)) i = 1
! ! doit = fdf_bboolean(pline, 1) do while(fdf_bline(bfdf, pline))
! doit = fdf_boolean("optimize_wavefunction", .true.) write(*,*) "some debug info pline" , pline%ntokens, pline%line
! write(6,*) 'optimize_wavefunction', doit keyword(i) = fdf_bnames(pline, 1)
argument(i) = fdf_bnames(pline, 2)
i = i + 1
enddo
endif
! doit = fdf_boolean('optimize_ci', .true.)
! write(6,*) 'optimize_ci', doit
! doit = fdf_boolean('optimize_jastrow', .true.) write(6,'(A,4X)') 'keywords', (keyword(i), i = 1, 4)
! write(6,*) 'optimize_jastrow:', doit write(6,'(A,4X)') 'arguments', (argument(i), i = 1, 4)
! doit = fdf_boolean('optimize_orbitals', .true.) do i = 1, 4
! write(6,*) 'optimize_orbitals:', doit write(*,*) "conversion" , fdf_boolean(argument(i), .false.)
! enddo enddo
! endif
doit = fdf_boolean("opt.optimize_wavefunction", .true.) ! write(6,'(A,4X)') 'optimize_wavefunction using bline', (subblock(i), i = 1, 4)
write(6,*) 'optimize_wavefunction', doit
doit = fdf_boolean('opt.optimize_ci', .true.) if (fdf_block('general', bfdf)) then
write(6,*) 'optimize_ci', doit 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
endif
doit = fdf_boolean('opt.optimize_jastrow', .true.)
write(6,*) 'optimize_jastrow:', doit
doit = fdf_boolean('opt.optimize_orbitals', .true.)
write(6,*) 'optimize_orbitals:', doit
doit = fdf_get("opt.optimize_wavefunction", .true.)
write(6,*) 'outside optimize_wavefunction', doit
doit = fdf_get('opt.optimize_ci', .true.)
write(6,*) 'outside optimize_ci', doit
doit = fdf_get('opt.optimize_jastrow', .true.)
write(6,*) 'outside optimize_jastrow:', doit
doit = fdf_get('opt.optimize_orbitals', .true.)
write(6,*) 'outside optimize_orbitals:', doit
@ -119,11 +139,14 @@ PROGRAM iochamp
if (fdf_defined('molecule')) then if (fdf_defined('molecule')) then
write(6,*) "molecule block has been defined :: molecule's geometry in angstrom units" write(6,*) "molecule block has been defined :: molecule's geometry in angstrom units"
molecule_name = fdf_string('molecule', 'h2o.xyz') ! molecule_name = fdf_string('molecule', 'h2o.xyz')
write(6,*) 'Name of xyz file:', molecule_name ! write(6,*) 'Name of xyz file:', molecule_name
na = 24 ! debug
if (fdf_block('molecule', bfdf)) then
ia = 1 ia = 1
do while(fdf_bline(bfdf, pline)) do while(fdf_bline(bfdf, pline))
! na = fdf_bintegers(pline, 1)
! write(*,*) na
symbol(ia) = fdf_bnames(pline, 1) symbol(ia) = fdf_bnames(pline, 1)
do i= 1, 3 do i= 1, 3
xa(i,ia) = fdf_breals(pline, i) xa(i,ia) = fdf_breals(pline, i)
@ -132,9 +155,10 @@ PROGRAM iochamp
enddo enddo
na = ia - 1 na = ia - 1
endif endif
endif
write(6,*) 'Coordinates from an external file:' write(6,*) 'Coordinates from an external file:'
do ia = 1, na do ia = 1, 24
write(6,'(A, 4x, 3F10.6)') symbol(ia), (xa(i,ia),i=1,3) write(6,'(A, 4x, 3F10.6)') symbol(ia), (xa(i,ia),i=1,3)
enddo enddo
@ -166,13 +190,24 @@ PROGRAM iochamp
if (fdf_block('Other-Block', bfdf)) then if (fdf_block('Other-Block', bfdf)) then
! Forward reading ! Forward reading
write(6,*) 'beginning of other block '
ia = 1 ia = 1
write(*,*) "linecount", fdf_block_linecount("Other-Block")
do while((fdf_bline(bfdf, pline)) .and. (ia .le. na)) do while((fdf_bline(bfdf, pline)) .and. (ia .le. na))
if (pline%ntokens == 1) then
number_of_atoms = fdf_bintegers(pline, 1)
write(*,*) "number of atoms", number_of_atoms
endif
na = 3
if (pline%ntokens == 4) then
symbol(ia) = fdf_bnames(pline, 1) symbol(ia) = fdf_bnames(pline, 1)
do i= 1, na do i= 1, na
xa(i,ia) = fdf_breals(pline, i) xa(i,ia) = fdf_breals(pline, i)
enddo enddo
ia = ia + 1 ia = ia + 1
endif
enddo enddo
write(6,*) 'Other-Block (Forward):' write(6,*) 'Other-Block (Forward):'

View File

@ -7,14 +7,14 @@ 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.0 energy_tol 0.004
opt.optimize_wavefunction no
opt.optimize_ci No
opt.optimize_jastrow yes
opt.optimize_orbitals False
%block optimization_flags
optimize_wavefunction no
optimize_ci No
optimize_jastrow yes
optimize_orbitals False
%endblock
# The sub blocks currently does not parse. # The sub blocks currently does not parse.
@ -35,7 +35,16 @@ opt.optimize_orbitals False
# Read molecule's geometry directly from the xyz file # Read molecule's geometry directly from the xyz file
# molecule caffeine.xyz %block molecule < "caffeine.xyz"
%block Other-Block
99
Nh 1.500000 1.108000 -3.000000
Ox 0.333000 0.000000 45.000000
Pd -1.431000 -1.108000 20.000000
%endblock Other-Block
# An alternative way to provide coordinates # An alternative way to provide coordinates