1
0
mirror of https://github.com/TREX-CoE/fparser.git synced 2024-08-24 22:21:45 +02:00

periodic table started

This commit is contained in:
Ravindra Shinde 2021-02-25 01:34:11 +01:00
parent 344bd9b26d
commit 29b4f422dd
3 changed files with 215 additions and 91 deletions

View File

@ -21,11 +21,97 @@
MODULE keywords MODULE keywords
! use iochamp
use iso_fortran_env
implicit none implicit none
public :: public :: title
public :: irn, rand_seed
public :: ijas, form_jastrow ! form of Jastrow. (between 1 and 6, mostly we use 4)
public :: isc, form_jastrow_scaling ! isc form of scaling function for ri,rj,rij in Jastrow (between 1 and 7, mostly use 2,4,6,7)
! 2 [1-exp(scalek*r)]/scalek
! 3 [1-exp{-scalek*r-(scalek*r)**2/2}]/scalek
! 4 r/(1+scalek*r)
! 5 r/{1+(scalek*r)**2}**.5
! 6 Short-range version of 2 (range given bu cutjas)
! 7 Short-range version of 4 (range given bu cutjas)
public :: iperiodic, periodic
public :: ibasis, form_basis
public :: hb, hbar
public :: etrial, energy_trial
public :: eunit, energy_unit
public :: nstep, nsteps
public :: nblk, nblocks
public :: nblkeq, nequil_blocks ! number of equilibration blocks
public :: nconf, nconfigs ! target number of MC configurations in dmc
public :: nconf_new, nconfigs_new ! number of new MC configs. saved per processor.
public :: idump, unit_restart_dump ! unit of a dump restart file
public :: irstar, restart ! Currently integer :: restart from restart file; proposed logical
public :: isite, generate_config ! call sites to generate starting MC config. in vmc
public :: ipr, print_level ! print level
public :: imetro, form_metropolis ! form of Metropolis (6 is most efficient choice for most systems)
! 1 simple algorithm with force-bias
! 6 accelerated Metropolis algorithm from Cyrus' 1993 PRL
public :: delta, step_size ! step-size for simple algorithm
public :: deltar, step_size_radial ! radial step-size for accelerated algorithm
public :: deltat, step_size_angular ! angular step-size for accelerated algorithm
public :: fbias, force_bias ! force-bias. (Use 1 always).
public :: idmc, form_dmc ! form of dmc algorithm
! 1 simple dmc
! 2 improved dmc from Umrigar, Nightingale, Runge 1993 JCP
public :: nfprod ! number of products to undo for estimating population control bias in dmc
public :: tau ! time-step in dmc
public :: nloc, pseudo_format ! nonlocal pseudopotential
! 0 local
! 1 in Fahy format
! 2 in Troullier-Martins format (unformatted)
! 3 in Troullier-Martins format (formatted)
public :: nquad, nquadrature ! number of angular quadrature points for nonlocal psp.
public :: nelec ! number of electrons
public :: nup, nalpha ! number of up-spin electrons
public :: ndown, nbeta ! number of down-spin electrons
public :: nctype, ntypes_atom ! number of atom/center types
public :: ncent, natoms, ncenters, ncentres ! number of atoms/centers
public :: iwctype ! specify atom-type for each atom
public :: znuc, znuclear, atomic_number ! nuclear charge
public :: cent, atom_coords ! atom positions
public :: ndet, ndeterminants ! number of determinants in wavefunction
public :: nbasis ! number of basis functions
public :: norb, norbitals ! number of orbitals
public :: cdet, det_coeffs ! coefficients of determinants
public :: iworbd ! which orbitals enter in which determinants
public :: ianalyt_lap, analytic_laplacian ! analytic laplacian or not
public :: nspin2 ! 1,2,3,-1,-2 -> nspin2b=abs(nspin2)
! nspin2 > 0 nspin2 sets of a, c parms, nspin2b sets of b parms
! nocuspb=0 parallel e-e cusp conditions satisfied (b=1/2,1/4)
! nspin2 < 0 -> nspin2=1
! nspin2=1 sets of a and c parms, nspin2b sets of b parms
! -1 nocuspb=1 parallel e-e cusp conditions not satisfied (1/2,1/2)
! -2 nocuspb=0 parallel e-e cusp conditions satisfied (1/2,1/4)
public :: nord, order_poly ! order of the polynmial
public :: norda, order_poly_en ! order of the e-n polynmial in Jastrow4
public :: nordb, order_poly_ee ! order of the e-e polynmial in Jastrow4
public :: nordc, order_poly_een ! order of the e-e-n polynmial in Jastrow4
public :: cjas1 ! simple jastrow1 (0.5 to satisfy cusps, parallel-spins automatically take half this value)
public :: cjas2 ! simple jastrow1 parameter
public :: scalek, scaling_jastrow ! scale factor for Jastrow
public :: a1,a2 ! Jastrow parameters for Jastrow2
public :: a,b,c ! Jastrow parameters for Jastrow3
public :: a4,b,c ! Jastrow parameters for Jastrow4,5,6
public :: cutjas, cutoff_jastrow ! cutoff for Jastrow4,5,6 if cutjas=6,7
public :: itau_eff, itau_effective
! Following not yet added
! rlobx(y) Lobachevsky parameters for Fock expansion
! ipq,iacc_rej,icross,icuspg,idiv_v
! private variables
private :: private ::
@ -33,95 +119,73 @@ MODULE keywords
module procedure names module procedure names
end interface end interface
! derived data types
type, public :: atom_t
character(len=:) :: name
character(len=:) :: symbol
integer(int32) :: znuclear
real(real64) :: atomic_mass
end type atom_t
! declarations
public :: title
public :: irn, rand_seed
public :: ijas, form_jastrow
public :: isc, form_jastrow_scaling
public :: iperiodic, periodic
public :: ibasis, form_basis
public :: hb, hbar
public :: etrial, energy_trial
public :: eunit, energy_unit
public :: nstep, nsteps
public :: nblk, nblocks
public :: nblkeq, nequil_blocks
public :: nconf, nconfigs
public :: nconf_new, nconfigs_new
public :: idump, unit_restart_dump
public :: irstar, restart
public :: isite, generate_config
public :: ipr, print_level
public :: imetro, form_metropolis
public :: delta, step_size
public :: deltar, step_size_radial
public :: deltat, step_size_angular
public :: fbias, force_bias
public :: idmc, form_dmc
public :: nfprod
public :: tau
public :: nloc, pseudo_format
public :: nquad, nquadrature
public :: nelec
public :: nup, nalpha
public :: ndown, nbeta
public :: nctype, ntypes_atom
public :: ncent, natoms, ncenters, ncentres
public :: iwctype
public :: znuc, znuclear, atomic_number
public :: cent, atom_coords
public :: ndet, ndeterminants
public :: nbasis
public :: norb, norbitals
public :: cdet, det_coeffs
public :: iworbd
public :: ianalyt_lap, analytic_laplacian
public :: nspin2
public :: nord, order_poly
public :: norda, order_poly_en
public :: nordb, order_poly_ee
public :: nordc, order_poly_een
public :: cjas1
public :: cjas2
public :: scalek, scaling_jastrow
public :: a1,a2
public :: a,b,c
public :: a4,b,c
public :: cutjas, cutoff_jastrow
public :: itau_eff, itau_effective
! Dynamic list for parsed_line structures
type, public :: line_dlist
character(len=MAX_LENGTH) :: str
type(parsed_line), pointer :: pline => null()
!
type(line_dlist), pointer :: next => null()
type(line_dlist), pointer :: prev => null()
end type line_dlist
contains contains
! title title
! irn random number seeds (four 4-digit integers)
! ijas form of Jastrow. (between 1 and 6, mostly we use 4)
! isc form of scaling function for ri,rj,rij in Jastrow (between 1 and 7, mostly use 2,4,6,7,16,17)
! iperiodic 0 finite system
! >0 periodic system
! ibasis form of basis
! hb hbar=0.5 for Hartree units
! etrial guess for energy
! eunit 'Hartree'
! nstep number of steps per block
! nblk number of blocks
! nblkeq number of equilibration blocks
! nconf target number of MC configurations in dmc
! nconf_new number of new MC configs. saved per processor.
! idump dump restart file
! irstar restart from restart file
! isite call sites to generate starting MC config. in vmc
! ipr print level
! imetro form of Metropolis (6 is most efficient choice for most systems)
! 1 simple algorithm with force-bias
! 6 accelerated Metropolis algorithm from Cyrus' 1993 PRL
! delta step-size for simple algorithm
! deltar radial step-size for accelerated algorithm
! deltat angular step-size for accelerated algorithm
! fbias force-bias. (Use 1 always).
! idmc form of dmc algorithm
! 1 simple dmc
! 2 improved dmc from Umrigar, Nightingale, Runge 1993 JCP
! ipq,itau_eff,iacc_rej,icross,icuspg,idiv_v
! nfprod number of products to undo for estimating population control bias in dmc
! tau time-step in dmc
! nloc nonlocal pseudopotential
! 0 local
! 1 in Fahy format
! 2 in Troullier-Martins format (unformatted)
! 3 in Troullier-Martins format (formatted)
! nquad number of angular quadrature points for nonlocal psp.
! nelec number of electrons
! nup number of up-spin electrons
! nctype number of atom/center types
! ncent number of atoms/centers
! iwctype specify atom-type for each atom
! znuc nuclear charge
! cent atom positions
! ndet number of determinants in wavefunction
! nbasis number of basis functions
! norb number of orbitals
! cdet coefficients of determinants
! iworbd which orbitals enter in which determinants
! ianalyt_lap analytic laplacian or not
! ijas form of Jastrow. (between 1 and 6, mostly we use 4)
! isc form of scaling function for ri,rj,rij in Jastrow (between 1 and 7, mostly use 2,4,6,7)
! 2 [1-exp(scalek*r)]/scalek
! 3 [1-exp{-scalek*r-(scalek*r)**2/2}]/scalek
! 4 r/(1+scalek*r)
! 5 r/{1+(scalek*r)**2}**.5
! 6 Short-range version of 2 (range given bu cutjas)
! 7 Short-range version of 4 (range given bu cutjas)
! nspin2 1,2,3,-1,-2 -> nspin2b=abs(nspin2)
! nspin2 > 0 nspin2 sets of a, c parms, nspin2b sets of b parms
! nocuspb=0 parallel e-e cusp conditions satisfied (b=1/2,1/4)
! nspin2 < 0 -> nspin2=1
! nspin2=1 sets of a and c parms, nspin2b sets of b parms
! -1 nocuspb=1 parallel e-e cusp conditions not satisfied (1/2,1/2)
! -2 nocuspb=0 parallel e-e cusp conditions satisfied (1/2,1/4)
! nord order of the polynmial
! norda order of the e-n polynmial in Jastrow4
! nordb order of the e-e polynmial in Jastrow4
! nordc order of the e-e-n polynmial in Jastrow4
! cjas1 simple jastrow1 (0.5 to satisfy cusps, parallel-spins automatically take half this value)
! cjas2 simple jastrow1 parameter
! scalek scale factor for Jastrow
! a1,a2 Jastrow parameters for Jastrow2
! a,b,c Jastrow parameters for Jastrow3
! a4,b,c Jastrow parameters for Jastrow4,5,6
! cutjas cutoff for Jastrow4,5,6 if cutjas=6,7
! rlobx(y) Lobachevsky parameters for Fock expansion

