mirror of
https://github.com/TREX-CoE/fparser.git
synced 2025-01-02 17:45:59 +01:00
pretty print
This commit is contained in:
parent
b241e85a0a
commit
a147bbeff9
2
.gitignore
vendored
2
.gitignore
vendored
@ -14,4 +14,4 @@ test_m_config
|
|||||||
*.a
|
*.a
|
||||||
example_1
|
example_1
|
||||||
example_2
|
example_2
|
||||||
|
a.out
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
FC=ifort
|
FC=ifort
|
||||||
echo $FC
|
|
||||||
|
|
||||||
$FC -c m_periodic_table.F90 m_keywords.F90
|
$FC -c m_periodic_table.F90 m_keywords.F90
|
||||||
$FC interface.F90 m_keywords.o m_periodic_table.o /usr/local/lib/libfdf.a
|
$FC interface.F90 m_keywords.o m_periodic_table.o /usr/local/lib/libfdf.a
|
||||||
|
@ -1,27 +1 @@
|
|||||||
|
nspin1 = 1
|
||||||
|
|
||||||
ianalyt_lap 1 isc 2 nspin1 1 nspin2 1 ifock 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## file ends here
|
|
||||||
|
|
||||||
# global vmc/dmc settings
|
|
||||||
|
|
||||||
# &general unit Hartrees mass 0.5 nforce 1
|
|
||||||
# &general seed 1837465927472523
|
|
||||||
# &general ipr -1
|
|
||||||
|
|
||||||
#&dmc idmc 2
|
|
||||||
#&dmc nfprod 100
|
|
||||||
#&dmc ipq 1 itau_eff 1 iacc_rej 1 icross 1
|
|
||||||
#&dmc icuspg 0 idiv_v 0 icut_br 0 icut_e 0
|
|
||||||
|
|
||||||
#&vmc imetro 6
|
|
||||||
#&vmc deltar 5. deltat 1.
|
|
||||||
#&vmc delta 1. fbias 1.
|
|
||||||
|
|
||||||
#&pseudo nloc 4 nquad 6
|
|
||||||
|
@ -30,15 +30,15 @@ PROGRAM iochamp
|
|||||||
type(block_fdf) :: bfdf, bfdf2
|
type(block_fdf) :: bfdf, bfdf2
|
||||||
type(parsed_line), pointer :: pline, pline2
|
type(parsed_line), pointer :: pline, pline2
|
||||||
real(dp) :: float_value
|
real(dp) :: float_value
|
||||||
character(len=20) :: real_format = '(A, T20, F14.8)'
|
character(len=20) :: real_format = '(A, T28, F14.8)'
|
||||||
character(len=20) :: int_format = '(A, T20, 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)'
|
||||||
character(len=80) :: logical_format = '(A, T40, L)'
|
character(len=80) :: logical_format = '(A, T40, L)'
|
||||||
|
|
||||||
! for determinants sections
|
! for determinants sections
|
||||||
integer :: nelectrons, nexcitation, iostat
|
integer :: nelectrons, nexcitation, iostat
|
||||||
integer, allocatable :: det_alpha(:), det_beta(:)
|
integer, allocatable :: det_alpha(:), det_beta(:)
|
||||||
real(selected_real_kind(6,15)), allocatable :: det_coeff(:)
|
real(kind=8), allocatable :: det_coeff(:)
|
||||||
character(len=20) :: temp1, temp2, temp3, temp4, temp5
|
character(len=20) :: temp1, temp2, temp3, temp4, temp5
|
||||||
!------------------------------------------------------------------------- BEGIN
|
!------------------------------------------------------------------------- BEGIN
|
||||||
|
|
||||||
@ -49,90 +49,117 @@ PROGRAM iochamp
|
|||||||
write(6,*) '------------------------------------------------------'
|
write(6,*) '------------------------------------------------------'
|
||||||
! strings/characters
|
! strings/characters
|
||||||
title = fdf_string('title', 'Default title')
|
title = fdf_string('title', 'Default title')
|
||||||
write(6,'(A)') 'Title of the calculation :: ', title
|
write(6,fmt=string_format) ' Title of the calculation :: ', title
|
||||||
|
|
||||||
! Get the directory where the pooled data is kept
|
! Get the directory where the pooled data is kept
|
||||||
path_pool = fdf_string('pool', './')
|
path_pool = fdf_string('pool', './')
|
||||||
write(6,fmt=string_format) 'pool directory location :: ', path_pool
|
write(6,fmt=string_format) ' pool directory location :: ', path_pool
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
file_molecule = fdf_load_filename('molecule', '')
|
||||||
|
write(6,fmt=string_format) ' filename molecule :: ', trim(file_molecule)
|
||||||
|
|
||||||
file_determinants = fdf_load_filename('determinants', 'default.det')
|
file_determinants = fdf_load_filename('determinants', 'default.det')
|
||||||
write(6,fmt=string_format) 'filename determinants :: ', trim(file_determinants)
|
write(6,fmt=string_format) ' filename determinants :: ', trim(file_determinants)
|
||||||
|
|
||||||
|
|
||||||
write(6,*) '------------------------------------------------------'
|
write(6,*) '------------------------------------------------------'
|
||||||
|
|
||||||
! Logical variables
|
! Logical variables
|
||||||
optimize_wave = fdf_boolean("optimize_wave", .false.)
|
optimize_wave = fdf_boolean("optimize_wave", .false.)
|
||||||
write(6,*) ' 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
|
||||||
|
|
||||||
ncore = fdf_integer('ncore', 0)
|
nextorb = fdf_integer('nextorb', 0)
|
||||||
write(6,fmt=int_format) 'NCore =', ncore
|
! 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
|
||||||
|
|
||||||
nspin1 = fdf_get('nspin1', 1)
|
nspin1 = fdf_get('nspin1', 1)
|
||||||
write(6,fmt=int_format) 'nspin1 from global.fdf ', nspin1
|
! write(6,fmt=int_format) ' nspin1 from global ', nspin1
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
opt_method = fdf_get('opt_method', "sr_n")
|
opt_method = fdf_get('opt_method', "sr_n")
|
||||||
write(6,fmt=string_format) 'Optimization method ', opt_method
|
! write(6,fmt=string_format) ' Optimization method ', opt_method
|
||||||
|
|
||||||
multiple_adiag = fdf_get('multiple_adiag', .false.)
|
multiple_adiag = fdf_get('multiple_adiag', .false.)
|
||||||
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
|
||||||
|
|
||||||
etrial = fdf_physical('etrial', -20.d0, 'eV')
|
etrial = fdf_physical('etrial', -20.d0, 'eV')
|
||||||
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
|
||||||
|
write(6,'(A)')
|
||||||
|
write(6,*) '------------------------------------------------------'
|
||||||
|
|
||||||
|
write(6,fmt=string_format) ' Optimization method ', opt_method
|
||||||
|
|
||||||
|
write(6,fmt=logical_format) ' Optimize wavefunctions :: ', optimize_wave
|
||||||
|
write(6,fmt=logical_format) ' multiple_adiag :: ', multiple_adiag
|
||||||
|
write(6,fmt=logical_format) ' Debug :: ', debug
|
||||||
|
|
||||||
|
write(6,*) '-------------------------'
|
||||||
|
|
||||||
|
write(6,fmt=int_format) ' NExtOrb :: ', nextorb
|
||||||
|
write(6,fmt=int_format) ' Nspin1 from global :: ', nspin1
|
||||||
|
|
||||||
|
write(6,*) '-------------------------'
|
||||||
|
|
||||||
|
write(6,fmt=real_format) ' sr_tau :: ', sr_tau
|
||||||
|
write(6,fmt=real_format) ' energy_tol :: ', energy_tol
|
||||||
|
|
||||||
|
write(6,*) '-------------------------'
|
||||||
|
|
||||||
|
write(6,fmt=real_format) ' Trial Energy in eV :: ', energy_trial
|
||||||
|
|
||||||
write(6,'(A)')
|
write(6,'(A)')
|
||||||
|
|
||||||
write(6,*) '------------------------------------------------------'
|
write(6,*) '------------------------------------------------------'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
! write(6,'(A,4X)') 'optimize_wavefunction using bline', (subblock(i), i = 1, 4)
|
! To Search a keyword inside a %block
|
||||||
|
|
||||||
if (fdf_block('general', bfdf)) then
|
if (fdf_block('general', bfdf)) then
|
||||||
write(*,*) "inside general block"
|
write(*,*) "Inside general block"
|
||||||
i = 1
|
i = 1
|
||||||
do while(fdf_bline(bfdf, pline))
|
do while(fdf_bline(bfdf, pline))
|
||||||
doit = fdf_bsearch(pline, "pool")
|
doit = fdf_bsearch(pline, "pool")
|
||||||
write(*,*) "pool found", doit
|
write(*,*) "pool found", doit
|
||||||
i = i + 1
|
i = i + 1
|
||||||
enddo
|
enddo
|
||||||
endif
|
|
||||||
|
|
||||||
write(6,'(A)')
|
write(6,'(A)')
|
||||||
|
write(6,*) '------------------------------------------------------'
|
||||||
write(6,*) '------------------------------------------------------'
|
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -158,17 +185,17 @@ PROGRAM iochamp
|
|||||||
do ia= 1, natoms
|
do ia= 1, natoms
|
||||||
write(6,'(A4,3F10.6)') symbol(ia), (cent(i,ia),i=1,3)
|
write(6,'(A4,3F10.6)') symbol(ia), (cent(i,ia),i=1,3)
|
||||||
enddo
|
enddo
|
||||||
|
write(6,'(A)')
|
||||||
|
write(6,*) '------------------------------------------------------'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
write(6,'(A)')
|
|
||||||
write(6,*) '------------------------------------------------------'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (fdf_block('molecule', bfdf)) then
|
if (fdf_block('molecule', bfdf)) then
|
||||||
! External file reading
|
! External file reading
|
||||||
write(6,*) 'Beginning of external file coordinates block '
|
write(6,*) 'Beginning of molecular coordinates block '
|
||||||
ia = 1
|
ia = 1
|
||||||
|
|
||||||
do while((fdf_bline(bfdf, pline)))
|
do while((fdf_bline(bfdf, pline)))
|
||||||
@ -189,66 +216,15 @@ PROGRAM iochamp
|
|||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
write(6,*) 'Coordinates from single line Molecule block: '
|
write(6,*) 'Coordinates from Molecule block: '
|
||||||
do ia= 1, natoms
|
do ia= 1, natoms
|
||||||
write(6,'(A4,3F10.6)') symbol(ia), (cent(i,ia),i=1,3)
|
write(6,'(A4,3F10.6)') symbol(ia), (cent(i,ia),i=1,3)
|
||||||
enddo
|
enddo
|
||||||
endif
|
|
||||||
|
|
||||||
write(6,'(A)')
|
write(6,'(A)')
|
||||||
|
write(6,*) '------------------------------------------------------'
|
||||||
write(6,*) '------------------------------------------------------'
|
|
||||||
|
|
||||||
|
|
||||||
! Molecule coordinate block begins here for demonstration
|
|
||||||
|
|
||||||
if (fdf_block('Coordinates', bfdf)) then
|
|
||||||
ia = 1
|
|
||||||
do while(fdf_bline(bfdf, pline))
|
|
||||||
symbol(ia) = fdf_bnames(pline, 1)
|
|
||||||
do i= 1, 3
|
|
||||||
xa(i,ia) = fdf_bvalues(pline, i)
|
|
||||||
enddo
|
|
||||||
ia = ia + 1
|
|
||||||
enddo
|
|
||||||
write(6,*) 'Coordinates from explicit data block:'
|
|
||||||
do j = 1, ia
|
|
||||||
write(6,'(A, 4x, 3F10.6)') symbol(j), (xa(i,j),i=1,3)
|
|
||||||
enddo
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
write(6,*) '------------------------------------------------------'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
! Determinants as a block. read directly from the input file
|
|
||||||
! under construction
|
|
||||||
if (fdf_block('determinants', bfdf)) then
|
|
||||||
ia = 1
|
|
||||||
do while(fdf_bline(bfdf, pline))
|
|
||||||
symbol(ia) = fdf_bnames(pline, 1)
|
|
||||||
do i= 1, 3
|
|
||||||
xa(i,ia) = fdf_bvalues(pline, i)
|
|
||||||
enddo
|
|
||||||
ia = ia + 1
|
|
||||||
enddo
|
|
||||||
na = ia - 1
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
! if (fdf_block('Coordinates', bfdf)) then
|
|
||||||
! write(6,*) 'Coordinates:'
|
|
||||||
! do ia = 1, na
|
|
||||||
! write(6,'(A, 4x, 3F10.6)') symbol(ia), (xa(i,ia),i=1,3)
|
|
||||||
! enddo
|
|
||||||
! endif
|
|
||||||
|
|
||||||
|
|
||||||
write(6,*) '------------------------------------------------------'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -277,6 +253,8 @@ PROGRAM iochamp
|
|||||||
write(*,*) " number of alpha electrons ", nalpha
|
write(*,*) " number of alpha electrons ", nalpha
|
||||||
write(*,*) " number of beta electrons ", nbeta
|
write(*,*) " number of beta electrons ", nbeta
|
||||||
|
|
||||||
|
write(6,'(A)')
|
||||||
|
write(*,*) "Determinant Coefficients"
|
||||||
write(fmt,*) '(', ndeterminants, '(f11.8,1x))'
|
write(fmt,*) '(', ndeterminants, '(f11.8,1x))'
|
||||||
write(*,fmt) (det_coeff(i), i=1,ndeterminants)
|
write(*,fmt) (det_coeff(i), i=1,ndeterminants)
|
||||||
|
|
||||||
@ -287,9 +265,12 @@ PROGRAM iochamp
|
|||||||
read(11,*) (iworbd(j,i), j=1,nelectrons)
|
read(11,*) (iworbd(j,i), j=1,nelectrons)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
write(fmt,*) '(i4,1x)'
|
write(6,'(A)')
|
||||||
|
write(*,*) "Spin-alpha and Spin-beta determinants"
|
||||||
|
write(fmt,*) '(', nelectrons, '(i4,1x))'
|
||||||
do i = 1, ndeterminants
|
do i = 1, ndeterminants
|
||||||
write(*,'(<nelectrons>(i4, 1x))') (iworbd(j,i), j=1,nelectrons)
|
! write(*,'(<nelectrons>(i4, 1x))') (iworbd(j,i), j=1,nelectrons) ! For Intel Fortran
|
||||||
|
write(*,fmt) (iworbd(j,i), j=1,nelectrons)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
read(11,*) temp1
|
read(11,*) temp1
|
||||||
@ -297,12 +278,10 @@ PROGRAM iochamp
|
|||||||
close(11)
|
close(11)
|
||||||
|
|
||||||
endif ! condition if load determinant is present
|
endif ! condition if load determinant is present
|
||||||
|
write(6,'(A)')
|
||||||
|
write(6,*) '------------------------------------------------------'
|
||||||
endif ! condition determinant block not present
|
endif ! condition determinant block not present
|
||||||
|
|
||||||
write(6,'(A)')
|
|
||||||
|
|
||||||
write(6,*) '------------------------------------------------------'
|
|
||||||
|
|
||||||
|
|
||||||
call fdf_shutdown()
|
call fdf_shutdown()
|
||||||
|
@ -118,10 +118,8 @@ MODULE keywords
|
|||||||
public :: cutjas, cutoff_jastrow ! cutoff for Jastrow4,5,6 if cutjas=6,7
|
public :: cutjas, cutoff_jastrow ! cutoff for Jastrow4,5,6 if cutjas=6,7
|
||||||
public :: itau_eff, itau_effective
|
public :: itau_eff, itau_effective
|
||||||
|
|
||||||
public :: optimize_wavefunction
|
public :: optimize_wave
|
||||||
public :: optimize_ci
|
public :: optimize_ci
|
||||||
public :: optimize_jastrow
|
|
||||||
public :: optimize_orbitals
|
|
||||||
|
|
||||||
public :: ncore
|
public :: ncore
|
||||||
public :: nextorb
|
public :: nextorb
|
||||||
@ -317,10 +315,8 @@ MODULE keywords
|
|||||||
real(dp), pointer :: itau_effective => itau_eff
|
real(dp), pointer :: itau_effective => itau_eff
|
||||||
|
|
||||||
|
|
||||||
logical :: optimize_wavefunction
|
logical :: optimize_wave
|
||||||
logical :: optimize_ci
|
logical :: optimize_ci
|
||||||
logical :: optimize_jastrow
|
|
||||||
logical :: optimize_orbitals
|
|
||||||
logical :: multiple_adiag
|
logical :: multiple_adiag
|
||||||
|
|
||||||
integer :: ncore
|
integer :: ncore
|
||||||
|
@ -4,4 +4,5 @@ Methane
|
|||||||
C 0.0000 0.0000 0.0000
|
C 0.0000 0.0000 0.0000
|
||||||
H 0.2051 0.8240 -0.6786
|
H 0.2051 0.8240 -0.6786
|
||||||
H 0.3345 -0.9314 -0.4496
|
H 0.3345 -0.9314 -0.4496
|
||||||
H -1.0685 -0.0537 0.1921
|
H -1.0685 -0.0537 0.1921
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
title A Sample QMC input file parsed by libfdf interfaced to CHAMP
|
title This is a sample input file.
|
||||||
pool ./pool
|
pool ./pool
|
||||||
basis BFD-T-normf0.bas
|
basis cc-pVTZ.bas
|
||||||
determinants determinant.det
|
molecule methane.xyz
|
||||||
optimize_wavefunction T
|
determinants sample.det
|
||||||
ncore 0
|
optimize_wave T
|
||||||
|
nextorb 280
|
||||||
sr_eps 0.1000000000E-02
|
sr_eps 0.1000000000E-02
|
||||||
Debug T # default value
|
Debug T # default value
|
||||||
sr_tau 0.2500000000E-01
|
sr_tau 0.2500000000E-01
|
||||||
nspin1 1 # default value
|
nspin1 1
|
||||||
energy_tol 0.1000000000E-04
|
energy_tol 0.1000000000E-04
|
||||||
opt_method sr_n
|
opt_method sr_n
|
||||||
multiple_adiag F
|
multiple_adiag F
|
||||||
@ -18,10 +19,10 @@ etrial -408.1744362 eV
|
|||||||
%block molecule
|
%block molecule
|
||||||
5
|
5
|
||||||
Methane
|
Methane
|
||||||
C 0.0000 0.0000 0.0000
|
H 0.5288 0.1610 0.9359
|
||||||
H 0.5288 0.1610 0.9359
|
C 0.0000 0.0000 0.0000
|
||||||
H 0.2051 0.8240 -0.6786
|
H 0.2051 0.8240 -0.6786
|
||||||
H 0.3345 -0.9314 -0.4496
|
H 0.3345 -0.9314 -0.4496
|
||||||
H -1.0685 -0.0537 0.1921
|
H -1.0685 -0.0537 0.1921
|
||||||
%endblock molecule
|
%endblock molecule
|
||||||
#:defined? determinants T
|
#:defined? determinants T
|
||||||
|
Loading…
Reference in New Issue
Block a user