Updating k-point output and atomic coordinates

I added a line to give the number of k-points even at
Iprint 0, and added a flag IO.AtomCoordsXYZ to allow output
at the start in XYZ format.  I copied periodic_table_module.f90
from the BasisGeneration utility to write out element symbols
This commit is contained in:
David Bowler 2020-05-19 09:15:32 +01:00
parent 762999b186
commit e9f57dec1f
4 changed files with 93 additions and 10 deletions

View File

@ -858,7 +858,7 @@ contains
pdb_output, banner, get_file_name, time_max, &
flag_MatrixFile_RankFromZero, flag_MatrixFile_BinaryFormat, &
flag_MatrixFile_BinaryFormat_Grab, flag_MatrixFile_BinaryFormat_Dump, &
flag_MatrixFile_BinaryFormat_Dump_END, atom_output_threshold
flag_MatrixFile_BinaryFormat_Dump_END, atom_output_threshold, flag_coords_xyz
use group_module, only: part_method, HILBERT, PYTHON
use H_matrix_module, only: locps_output, locps_choice
@ -1086,6 +1086,7 @@ contains
InitAtomicDistance_min = fdf_double('IO.InitAtomicDistance_min', 0.5_double)
end if
atom_output_threshold = fdf_integer('IO.AtomOutputThreshold',200)
flag_coords_xyz = fdf_boolean('IO.AtomCoordsXYZ',.false.)
call my_barrier()
!
!
@ -2789,6 +2790,7 @@ contains
real(double), allocatable, dimension(:) :: wtk_tmp
integer :: nkp_tmp
integer :: counter
character(len=2) :: suffix
!****lat<$
call start_backtrace(t=backtrace_timer,who='readDiagInfo',where=1,level=2)
@ -2907,7 +2909,11 @@ contains
flag_lines_kpoints = fdf_boolean('Diag.KspaceLines',.false.)
if(flag_lines_kpoints) then
nkp_lines = fdf_integer('Diag.NumKptLines',1)
if(iprint_init>1.AND.inode==ionode) write(io_lun,fmt='(8x,"Number of Kpoint lines: ",i4)') nkp_lines
if(iprint_init>1.AND.inode==ionode) then
write(io_lun,fmt='(8x,"Number of Kpoint lines: ",i4)') nkp_lines
else
write(io_lun,fmt='(4x,"Using ",i3," lines of k-points specified by user")')
end if
if(nkp_lines<1) call cq_abort("Need to specify how many kpoint lines !",nkp_lines)
nkp = fdf_integer('Diag.NumKpts',2)
if(iprint_init>1.AND.inode==ionode) write(io_lun,fmt='(8x,"Number of Kpoints in a line: ",i4)') nkp
@ -2959,7 +2965,9 @@ contains
else
! Read k-point number and allocate
nkp = fdf_integer('Diag.NumKpts',1)
if(iprint_init>1.AND.inode==ionode) write(io_lun,fmt='(8x,"Number of Kpoints: ",i4)') nkp
if(iprint_init>1.AND.inode==ionode) then
write(io_lun,fmt='(8x,"Number of Kpoints: ",i4)') nkp
end if
if(nkp<1) call cq_abort("Need to specify how many kpoints !",nkp)
allocate(kk(3,nkp),wtk(nkp),STAT=stat)
if(stat/=0) call cq_abort('FindEvals: couldnt allocate kpoints',nkp)
@ -2967,6 +2975,13 @@ contains
sum = zero
! Read k-points
if(fdf_block('Diag.Kpoints'))then
if(iprint_init==0) then
if(nkp==1) then
write(io_lun,fmt='(4x,"Using ",i1," k-point specified by user")') nkp
else
write(io_lun,fmt='(4x,"Using ",i3," k-points specified by user")') nkp
endif
end if
if(1+block_end-block_start<nkp) &
call cq_abort("Kpoint error: ",1+block_end-block_start,nkp)
do i=1,nkp
@ -2981,7 +2996,7 @@ contains
call fdf_endblock
wtk = wtk/sum
else ! Force gamma point dependence
if(inode==ionode) write(io_lun,4)
if(inode==ionode) write(io_lun,fmt='(4x,"Default k-point sampling of Gamma point only")')
nkp = 1
kk(1,1) = zero
kk(2,1) = zero
@ -3014,6 +3029,14 @@ contains
write (io_lun,fmt='(/8x,a, i3," x ",i3," x ",i3)') &
' Monkhorst-Pack mesh: ', (mp(i), i=1,3)
end if
else if(inode==ionode) then
if(flag_gamma) then
suffix = " G"
else
suffix = " "
end if
write (io_lun,fmt='(4x,"Using a MP mesh for k-points: ", i3," x ",i3," x ",i3,a2)') &
(mp(i), i=1,3), suffix
end if
if (mp(1) <= 0 .OR. mp(2) <= 0 .OR. mp(3) <= 0) &
call cq_abort('K-points: number of k-points must be > 0!')

View File