27
src/periodic_table_m.f90 Normal file
View File

@ -0,0 +1,27 @@
module periodic_table
public :: element, atom_t
type :: atom_t
character(len=20) :: name
character(len=3) :: symbol
integer :: znuclear
real :: atomic_mass
end type atom_t
contains
type(atom_t) function element(sym) result(atom)
character(len=*) :: sym
select case(sym)
case("hydrogen", "Hydrogen", "H", "1")
atom = atom_t(name="hydrogen", symbol="H", atomic_mass=1.00794, znuclear=1)
case default
error stop "Unknown element or symbol"
end select
return
end function
end module

33
src/trial.f90 Normal file
View File

@ -0,0 +1,33 @@
program trial_reading
use iso_fortran_env
use periodic_table, only: atom_t, element
integer :: nalpha, nbeta, nelectrons, ndeterminants, nexcitation
character(40) :: temp1, temp2, temp3, fmt
real(selected_real_kind(6,15)), allocatable :: det_coeff(:)
type(atom_t) :: atom1
atom1 = element("Hydrogen")
print*, "atom info name ", atom1%name
print*, "atom info symbol ", atom1%symbol
print*, "atom info mass ", atom1%atomic_mass
print*, "atom info charge ", atom1%znuclear
print*, atom1
open (unit=11,file='TZ_1M_500.det', iostat=iostat, action='read' )
read(11,*) temp1, temp2, nelectrons, temp3, nalpha
write(*,'(a,1x,i3,1x,i3)') "write after read1", nelectrons, nalpha
read(11,*) temp1, ndeterminants, nexcitation
allocate(det_coeff(ndeterminants))
write(*,'(a,1x,i3, 1x, i3)') "write after read2", ndeterminants, nexcitation
read(11,*) (det_coeff(i), i=1,500)
write(fmt,*) '(', ndeterminants, '(f11.8,1x))'
write(*,fmt) (det_coeff(i), i=1,500)
! write(*,'(<ndeterminants>(f10.8, 1x))') (det_coeff(i), i=1,ndeterminants)
close(11)
end program