@ -114,6 +114,7 @@ module io_module
! Moved here from read_and_write so that it can be used for extended XYZ output
! Moved here from initial_read_module to slove the dependence problem
character(len=80), save :: titles
logical :: flag_coords_xyz
!!***
@ -3098,7 +3099,9 @@ second: do
use global_module, only: atom_coord, iprint_MD, ni_in_cell, species_glob
use dimens, only: r_super_x, r_super_y, r_super_z
use GenComms, only: inode, ionode
use units, only: dist_conv, d_units, dist_units
use units, only: dist_conv, d_units, dist_units, BohrToAng, bohr
use periodic_table, only: pte
use pseudo_tm_info, only: pseudo
implicit none
@ -3108,11 +3111,27 @@ second: do
write(io_lun,fmt='(/4x,"Simulation cell dimensions: ",f10.4,a3," x ",f10.4,a3," x ",f10.4,a3)') &
r_super_x*dist_conv, d_units(dist_units), r_super_y*dist_conv, d_units(dist_units), &
r_super_z*dist_conv, d_units(dist_units)
write(io_lun,fmt='(/4x,"Atomic coordinates (",a2,")")') d_units(dist_units)
write(io_lun,fmt='(4x," Atom X Y Z Species")')
do i = 1, ni_in_cell
write (io_lun,fmt='(4x, i7, 3f10.4, 6x, i3)') i,atom_coord(1:3,i), species_glob(i)
end do
if(flag_coords_xyz) then
write(io_lun,fmt='(4x," X Y Z")')
if(dist_units==bohr) then
write(io_lun,fmt='(/4x,"Atomic coordinates (",a2,")")') "A "
do i = 1, ni_in_cell
write (io_lun,fmt='(4x, a2, 3f10.4)') pte(pseudo(species_glob(i))%z), atom_coord(1:3,i)*BohrToAng
end do
write(io_lun,fmt='(6x,"N.B. units above converted to Angstroms for xyz output")')
else
write(io_lun,fmt='(/4x,"Atomic coordinates (",a2,")")') d_units(dist_units)
do i = 1, ni_in_cell
write (io_lun,fmt='(4x, a2, 3f10.4)') pte(pseudo(species_glob(i))%z), atom_coord(1:3,i)
end do
end if
else
write(io_lun,fmt='(/4x,"Atomic coordinates (",a2,")")') d_units(dist_units)
write(io_lun,fmt='(4x," Atom X Y Z Species")')
do i = 1, ni_in_cell
write (io_lun,fmt='(4x, i7, 3f10.4, 6x, i3)') i,atom_coord(1:3,i), species_glob(i)
end do
end if
end if
return

View File

@ -15,4 +15,5 @@ ODD_OBJS = global_module.o \
rng_module.o \
biblio_module.o \
references.o \
periodic_table_module.o \
fft_module.o $(FFT_OBJ)

View File

@ -0,0 +1,40 @@
module periodic_table
use datatypes
implicit none
integer, parameter :: n_species=94
real(double), parameter :: atomic_mass(n_species) = (/ &
1.01_double, 4.00_double, 6.94_double, 9.01_double, 10.81_double, 12.01_double, &
14.01_double, 16.00_double, 19.00_double, 20.18_double, 22.99_double, 24.31_double, &
26.98_double, 28.09_double, 30.97_double, 32.07_double, 35.45_double, 39.95_double, &
39.10_double, 40.08_double, 44.96_double, 47.88_double, 50.94_double, 52.00_double, &
54.94_double, 55.85_double, 58.93_double, 58.69_double, 63.55_double, 65.39_double, &
69.72_double, 72.61_double, 74.92_double, 78.96_double, 79.90_double, 83.80_double, &
85.47_double, 87.62_double, 88.91_double, 91.22_double, 92.91_double, 95.94_double, &
98.91_double, 101.07_double,102.91_double,106.42_double,107.87_double,112.41_double, &
114.82_double,118.71_double,121.75_double,127.60_double,126.90_double,131.29_double, &
132.91_double,137.33_double,138.91_double,140.12_double,140.91_double,144.24_double, &
146.92_double,150.36_double,151.97_double,157.25_double,158.93_double,162.50_double, &
164.93_double,167.26_double,168.93_double,173.04_double,174.97_double,178.49_double, &
180.95_double,183.85_double,186.21_double,190.20_double,192.22_double,195.08_double, &
196.97_double,200.59_double,204.38_double,207.20_double,208.98_double,208.98_double, &
209.99_double,222.02_double,223.02_double,226.03_double,227.03_double,232.04_double, &
231.04_double,238.03_double,237.05_double,244.06_double/)
character(len=2), dimension(103) :: pte = &
(/ "H ", "He", "Li", "Be", "B ", "C ", "N ", "O ", "F ", "Ne", &
"Na", "Mg", "Al", "Si", "P ", "S ", "Cl", "Ar", "K ", "Ca", &
"Sc", "Ti", "V ", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", &
"Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y ", "Zr", &
"Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", &
"Sb", "Te", "I ", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", &
"Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", &
"Lu", "Hf", "Ta", "W ", "Re", "Os", "Ir", "Pt", "Au", "Hg", &
"Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", &
"Pa", "U ", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", &
"Md", "No", "Lr"/)
end module periodic_table